@libxai/board 1.9.16 → 1.9.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +55 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +55 -55
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -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 r=Iu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let c=Iu(t[o]||"");if(c.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-c.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((m,g)=>{i[m]=c[g]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let u=n.get(d),p={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:u.id,position:u.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(p),u.cardIds.push(p.id);}catch(c){s.push(`Line ${o+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Iu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Ru(e,t){switch(t){case "json":return Db(e);case "csv":return Sb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Bu(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var Ql=createContext(null);function $u(){return useContext(Ql)}var Ou=createContext(null);function Hu({children:e,themeName:t}){return jsx(Ou.Provider,{value:{themeName:t},children:e})}function vi(){return useContext(Ou)}function nr({children:e,container:t}){let[r,a]=useState(false),n=$u(),s=vi();if(useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:c,themeName:l}=n,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return createPortal(jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Vu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Rb="#BDC3C7",Bb=({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 vo({priority:e,onChange:t,className:r}){let[a,n]=useState(false),[s,o]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),i=()=>{if(!l.current)return;let m=l.current.getBoundingClientRect(),g=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=m.right-y;v<10&&(v=m.left),v+y>x-10&&(v=x-y-10);let w=g-m.bottom,C=m.top,E;w>=b+h?E=m.bottom+h:C>=b+h?E=m.top-b-h:E=w>=C?m.bottom+h:Math.max(10,m.top-b-h),o({top:E,left:v}),n(true);};useEffect(()=>{let m=g=>{c.current&&!c.current.contains(g.target)&&!l.current?.contains(g.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),useEffect(()=>{let m=g=>{g.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let d=m=>{t(m),n(false);},u=e?Vu[e]:null,p=u?.color||Rb;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:l,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:u?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),a&&jsx(nr,{children:jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(Vu).map(([m,g])=>jsxs("button",{onClick:()=>d(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Bb,{color:g.color}),jsx("span",{className:"font-semibold text-sm",children:g.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>d(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var $b=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Ds({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),p=(vi()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,E=320,L=380,k=4,S=v.left;S+E>C-10&&(S=C-E-10),S<10&&(S=10);let P=w-v.bottom,N=v.top,K;P>=L+k?K=v.bottom+k:N>=L+k?K=v.top-L-k:K=P>=N?v.bottom+k:Math.max(10,v.top-L-k),c({top:K,left:S}),s(true);};useEffect(()=>{let v=w=>{l.current&&!l.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let g=v=>{let w=new Date,C=S=>{let P=S.getFullYear(),N=String(S.getMonth()+1).padStart(2,"0"),K=String(S.getDate()).padStart(2,"0");return `${P}-${N}-${K}`},E=C(w),L=new Date(w);L.setDate(L.getDate()+v);let k=C(L);r(E,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=L=>{if(L instanceof Date)return L;if(typeof L!="string"||!L.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=L.split("-").map(Number);if(k.length!==3||k.some(K=>isNaN(K)))return null;let S=k[0],P=k[1],N=k[2];return S===void 0||P===void 0||N===void 0?null:new Date(S,P-1,N)},w=v(e),C=v(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${E[w.getMonth()]} ${w.getDate()} \u2013 ${E[C.getMonth()]} ${C.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxs("div",{className:`relative ${a||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${x()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsx(nr,{children:jsxs("div",{ref:l,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:$b.map(v=>jsx("button",{onClick:()=>g(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ko({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[c,l]=useState(""),[i,d]=useState({top:0,left:0}),u=useRef(null),p=useRef(null),m=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,C=300,E=380,L=4,k=h.right-C;k<10&&(k=h.left),k+C>w-10&&(k=w-C-10);let S=v-h.bottom,P=h.top,N;S>=E+L?N=h.bottom+L:P>=E+L?N=h.top-E-L:N=S>=P?h.bottom+L:Math.max(10,h.top-E-L),d({top:N,left:k}),o(true);};useEffect(()=>{let h=v=>{u.current&&!u.current.contains(v.target)&&!p.current?.contains(v.target)&&(o(false),l(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),l(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let g=h=>{let v=e.some(w=>w.id===h.id);r(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,onClick:()=>s?o(false):m(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(nr,{children:jsxs("div",{ref:u,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:c,onChange:h=>l(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>g(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{r([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function wi(e,t,r){let a=new Map;e.forEach(l=>{if(l.dependencies&&Array.isArray(l.dependencies)){let i=l.dependencies.map(d=>{if(typeof d=="string")return d;let u=d;return u.taskId||u.targetId||""}).filter(Boolean);a.set(l.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,c=l=>{if(!s.has(l)){s.add(l),o.add(l);let i=a.get(l)||[];for(let d of i){if(!s.has(d)&&c(d))return true;if(o.has(d))return true}}return o.delete(l),false};return c(r)}function Es({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[c,l]=useState(false),[i,d]=useState(""),[u,p]=useState(t.length>0),[m,g]=useState({top:0,left:0}),[x,y]=useState(null),b=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,N=300,K=u?380:120,H=4,Q=k.right-N;Q<10&&(Q=k.left),Q+N>P-10&&(Q=P-N-10);let I=S-k.bottom,q=k.top,j;I>=K+H?j=k.bottom+H:q>=K+H?j=k.top-K-H:j=I>=q?k.bottom+H:Math.max(10,k.top-K-H),g({top:j,left:Q}),l(true);};useEffect(()=>{if(!c||!h.current)return;let k=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,N=300,K=u?380:120,H=4,Q=k.right-N;Q<10&&(Q=k.left),Q+N>P-10&&(Q=P-N-10);let I=S-k.bottom,q=k.top,j;I>=K+H?j=k.bottom+H:q>=K+H?j=k.top-K-H:j=I>=q?k.bottom+H:Math.max(10,k.top-K-H),g({top:j,left:Q});},[u,c]),useEffect(()=>{let k=S=>{b.current&&!b.current.contains(S.target)&&!h.current?.contains(S.target)&&(l(false),d(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=S=>{S.key==="Escape"&&(l(false),d(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let S=t.includes(k),P=r.find(N=>N.id===k);if(y(null),S){let N=t.filter(K=>K!==k);a(N),N.length===0&&p(false);}else {if(s&&wi(r,k,e)){let K=`Cannot add "${P?.title||k}" as dependency - would create circular reference`;y(K),o?.(k,P?.title||k),setTimeout(()=>y(null),3e3);return}a([...t,k]),p(true);}},C=()=>{let k=!u;p(k),k||a([]);},E=r.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),L=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>c?l(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:L,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:L},children:t.length})]}),c&&jsx(nr,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:u?"#00E5CC":"transparent",borderColor:u?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:u&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),u&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>d(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:E.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):E.map(k=>{let S=t.includes(k.id);return jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:S?"#00E5CC":"transparent",borderColor:S?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:S&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{a([]),p(false),l(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var An=memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:c=[],allCards:l=[]})=>{let{attributes:i,listeners:d,setNodeRef:u,transform:p,transition:m,isDragging:g}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:bi.Transform.toString(p),transition:m};if(t)return jsx("div",{ref:u,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let y=c.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:u,style:v,className:f("asakaa-card",g&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:E=>{E.currentTarget.style.display="none";}}),C===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(vo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ds,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,C)=>o?.(e.id,{startDate:w,endDate:C})})}),c.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(ko,{assignedUsers:y,availableUsers:c,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Es,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:l,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var ki={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},ep=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function tp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),d=[...Object.entries(ki).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...a.filter(y=>!Object.keys(ki).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],u=()=>{let y=ki[e];if(y)return {...y,id:e};let b=a.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ki.todo,id:"todo"}},p=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,C=4,E=y.right-v;E<10&&(E=y.left),E+v>h-10&&(E=h-v-10);let L=b-y.bottom,k=y.top,S;L>=w+C?S=y.bottom+C:k>=w+C?S=y.top-w-C:S=L>=k?y.bottom+C:Math.max(10,y.top-w-C),c({top:S,left:E}),s(true);};useEffect(()=>{let y=b=>{l.current&&!l.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let m=y=>{t(y),s(false);},g=u(),x=g.color;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,onClick:()=>n?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:g.label,children:jsx(ep,{icon:g.icon,color:x})}),n&&jsx(nr,{children:jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:d.map(y=>jsxs("button",{onClick:()=>m(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(ep,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var rp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function ap({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=rp[s]||rp.en,[c,l]=useState(false),[i,d]=useState(false),[u,p]=useState(e),[m,g]=useState({top:0,left:0}),x=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(c&&y.current){let C=y.current.getBoundingClientRect();g({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[c]),useEffect(()=>{let C=E=>{x.current&&!x.current.contains(E.target)&&!y.current?.contains(E.target)&&(l(false),d(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),useEffect(()=>{let C=E=>{E.key==="Escape"&&(l(false),d(false),p(e));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{d(true),p(e);},v=()=>{let C=u.trim();C&&C!==e&&t(C),d(false),l(false),p(e);},w=C=>{C.key==="Enter"?v():C.key==="Escape"&&(d(false),p(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>l(!c),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),c&&jsx(nr,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:u,onChange:C=>p(C.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{r(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var _o=memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:c,availableUsers:l,allCards:i,enableVirtualization:d,cardHeight:u=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:g,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),E=useRef(null),L=d??Eu(t.length),k=useVirtualizer({count:t.length,getScrollElement:()=>E.current,estimateSize:()=>u,enabled:L});if(r)return jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),N=P.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:f("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",N&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f(K()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),P.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),P.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),P.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(g||x)&&jsx(ap,{columnTitle:e.title,onRename:H=>g?.(e.id,H),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!p&&jsx("div",{ref:E,className:"asakaa-column-cards",style:{maxHeight:L?"600px":void 0},children:jsx(SortableContext,{items:t.map(H=>H.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):L?jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(H=>{let Q=t[H.index];return Q?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsx(An,{card:Q,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i})},Q.id):null})}):t.map(H=>jsx(An,{card:H,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i},H.id))})})]})});_o.displayName="Column";function ac({title:e,onSave:t,className:r}){let[a,n]=useState(false),[s,o]=useState(e),c=useRef(null);useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?l():d.key==="Escape"&&(o(e),n(false));};return a?jsx("input",{ref:c,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:l,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsx("h2",{className:f("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ah(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function cp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(c=>{let l=c.name.toLowerCase(),i=l.replace(/\s+/g,""),d=l.split(/\s+/);return !!(i===s||l===s||d.some(u=>u===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function nh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function oh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var sh=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function dp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:c="dark",locale:l="es",currentUser:i,enableEmoji:d=true,enableAttachments:u=true,pendingFiles:p=[],onFilesSelect:m,onRemoveFile:g,maxFileSizeMB:x=10}){let y=c==="dark",[b,h]=useState(false),[v,w]=useState([]),[C,E]=useState(0),[L,k]=useState(null),[S,P]=useState(false),N=useRef(null),K=useRef(null),H=useRef(null),Q=useRef(null),I=useCallback((be,ve)=>{let he=ah(be,ve);if(k(he),he){let Oe=a.filter(Se=>Se.name.toLowerCase().includes(he.query)||Se.email&&Se.email.toLowerCase().includes(he.query)).slice(0,5);w(Oe),h(Oe.length>0),E(0);}else h(false),w([]);},[a]),q=be=>{let ve=be.target.value;if(t(ve),I(ve,be.target.selectionStart||0),N.current){N.current.style.height="24px";let he=N.current.scrollHeight,Oe=280,Se=Math.min(he,Oe);N.current.style.height=`${Se}px`,N.current.style.overflowY=he>Oe?"auto":"hidden";}},j=()=>{N.current&&I(e,N.current.selectionStart||0);},U=useCallback(be=>{if(!L||!N.current)return;let ve=e.slice(0,L.start),he=e.slice(L.end),Oe=`@${be.name.replace(/\s+/g,"")} `,Se=ve+Oe+he;t(Se),h(false),k(null),setTimeout(()=>{if(N.current){let Fe=L.start+Oe.length;N.current.selectionStart=Fe,N.current.selectionEnd=Fe,N.current.focus();}},0);},[L,e,t]),B=be=>{if(b&&v.length>0)switch(be.key){case "ArrowDown":be.preventDefault(),E(ve=>ve<v.length-1?ve+1:0);break;case "ArrowUp":be.preventDefault(),E(ve=>ve>0?ve-1:v.length-1);break;case "Enter":{be.preventDefault();let ve=v[C];ve&&U(ve);break}case "Tab":{be.preventDefault();let ve=v[C];ve&&U(ve);break}case "Escape":be.preventDefault(),h(false);break}else be.key==="Enter"&&!be.shiftKey&&(be.preventDefault(),r());};useEffect(()=>{let be=ve=>{K.current&&!K.current.contains(ve.target)&&N.current&&!N.current.contains(ve.target)&&h(false),Q.current&&!Q.current.contains(ve.target)&&P(false);};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]);let we=useCallback(be=>{if(!N.current)return;let ve=N.current.selectionStart||e.length,he=e.slice(0,ve)+be+e.slice(ve);t(he),P(false),setTimeout(()=>{if(N.current){let Oe=ve+be.length;N.current.selectionStart=Oe,N.current.selectionEnd=Oe,N.current.focus();}},0);},[e,t]),Ge=useCallback(be=>{if(!m||!be.target.files)return;let ve=Array.from(be.target.files),he=x*1024*1024,Oe=ve.filter(Se=>Se.size>he?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);Oe.length>0&&m(Oe),be.target.value="";},[m,x]),Pe=useCallback(be=>be.type.startsWith("image/")?Image:be.type.includes("pdf")||be.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&K.current){let be=K.current.children[C];be&&be.scrollIntoView({block:"nearest"});}},[C,b]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(be=>{let ve=Pe(be.file),he=be.file.type.startsWith("image/");return jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[he&&be.preview?jsx("img",{src:be.preview,alt:be.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(ve,{className:f("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:f("text-xs truncate",y?"text-white":"text-gray-900"),children:be.file.name}),jsx("p",{className:f("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:oh(be.file.size)})]}),g&&jsx("button",{onClick:()=>g(be.id),className:f("p-0.5 rounded-full transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},be.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxs("div",{className:f("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!S),disabled:s||o,className:f("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:S&&jsx(motion.div,{ref:Q,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:sh.map(be=>jsx("button",{type:"button",onClick:()=>we(be),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:be},be))})})})]}),u&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||o,className:f("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:l==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:H,type:"file",multiple:true,onChange:Ge,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:q,onSelect:j,onKeyDown:B,placeholder:n||(l==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:r,disabled:o||!e.trim()&&p.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&v.length>0&&jsx(motion.div,{ref:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((be,ve)=>jsxs("button",{type:"button",onClick:()=>U(be),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ve===C?y?"bg-white/10":"bg-gray-100":y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:be.color||"#8B5CF6"},children:nh(be.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:f("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:be.name}),be.email&&jsx("p",{className:f("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:be.email})]})]},be.id))})})]})]})]})}function up({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((c,l)=>c.type==="mention"?jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:c.value},l):jsx("span",{children:c.value},l))})}var Si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ko({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[c,l]=useState(false),[i,d]=useState(""),[u,p]=useState(false),[m,g]=useState(Si[10]||"#00E5CC"),[x,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),v=useRef(null),w=useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),E=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(c&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+6,left:N.left});}},[c]),useEffect(()=>{let N=K=>{let H=K.target,Q=b.current?.contains(H),I=v.current?.contains(H);!Q&&!I&&(l(false),d(""),p(false));};if(c)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[c]),useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let L=N=>{let K=e.some(H=>H.id===N.id);r(K?e.filter(H=>H.id!==N.id):[...e,N]);},k=async()=>{if(!(!a||!i.trim())){p(true);try{let N=await a(i.trim(),m);N&&(r([...e,N]),d(""),g(Si[Math.floor(Math.random()*Si.length)]||"#00E5CC"));}finally{p(false);}}},S=(N,K)=>{K.stopPropagation(),r(e.filter(H=>H.id!==N));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&l(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:c&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>d(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!E&&a&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:K=>S(N.id,K),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(N=>{let K=e.some(H=>H.id===N.id);return jsxs("button",{type:"button",onClick:()=>L(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:H=>{K||(H.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:H=>{K||(H.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!E&&a&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Si.map(N=>jsx("button",{type:"button",onClick:()=>g(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:k,disabled:u,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:u?.7:1},children:[u?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function oc({tag:e,onRemove:t,size:r="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function mp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsx(oc,{tag:s,size:r},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var To=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function gp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function fh(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 bh({className:e}){return jsxs("svg",{className:f("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function sc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=fh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},l=gp(e.loggedMinutes),i=e.estimateMinutes?gp(e.estimateMinutes):null,d=r&&i?`${l} / ${i}`:l;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(a?"button":"span",{className:f("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsx(bh,{className:c[t]}),jsx("span",{children:d})]})}function hh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Mi(e){let t=hh(e);return t!==null?String(t):e}function bp(e){let r=Mi(e).trim().toLowerCase();if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Pi(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function vh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function wh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function kh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function hp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Ch({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function ic({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:c,onStopTimer:l,onDiscardTimer:i,onClose:d,className:u}){let[p,m]=useState(""),[g,x]=useState(t.estimateMinutes?Pi(t.estimateMinutes):""),[y,b]=useState(""),[h,v]=useState(false),[w,C]=useState(false),E=useRef(null);useEffect(()=>{E.current?.focus();},[]);let L=async()=>{let P=bp(p);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),m(""),b("");}finally{v(false);}}},k=async()=>{if(!o)return;let P=g.trim()?bp(g):null;await o(P),C(false);},S=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),L()),P.key==="Escape"&&d?.();};return jsxs("div",{className:f("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",u),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(hp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:a?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:vh(n)})]}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(kh,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(hp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:c,className:f("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(wh,{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(Ch,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:E,type:"text",value:p,onChange:P=>m(P.target.value),onKeyDown:S,placeholder:"8 (=8h), 2h 30m",className:f("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:L,disabled:h||!p.trim(),className:f("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:S,placeholder:"Note (optional)",className:f("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Pi(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:g,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&k(),P.key==="Escape"&&C(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Pi(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:f("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:f("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),r.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Pi(P.durationMinutes)})]},P.id))})]})]})}function Eh(e){let r=Mi(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Mh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function vn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[c,l]=useState(Mh(a)),[i,d]=useState(""),[u,p]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let g=async()=>{p(true);let v=Eh(c);await n(v&&v>0?v:null,i||void 0),p(false);},x=async()=>{p(true),await n(null),p(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),g()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:f("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:c,onChange:v=>l(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:g,disabled:u||!c.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:u?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),a&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:u,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Ph(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 Fh(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function cc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Ph(e.health),s=Fh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,l=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxs("div",{className:f("flex items-center gap-2",a),children:[jsx("div",{className:f("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsx("div",{className:f("h-full w-1/4",n)})}),t&&jsx("span",{className:f("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:f("flex items-center gap-2",a),children:[jsxs("div",{className:f("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsx("div",{className:f("h-full transition-all duration-300",n),style:{width:`${l}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:f("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function qo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function Ah(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Ih(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Rh(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 Bh({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",c=r?"text-[#9CA3AF]":"text-gray-500",l=r?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:f("text-2xl font-bold",n),children:[a?"+":"",qo(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:f("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-2",c),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:f("font-medium",l),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:f("font-medium",l),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:f("font-medium",l),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-2",c),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:c,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:f("font-medium",l),children:qo(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:f("font-medium",l),children:qo(e.totalLoggedMinutes)})]}),jsxs("div",{className:f("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:f("font-medium",l),children:e.totalTasksWithEstimate})]})]})]})]})}function $h({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",c=r?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:f("border-b",s,a&&f("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:f("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:f("text-xs mt-1",c),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?qo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:qo(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:f("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":c),children:[n,qo(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:f("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":c),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:f("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Ih(e.status,r),Ah(e.status,r)),children:Rh(e.status,t)})})]})}function dc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",c=o?"bg-[#050505]":"bg-gray-50",l=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",u=o?"text-white/[0.60]":"text-gray-500",p=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((g,x)=>g.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-g.varianceMinutes):[],[e]);return t?jsx("div",{className:f("p-8 text-center",u,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:f("p-8 text-center",u,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:f("space-y-6 p-6",c,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:f("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:f("text-sm mt-1",u),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Bh,{summary:e.summary,locale:r,isDark:o}),jsx("div",{className:f("rounded-lg border overflow-hidden",l,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:f("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Tarea":"Task"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Ofertado":"Sold"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Trabajado":"Logged"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:"%"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:f("divide-y",i),children:m.map(g=>jsx($h,{task:g,locale:r,isDark:o,onClick:s},g.taskId))})]})})}),jsx("div",{className:f("text-xs text-center",u),children:r==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Yo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Jh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Sp(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function Qh(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 No({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:c=[],availableTags:l=[],onCreateTag:i,attachments:d=[],onUploadAttachments:u,onDeleteAttachment:p,availableTasks:m=[],comments:g=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:E=false,timerElapsedSeconds:L=0,onTimeLog:k,onEstimateUpdate:S,onSoldEffortUpdate:P,onTimerStart:N,onTimerStop:K,onTimerDiscard:H,blurFinancials:Q=false}){let I=s==="dark",q={textTertiary:I?"#6B7280":"#9CA3AF",textSecondary:I?"#9CA3AF":"#6B7280",textPrimary:I?"#FFFFFF":"#111827",borderLight:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:I?"#1A1D25":"#FFFFFF",bgSecondary:I?"#0A0A0A":"#F9FAFB",hoverBg:I?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},j=e&&"title"in e&&!("name"in e),U=e,[B,we]=useState(e?Sp(e,c):null),[Ge,Pe]=useState(false),[be,ve]=useState(false),[he,Oe]=useState(false),[Se,Fe]=useState(null),[He,Be]=useState(new Date),[ue,Ke]=useState(false),[ze,Ae]=useState(false),[Tt,Nt]=useState(""),[Re,Le]=useState(false),[ut,Ct]=useState(false),[Ie,lt]=useState(false),[F,re]=useState(false),[R,X$1]=useState(""),O=useRef(null),J=useRef(null),[Te,me]=useState(""),tt=useRef(null),[ot,Ye]=useState(""),[$t,Dt]=useState(false),[St,Wt]=useState([]),[rr,gr]=useState(""),[ia,Yt]=useState(false),fr=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 T=Sp(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),we(T),X$1(T.description||""),me(T.name||"");}},[e?.id,e?.quotedMinutes,c,t]),useEffect(()=>{if(!t||!R)return;let T=setTimeout(()=>{let V=J.current;V&&(V.style.height="auto",V.style.height=`${Math.max(100,V.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,R]),useEffect(()=>()=>{O.current&&clearTimeout(O.current),tt.current&&clearTimeout(tt.current);},[]),useEffect(()=>{t&&fr.current&&g.length>0&&setTimeout(()=>{fr.current&&(fr.current.scrollTop=fr.current.scrollHeight);},100);},[t,g.length]);let At=useCallback(T=>{we(T),j&&n&&U?n(Qh(T,U)):a&&a(T);},[j,U,n,a]),qr=useCallback(()=>{Pe(false),ve(false),Oe(false),Fe(null),Ae(false),Nt(""),Le(false);},[]),jt=useCallback((T,V)=>{if(!B)return;let G={...B,[T]:V};At(G);},[B,At]),_t=useCallback(()=>{let T=J.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),la=useCallback(T=>{X$1(T),setTimeout(_t,0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(B){let V={...B,description:T};At(V);}},800);},[B,At,_t]),ta=useCallback(T=>{me(T),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{if(B&&T.trim()){let V={...B,name:T.trim()};At(V);}},800);},[B,At]),Xe=useCallback(T=>{let V=T.map(G=>{let Z={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:G};return G.type.startsWith("image/")&&(Z.preview=URL.createObjectURL(G)),Z});Wt(G=>[...G,...V]);},[]),Je=useCallback(T=>{Wt(V=>{let G=V.find(Z=>Z.id===T);return G?.preview&&URL.revokeObjectURL(G.preview),V.filter(Z=>Z.id!==T)});},[]),zr=useCallback(async()=>{if(!(!B||!ot.trim()&&St.length===0||!x)){Dt(true);try{let T=cp(ot,b),V=[];if(St.length>0&&h){let G=St.map(Z=>Z.file);V=await h(G);}await x(B.id,ot.trim(),T.length>0?T:void 0,V.length>0?V:void 0),Ye(""),St.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}),Wt([]);}finally{Dt(false);}}},[B,ot,St,x,b,h]),Cr=useCallback(()=>{if(!B||!rr.trim())return;let T=B.subtasks||[],V={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:rr.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},G=[...T,V],Z={...B,subtasks:G};At(Z),gr(""),Yt(false);},[B,rr,At]),ir=useCallback(T=>{if(!B?.subtasks)return;let V=B.subtasks.map(Z=>Z.id===T?{...Z,progress:Z.progress===100?0:100}:Z),G={...B,subtasks:V};At(G);},[B,At]),fa=useCallback(T=>{if(!B?.subtasks)return;let V=B.subtasks.filter(Z=>Z.id!==T),G={...B,subtasks:V};At(G);},[B,At]),ne=useCallback(T=>{let V=typeof T=="string"?new Date(T):T,Z=new Date().getTime()-V.getTime(),Ze=Math.floor(Z/6e4),le=Math.floor(Z/36e5),Ue=Math.floor(Z/864e5);return Ze<1?o==="es"?"Ahora":"Just now":Ze<60?o==="es"?`Hace ${Ze} min`:`${Ze}m ago`:le<24?o==="es"?`Hace ${le}h`:`${le}h ago`:Ue<7?o==="es"?`Hace ${Ue}d`:`${Ue}d ago`:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),fe=useCallback(T=>{if(!B)return;let V=B.progress||0;T==="completed"?V=100:T==="in-progress"&&V===0?V=10:T==="todo"&&(V=0);let G={...B,status:T,progress:V};At(G),Pe(false);},[B,At]),it=useCallback((T,V)=>{if(!B)return;let G={...B,startDate:T,endDate:V};At(G);},[B,At]),Qe=useCallback(()=>{let T=He.getFullYear(),V=He.getMonth(),G=new Date(T,V,1),Ze=new Date(T,V+1,0).getDate(),le=G.getDay(),Ue=[],mt=new Date(T,V,0).getDate();for(let Mt=le-1;Mt>=0;Mt--)Ue.push({date:new Date(T,V-1,mt-Mt),isCurrentMonth:false});for(let Mt=1;Mt<=Ze;Mt++)Ue.push({date:new Date(T,V,Mt),isCurrentMonth:true});let It=42-Ue.length;for(let Mt=1;Mt<=It;Mt++)Ue.push({date:new Date(T,V+1,Mt),isCurrentMonth:false});return Ue},[He]),_=useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),lt(false),!B||!u)return;let V=Array.from(T.dataTransfer.files);if(V.length!==0){re(true);try{await u(B.id,V);}finally{re(false);}}},[B,u]),se=useCallback(async T=>{if(!B||!u||!T.target.files)return;let V=Array.from(T.target.files);if(V.length!==0){re(true);try{await u(B.id,V);}finally{re(false);}T.target.value="";}},[B,u]),ee=useCallback(T=>{T.preventDefault(),T.stopPropagation(),lt(true);},[]),$=useCallback(T=>{T.preventDefault(),T.stopPropagation(),lt(false);},[]),de=useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),xe=useCallback(T=>T.startsWith("image/")?Image:T.includes("pdf")||T.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",I?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3 h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let T=B.progress===100?0:100,G={...B,progress:T,status:T===100?"completed":"todo"};At(G);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Te,onChange:T=>ta(T.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":I?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{qr(),Pe(!Ge);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Ge&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(T=>jsxs("button",{onClick:()=>fe(T.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",T.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{qr(),Oe(!he);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((T,V)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},V)),B.assignees.length>3&&jsxs("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:f("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(T=>{let V=B.assignees?.some(G=>G.name===T.name);return jsxs("button",{onClick:()=>{let G=B.assignees||[],Z;V?Z=G.filter(Ze=>Ze.name!==T.name):Z=[...G,T],jt("assignees",Z);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",V&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1",I?"text-white":"text-gray-900"),children:T.name}),V&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Fe(Se?null:"start"),Be(B.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Se&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let G=new Date(T);G.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Z=new Date(T);Z.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let Ze=new Date(T);Ze.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let le=new Date(T);le.setDate(T.getDate()+14);let Ue=new Date(T);return Ue.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:G,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Z,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ze,display:Ze.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:le,display:le.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((It,Mt)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let Tr=B.endDate&&It.date>B.endDate?It.date:B.endDate;it(It.date,Tr),Fe("end");}else {let Tr=B.startDate&&It.date<B.startDate?It.date:B.startDate;it(Tr,It.date),Fe(null);}},children:[jsx("span",{children:It.label}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:It.display})]},Mt))})(),jsx("div",{className:f("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{it(void 0,void 0),Fe(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",I?"text-white":"text-gray-900"),children:He.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Be(new Date),className:f("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Be(new Date(He.getFullYear(),He.getMonth()-1)),className:f("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Be(new Date(He.getFullYear(),He.getMonth()+1)),className:f("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Qe().map((T,V)=>{let G=T.date.toDateString()===new Date().toDateString(),Z=B.startDate?.toDateString()===T.date.toDateString(),Ze=B.endDate?.toDateString()===T.date.toDateString(),le=Z||Ze,Ue=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsx("button",{onClick:()=>{let mt=new Date(T.date);if(Se==="start"){let It=B.endDate&&mt>B.endDate?mt:B.endDate;it(mt,It),Fe("end");}else {let It=B.startDate&&mt<B.startDate?mt:B.startDate;it(It,mt),Fe(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(I?"text-white":"text-gray-900"),G&&"ring-2 ring-[#00E5CC]",Z&&"bg-[#00E5CC] text-white",Ze&&!Z&&"bg-[#7C3AED] text-white",Ue&&!le&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!le&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{qr(),ve(!be);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ve(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(T=>jsxs("button",{onClick:()=>{jt("priority",T.id),ve(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",T.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ue?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let V=parseInt(T.target.value),G=B.status;V===100?G="completed":V>0?G="in-progress":G="todo";let Z={...B,progress:V,status:G};At(Z);},onBlur:()=>Ke(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",I?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ke(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",I?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:f("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Yo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Ct("estimate"),className:f("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Yo(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Ct("estimate"),className:f("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ut==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(vn,{mode:"estimate",locale:o,isDark:I,currentValue:w?.estimateMinutes||null,onSave:async T=>{await S?.(B.id,T),Ct(false);},onClose:()=>Ct(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Q?jsx("span",{className:f("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsx("span",{className:f("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Yo(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>Ct("quoted"),className:f("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Yo(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Ct("quoted"),className:f("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ut==="quoted"&&!Q&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(vn,{mode:"quoted",locale:o,isDark:I,currentValue:B.quotedMinutes||null,onSave:async T=>{P?(await P(B.id,T),we(V=>V?{...V,quotedMinutes:T}:null)):jt("quotedMinutes",T),Ct(false);},onClose:()=>Ct(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:f("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",I?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):E?jsxs("button",{type:"button",onClick:()=>K?.(B.id),className:f("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"}),Jh(L||0)]}):jsx("button",{type:"button",onClick:()=>N?.(B.id),className:f("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",I?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Ct("log"),className:f("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",I?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[Yo(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:f("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",Yo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:f("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ut==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(vn,{mode:"log",locale:o,isDark:I,currentValue:null,onSave:async(T,V)=>{T&&await k?.(B.id,{durationMinutes:T,note:V,source:"manual"}),Ct(false);},onClose:()=>Ct(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Ko,{selectedTags:B.tags||[],availableTags:l,onChange:T=>{jt("tags",T);},onCreateTag:i,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(T=>{let V=m.find(G=>G.id===T);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[V?.name||T.slice(0,8),jsx("button",{onClick:()=>{let G=(B.dependencies||[]).filter(Z=>Z!==T);jt("dependencies",G);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},T)})}),jsxs("button",{onClick:()=>{qr(),Ae(!ze);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ze&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(false),Nt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Tt,onChange:T=>Nt(T.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(T=>T.id!==B.id).filter(T=>Tt===""||T.name.toLowerCase().includes(Tt.toLowerCase())).map(T=>{let V=B.dependencies?.includes(T.id);return jsxs("button",{onClick:()=>{let G=B.dependencies||[],Z;V?Z=G.filter(Ze=>Ze!==T.id):Z=[...G,T.id],jt("dependencies",Z);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",V&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",V?"bg-[#00E5CC] border-[#00E5CC]":I?"border-white/30":"border-gray-300"),children:V&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",I?"text-white":"text-gray-900"),children:T.name}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{qr(),Le(!Re);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:To.find(T=>T.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:To.map(T=>{let V=B.color===T.value;return jsx("button",{onClick:()=>{jt("color",T.value),Le(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",V&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:V?T.value:void 0},title:T.name,children:V&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:T=>jt("isMilestone",T.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":I?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:J,value:R,onChange:T=>la(T.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(T=>T.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((T,V)=>(T.position??0)-(V.position??0)).map(T=>jsxs("div",{className:f("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",I?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>ir(T.id),className:f("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.progress===100?"bg-green-500 border-green-500":I?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:T.name}),jsx("button",{onClick:()=>fa(T.id),className:f("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",I?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),ia?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:rr,onChange:T=>gr(T.target.value),onKeyDown:T=>{T.key==="Enter"&&rr.trim()?Cr():T.key==="Escape"&&(Yt(false),gr(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:f("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",I?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Cr,disabled:!rr.trim(),className:f("px-3 py-2 rounded-lg text-sm font-medium transition-colors",rr.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Yt(false),gr("");},className:f("p-2 rounded-lg transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Yt(true),className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsx("div",{className:"space-y-2 mb-4",children:d.map(T=>{let V=xe(T.type),G=T.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[G&&T.thumbnailUrl?jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsx(V,{className:f("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:T.name}),jsx("p",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:de(T.size)})]}),p&&jsx("button",{onClick:()=>p(T.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",I?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxs("div",{onDragOver:ee,onDragLeave:$,onDrop:_,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ie?I?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",F&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:se,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!u||F}),F?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",Ie?"text-[#00E5CC]":I?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:Ie?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!u&&jsx("p",{className:f("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-96 border-l flex flex-col",I?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",g.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",g.length,")"]})]}),jsx("button",{onClick:r,className:f("p-1.5 rounded transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Cb from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var fi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var bi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [bi.Translate.toString(e),bi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function f(...e){return twMerge(clsx(e))}function hi(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function yb(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function Yl(e,t){return e.length===0?1e3:t===0?hi(null,e[0].position):t>=e.length?hi(e[e.length-1].position,null):hi(e[t-1].position,e[t].position)}function Mu(e,t=100){return e>t}var xb=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 vb(e,t,r,a){let n=t*Math.pow(r,e-1),s=n*.2*Math.random();return Math.min(n+s,a)}async function yi(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=xb,onRetry:c}=t,l,i=0;for(let d=1;d<=r;d++){i=d;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(l=m,d===r||!o(l,d))return {error:l,attempts:i,success:false};let p=vb(d,a,n,s);if(c)try{c(l,d,p);}catch(g){console.error("Error in retry callback:",g);}await new Promise(g=>setTimeout(g,p));}}return {error:l||new Error("Unknown error"),attempts:i,success:false}}function wb(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function kb(e,t={}){return async(...r)=>yi(()=>e(...r),t)}var Xl=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Pu=(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))(Pu||{}),xo=class xo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:s,...o}=t,c=`[${r}] [${a}] [${s}]`,l=Object.keys(o).length>0;switch(a){case "DEBUG":console.debug(c,n,l?o:"");break;case "INFO":console.info(c,n,l?o:"");break;case "WARN":console.warn(c,n,l?o:"");break;case "ERROR":console.error(c,n,l?o:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...xo.globalOptions};}static configure(t){xo.globalOptions={...xo.globalOptions,...t};}child(t){return new xo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new xi((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new xi(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Pu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};xo.globalOptions={};var Jl=xo,xi=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Fu=new Jl;function Tb(e,t){let r={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(r,null,2)}function Nb(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(s=>{let o=e.columns.find(c=>c.id===s.columnId);return [s.id,Ql(s.title),Ql(s.description||""),Ql(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [r.join(","),...a.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function Db(e,t,r){let a=t;if(!a){let o=document.querySelector(".asakaa-board");o&&(a=o.parentElement||o);}if(a)try{let o=await Cb(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=o.toDataURL("image/png"),l=297,i=210,d=o.width/o.height,m=l-20,u=m/d;u>i-20&&(u=i-20,m=u*d);let p=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});p.setFontSize(16),p.setTextColor(255,255,255),p.setFillColor(10,10,10),p.rect(0,0,l,15,"F"),p.text(e.title||"Kanban Board",10,10);let g=(l-m)/2;return p.addImage(c,"PNG",g,20,m,u),p}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let c=e.cards.filter(l=>l.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,c.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):c.forEach(l=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(l.title,25,s),s+=6,l.description){n.setFontSize(9),n.setFont("helvetica","normal");let d=n.splitTextToSize(l.description,160);n.text(d,25,s),s+=d.length*5;}let i=[];if(l.priority&&i.push(`Priority: ${l.priority}`),l.labels&&l.labels.length>0&&i.push(`Labels: ${l.labels.join(", ")}`),l.assignedUserIds&&l.assignedUserIds.length>0&&i.push(`Assigned: ${l.assignedUserIds.length} user(s)`),l.startDate||l.endDate){let d=[];l.startDate&&d.push(`Start: ${l.startDate}`),l.endDate&&d.push(`End: ${l.endDate}`),i.push(d.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function Ql(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Au(e,t,r,a){switch(t){case "json":return Tb(e,a);case "csv":return Nb(e);case "pdf":return await Db(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Iu(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${a}.pdf`;e.save(d);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:o[t]}),l=URL.createObjectURL(c),i=document.createElement("a");i.href=l,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l);}function Sb(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Eb(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let r=Ru(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let c=Ru(t[o]||"");if(c.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-c.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((p,g)=>{i[p]=c[g]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let m=n.get(d),u={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(u),m.cardIds.push(u.id);}catch(c){s.push(`Line ${o+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ru(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Bu(e,t){switch(t){case "json":return Sb(e);case "csv":return Eb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function $u(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var Zl=createContext(null);function Ou(){return useContext(Zl)}var Hu=createContext(null);function Uu({children:e,themeName:t}){return jsx(Hu.Provider,{value:{themeName:t},children:e})}function vi(){return useContext(Hu)}function ar({children:e,container:t}){let[r,a]=useState(false),n=Ou(),s=vi();if(useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:c,themeName:l}=n,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return createPortal(jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var ju={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Bb="#BDC3C7",$b=({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 vo({priority:e,onChange:t,className:r}){let[a,n]=useState(false),[s,o]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),i=()=>{if(!l.current)return;let p=l.current.getBoundingClientRect(),g=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=p.right-y;v<10&&(v=p.left),v+y>x-10&&(v=x-y-10);let w=g-p.bottom,C=p.top,E;w>=b+h?E=p.bottom+h:C>=b+h?E=p.top-b-h:E=w>=C?p.bottom+h:Math.max(10,p.top-b-h),o({top:E,left:v}),n(true);};useEffect(()=>{let p=g=>{c.current&&!c.current.contains(g.target)&&!l.current?.contains(g.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),useEffect(()=>{let p=g=>{g.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let d=p=>{t(p),n(false);},m=e?ju[e]:null,u=m?.color||Bb;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:l,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:m?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),a&&jsx(ar,{children:jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(ju).map(([p,g])=>jsxs("button",{onClick:()=>d(p),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:g.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx($b,{color:g.color}),jsx("span",{className:"font-semibold text-sm",children:g.label}),e===p&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>d(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Ob=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Ds({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),u=(vi()?.themeName||"dark")==="dark",p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,E=320,F=380,k=4,S=v.left;S+E>C-10&&(S=C-E-10),S<10&&(S=10);let P=w-v.bottom,N=v.top,K;P>=F+k?K=v.bottom+k:N>=F+k?K=v.top-F-k:K=P>=N?v.bottom+k:Math.max(10,v.top-F-k),c({top:K,left:S}),s(true);};useEffect(()=>{let v=w=>{l.current&&!l.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let g=v=>{let w=new Date,C=S=>{let P=S.getFullYear(),N=String(S.getMonth()+1).padStart(2,"0"),K=String(S.getDate()).padStart(2,"0");return `${P}-${N}-${K}`},E=C(w),F=new Date(w);F.setDate(F.getDate()+v);let k=C(F);r(E,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=F=>{if(F instanceof Date)return F;if(typeof F!="string"||!F.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=F.split("-").map(Number);if(k.length!==3||k.some(K=>isNaN(K)))return null;let S=k[0],P=k[1],N=k[2];return S===void 0||P===void 0||N===void 0?null:new Date(S,P-1,N)},w=v(e),C=v(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${E[w.getMonth()]} ${w.getDate()} \u2013 ${E[C.getMonth()]} ${C.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxs("div",{className:`relative ${a||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):p(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${x()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsx(ar,{children:jsxs("div",{ref:l,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"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:u?"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:u?"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:Ob.map(v=>jsx("button",{onClick:()=>g(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ko({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[c,l]=useState(""),[i,d]=useState({top:0,left:0}),m=useRef(null),u=useRef(null),p=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,C=300,E=380,F=4,k=h.right-C;k<10&&(k=h.left),k+C>w-10&&(k=w-C-10);let S=v-h.bottom,P=h.top,N;S>=E+F?N=h.bottom+F:P>=E+F?N=h.top-E-F:N=S>=P?h.bottom+F:Math.max(10,h.top-E-F),d({top:N,left:k}),o(true);};useEffect(()=>{let h=v=>{m.current&&!m.current.contains(v.target)&&!u.current?.contains(v.target)&&(o(false),l(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),l(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let g=h=>{let v=e.some(w=>w.id===h.id);r(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:u,onClick:()=>s?o(false):p(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ar,{children:jsxs("div",{ref:m,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:c,onChange:h=>l(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>g(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{r([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function wi(e,t,r){let a=new Map;e.forEach(l=>{if(l.dependencies&&Array.isArray(l.dependencies)){let i=l.dependencies.map(d=>{if(typeof d=="string")return d;let m=d;return m.taskId||m.targetId||""}).filter(Boolean);a.set(l.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,c=l=>{if(!s.has(l)){s.add(l),o.add(l);let i=a.get(l)||[];for(let d of i){if(!s.has(d)&&c(d))return true;if(o.has(d))return true}}return o.delete(l),false};return c(r)}function Es({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[c,l]=useState(false),[i,d]=useState(""),[m,u]=useState(t.length>0),[p,g]=useState({top:0,left:0}),[x,y]=useState(null),b=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,N=300,K=m?380:120,U=4,ae=k.right-N;ae<10&&(ae=k.left),ae+N>P-10&&(ae=P-N-10);let I=S-k.bottom,_=k.top,j;I>=K+U?j=k.bottom+U:_>=K+U?j=k.top-K-U:j=I>=_?k.bottom+U:Math.max(10,k.top-K-U),g({top:j,left:ae}),l(true);};useEffect(()=>{if(!c||!h.current)return;let k=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,N=300,K=m?380:120,U=4,ae=k.right-N;ae<10&&(ae=k.left),ae+N>P-10&&(ae=P-N-10);let I=S-k.bottom,_=k.top,j;I>=K+U?j=k.bottom+U:_>=K+U?j=k.top-K-U:j=I>=_?k.bottom+U:Math.max(10,k.top-K-U),g({top:j,left:ae});},[m,c]),useEffect(()=>{let k=S=>{b.current&&!b.current.contains(S.target)&&!h.current?.contains(S.target)&&(l(false),d(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=S=>{S.key==="Escape"&&(l(false),d(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let S=t.includes(k),P=r.find(N=>N.id===k);if(y(null),S){let N=t.filter(K=>K!==k);a(N),N.length===0&&u(false);}else {if(s&&wi(r,k,e)){let K=`Cannot add "${P?.title||k}" as dependency - would create circular reference`;y(K),o?.(k,P?.title||k),setTimeout(()=>y(null),3e3);return}a([...t,k]),u(true);}},C=()=>{let k=!m;u(k),k||a([]);},E=r.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),F=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>c?l(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:F,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:F},children:t.length})]}),c&&jsx(ar,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>d(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:E.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):E.map(k=>{let S=t.includes(k.id);return jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:S?"#00E5CC":"transparent",borderColor:S?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:S&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{a([]),u(false),l(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var In=memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:c=[],allCards:l=[]})=>{let{attributes:i,listeners:d,setNodeRef:m,transform:u,transition:p,isDragging:g}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:bi.Transform.toString(u),transition:p};if(t)return jsx("div",{ref:m,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let y=c.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:m,style:v,className:f("asakaa-card",g&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:E=>{E.currentTarget.style.display="none";}}),C===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(vo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ds,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,C)=>o?.(e.id,{startDate:w,endDate:C})})}),c.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(ko,{assignedUsers:y,availableUsers:c,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Es,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:l,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));In.displayName="Card";var ki={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},tp=({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 rp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),d=[...Object.entries(ki).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...a.filter(y=>!Object.keys(ki).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let y=ki[e];if(y)return {...y,id:e};let b=a.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ki.todo,id:"todo"}},u=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,C=4,E=y.right-v;E<10&&(E=y.left),E+v>h-10&&(E=h-v-10);let F=b-y.bottom,k=y.top,S;F>=w+C?S=y.bottom+C:k>=w+C?S=y.top-w-C:S=F>=k?y.bottom+C:Math.max(10,y.top-w-C),c({top:S,left:E}),s(true);};useEffect(()=>{let y=b=>{l.current&&!l.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let p=y=>{t(y),s(false);},g=m(),x=g.color;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,onClick:()=>n?s(false):u(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:g.label,children:jsx(tp,{icon:g.icon,color:x})}),n&&jsx(ar,{children:jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:d.map(y=>jsxs("button",{onClick:()=>p(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(tp,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var ap={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 np({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=ap[s]||ap.en,[c,l]=useState(false),[i,d]=useState(false),[m,u]=useState(e),[p,g]=useState({top:0,left:0}),x=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(c&&y.current){let C=y.current.getBoundingClientRect();g({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[c]),useEffect(()=>{let C=E=>{x.current&&!x.current.contains(E.target)&&!y.current?.contains(E.target)&&(l(false),d(false));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),useEffect(()=>{let C=E=>{E.key==="Escape"&&(l(false),d(false),u(e));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{d(true),u(e);},v=()=>{let C=m.trim();C&&C!==e&&t(C),d(false),l(false),u(e);},w=C=>{C.key==="Enter"?v():C.key==="Escape"&&(d(false),u(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>l(!c),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),c&&jsx(ar,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${p.top}px`,left:`${p.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:m,onChange:C=>u(C.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{r(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var _o=memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:c,availableUsers:l,allCards:i,enableVirtualization:d,cardHeight:m=120,isCollapsed:u,onToggleCollapse:p,onColumnRename:g,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),E=useRef(null),F=d??Mu(t.length),k=useVirtualizer({count:t.length,getScrollElement:()=>E.current,estimateSize:()=>m,enabled:F});if(r)return jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),N=P.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:f("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",N&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f(K()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),P.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),P.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),P.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(g||x)&&jsx(np,{columnTitle:e.title,onRename:U=>g?.(e.id,U),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),p&&jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!u&&jsx("div",{ref:E,className:"asakaa-column-cards",style:{maxHeight:F?"600px":void 0},children:jsx(SortableContext,{items:t.map(U=>U.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):F?jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(U=>{let ae=t[U.index];return ae?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsx(In,{card:ae,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i})},ae.id):null})}):t.map(U=>jsx(In,{card:U,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i},U.id))})})]})});_o.displayName="Column";function nc({title:e,onSave:t,className:r}){let[a,n]=useState(false),[s,o]=useState(e),c=useRef(null);useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?l():d.key==="Escape"&&(o(e),n(false));};return a?jsx("input",{ref:c,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:l,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsx("h2",{className:f("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function nh(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function dp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(c=>{let l=c.name.toLowerCase(),i=l.replace(/\s+/g,""),d=l.split(/\s+/);return !!(i===s||l===s||d.some(m=>m===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function oh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function sh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ih=["\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 up({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:c="dark",locale:l="es",currentUser:i,enableEmoji:d=true,enableAttachments:m=true,pendingFiles:u=[],onFilesSelect:p,onRemoveFile:g,maxFileSizeMB:x=10}){let y=c==="dark",[b,h]=useState(false),[v,w]=useState([]),[C,E]=useState(0),[F,k]=useState(null),[S,P]=useState(false),N=useRef(null),K=useRef(null),U=useRef(null),ae=useRef(null),I=useCallback((me,xe)=>{let he=nh(me,xe);if(k(he),he){let We=a.filter(Se=>Se.name.toLowerCase().includes(he.query)||Se.email&&Se.email.toLowerCase().includes(he.query)).slice(0,5);w(We),h(We.length>0),E(0);}else h(false),w([]);},[a]),_=me=>{let xe=me.target.value;if(t(xe),I(xe,me.target.selectionStart||0),N.current){N.current.style.height="24px";let he=N.current.scrollHeight,We=280,Se=Math.min(he,We);N.current.style.height=`${Se}px`,N.current.style.overflowY=he>We?"auto":"hidden";}},j=()=>{N.current&&I(e,N.current.selectionStart||0);},W=useCallback(me=>{if(!F||!N.current)return;let xe=e.slice(0,F.start),he=e.slice(F.end),We=`@${me.name.replace(/\s+/g,"")} `,Se=xe+We+he;t(Se),h(false),k(null),setTimeout(()=>{if(N.current){let Re=F.start+We.length;N.current.selectionStart=Re,N.current.selectionEnd=Re,N.current.focus();}},0);},[F,e,t]),B=me=>{if(b&&v.length>0)switch(me.key){case "ArrowDown":me.preventDefault(),E(xe=>xe<v.length-1?xe+1:0);break;case "ArrowUp":me.preventDefault(),E(xe=>xe>0?xe-1:v.length-1);break;case "Enter":{me.preventDefault();let xe=v[C];xe&&W(xe);break}case "Tab":{me.preventDefault();let xe=v[C];xe&&W(xe);break}case "Escape":me.preventDefault(),h(false);break}else me.key==="Enter"&&!me.shiftKey&&(me.preventDefault(),r());};useEffect(()=>{let me=xe=>{K.current&&!K.current.contains(xe.target)&&N.current&&!N.current.contains(xe.target)&&h(false),ae.current&&!ae.current.contains(xe.target)&&P(false);};return document.addEventListener("mousedown",me),()=>document.removeEventListener("mousedown",me)},[]);let ve=useCallback(me=>{if(!N.current)return;let xe=N.current.selectionStart||e.length,he=e.slice(0,xe)+me+e.slice(xe);t(he),P(false),setTimeout(()=>{if(N.current){let We=xe+me.length;N.current.selectionStart=We,N.current.selectionEnd=We,N.current.focus();}},0);},[e,t]),je=useCallback(me=>{if(!p||!me.target.files)return;let xe=Array.from(me.target.files),he=x*1024*1024,We=xe.filter(Se=>Se.size>he?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);We.length>0&&p(We),me.target.value="";},[p,x]),Pe=useCallback(me=>me.type.startsWith("image/")?Image:me.type.includes("pdf")||me.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&K.current){let me=K.current.children[C];me&&me.scrollIntoView({block:"nearest"});}},[C,b]),jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:u.map(me=>{let xe=Pe(me.file),he=me.file.type.startsWith("image/");return jsxs("div",{className:f("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[he&&me.preview?jsx("img",{src:me.preview,alt:me.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(xe,{className:f("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:f("text-xs truncate",y?"text-white":"text-gray-900"),children:me.file.name}),jsx("p",{className:f("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:sh(me.file.size)})]}),g&&jsx("button",{onClick:()=>g(me.id),className:f("p-0.5 rounded-full transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},me.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:f("flex-1 relative min-w-0"),children:[jsxs("div",{className:f("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!S),disabled:s||o,className:f("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:S&&jsx(motion.div,{ref:ae,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:ih.map(me=>jsx("button",{type:"button",onClick:()=>ve(me),className:f("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:me},me))})})})]}),m&&p&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||o,className:f("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:l==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:U,type:"file",multiple:true,onChange:je,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:_,onSelect:j,onKeyDown:B,placeholder:n||(l==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:f("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:r,disabled:o||!e.trim()&&u.length===0||s,className:f("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&v.length>0&&jsx(motion.div,{ref:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:f("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((me,xe)=>jsxs("button",{type:"button",onClick:()=>W(me),className:f("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",xe===C?y?"bg-white/10":"bg-gray-100":y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:me.color||"#8B5CF6"},children:oh(me.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:f("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:me.name}),me.email&&jsx("p",{className:f("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:me.email})]})]},me.id))})})]})]})]})}function pp({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((c,l)=>c.type==="mention"?jsx("span",{className:f("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:c.value},l):jsx("span",{children:c.value},l))})}var Si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Ko({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[c,l]=useState(false),[i,d]=useState(""),[m,u]=useState(false),[p,g]=useState(Si[10]||"#00E5CC"),[x,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),v=useRef(null),w=useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),E=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(c&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+6,left:N.left});}},[c]),useEffect(()=>{let N=K=>{let U=K.target,ae=b.current?.contains(U),I=v.current?.contains(U);!ae&&!I&&(l(false),d(""),u(false));};if(c)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[c]),useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let F=N=>{let K=e.some(U=>U.id===N.id);r(K?e.filter(U=>U.id!==N.id):[...e,N]);},k=async()=>{if(!(!a||!i.trim())){u(true);try{let N=await a(i.trim(),p);N&&(r([...e,N]),d(""),g(Si[Math.floor(Math.random()*Si.length)]||"#00E5CC"));}finally{u(false);}}},S=(N,K)=>{K.stopPropagation(),r(e.filter(U=>U.id!==N));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&l(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:c&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>d(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!E&&a&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:K=>S(N.id,K),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(N=>{let K=e.some(U=>U.id===N.id);return jsxs("button",{type:"button",onClick:()=>F(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:U=>{K||(U.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:U=>{K||(U.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!E&&a&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Si.map(N=>jsx("button",{type:"button",onClick:()=>g(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:p===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:k,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:p,color:"#FFFFFF",opacity:m?.7:1},children:[m?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function sc({tag:e,onRemove:t,size:r="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function gp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsx(sc,{tag:s,size:r},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var To=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function fp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function bh(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 hh({className:e}){return jsxs("svg",{className:f("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 ic({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=bh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},l=fp(e.loggedMinutes),i=e.estimateMinutes?fp(e.estimateMinutes):null,d=r&&i?`${l} / ${i}`:l;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(a?"button":"span",{className:f("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsx(hh,{className:c[t]}),jsx("span",{children:d})]})}function yh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Mi(e){let t=yh(e);return t!==null?String(t):e}function hp(e){let r=Mi(e).trim().toLowerCase();if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Pi(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function wh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function kh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Ch({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 yp({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 Th({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 lc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:c,onStopTimer:l,onDiscardTimer:i,onClose:d,className:m}){let[u,p]=useState(""),[g,x]=useState(t.estimateMinutes?Pi(t.estimateMinutes):""),[y,b]=useState(""),[h,v]=useState(false),[w,C]=useState(false),E=useRef(null);useEffect(()=>{E.current?.focus();},[]);let F=async()=>{let P=hp(u);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),p(""),b("");}finally{v(false);}}},k=async()=>{if(!o)return;let P=g.trim()?hp(g):null;await o(P),C(false);},S=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),F()),P.key==="Escape"&&d?.();};return jsxs("div",{className:f("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",m),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(yp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:a?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:wh(n)})]}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Ch,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(yp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:c,className:f("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(kh,{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(Th,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:E,type:"text",value:u,onChange:P=>p(P.target.value),onKeyDown:S,placeholder:"8 (=8h), 2h 30m",className:f("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:F,disabled:h||!u.trim(),className:f("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:S,placeholder:"Note (optional)",className:f("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Pi(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:g,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&k(),P.key==="Escape"&&C(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Pi(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:f("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:f("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),r.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Pi(P.durationMinutes)})]},P.id))})]})]})}function Mh(e){let r=Mi(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Ph(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function wn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[c,l]=useState(Ph(a)),[i,d]=useState(""),[m,u]=useState(false),p=useRef(null);useEffect(()=>{p.current?.focus();},[]);let g=async()=>{u(true);let v=Mh(c);await n(v&&v>0?v:null,i||void 0),u(false);},x=async()=>{u(true),await n(null),u(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),g()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:f("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:p,type:"text",value:c,onChange:v=>l(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:g,disabled:m||!c.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:m?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),a&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Fh(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 Lh(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 dc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Fh(e.health),s=Lh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,l=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxs("div",{className:f("flex items-center gap-2",a),children:[jsx("div",{className:f("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsx("div",{className:f("h-full w-1/4",n)})}),t&&jsx("span",{className:f("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:f("flex items-center gap-2",a),children:[jsxs("div",{className:f("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsx("div",{className:f("h-full transition-all duration-300",n),style:{width:`${l}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:f("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function qo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function Ih(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Rh(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Bh(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 $h({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",c=r?"text-[#9CA3AF]":"text-gray-500",l=r?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:f("text-2xl font-bold",n),children:[a?"+":"",qo(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:f("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-2",c),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:f("font-medium",l),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:f("font-medium",l),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:f("font-medium",l),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:f("p-4 rounded-lg border",s,o),children:[jsx("div",{className:f("text-sm font-medium mb-2",c),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:c,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:f("font-medium",l),children:qo(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:f("font-medium",l),children:qo(e.totalLoggedMinutes)})]}),jsxs("div",{className:f("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:f("font-medium",l),children:e.totalTasksWithEstimate})]})]})]})]})}function Oh({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",c=r?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:f("border-b",s,a&&f("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:f("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:f("text-xs mt-1",c),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?qo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:qo(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:f("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":c),children:[n,qo(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:f("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":c),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:f("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Rh(e.status,r),Ih(e.status,r)),children:Bh(e.status,t)})})]})}function uc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",c=o?"bg-[#050505]":"bg-gray-50",l=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",u=o?"bg-[#050505]/50":"bg-gray-50",p=useMemo(()=>e?[...e.tasks].sort((g,x)=>g.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-g.varianceMinutes):[],[e]);return t?jsx("div",{className:f("p-8 text-center",m,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:f("p-8 text-center",m,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:f("space-y-6 p-6",c,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:f("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:f("text-sm mt-1",m),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx($h,{summary:e.summary,locale:r,isDark:o}),jsx("div",{className:f("rounded-lg border overflow-hidden",l,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:u,children:jsxs("tr",{children:[jsx("th",{className:f("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Tarea":"Task"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Ofertado":"Sold"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Trabajado":"Logged"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsx("th",{className:f("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:f("divide-y",i),children:p.map(g=>jsx(Oh,{task:g,locale:r,isDark:o,onClick:s},g.taskId))})]})})}),jsx("div",{className:f("text-xs text-center",m),children:r==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Yo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Qh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Ep(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function Zh(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 No({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:c=[],availableTags:l=[],onCreateTag:i,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:u,availableTasks:p=[],comments:g=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:E=false,timerElapsedSeconds:F=0,onTimeLog:k,onEstimateUpdate:S,onSoldEffortUpdate:P,onTimerStart:N,onTimerStop:K,onTimerDiscard:U,blurFinancials:ae=false}){let I=s==="dark",_={textTertiary:I?"#6B7280":"#9CA3AF",textSecondary:I?"#9CA3AF":"#6B7280",textPrimary:I?"#FFFFFF":"#111827",borderLight:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:I?"#1A1D25":"#FFFFFF",bgSecondary:I?"#0A0A0A":"#F9FAFB",hoverBg:I?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},j=e&&"title"in e&&!("name"in e),W=e,[B,ve]=useState(e?Ep(e,c):null),[je,Pe]=useState(false),[me,xe]=useState(false),[he,We]=useState(false),[Se,Re]=useState(null),[Ae,Ye]=useState(new Date),[se,Xe]=useState(false),[Be,$e]=useState(false),[mt,Nt]=useState(""),[ze,Fe]=useState(false),[nt,It]=useState(false),[Ie,ot]=useState(false),[L,Q]=useState(false),[R,J]=useState(""),O=useRef(null),Y=useRef(null),[Te,ge]=useState(""),Ze=useRef(null),[et,Je]=useState(""),[Bt,Tt]=useState(false),[zt,kt]=useState([]),[tr,ur]=useState(""),[da,Gt]=useState(false),gr=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let T=Ep(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),ve(T),J(T.description||""),ge(T.name||"");}},[e?.id,e?.quotedMinutes,c,t]),useEffect(()=>{if(!t||!R)return;let T=setTimeout(()=>{let H=Y.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,R]),useEffect(()=>()=>{O.current&&clearTimeout(O.current),Ze.current&&clearTimeout(Ze.current);},[]),useEffect(()=>{t&&gr.current&&g.length>0&&setTimeout(()=>{gr.current&&(gr.current.scrollTop=gr.current.scrollHeight);},100);},[t,g.length]);let Rt=useCallback(T=>{ve(T),j&&n&&W?n(Zh(T,W)):a&&a(T);},[j,W,n,a]),Kr=useCallback(()=>{Pe(false),xe(false),We(false),Re(null),$e(false),Nt(""),Fe(false);},[]),Vt=useCallback((T,H)=>{if(!B)return;let ue={...B,[T]:H};Rt(ue);},[B,Rt]),Jt=useCallback(()=>{let T=Y.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),Gr=useCallback(T=>{J(T),setTimeout(Jt,0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(B){let H={...B,description:T};Rt(H);}},800);},[B,Rt,Jt]),ua=useCallback(T=>{ge(T),Ze.current&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>{if(B&&T.trim()){let H={...B,name:T.trim()};Rt(H);}},800);},[B,Rt]),tt=useCallback(T=>{let H=T.map(ue=>{let q={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ue};return ue.type.startsWith("image/")&&(q.preview=URL.createObjectURL(ue)),q});kt(ue=>[...ue,...H]);},[]),_e=useCallback(T=>{kt(H=>{let ue=H.find(q=>q.id===T);return ue?.preview&&URL.revokeObjectURL(ue.preview),H.filter(q=>q.id!==T)});},[]),ga=useCallback(async()=>{if(!(!B||!et.trim()&&zt.length===0||!x)){Tt(true);try{let T=dp(et,b),H=[];if(zt.length>0&&h){let ue=zt.map(q=>q.file);H=await h(ue);}await x(B.id,et.trim(),T.length>0?T:void 0,H.length>0?H:void 0),Je(""),zt.forEach(ue=>{ue.preview&&URL.revokeObjectURL(ue.preview);}),kt([]);}finally{Tt(false);}}},[B,et,zt,x,b,h]),sr=useCallback(()=>{if(!B||!tr.trim())return;let T=B.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:tr.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},ue=[...T,H],q={...B,subtasks:ue};Rt(q),ur(""),Gt(false);},[B,tr,Rt]),Zr=useCallback(T=>{if(!B?.subtasks)return;let H=B.subtasks.map(q=>q.id===T?{...q,progress:q.progress===100?0:100}:q),ue={...B,subtasks:H};Rt(ue);},[B,Rt]),fr=useCallback(T=>{if(!B?.subtasks)return;let H=B.subtasks.filter(q=>q.id!==T),ue={...B,subtasks:H};Rt(ue);},[B,Rt]),wa=useCallback(T=>{let H=typeof T=="string"?new Date(T):T,q=new Date().getTime()-H.getTime(),ke=Math.floor(q/6e4),st=Math.floor(q/36e5),re=Math.floor(q/864e5);return ke<1?o==="es"?"Ahora":"Just now":ke<60?o==="es"?`Hace ${ke} min`:`${ke}m ago`:st<24?o==="es"?`Hace ${st}h`:`${st}h ago`:re<7?o==="es"?`Hace ${re}d`:`${re}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),le=useCallback(T=>{if(!B)return;let H=B.progress||0;T==="completed"?H=100:T==="in-progress"&&H===0?H=10:T==="todo"&&(H=0);let ue={...B,status:T,progress:H};Rt(ue),Pe(false);},[B,Rt]),de=useCallback((T,H)=>{if(!B)return;let ue={...B,startDate:T,endDate:H};Rt(ue);},[B,Rt]),dt=useCallback(()=>{let T=Ae.getFullYear(),H=Ae.getMonth(),ue=new Date(T,H,1),ke=new Date(T,H+1,0).getDate(),st=ue.getDay(),re=[],it=new Date(T,H,0).getDate();for(let St=st-1;St>=0;St--)re.push({date:new Date(T,H-1,it-St),isCurrentMonth:false});for(let St=1;St<=ke;St++)re.push({date:new Date(T,H,St),isCurrentMonth:true});let pt=42-re.length;for(let St=1;St<=pt;St++)re.push({date:new Date(T,H+1,St),isCurrentMonth:false});return re},[Ae]),V=useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),ot(false),!B||!m)return;let H=Array.from(T.dataTransfer.files);if(H.length!==0){Q(true);try{await m(B.id,H);}finally{Q(false);}}},[B,m]),be=useCallback(async T=>{if(!B||!m||!T.target.files)return;let H=Array.from(T.target.files);if(H.length!==0){Q(true);try{await m(B.id,H);}finally{Q(false);}T.target.value="";}},[B,m]),Z=useCallback(T=>{T.preventDefault(),T.stopPropagation(),ot(true);},[]),$=useCallback(T=>{T.preventDefault(),T.stopPropagation(),ot(false);},[]),te=useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),we=useCallback(T=>T.startsWith("image/")?Image:T.includes("pdf")||T.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",I?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3 h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:f("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let T=B.progress===100?0:100,ue={...B,progress:T,status:T===100?"completed":"todo"};Rt(ue);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Te,onChange:T=>ua(T.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":I?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Kr(),Pe(!je);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(T=>jsxs("button",{onClick:()=>le(T.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",T.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Kr(),We(!he);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((T,H)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:T.color||"#8B5CF6"},title:T.name,children:T.initials||T.name.slice(0,2).toUpperCase()},H)),B.assignees.length>3&&jsxs("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:f("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:f("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(T=>{let H=B.assignees?.some(ue=>ue.name===T.name);return jsxs("button",{onClick:()=>{let ue=B.assignees||[],q;H?q=ue.filter(ke=>ke.name!==T.name):q=[...ue,T],Vt("assignees",q);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",H&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:T.color||"#8B5CF6"},children:T.initials||T.name.slice(0,2).toUpperCase()}),jsx("span",{className:f("flex-1",I?"text-white":"text-gray-900"),children:T.name}),H&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Re(Se?null:"start"),Ye(B.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:f("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Se&&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:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,H=new Date(T);H.setDate(T.getDate()+1);let ue=new Date(T);ue.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let q=new Date(T);q.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let ke=new Date(T);ke.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let st=new Date(T);st.setDate(T.getDate()+14);let re=new Date(T);return re.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:ue,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:q,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ke,display:ke.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:st,display:st.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:re,display:re.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((pt,St)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let br=B.endDate&&pt.date>B.endDate?pt.date:B.endDate;de(pt.date,br),Re("end");}else {let br=B.startDate&&pt.date<B.startDate?pt.date:B.startDate;de(br,pt.date),Re(null);}},children:[jsx("span",{children:pt.label}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:pt.display})]},St))})(),jsx("div",{className:f("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{de(void 0,void 0),Re(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",I?"text-white":"text-gray-900"),children:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Ye(new Date),className:f("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Ye(new Date(Ae.getFullYear(),Ae.getMonth()-1)),className:f("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Ye(new Date(Ae.getFullYear(),Ae.getMonth()+1)),className:f("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:dt().map((T,H)=>{let ue=T.date.toDateString()===new Date().toDateString(),q=B.startDate?.toDateString()===T.date.toDateString(),ke=B.endDate?.toDateString()===T.date.toDateString(),st=q||ke,re=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsx("button",{onClick:()=>{let it=new Date(T.date);if(Se==="start"){let pt=B.endDate&&it>B.endDate?it:B.endDate;de(it,pt),Re("end");}else {let pt=B.startDate&&it<B.startDate?it:B.startDate;de(pt,it),Re(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(I?"text-white":"text-gray-900"),ue&&"ring-2 ring-[#00E5CC]",q&&"bg-[#00E5CC] text-white",ke&&!q&&"bg-[#7C3AED] text-white",re&&!st&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!st&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},H)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Kr(),xe(!me);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:me&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(T=>jsxs("button",{onClick:()=>{Vt("priority",T.id),xe(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",T.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:f("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let H=parseInt(T.target.value),ue=B.status;H===100?ue="completed":H>0?ue="in-progress":ue="todo";let q={...B,progress:H,status:ue};Rt(q);},onBlur:()=>Xe(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",I?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Xe(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",I?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:f("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:f("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:f("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Yo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>It("estimate"),className:f("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Yo(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>It("estimate"),className:f("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:nt==="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(wn,{mode:"estimate",locale:o,isDark:I,currentValue:w?.estimateMinutes||null,onSave:async T=>{await S?.(B.id,T),It(false);},onClose:()=>It(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ae?jsx("span",{className:f("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsx("span",{className:f("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Yo(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>It("quoted"),className:f("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Yo(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>It("quoted"),className:f("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:nt==="quoted"&&!ae&&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(wn,{mode:"quoted",locale:o,isDark:I,currentValue:B.quotedMinutes||null,onSave:async T=>{P?(await P(B.id,T),ve(H=>H?{...H,quotedMinutes:T}:null)):Vt("quotedMinutes",T),It(false);},onClose:()=>It(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:f("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",I?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):E?jsxs("button",{type:"button",onClick:()=>K?.(B.id),className:f("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"}),Qh(F||0)]}):jsx("button",{type:"button",onClick:()=>N?.(B.id),className:f("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",I?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>It("log"),className:f("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",I?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:f("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[Yo(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:f("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",Yo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:f("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:nt==="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(wn,{mode:"log",locale:o,isDark:I,currentValue:null,onSave:async(T,H)=>{T&&await k?.(B.id,{durationMinutes:T,note:H,source:"manual"}),It(false);},onClose:()=>It(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Ko,{selectedTags:B.tags||[],availableTags:l,onChange:T=>{Vt("tags",T);},onCreateTag:i,theme:_})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:f("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(T=>{let H=p.find(ue=>ue.id===T);return jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[H?.name||T.slice(0,8),jsx("button",{onClick:()=>{let ue=(B.dependencies||[]).filter(q=>q!==T);Vt("dependencies",ue);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},T)})}),jsxs("button",{onClick:()=>{Kr(),$e(!Be);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),Nt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:f("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:mt,onChange:T=>Nt(T.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:p.length>0?p.filter(T=>T.id!==B.id).filter(T=>mt===""||T.name.toLowerCase().includes(mt.toLowerCase())).map(T=>{let H=B.dependencies?.includes(T.id);return jsxs("button",{onClick:()=>{let ue=B.dependencies||[],q;H?q=ue.filter(ke=>ke!==T.id):q=[...ue,T.id],Vt("dependencies",q);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",H&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-[#00E5CC] border-[#00E5CC]":I?"border-white/30":"border-gray-300"),children:H&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:f("block truncate",I?"text-white":"text-gray-900"),children:T.name}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsx("div",{className:f("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Kr(),Fe(!ze);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:To.find(T=>T.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:f("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ze&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:To.map(T=>{let H=B.color===T.value;return jsx("button",{onClick:()=>{Vt("color",T.value),Fe(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:H?T.value:void 0},title:T.name,children:H&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:f("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:T=>Vt("isMilestone",T.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":I?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:f("text-sm",I?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:f("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Y,value:R,onChange:T=>Gr(T.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(T=>T.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((T,H)=>(T.position??0)-(H.position??0)).map(T=>jsxs("div",{className:f("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",I?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Zr(T.id),className:f("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",T.progress===100?"bg-green-500 border-green-500":I?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:f("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:T.name}),jsx("button",{onClick:()=>fr(T.id),className:f("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",I?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),da?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:tr,onChange:T=>ur(T.target.value),onKeyDown:T=>{T.key==="Enter"&&tr.trim()?sr():T.key==="Escape"&&(Gt(false),ur(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:f("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",I?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:sr,disabled:!tr.trim(),className:f("px-3 py-2 rounded-lg text-sm font-medium transition-colors",tr.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Gt(false),ur("");},className:f("p-2 rounded-lg transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Gt(true),className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:f("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsx("div",{className:"space-y-2 mb-4",children:d.map(T=>{let H=we(T.type),ue=T.type.startsWith("image/");return jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ue&&T.thumbnailUrl?jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsx(H,{className:f("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:T.name}),jsx("p",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:te(T.size)})]}),u&&jsx("button",{onClick:()=>u(T.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",I?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxs("div",{onDragOver:Z,onDragLeave:$,onDrop:V,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ie?I?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",L&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:be,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||L}),L?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:f("w-6 h-6 mx-auto mb-2",Ie?"text-[#00E5CC]":I?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:Ie?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsx("p",{className:f("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:f("w-96 border-l flex flex-col",I?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:f("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",g.length>0&&jsxs("span",{className:f("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",g.length,")"]})]}),jsx("button",{onClick:r,className:f("p-1.5 rounded transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${I?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:fr,className:f("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:g.length>0?jsx("div",{className:"space-y-4",children:[...g].sort((T,V)=>{let G=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,Z=typeof V.createdAt=="string"?new Date(V.createdAt):V.createdAt;return G.getTime()-Z.getTime()}).map(T=>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:T.user?.color||"#8B5CF6"},children:T.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:f("text-sm font-medium",I?"text-white":"text-gray-900"),children:T.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:ne(T.createdAt)})]}),jsx("div",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsx(up,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(V=>{let G=V.type.startsWith("image/");return jsxs("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[G?jsx(Image,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:f("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:V.name})]},V.id)})})]})]},T.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsx(dp,{value:ot,onChange:Ye,onSubmit:zr,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:$t,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:St,onFilesSelect:Xe,onRemoveFile:Je})})]})]})]})})}function pc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{dragStore.setState(a);},[]);return [e,r]}function Zn({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:c,isLoading:l,error:i,children:d,availableTags:u=[],onCreateTag:p,attachmentsByCard:m,onUploadAttachments:g,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:E,timeTrackingSummary:L,timeEntries:k,timerState:S,onLogTime:P,onUpdateEstimate:N,onUpdateSoldEffort:K,onStartTimer:H,onStopTimer:Q,onDiscardTimer:I,blurFinancials:q=false,sidePanel:j,renderColumnMetrics:U,suppressDetailModal:B=false}){let[we,Ge]=pc(),[Pe,be]=useState(null),[ve,he]=useState(false),Oe=useRef(null),Se=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Fe=n?.theme||"dark",He=Fe==="dark"||Fe==="neutral",Be=He?"dark":"",ue=useCallback((F,re)=>{t.onCardUpdate?.(F,re);},[t]),Ke=useCallback((F,re)=>{t.onColumnUpdate?.(F,{title:re});},[t]),ze=useCallback(F=>{t.onColumnDelete?.(F);},[t]),Ae=["todo","in-progress","completed"],Tt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Nt=useMemo(()=>{let F=new Map;return e.columns.forEach(re=>{let R=re.cardIds.map(X=>e.cards.find(O=>O.id===X)).filter(X=>X!==void 0).sort((X,O)=>X.position-O.position);F.set(re.id,R);}),F},[e.cards,e.columns]);useEffect(()=>{let F=Oe.current;if(!F)return;let re=J=>{let Te=J.target,me=J.button===1,tt=Te===F||Te.classList.contains("asakaa-column")&&!Te.closest(".asakaa-card");(me||J.button===0&&tt&&!we.isDragging)&&(J.preventDefault(),he(true),Se.current={x:J.clientX,y:J.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},F.style.cursor="grabbing",F.style.userSelect="none");},R=J=>{if(!ve)return;let Te=J.clientX-Se.current.x,me=J.clientY-Se.current.y;F.scrollLeft=Se.current.scrollLeft-Te,F.scrollTop=Se.current.scrollTop-me;},X=()=>{ve&&(he(false),F.style.cursor="",F.style.userSelect="");},O=()=>{ve&&(he(false),F.style.cursor="",F.style.userSelect="");};return F.addEventListener("mousedown",re),document.addEventListener("mousemove",R),document.addEventListener("mouseup",X),F.addEventListener("mouseleave",O),()=>{F.removeEventListener("mousedown",re),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",X),F.removeEventListener("mouseleave",O);}},[ve,we.isDragging]);let Re=useMemo(()=>e.cards.map(F=>({id:F.id,name:F.title,startDate:F.startDate?new Date(F.startDate):void 0,endDate:F.endDate?new Date(F.endDate):void 0,progress:F.progress||0,status:F.columnId,priority:F.priority?.toLowerCase(),dependencies:Array.isArray(F.dependencies)?F.dependencies.map(re=>typeof re=="string"?re:re.taskId):[]})),[e.cards]),Le=useCallback(F=>{let{active:re}=F,R=e.cards.find(X=>X.id===re.id);R&&Ge({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Ge]),ut=useCallback(F=>{let{active:re,over:R}=F;if(!R||!e.cards.find(J=>J.id===re.id))return;let O=null;R.data.current?.type==="column"?O=R.id:R.data.current?.type==="card"&&(O=e.cards.find(Te=>Te.id===R.id)?.columnId||null),O&&O!==we.targetColumnId&&Ge({...we,targetColumnId:O});},[e.cards,we,Ge]),Ct=useCallback(async F=>{let{active:re,over:R}=F;if(Ge({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let X=e.cards.find(me=>me.id===re.id);if(!X)return;let O,J;if(R.data.current?.type==="column"){O=R.id;let me=Nt.get(O)||[];J=ql(me,0);}else {let me=e.cards.find(Ye=>Ye.id===R.id);if(!me)return;O=me.columnId;let tt=Nt.get(O)||[],ot=tt.findIndex(Ye=>Ye.id===R.id);J=ql(tt,ot);}let Te=e.columns.find(me=>me.id===O);if(Te&&Te.wipLimit&&Te.wipLimitType==="hard"){let me=Nt.get(O)||[];if(X.columnId!==O&&me.length>=Te.wipLimit){t.onWipLimitExceeded?.(Te,X);return}}(X.columnId!==O||X.position!==J)&&await t.onCardMove?.(X.id,O,J);},[e.cards,e.columns,Nt,t,Ge]),Ie=useCallback(F=>{B||be(F),r?.(F),w?.(F.id);},[r,w,B]),lt=useCallback(F=>{t.onCardUpdate?.(F.id,F),be(F);},[t]);return l?jsx("div",{className:f("asakaa-board",Be,o),style:c,children:jsx(dy,{columnCount:3})}):i?jsx("div",{className:f("asakaa-board",Be,o),style:c,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Hu,{themeName:Fe,children:[jsxs("div",{className:f("flex h-full overflow-hidden",j?"flex-row":""),children:[jsxs(DndContext,{sensors:Tt,collisionDetection:closestCorners,onDragStart:Le,onDragOver:ut,onDragEnd:Ct,children:[jsxs("div",{ref:Oe,className:f("asakaa-board",j?"flex-1":"",Be,o),style:{...c,cursor:ve?"grabbing":void 0},"data-theme":Fe,children:[e.columns.sort((F,re)=>F.position-re.position).map(F=>{let re=Nt.get(F.id)||[],R=!Ae.includes(F.id),X=a?.renderColumnFooter?.(F);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(_o,{column:F,cards:re,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:U?(O,J)=>U(O,J):void 0,onCardClick:Ie,onCardUpdate:ue,onColumnRename:t.onColumnUpdate?Ke:void 0,onColumnDelete:t.onColumnDelete?ze:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),X]},F.id)}),d]}),jsx(DragOverlay,{children:we.draggedCardId?jsx(An,{card:e.cards.find(F=>F.id===we.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),j]}),!B&&jsx(No,{task:Pe,isOpen:!!Pe,onClose:()=>be(null),onCardUpdate:lt,theme:He?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:u,onCreateTag:p,attachments:Pe?m?.get(Pe.id)||[]:[],onUploadAttachments:g,onDeleteAttachment:x,availableTasks:Re,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:C,enableTimeTracking:E,timeTrackingSummary:L,timeEntries:k,isTimerRunning:S?.isRunning,timerElapsedSeconds:S?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:N,onSoldEffortUpdate:K,onTimerStart:H,onTimerStop:Q,onTimerDiscard:I,blurFinancials:q})]})}function dy({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,r)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var fy={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},by={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},hy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},yy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function xy({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let l=i=>{t(i),o(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||a.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxs(motion.button,{onClick:()=>l(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function vy({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=useState(false),[c,l]=useState(null),i=useRef(null);if(useEffect(()=>{let m=g=>{i.current&&!i.current.contains(g.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(r||a||n))return null;let u=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(m=>m.handler),p=async(m,g)=>{if(g){l(m);try{await g();}catch(x){console.error(`Export ${m} failed:`,x);}finally{l(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:u.map((m,g)=>jsxs(motion.button,{onClick:()=>p(m.id,m.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:g<u.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function wy({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function gc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:c,onExportExcel:l,translations:i,toolbarRightContent:d,toolbarEndContent:u}){let p=a==="dark"?fy:by,m={...n==="es"?hy:yy,...i},g=o||c||l;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxs(Fragment,{children:[d,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(vy,{theme:p,t:m,onExportCSV:o,onExportJSON:c,onExportExcel:l}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),u,t&&(s?jsx(xy,{columns:e,onSelect:t,theme:p,t:m,createTaskLabel:r}):jsx(wy,{onClick:()=>t(),label:r||m.newTask}))]})})}function bc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(""),i=useCallback(()=>{let p=c.trim();p&&(e(p),l(""),o(false));},[c,e]),d=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(l(""),o(false));},[i]),u=useCallback(()=>{setTimeout(()=>{c.trim()||o(false);},150);},[c]);return s?jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:c,onChange:p=>l(p.target.value),onKeyDown:d,onBlur:u,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{l(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:f("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Bs({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:c="up"}){let[l,i]=useState(""),[d,u]=useState(void 0),[p,m]=useState(null),[g,x]=useState(null),[y,b]=useState(false),[h,v]=useState(false),[w,C]=useState(false),[E,L]=useState(s||new Date),k=useRef(null),S=n==="es",P=c==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{k.current?.focus();},[]);let N=useCallback(()=>{b(false),v(false),C(false);},[]),K=useCallback(()=>{i(""),u(void 0),m(null),x(null),N(),t();},[t,N]),H=useCallback(()=>{let q=l.trim();if(!q)return;let j=r.find(B=>B.id===p),U=g||s;e({name:q,priority:d,assignee:j||void 0,assigneeId:p,startDate:U,endDate:U}),i(""),u(void 0),m(null),x(null),N(),k.current?.focus();},[l,d,p,g,s,r,e,N]),Q=useCallback(q=>{q.key==="Enter"&&l.trim()&&(q.preventDefault(),H()),q.key==="Escape"&&K();},[H,K,l]),I=g||s||new Date;return jsxs("div",{className:f("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:k,type:"text",value:l,onChange:q=>i(q.target.value),placeholder:S?"Nombre de la tarea...":"Task name...",className:f("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:Q})}),jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),b(!y),v(false),C(false);},type:"button",className:f("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:S?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:S?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:S?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:S?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:S?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{u(q.id),b(false);},type:"button",className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===q.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),C(!w),b(false),v(false),L(g||s||new Date);},type:"button",className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",g?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),I.toLocaleDateString(S?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:f("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,j=new Date(q);j.setDate(q.getDate()+1);let U=new Date(q);U.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let B=new Date(q);B.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let we=new Date(q);we.setDate(q.getDate()+14);let Ge=new Date(q);Ge.setDate(q.getDate()+28);let Pe=S?"es-ES":"en-US";return [{label:S?"Hoy":"Today",date:q,display:q.toLocaleDateString(Pe,{weekday:"short"}).slice(0,3)+"."},{label:S?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(Pe,{weekday:"short"}).slice(0,3)+"."},{label:S?"Este fin de semana":"This weekend",date:U,display:S?"s\xE1b.":"sat."},{label:S?"Pr\xF3xima semana":"Next week",date:B,display:S?"lun.":"mon."},{label:S?"2 semanas":"2 weeks",date:we,display:we.toLocaleDateString(Pe,{day:"numeric",month:"short"})},{label:S?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(Pe,{day:"numeric",month:"short"})}].map((ve,he)=>jsxs("button",{type:"button",className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(ve.date),C(false);},children:[jsx("span",{children:ve.label}),jsx("span",{className:f("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:ve.display})]},he))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:f("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:E.toLocaleDateString(S?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>L(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:S?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>L(new Date(E.getFullYear(),E.getMonth()-1)),className:f("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>L(new Date(E.getFullYear(),E.getMonth()+1)),className:f("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(S?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=E.getFullYear(),j=E.getMonth(),U=new Date(q,j,1).getDay(),B=new Date(q,j+1,0).getDate(),we=new Date(q,j,0).getDate(),Ge=new Date().toDateString(),Pe=[];for(let ve=U-1;ve>=0;ve--)Pe.push({dayNum:we-ve,isCurrent:false,date:new Date(q,j-1,we-ve)});for(let ve=1;ve<=B;ve++)Pe.push({dayNum:ve,isCurrent:true,date:new Date(q,j,ve)});let be=42-Pe.length;for(let ve=1;ve<=be;ve++)Pe.push({dayNum:ve,isCurrent:false,date:new Date(q,j+1,ve)});return Pe.map((ve,he)=>{let Oe=ve.date.toDateString()===Ge,Se=(g||s)?.toDateString()===ve.date.toDateString();return jsx("button",{type:"button",className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ve.isCurrent&&(a?"text-white/20":"text-gray-300"),ve.isCurrent&&(a?"text-white":"text-gray-900"),Oe&&"ring-1 ring-[#007FFF]",Se&&"bg-[#007FFF] text-white",!Se&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ve.date),C(false);},children:ve.dayNum},he)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),v(!h),b(false),C(false);},type:"button",className:f("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(q=>q.id===p)?.color||"#007FFF"},children:r.find(q=>q.id===p)?.initials||r.find(q=>q.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),v(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!p&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:a?"text-white/40":"text-gray-500",children:S?"Sin asignar":"Unassigned"})]}),r.map(q=>jsxs("button",{type:"button",onClick:()=>{m(q.id),v(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",p===q.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:a?"text-white":"text-gray-900",children:q.name})]},q.id)),r.length===0&&jsx("div",{className:f("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:S?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:H,disabled:!l.trim(),type:"button",className:f("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",l.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:S?"Guardar":"Save"})]})]})}function wc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:c="es"}){let[l,i]=useState(false),d=useRef(null),u=useRef(null),[p,m]=useState({}),[g,x]=useState(false),y=o==="dark",h={buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!l||!d.current)return;let w=90,C=()=>{let E=d.current.getBoundingClientRect(),k=window.innerHeight-E.bottom<w+8;x(k),m({position:"fixed",...k?{bottom:window.innerHeight-E.top+4}:{top:E.bottom+4},left:E.left,width:E.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[l]),useEffect(()=>{if(!l)return;let w=C=>{let E=C.target;u.current&&!u.current.contains(E)&&d.current&&!d.current.contains(E)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]);let v=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:d,className:f("asakaa-add-card",a),children:[jsxs("button",{onClick:()=>i(!l),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:u,initial:{opacity:0,y:g?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:g?4:-4,scale:.97},transition:{duration:.12},style:p,className:f("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Bs,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:y,locale:c,dropdownDirection:"up"})})}),document.body)]})}var Os=class extends BaseViewAdapter{constructor(r={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=createRoot(r),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${r}`)}}render(){if(!this.root||!this.data)return;let r={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Zn,{board:r,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Gp(e={}){return new Os(e)}var Xo=class extends Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function kc(e,t){let r=a=>jsx(Xo,{...t,children:jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Tc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:c,onOpenAIUsage:l,shortcut:i="k",className:d=""}){let[u,p]=useState(false),[m,g]=useState(""),[x,y]=useState("home"),[b,h]=useState(""),[v,w]=useState("");useEffect(()=>{let k=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),p(P=>!P)),S.key==="Escape"&&(p(false),y("home"),g(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{u||(y("home"),g(""),h(""),w(""));},[u]);let C=useCallback(()=>{p(false);},[]),E=useCallback(k=>{let[S,P]=k.split(":");switch(S){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(r?.(P),C()):y("navigate");break;case "search":a?.(m),C();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),C());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),C());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":l?.(),C();break;case "back":y("home");break;}},[m,v,t,r,a,n,s,o,c,l,C]),L=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),C());},[b,m,t,C]);return u?jsx(nr,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:g,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&L();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:E,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(S=>jsx("span",{className:"command-palette-item-label",children:S},S))})]},k.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let S=e.columns.find(P=>P.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:E,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function _p(e,t,r,a,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:gr,className:f("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:g.length>0?jsx("div",{className:"space-y-4",children:[...g].sort((T,H)=>{let ue=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,q=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return ue.getTime()-q.getTime()}).map(T=>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:T.user?.color||"#8B5CF6"},children:T.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:f("text-sm font-medium",I?"text-white":"text-gray-900"),children:T.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:f("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:wa(T.createdAt)})]}),jsx("div",{className:f("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsx(pp,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(H=>{let ue=H.type.startsWith("image/");return jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:f("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ue?jsx(Image,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:f("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:f("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:H.name})]},H.id)})})]})]},T.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:f("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:f("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:f("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsx(up,{value:et,onChange:Je,onSubmit:ga,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:Bt,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:zt,onFilesSelect:tt,onRemoveFile:_e})})]})]})]})})}function mc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{dragStore.setState(a);},[]);return [e,r]}function Zn({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:c,isLoading:l,error:i,children:d,availableTags:m=[],onCreateTag:u,attachmentsByCard:p,onUploadAttachments:g,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:E,timeTrackingSummary:F,timeEntries:k,timerState:S,onLogTime:P,onUpdateEstimate:N,onUpdateSoldEffort:K,onStartTimer:U,onStopTimer:ae,onDiscardTimer:I,blurFinancials:_=false,sidePanel:j,renderColumnMetrics:W,suppressDetailModal:B=false}){let[ve,je]=mc(),[Pe,me]=useState(null),[xe,he]=useState(false),We=useRef(null),Se=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Re=n?.theme||"dark",Ae=Re==="dark"||Re==="neutral",Ye=Ae?"dark":"",se=useCallback((L,Q)=>{t.onCardUpdate?.(L,Q);},[t]),Xe=useCallback((L,Q)=>{t.onColumnUpdate?.(L,{title:Q});},[t]),Be=useCallback(L=>{t.onColumnDelete?.(L);},[t]),$e=["todo","in-progress","completed"],mt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Nt=useMemo(()=>{let L=new Map;return e.columns.forEach(Q=>{let R=Q.cardIds.map(J=>e.cards.find(O=>O.id===J)).filter(J=>J!==void 0).sort((J,O)=>J.position-O.position);L.set(Q.id,R);}),L},[e.cards,e.columns]);useEffect(()=>{let L=We.current;if(!L)return;let Q=Y=>{let Te=Y.target,ge=Y.button===1,Ze=Te===L||Te.classList.contains("asakaa-column")&&!Te.closest(".asakaa-card");(ge||Y.button===0&&Ze&&!ve.isDragging)&&(Y.preventDefault(),he(true),Se.current={x:Y.clientX,y:Y.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},R=Y=>{if(!xe)return;let Te=Y.clientX-Se.current.x,ge=Y.clientY-Se.current.y;L.scrollLeft=Se.current.scrollLeft-Te,L.scrollTop=Se.current.scrollTop-ge;},J=()=>{xe&&(he(false),L.style.cursor="",L.style.userSelect="");},O=()=>{xe&&(he(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",Q),document.addEventListener("mousemove",R),document.addEventListener("mouseup",J),L.addEventListener("mouseleave",O),()=>{L.removeEventListener("mousedown",Q),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",J),L.removeEventListener("mouseleave",O);}},[xe,ve.isDragging]);let ze=useMemo(()=>e.cards.map(L=>({id:L.id,name:L.title,startDate:L.startDate?new Date(L.startDate):void 0,endDate:L.endDate?new Date(L.endDate):void 0,progress:L.progress||0,status:L.columnId,priority:L.priority?.toLowerCase(),dependencies:Array.isArray(L.dependencies)?L.dependencies.map(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),Fe=useCallback(L=>{let{active:Q}=L,R=e.cards.find(J=>J.id===Q.id);R&&je({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,je]),nt=useCallback(L=>{let{active:Q,over:R}=L;if(!R||!e.cards.find(Y=>Y.id===Q.id))return;let O=null;R.data.current?.type==="column"?O=R.id:R.data.current?.type==="card"&&(O=e.cards.find(Te=>Te.id===R.id)?.columnId||null),O&&O!==ve.targetColumnId&&je({...ve,targetColumnId:O});},[e.cards,ve,je]),It=useCallback(async L=>{let{active:Q,over:R}=L;if(je({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let J=e.cards.find(ge=>ge.id===Q.id);if(!J)return;let O,Y;if(R.data.current?.type==="column"){O=R.id;let ge=Nt.get(O)||[];Y=Yl(ge,0);}else {let ge=e.cards.find(Je=>Je.id===R.id);if(!ge)return;O=ge.columnId;let Ze=Nt.get(O)||[],et=Ze.findIndex(Je=>Je.id===R.id);Y=Yl(Ze,et);}let Te=e.columns.find(ge=>ge.id===O);if(Te&&Te.wipLimit&&Te.wipLimitType==="hard"){let ge=Nt.get(O)||[];if(J.columnId!==O&&ge.length>=Te.wipLimit){t.onWipLimitExceeded?.(Te,J);return}}(J.columnId!==O||J.position!==Y)&&await t.onCardMove?.(J.id,O,Y);},[e.cards,e.columns,Nt,t,je]),Ie=useCallback(L=>{B||me(L),r?.(L),w?.(L.id);},[r,w,B]),ot=useCallback(L=>{t.onCardUpdate?.(L.id,L),me(L);},[t]);return l?jsx("div",{className:f("asakaa-board",Ye,o),style:c,children:jsx(uy,{columnCount:3})}):i?jsx("div",{className:f("asakaa-board",Ye,o),style:c,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Uu,{themeName:Re,children:[jsxs("div",{className:f("flex h-full overflow-hidden",j?"flex-row":""),children:[jsxs(DndContext,{sensors:mt,collisionDetection:closestCorners,onDragStart:Fe,onDragOver:nt,onDragEnd:It,children:[jsxs("div",{ref:We,className:f("asakaa-board",j?"flex-1":"",Ye,o),style:{...c,cursor:xe?"grabbing":void 0},"data-theme":Re,children:[e.columns.sort((L,Q)=>L.position-Q.position).map(L=>{let Q=Nt.get(L.id)||[],R=!$e.includes(L.id),J=a?.renderColumnFooter?.(L);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(_o,{column:L,cards:Q,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:W?(O,Y)=>W(O,Y):void 0,onCardClick:Ie,onCardUpdate:se,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?Be:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),J]},L.id)}),d]}),jsx(DragOverlay,{children:ve.draggedCardId?jsx(In,{card:e.cards.find(L=>L.id===ve.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),j]}),!B&&jsx(No,{task:Pe,isOpen:!!Pe,onClose:()=>me(null),onCardUpdate:ot,theme:Ae?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:u,attachments:Pe?p?.get(Pe.id)||[]:[],onUploadAttachments:g,onDeleteAttachment:x,availableTasks:ze,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:C,enableTimeTracking:E,timeTrackingSummary:F,timeEntries:k,isTimerRunning:S?.isRunning,timerElapsedSeconds:S?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:N,onSoldEffortUpdate:K,onTimerStart:U,onTimerStop:ae,onTimerDiscard:I,blurFinancials:_})]})}function uy({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,r)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var by={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},hy={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},yy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},xy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function vy({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let l=i=>{t(i),o(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||a.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxs(motion.button,{onClick:()=>l(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function wy({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=useState(false),[c,l]=useState(null),i=useRef(null);if(useEffect(()=>{let p=g=>{i.current&&!i.current.contains(g.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),!(r||a||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),u=async(p,g)=>{if(g){l(p);try{await g();}catch(x){console.error(`Export ${p} failed:`,x);}finally{l(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:m.map((p,g)=>jsxs(motion.button,{onClick:()=>u(p.id,p.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:g<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===p.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function ky({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function fc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:c,onExportExcel:l,translations:i,toolbarRightContent:d,toolbarEndContent:m}){let u=a==="dark"?by:hy,p={...n==="es"?yy:xy,...i},g=o||c||l;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxs(Fragment,{children:[d,jsx("div",{className:"w-px h-5",style:{backgroundColor:u.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(wy,{theme:u,t:p,onExportCSV:o,onExportJSON:c,onExportExcel:l}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),m,t&&(s?jsx(vy,{columns:e,onSelect:t,theme:u,t:p,createTaskLabel:r}):jsx(ky,{onClick:()=>t(),label:r||p.newTask}))]})})}function hc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(""),i=useCallback(()=>{let u=c.trim();u&&(e(u),l(""),o(false));},[c,e]),d=useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(l(""),o(false));},[i]),m=useCallback(()=>{setTimeout(()=>{c.trim()||o(false);},150);},[c]);return s?jsx("div",{className:f("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:c,onChange:u=>l(u.target.value),onKeyDown:d,onBlur:m,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{l(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:f("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Bs({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:c="up"}){let[l,i]=useState(""),[d,m]=useState(void 0),[u,p]=useState(null),[g,x]=useState(null),[y,b]=useState(false),[h,v]=useState(false),[w,C]=useState(false),[E,F]=useState(s||new Date),k=useRef(null),S=n==="es",P=c==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{k.current?.focus();},[]);let N=useCallback(()=>{b(false),v(false),C(false);},[]),K=useCallback(()=>{i(""),m(void 0),p(null),x(null),N(),t();},[t,N]),U=useCallback(()=>{let _=l.trim();if(!_)return;let j=r.find(B=>B.id===u),W=g||s;e({name:_,priority:d,assignee:j||void 0,assigneeId:u,startDate:W,endDate:W}),i(""),m(void 0),p(null),x(null),N(),k.current?.focus();},[l,d,u,g,s,r,e,N]),ae=useCallback(_=>{_.key==="Enter"&&l.trim()&&(_.preventDefault(),U()),_.key==="Escape"&&K();},[U,K,l]),I=g||s||new Date;return jsxs("div",{className:f("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:k,type:"text",value:l,onChange:_=>i(_.target.value),placeholder:S?"Nombre de la tarea...":"Task name...",className:f("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ae})}),jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:_=>{_.stopPropagation(),b(!y),v(false),C(false);},type:"button",className:f("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[{id:"urgent",label:S?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:S?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:S?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:S?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:S?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(_=>jsxs("button",{onClick:()=>{m(_.id),b(false);},type:"button",className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===_.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:f("w-2 h-2 rounded-full",_.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:_.label})]},_.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:_=>{_.stopPropagation(),C(!w),b(false),v(false),F(g||s||new Date);},type:"button",className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",g?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),I.toLocaleDateString(S?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[jsx("div",{className:f("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let _=new Date,j=new Date(_);j.setDate(_.getDate()+1);let W=new Date(_);W.setDate(_.getDate()+((6-_.getDay()+7)%7||7));let B=new Date(_);B.setDate(_.getDate()+((1-_.getDay()+7)%7||7));let ve=new Date(_);ve.setDate(_.getDate()+14);let je=new Date(_);je.setDate(_.getDate()+28);let Pe=S?"es-ES":"en-US";return [{label:S?"Hoy":"Today",date:_,display:_.toLocaleDateString(Pe,{weekday:"short"}).slice(0,3)+"."},{label:S?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(Pe,{weekday:"short"}).slice(0,3)+"."},{label:S?"Este fin de semana":"This weekend",date:W,display:S?"s\xE1b.":"sat."},{label:S?"Pr\xF3xima semana":"Next week",date:B,display:S?"lun.":"mon."},{label:S?"2 semanas":"2 weeks",date:ve,display:ve.toLocaleDateString(Pe,{day:"numeric",month:"short"})},{label:S?"4 semanas":"4 weeks",date:je,display:je.toLocaleDateString(Pe,{day:"numeric",month:"short"})}].map((xe,he)=>jsxs("button",{type:"button",className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(xe.date),C(false);},children:[jsx("span",{children:xe.label}),jsx("span",{className:f("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:xe.display})]},he))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:f("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:E.toLocaleDateString(S?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>F(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:S?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>F(new Date(E.getFullYear(),E.getMonth()-1)),className:f("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>F(new Date(E.getFullYear(),E.getMonth()+1)),className:f("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(S?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(_=>jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:_},_))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=E.getFullYear(),j=E.getMonth(),W=new Date(_,j,1).getDay(),B=new Date(_,j+1,0).getDate(),ve=new Date(_,j,0).getDate(),je=new Date().toDateString(),Pe=[];for(let xe=W-1;xe>=0;xe--)Pe.push({dayNum:ve-xe,isCurrent:false,date:new Date(_,j-1,ve-xe)});for(let xe=1;xe<=B;xe++)Pe.push({dayNum:xe,isCurrent:true,date:new Date(_,j,xe)});let me=42-Pe.length;for(let xe=1;xe<=me;xe++)Pe.push({dayNum:xe,isCurrent:false,date:new Date(_,j+1,xe)});return Pe.map((xe,he)=>{let We=xe.date.toDateString()===je,Se=(g||s)?.toDateString()===xe.date.toDateString();return jsx("button",{type:"button",className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!xe.isCurrent&&(a?"text-white/20":"text-gray-300"),xe.isCurrent&&(a?"text-white":"text-gray-900"),We&&"ring-1 ring-[#007FFF]",Se&&"bg-[#007FFF] text-white",!Se&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(xe.date),C(false);},children:xe.dayNum},he)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:_=>{_.stopPropagation(),v(!h),b(false),C(false);},type:"button",className:f("p-1 rounded transition-colors",u?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:u?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(_=>_.id===u)?.color||"#007FFF"},children:r.find(_=>_.id===u)?.initials||r.find(_=>_.id===u)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:f("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{p(null),v(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!u&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:a?"text-white/40":"text-gray-500",children:S?"Sin asignar":"Unassigned"})]}),r.map(_=>jsxs("button",{type:"button",onClick:()=>{p(_.id),v(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===_.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:_.color||"#007FFF"},children:_.initials||_.name?.slice(0,2).toUpperCase()}),jsx("span",{className:a?"text-white":"text-gray-900",children:_.name})]},_.id)),r.length===0&&jsx("div",{className:f("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:S?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:U,disabled:!l.trim(),type:"button",className:f("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",l.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:S?"Guardar":"Save"})]})]})}function kc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:c="es"}){let[l,i]=useState(false),d=useRef(null),m=useRef(null),[u,p]=useState({}),[g,x]=useState(false),y=o==="dark",h={buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!l||!d.current)return;let w=90,C=()=>{let E=d.current.getBoundingClientRect(),k=window.innerHeight-E.bottom<w+8;x(k),p({position:"fixed",...k?{bottom:window.innerHeight-E.top+4}:{top:E.bottom+4},left:E.left,width:E.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[l]),useEffect(()=>{if(!l)return;let w=C=>{let E=C.target;m.current&&!m.current.contains(E)&&d.current&&!d.current.contains(E)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]);let v=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:d,className:f("asakaa-add-card",a),children:[jsxs("button",{onClick:()=>i(!l),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:m,initial:{opacity:0,y:g?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:g?4:-4,scale:.97},transition:{duration:.12},style:u,className:f("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Bs,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:y,locale:c,dropdownDirection:"up"})})}),document.body)]})}var Os=class extends BaseViewAdapter{constructor(r={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=createRoot(r),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${r}`)}}render(){if(!this.root||!this.data)return;let r={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Zn,{board:r,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Vp(e={}){return new Os(e)}var Xo=class extends Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function Cc(e,t){let r=a=>jsx(Xo,{...t,children:jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Nc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:c,onOpenAIUsage:l,shortcut:i="k",className:d=""}){let[m,u]=useState(false),[p,g]=useState(""),[x,y]=useState("home"),[b,h]=useState(""),[v,w]=useState("");useEffect(()=>{let k=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),u(P=>!P)),S.key==="Escape"&&(u(false),y("home"),g(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{m||(y("home"),g(""),h(""),w(""));},[m]);let C=useCallback(()=>{u(false);},[]),E=useCallback(k=>{let[S,P]=k.split(":");switch(S){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(r?.(P),C()):y("navigate");break;case "search":a?.(p),C();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),C());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),C());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":l?.(),C();break;case "back":y("home");break;}},[p,v,t,r,a,n,s,o,c,l,C]),F=useCallback(()=>{b&&p.trim()&&(t?.(b,p.trim()),C());},[b,p,t,C]);return m?jsx(ar,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:p,onValueChange:g,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&F();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:E,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:E,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(S=>jsx("span",{className:"command-palette-item-label",children:S},S))})]},k.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let S=e.columns.find(P=>P.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:E,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:E,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Kp(e,t,r,a,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -30,7 +30,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,c.onclick=
|
|
33
|
+
`,c.onclick=m=>m.stopPropagation();let l=document.createElement("div");l.className="attachment-lightbox-hint",l.textContent="Click anywhere or press ESC to close",l.style.cssText=`
|
|
34
34
|
position: absolute !important;
|
|
35
35
|
bottom: 24px !important;
|
|
36
36
|
left: 50% !important;
|
|
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let i=()=>{o.remove(),document.removeEventListener("keydown",d);},d=
|
|
41
|
+
`;let i=()=>{o.remove(),document.removeEventListener("keydown",d);},d=m=>{if(m.key==="Escape")i();else if(m.key==="ArrowLeft"&&r.length>1){let u=a>0?a-1:r.length-1;i(),n(u);}else if(m.key==="ArrowRight"&&r.length>1){let u=a<r.length-1?a+1:0;i(),n(u);}};if(o.onclick=i,document.addEventListener("keydown",d),r.length>1){let m=document.createElement("div");m.className="attachment-lightbox-dots",m.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,7 +48,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,
|
|
51
|
+
`,m.onclick=g=>g.stopPropagation(),r.forEach((g,x)=>{let y=document.createElement("button");y.className=`attachment-lightbox-dot ${x===a?"active":""}`,y.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
@@ -56,7 +56,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,y.onclick=b=>{b.stopPropagation(),i(),n(x);},
|
|
59
|
+
`,y.onclick=b=>{b.stopPropagation(),i(),n(x);},m.appendChild(y);});let u=document.createElement("button");u.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",u.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',u.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,
|
|
72
|
+
`,u.onmouseenter=()=>{u.style.opacity="1";},u.onmouseleave=()=>{u.style.opacity="0.5";},u.onclick=g=>{g.stopPropagation();let x=a>0?a-1:r.length-1;i(),n(x);};let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=g=>{g.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(u),o.appendChild(p),o.appendChild(m);}o.appendChild(c),o.appendChild(l),document.body.appendChild(o),setTimeout(()=>{l.style.transition="opacity 0.5s ease",l.style.opacity="0";},2e3);}function By(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function $y(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Dc(e){return e.startsWith("image/")}function Jo({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,c]=useState(false),[l,i]=useState(false),[d,u]=useState(null),p=useRef(null),m=useRef(e);m.current=e;let g=useCallback((k,S)=>{S.preventDefault(),S.stopPropagation();let P=m.current.filter(H=>Dc(H.type)),N=P.findIndex(H=>H.id===k.id),K=H=>{let Q=m.current.filter(q=>Dc(q.type)),I=Q[H];I&&_p(I.url,I.name,Q,H,K);};_p(k.url,k.name,P,N,K);},[]),x=useCallback(k=>{let S=[],P=[];return e.length+k.length>s?(P.push(`Maximum ${s} files allowed`),{valid:S,errors:P}):(k.forEach(N=>{if(N.size/1048576>a){P.push(`${N.name} is too large (max ${a}MB)`);return}if(n&&!n.some(H=>N.type.match(H))){P.push(`${N.name} has invalid file type`);return}S.push(N);}),{valid:S,errors:P})},[e.length,s,a,n]),y=useCallback(async k=>{let{valid:S,errors:P}=x(k);if(P.length>0){u(P.join(", ")),setTimeout(()=>u(null),5e3);return}if(S.length!==0){i(true),u(null);try{await t?.(S);}catch(N){u(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>u(null),5e3);}finally{i(false);}}},[x,t]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),v=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let S=Array.from(k.dataTransfer.files);y(S);},[y]),C=useCallback(k=>{let S=k.target.files?Array.from(k.target.files):[];y(S),p.current&&(p.current.value="");},[y]),E=useCallback(()=>{p.current?.click();},[]),L=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&r?.(k);},[r]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:E,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:l?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Dc(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>g(k,S),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:$y(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:By(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>L(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function jy({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," cards"]},a))]})}function Ec({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((c,l)=>c+l.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(jy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,c)=>o+c.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,c)=>o+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,c)=>o+(c.planned||0),0)})]})]})]})}function ex({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," tasks"]},a))]})}function Mc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=s>0?(s-o)/s*100:0,i=o<=c;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ex,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:l>=50?"#10B981":"#F59E0B"},children:[l.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var cx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function dx({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,c=e+o*Math.cos(-r*(Math.PI/180)),l=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function tm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsx("strong",{children:r.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Pc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((l,i)=>l+i.value,0),o=e.map(l=>({...l,totalValue:s,color:l.color||cx[l.name]||em[e.indexOf(l)%em.length]})),c=o.map(l=>l.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?dx:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(tm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,i)=>{let d=i.payload,u=s>0?(d.value/s*100).toFixed(0):"0";return `${l} (${d.value} - ${u}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(tm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((l,i)=>i.value>l.value?i:l).name})]})]})]})}var zi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,c]=useState(false),[l,i]=useState(false),[d,u]=useState(false),[p,m]=useState(false);if(e.length===0)return null;let g=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(g,{priority:w}),c(false);},y=w=>{a.onBulkMove?.(g,w),i(false),r();},b=w=>{a.onBulkUpdate?.(g,{assignedUserIds:w}),u(false);},h=w=>{let C=new Set;e.forEach(L=>{L.labels?.forEach(k=>C.add(k));});let E=Array.from(new Set([...C,...w]));a.onBulkUpdate?.(g,{labels:E}),m(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(g),r());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsx("span",{className:f("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!l),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),l&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!d),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});zi.displayName="BulkOperationsToolbar";function fx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,c,l,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(m=>{let g=r?.find(x=>x.id===m);o=`assignee-${m}`,c=g?.name||`User ${m}`,l=g?.color,i=g?.avatar,a.has(o)||a.set(o,{id:o,title:c,groupValue:m,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",c="Unassigned",l="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=p.title,l=p.color,a.has(o)||a.set(o,{id:o,title:c,groupValue:s,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,c=m,l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:m,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);}):(o="label-none",c="No Labels",l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Fc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:u,attachmentsByCard:p,renderColumnMetrics:m}){let[g,x]=useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),y=useMemo(()=>s||fx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:u,attachmentsByCard:p,renderColumnMetrics:m},h=useCallback(v=>{x(w=>{let C=new Set(w);return C.has(v)?C.delete(v):C.add(v),C});},[]);return !s&&(t.groupBy==="none"||y.length===0)?jsx(Zn,{board:e,className:n,...b}):jsxs("div",{className:f("asakaa-swimlane-view",n),children:[y.map(v=>{let w=g.has(v.id),C=e.cards.filter(L=>v.cardIds.includes(L.id)),E={...e,cards:C};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>h(v.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&h(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Zn,{board:E,...b})})]},v.id)}),y.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Lc=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Ac({value:e,onChange:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null),c=Lc.find(i=>i.value===e)||Lc[0];useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);};return jsxs("div",{className:f("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:f("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Lc.map(i=>jsxs("button",{onClick:()=>l(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Us=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function yx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return s&&o&&c&&l}function sm(e={}){let{shortcuts:t=Us,enabled:r=true,preventDefault:a=true}=e,n=useRef(t),s=useRef(r);useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=useCallback(l=>{n.current=[...n.current,l];},[]),c=useCallback(l=>{n.current=n.current.filter(i=>i.action!==l);},[]);return useEffect(()=>{function l(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let u of n.current)if(yx(i,u)){a&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:u.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:o,unregisterShortcut:c,isEnabled:r}}function vx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function wx(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function kx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=wx(e),a=t?vx(t):"";return r?`${r} + ${a}`:a}function Cx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Ic({shortcuts:e=Us,isOpen:t,onClose:r,className:a}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let o=Cx(e);return jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([c,l])=>l.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),c]}),jsx("div",{className:"space-y-3",children:l.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:kx(i)})]},i.action))})]},c))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Rc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=g=>{g.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(m),o.appendChild(u),o.appendChild(p);}o.appendChild(c),o.appendChild(l),document.body.appendChild(o),setTimeout(()=>{l.style.transition="opacity 0.5s ease",l.style.opacity="0";},2e3);}function $y(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function Oy(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 Sc(e){return e.startsWith("image/")}function Jo({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,c]=useState(false),[l,i]=useState(false),[d,m]=useState(null),u=useRef(null),p=useRef(e);p.current=e;let g=useCallback((k,S)=>{S.preventDefault(),S.stopPropagation();let P=p.current.filter(U=>Sc(U.type)),N=P.findIndex(U=>U.id===k.id),K=U=>{let ae=p.current.filter(_=>Sc(_.type)),I=ae[U];I&&Kp(I.url,I.name,ae,U,K);};Kp(k.url,k.name,P,N,K);},[]),x=useCallback(k=>{let S=[],P=[];return e.length+k.length>s?(P.push(`Maximum ${s} files allowed`),{valid:S,errors:P}):(k.forEach(N=>{if(N.size/1048576>a){P.push(`${N.name} is too large (max ${a}MB)`);return}if(n&&!n.some(U=>N.type.match(U))){P.push(`${N.name} has invalid file type`);return}S.push(N);}),{valid:S,errors:P})},[e.length,s,a,n]),y=useCallback(async k=>{let{valid:S,errors:P}=x(k);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(S.length!==0){i(true),m(null);try{await t?.(S);}catch(N){m(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),v=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let S=Array.from(k.dataTransfer.files);y(S);},[y]),C=useCallback(k=>{let S=k.target.files?Array.from(k.target.files):[];y(S),u.current&&(u.current.value="");},[y]),E=useCallback(()=>{u.current?.click();},[]),F=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&r?.(k);},[r]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:E,children:[jsx("input",{ref:u,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:l?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Sc(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>g(k,S),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Oy(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:$y(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>F(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function _y({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," cards"]},a))]})}function Mc({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((c,l)=>c+l.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(_y,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,c)=>o+c.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,c)=>o+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,c)=>o+(c.planned||0),0)})]})]})]})}function tx({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," tasks"]},a))]})}function Pc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=s>0?(s-o)/s*100:0,i=o<=c;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(tx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:l>=50?"#10B981":"#F59E0B"},children:[l.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var dx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},tm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function ux({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,c=e+o*Math.cos(-r*(Math.PI/180)),l=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function rm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsx("strong",{children:r.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Fc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((l,i)=>l+i.value,0),o=e.map(l=>({...l,totalValue:s,color:l.color||dx[l.name]||tm[e.indexOf(l)%tm.length]})),c=o.map(l=>l.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?ux:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(rm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,i)=>{let d=i.payload,m=s>0?(d.value/s*100).toFixed(0):"0";return `${l} (${d.value} - ${m}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(rm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((l,i)=>i.value>l.value?i:l).name})]})]})]})}var zi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,c]=useState(false),[l,i]=useState(false),[d,m]=useState(false),[u,p]=useState(false);if(e.length===0)return null;let g=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(g,{priority:w}),c(false);},y=w=>{a.onBulkMove?.(g,w),i(false),r();},b=w=>{a.onBulkUpdate?.(g,{assignedUserIds:w}),m(false);},h=w=>{let C=new Set;e.forEach(F=>{F.labels?.forEach(k=>C.add(k));});let E=Array.from(new Set([...C,...w]));a.onBulkUpdate?.(g,{labels:E}),p(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(g),r());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsx("span",{className:f("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!l),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),l&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});zi.displayName="BulkOperationsToolbar";function bx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,c,l,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(p=>{let g=r?.find(x=>x.id===p);o=`assignee-${p}`,c=g?.name||`User ${p}`,l=g?.color,i=g?.avatar,a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",c="Unassigned",l="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=u.title,l=u.color,a.has(o)||a.set(o,{id:o,title:c,groupValue:s,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{o=`label-${p}`,c=p,l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:p,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);}):(o="label-none",c="No Labels",l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Lc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p}){let[g,x]=useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),y=useMemo(()=>s||bx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p},h=useCallback(v=>{x(w=>{let C=new Set(w);return C.has(v)?C.delete(v):C.add(v),C});},[]);return !s&&(t.groupBy==="none"||y.length===0)?jsx(Zn,{board:e,className:n,...b}):jsxs("div",{className:f("asakaa-swimlane-view",n),children:[y.map(v=>{let w=g.has(v.id),C=e.cards.filter(F=>v.cardIds.includes(F.id)),E={...e,cards:C};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>h(v.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&h(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Zn,{board:E,...b})})]},v.id)}),y.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ac=[{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 Ic({value:e,onChange:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null),c=Ac.find(i=>i.value===e)||Ac[0];useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);};return jsxs("div",{className:f("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:f("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Ac.map(i=>jsxs("button",{onClick:()=>l(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Us=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function xx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return s&&o&&c&&l}function im(e={}){let{shortcuts:t=Us,enabled:r=true,preventDefault:a=true}=e,n=useRef(t),s=useRef(r);useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=useCallback(l=>{n.current=[...n.current,l];},[]),c=useCallback(l=>{n.current=n.current.filter(i=>i.action!==l);},[]);return useEffect(()=>{function l(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(xx(i,m)){a&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:o,unregisterShortcut:c,isEnabled:r}}function wx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function kx(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Cx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=kx(e),a=t?wx(t):"";return r?`${r} + ${a}`:a}function Tx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Rc({shortcuts:e=Us,isOpen:t,onClose:r,className:a}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let o=Tx(e);return jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([c,l])=>l.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),c]}),jsx("div",{className:"space-y-3",children:l.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Cx(i)})]},i.action))})]},c))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Bc=[{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 Bc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let u=d.category||"Other";return i[u]||(i[u]=[]),i[u].push(d),i},{});return jsxs("div",{className:f("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:f("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(l).map(([i,d])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:d.map(u=>jsxs("button",{onClick:()=>c(u),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:u.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:u.name}),u.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:u.description})]})]},u.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Oc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=useState("export"),[l,i]=useState("json"),[d,u]=useState(null),p=useRef(null);if(!t)return null;let m=async()=>{let x=n?.current||void 0,y=await Lu(e,l,x);Au(y,l);},g=async x=>{let y=x.target.files?.[0];if(y){try{let b=await Bu(y),h=y.name.endsWith(".json")?"json":"csv",v=Ru(b,h);u(v),v.success&&a&&a(v,b);}catch(b){u({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:f("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:g,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxs("div",{className:f("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:f("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Ex=["URGENT","HIGH","MEDIUM","LOW"],Mx=[{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"}],Px=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Hc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:u=true,compact:p=false,groupBy:m="none",onGroupByChange:g}){let[x,y]=useState(true),b=useCallback(E=>{r({search:E.target.value});},[r]),h=useCallback(E=>{r({dateFilter:E.target.value});},[r]),v=useCallback(E=>{a({by:E.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),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 ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),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)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[u&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:E=>{let L=E.target.value;r({priorities:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Ex.map(E=>jsx("option",{value:E,children:E},E))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let L=E.target.value;r({assignees:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),l.map(E=>jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let L=E.target.value;r({labels:L==="all"?[]:[L]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsx("option",{value:E,children:E},E))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Mx.map(E=>jsx("option",{value:E.value,children:E.label},E.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),g&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:E=>g(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Px.map(E=>jsx("option",{value:E.value,children:E.label},E.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Uc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=useState(false),u=useRef(null);useEffect(()=>{let m=g=>{u.current&&!u.current.contains(g.target)&&d(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),d(false);};return jsxs("div",{className:f("relative",a),ref:u,children:[jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Wc={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},zc={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Gc={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},So={dark:Wc,light:zc,neutral:Gc},Vi="dark";var ji=createContext(void 0),Ux="asakaa-theme";function cm({children:e,defaultTheme:t=Vi,storageKey:r=Ux}){let[a,n]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=So[a];Object.entries(l.colors).forEach(([d,u])=>{u&&c.style.setProperty(`--theme-${Wx(d)}`,u);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([d,u])=>{let p=l.colors[d];p&&c.style.setProperty(u,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:So};return jsx(ji.Provider,{value:o,children:e})}function es(){let e=useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Vc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=es();return e?jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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(So).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),a===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var st={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function dm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return st[e]||st.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",st[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",st[e].bgSecondary),bgGrid:a("--theme-bg-card",st[e].bgGrid),bgWeekend:a("--theme-bg-hover",st[e].bgWeekend),border:a("--theme-border-primary",st[e].border),borderLight:a("--theme-border-subtle",st[e].borderLight),textPrimary:a("--theme-text-primary",st[e].textPrimary),textSecondary:a("--theme-text-secondary",st[e].textSecondary),textTertiary:a("--theme-text-tertiary",st[e].textTertiary),accent:a("--theme-accent-primary",st[e].accent),accentHover:a("--theme-accent-hover",st[e].accentHover),accentLight:a("--theme-accent-primary",st[e].accentLight),taskBarPrimary:a("--theme-accent-primary",st[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",st[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",st[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",st[e].dependency),dependencyHover:a("--theme-border-secondary",st[e].dependencyHover),criticalPath:a("--theme-error",st[e].criticalPath),criticalPathLight:a("--theme-error",st[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",st[e].today):e==="neutral"?a("--theme-text-primary",st[e].today):a("--theme-error",st[e].today),todayLight:e==="light"?a("--theme-accent-primary",st[e].todayLight):e==="neutral"?a("--theme-text-primary",st[e].todayLight):a("--theme-error",st[e].todayLight),milestone:a("--theme-warning",st[e].milestone),milestoneLight:a("--theme-warning",st[e].milestoneLight),statusTodo:a("--theme-text-tertiary",st[e].statusTodo),statusInProgress:a("--theme-accent-primary",st[e].statusInProgress),statusCompleted:a("--theme-success",st[e].statusCompleted),hoverBg:a("--theme-bg-hover",st[e].hoverBg),focusRing:a("--theme-accent-primary",st[e].focusRing),...st[e].dotGrid&&{dotGrid:st[e].dotGrid},...st[e].glassHeader&&{glassHeader:st[e].glassHeader},...st[e].glassToolbar&&{glassToolbar:st[e].glassToolbar},...st[e].forecastHud&&{forecastHud:st[e].forecastHud},...st[e].neonRedGlow&&{neonRedGlow:st[e].neonRedGlow},...st[e].executionBarBg&&{executionBarBg:st[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},um={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},jc={en:_i,es:um};function pm(e){return jc[e]||jc.en}function _c(e,t){let r=pm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var rs=createContext(_i);function _a(){return useContext(rs)}function Gs(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function wm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=useState(false),[i,d]=useState(null),u=useRef(null),p=useRef(null),m=_a(),g=Gs(u,c,"right",176);if(useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;u.current&&!u.current.contains(w)&&p.current&&!p.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:u,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:g.top,left:g.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function gm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=useState(false),[l,i]=useState(null),[d,u]=useState(false),p=useRef(null),m=useRef(null),g=_a(),x=Gs(p,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=g.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=E=>{let L=E.target;p.current&&!p.current.contains(L)&&m.current&&!m.current.contains(L)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let h=[{id:"png",label:g.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:g.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:g.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:g.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,E)=>{if(E){i(C);try{await E();}catch(L){console.error(`Export ${C} failed:`,L);}finally{i(null),c(false);}}},w=()=>{s?.(),u(true),setTimeout(()=>u(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>c(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:g.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((C,E)=>jsxs(motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:E*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:d?g.toolbar.copied:g.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function cv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function dv({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function fm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),c=useRef(null),l=_a(),i=Gs(o,n,"left");useEffect(()=>{if(!n)return;let p=m=>{let g=m.target;o.current&&!o.current.contains(g)&&c.current&&!c.current.contains(g)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(p,m)=>({value:m+1,label:`L${m+1}`}))],u=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.wbsLevel||"Level"}: ${u}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:u})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:d.map((p,m)=>{let g=t===p.value;return jsxs(motion.button,{onClick:()=>{r(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:g?e.accentLight:"transparent",borderBottom:m<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:g?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:g?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:g?600:500},children:p.label}),g&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function bm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),c=useRef(null),l=useRef(null),i=_a(),d=Gs(c,s,"left");useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(g),l._cleanup&&l._cleanup();}},[s]);let u=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||a,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:c,onClick:g=>{g.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:u.map(g=>{let x=t===g.value&&!a,y=()=>g.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):g.icon;return jsxs(motion.button,{onClick:()=>{r(g.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?g.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:g.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},g.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function uv({value:e,onChange:t,theme:r}){let a=_a(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function pv({theme:e,forecast:t}){let r=_a(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,u=t?.costAtCompletion,p=t?.currency||"$",m=u!=null?u>=1e6?`${p}${(u/1e6).toFixed(2)}M`:u>=1e3?`${p}${(u/1e3).toFixed(1)}K`:`${p}${u.toFixed(0)}`:"\u2014",g=t?.budgetVariancePercent,x=g!=null&&g!==0,y=g!=null?g>0?`+${g.toFixed(0)}% ${r.toolbar.budgetOver}`:`${g.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=g!=null&&g>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:g!=null&&g<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace"},children:c})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function mv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:u=true}){let[p,m]=useState(false),g=useRef(null),x=useRef(null),y=_a(),b=Gs(g,p,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let E=L=>{let k=L.target;g.current&&!g.current.contains(k)&&x.current&&!x.current.contains(k)&&m(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,disabled:!u,tooltip:u?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:c,onChange:l}],C=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((E,L)=>{let k=E.icon,S=E.disabled,P=E.tooltip;return jsxs(motion.button,{onClick:()=>!S&&E.onChange?.(!E.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:S?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:S?"not-allowed":"pointer"},whileHover:S?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:L*.03},title:P,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:S?h?"rgba(255,255,255,0.2)":"#D1D5DB":E.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:E.label}),E.active&&!S&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((E,L)=>{let k=i===E.value;return jsxs(motion.button,{onClick:()=>d(E.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+L)*.03},children:[jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:E.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:u,onCreateTask:p,taskFilter:m="all",onTaskFilterChange:g,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:E,projectForecast:L,hideForecastHud:k,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportCSV:K,onExportJSON:H,onExportMSProject:Q,showCriticalPath:I=true,onShowCriticalPathChange:q,showDependencies:j=true,onShowDependenciesChange:U,highlightWeekends:B=true,onHighlightWeekendsChange:we,showBaseline:Ge=false,onShowBaselineChange:Pe,onCopySnapshotLink:be,hasDependencies:ve=true}){let he=_a(),Oe=S||P||N||K||H||Q,Se=!!e.glassToolbar,Fe=[{value:"day",label:he.toolbar.day},{value:"week",label:he.toolbar.week},{value:"month",label:he.toolbar.month}],He=[{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"})}],Be=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let ue=Be?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:E&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Be?"#000000":e.bgSecondary,border:`1px solid ${Be?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>E("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Be?"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:he.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>E("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Be?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:he.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(uv,{value:t,onChange:r,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),v&&jsx(fm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),g&&jsx(bm,{theme:e,value:m,onChange:g,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),jsx(mv,{theme:e,showCriticalPath:I,onShowCriticalPathChange:q,showBaseline:Ge,onShowBaselineChange:Pe,highlightWeekends:B,onHighlightWeekendsChange:we,showDependencies:j,onShowDependenciesChange:U,rowDensity:c,onRowDensityChange:l,hasDependencies:ve}),jsx(gm,{theme:e,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportMSProject:Q,onCopySnapshotLink:be}),d&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Be?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Be?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:u||he.toolbar.createTask})]})]})]}),L&&!k&&jsx(pv,{theme:e,forecast:L})]})}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(dv,{options:Fe,value:t,onChange:ue=>r(ue),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsx(fm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),g&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(bm,{theme:e,value:m,onChange:g,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:u||he.toolbar.createTask})]}),(Oe||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(gm,{theme:e,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportMSProject:Q,onCopySnapshotLink:be}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(cv,{options:He,value:s,onChange:ue=>o(ue),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!a)return;let d=u=>{c.current&&!c.current.contains(u.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(nr,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:d.label}),d.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function os({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[c,l]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let d=200,u=a.length*36+8,p=8,m=window.innerWidth,g=window.innerHeight,x=t,y=r;t+d+p>m&&(x=t-d,x<p&&(x=p)),r+u+p>g&&(y=g-u-p,y<p&&(y=p)),l({x,y});},[e,t,r,a.length]),useEffect(()=>{if(!e)return;let d=p=>{o.current&&!o.current.contains(p.target)&&n();},u=p=>{p.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.map(d=>jsxs("div",{children:[d.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:u=>{d.disabled||(u.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Em({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:u,enableKeyboard:p=true}){let m=useRef(false),g=useCallback(v=>{m.current=v;},[]),x=useCallback(v=>{let w=[],C=E=>{for(let L of E)w.push(L),L.subtasks&&L.subtasks.length>0&&L.isExpanded&&C(L.subtasks);};return C(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let E=y();if(!E){r(C[0].id,false);return}let L=C.findIndex(P=>P.id===E.id);if(L===-1)return;let k=v==="up"?L-1:L+1;if(k<0||k>=C.length)return;let S=C[k];r(S.id,w);},[e,y,x,r]),h=useCallback(v=>{if(!p)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){v.key==="Escape"&&(w.blur(),m.current=false);return}let L=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),S=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(S&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!S.isExpanded||v.key==="ArrowLeft"&&S.isExpanded)&&d(S.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!L){S&&(v.preventDefault(),a(S.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!L){S&&(v.preventDefault(),a(S.id,"above"));return}if(v.key==="Enter"&&L){S&&(v.preventDefault(),u(S.id));return}if(v.key==="F2"){S&&(v.preventDefault(),i(S.id));return}if(v.key==="Delete"||v.key==="Backspace"&&L){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&L&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[p,t,y,b,a,n,s,o,c,l,i,d,u]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:g}}function Pm(){let[e,t]=useState(new Set),[r,a]=useState(null),n=useCallback(u=>{t(new Set([u])),a(u);},[]),s=useCallback(u=>{t(p=>{let m=new Set(p);return m.has(u)?m.delete(u):m.add(u),m}),a(u);},[]),o=useCallback((u,p)=>{if(!r){n(u);return}let m=p.indexOf(r),g=p.indexOf(u);if(m===-1||g===-1){n(u);return}let x=Math.min(m,g),y=Math.max(m,g),b=p.slice(x,y+1);t(new Set(b)),a(u);},[r,n]),c=useCallback((u,p,m,g)=>{g?o(u,p):m?s(u):n(u);},[n,s,o]),l=useCallback((u,p)=>{p?t(m=>{let g=new Set(m);return g.add(u),g}):n(u);},[n]),i=useCallback(()=>{t(new Set),a(null);},[]),d=useCallback(u=>e.has(u),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:s,selectTaskRange:o,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:i,isTaskSelected:d}}function Jc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Jc(t.subtasks):t.subtasks}))}function Mo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ss(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ss(r.subtasks,t);if(a)return a}}return null}function Xc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Xc(r.subtasks,t);if(a)return a}return null}function Qc(e,t){if(t.length===0)return e;let r=Mo(e),a=t[0],n=r.findIndex(p=>p.id===a);if(n<=0)return e;let s=r[n-1],o=(p,m)=>{let g=[];return {tasks:p.filter(y=>{if(m.has(y.id))return g.push(y),false;if(y.subtasks){let b=o(y.subtasks,m);y.subtasks=b.tasks,g.push(...b.removed);}return true}),removed:g}},c=(p,m,g)=>p.map(x=>x.id===m?{...x,subtasks:[...x.subtasks||[],...g],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,m,g)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),u=c(i,s.id,d);return Jc(u)}function Zc(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Xc(r,a);if(!n)continue;let s=Xc(r,n.id),o=(i,d,u)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===d&&m.subtasks){let g=m.subtasks.findIndex(x=>x.id===u);if(g!==-1){let[x]=m.subtasks.splice(g,1);return x}}if(m.subtasks){let g=o(m.subtasks,d,u);if(g)return g}}return null},c=(i,d,u)=>{let p=i.findIndex(m=>m.id===d);if(p!==-1)return i.splice(p+1,0,u),i;for(let m of i)m.subtasks&&c(m.subtasks,d,u);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Jc(r)}function ed(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(u=>u.id===c);if(i===-1){for(let u of o)if(u.subtasks&&s(u.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function td(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,u)=>({...d,id:`${d.id}-copy-${Date.now()}-${u}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${u}`):void 0})),o=l=>{let i=l.findIndex(m=>m.id===n);if(i===-1){for(let m of l)if(m.subtasks){let g=o(m.subtasks);if(g)return g}return null}let d=l[i],u=`${d.id}-copy-${Date.now()}`,p={...d,id:u,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,u):void 0};return l.splice(i+1,0,p),p},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Fm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},c=l=>{let i=l.findIndex(u=>u.id===t);if(i===-1){for(let u of l)if(u.subtasks&&c(u.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function rd(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:rd(a.subtasks,t,r)}:a)}function ad(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ad(r.subtasks,t)}:r)}function nd(e,t){let r=p=>{for(let m of p){if(m.id===t)return m;if(m.subtasks){let g=r(m.subtasks);if(g)return g}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=p=>{for(let m of p){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let g=l(m.subtasks);if(g>=0)return g}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},u=p=>p.map(m=>{if(m.id===t){let g=m.subtasks||[];return {...m,subtasks:[...g,d],isExpanded:true}}return m.subtasks?{...m,subtasks:u(m.subtasks)}:m});return {tasks:u(e),newTask:d}}function Lm(e,t,r,a){if(t===r)return e;let n=ss(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,u)=>{let p=i?{...d,position:u}:d;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],u=a!==void 0?a:d.length,p=[...d];p.splice(u,0,{...n,parentId:r});let m=p.map((g,x)=>({...g,position:x}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ka(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ka(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:i,scrollTop:d,columns:u,onToggleColumn:p,onColumnResize:m,onTaskUpdate:g,onBulkFill:x,onTaskIndent:y,onTaskOutdent:b,onTaskMove:h,onMultiTaskDelete:v,onTaskDuplicate:w,onTaskCreate:C,onTaskRename:E,onCreateSubtask:L,onOpenTaskModal:k,onDeleteRequest:S,onTaskReparent:P,allTasks:N,scrollContainerRef:K,showCriticalPath:H=false}){let Q=useContext(rs),[I,q]=useState(null),[j,U]=useState(null),[B,we]=useState(""),Ge=useRef(null),[Pe,be]=useState(null),[ve,he]=useState(0),[Oe,Se]=useState(0),[Fe,He]=useState({isOpen:false,x:0,y:0,type:"header"}),[Be,ue]=useState(null),[Ke,ze]=useState(null),[Ae,Tt]=useState(null),Nt=useRef(0),Re=5,Le=useRef(false),[ut,Ct]=useState(null),[Ie,lt]=useState(false),F=useRef(null),[re,R]=useState(null),[X,O]=useState(null),[J,Te]=useState(false),me=useRef(null);useEffect(()=>{function ne(fe){me.current&&!me.current.contains(fe.target)&&Te(false);}if(J)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[J]),useEffect(()=>{j&&Ge.current&&(Ge.current.focus(),Ge.current.select());},[j]),useEffect(()=>{if(!Pe)return;let ne=it=>{let Qe=it.clientX-ve,_=Oe+Qe;m?.(Pe,_);},fe=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[Pe,ve,Oe,m]);let{selectedTaskIds:tt,handleTaskClick:ot,isTaskSelected:Ye}=Pm(),{setIsEditing:$t}=Em({tasks:e,selectedTaskIds:tt,onTaskSelect:(ne,fe)=>{let Qe=Mo(e).map(_=>_.id);ot(ne,Qe,fe||false,false),o?.(ne);},onTaskCreate:C||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:w||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:ne=>{let fe=Mo(e).find(it=>it.id===ne);fe&&At(fe);},onTaskToggleExpand:i||(()=>{}),onOpenTaskModal:ne=>{let fe=Mo(e).find(it=>it.id===ne);fe&&k&&k(fe);},enableKeyboard:true}),Dt=(ne,fe=0,it="")=>{let Qe=[],_=[...ne].sort((se,ee)=>(se.position??0)-(ee.position??0));for(let se=0;se<_.length;se++){let ee=_[se],$=se+1,de=it?`${it}.${$}`:`${$}.0`,xe=ee.wbsCode||de;if(ee.wbsCode=xe,Qe.push({task:ee,level:fe}),ee.subtasks&&ee.subtasks.length>0&&ee.isExpanded){let V=ee.wbsCode?.replace(/\.0$/,"")||(it?`${it}.${$}`:`${$}`);Qe.push(...Dt(ee.subtasks,fe+1,V));}}return Qe},St=Dt(e),Wt=48,rr=Math.max(St.length*r,600-Wt),gr=(ne,fe)=>fe==="assignees"?ne.assignees:fe==="startDate"?ne.startDate:ne.endDate,ia=(ne,fe,it,Qe)=>{ne.preventDefault(),ne.stopPropagation(),R({sourceTaskId:fe,column:it,sourceIndex:Qe,targetIndex:Qe}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let _=ne.currentTarget.closest("[data-grid-body]"),se=Z=>{let Ze=_?.getBoundingClientRect().top??0,le=Math.floor((Z-Ze)/r);return le=Math.max(0,Math.min(St.length-1,le)),le<Qe&&(le=Qe),le},ee=ne.clientY,$=K?.current??null,de=()=>{F.current&&(cancelAnimationFrame(F.current),F.current=null);},xe=()=>{let Z=se(ee);R(Ze=>Ze&&{...Ze,targetIndex:Z});},T=()=>{if(de(),!$)return;let Z=$.getBoundingClientRect(),Ze=60,le=12,Ue=ee-Z.top,mt=Z.bottom-ee;if(mt<Ze&&$.scrollTop<$.scrollHeight-$.clientHeight){let It=Math.max(1,Math.round(le*(1-Math.max(0,mt)/Ze))),Mt=()=>{$.scrollTop+=It,xe(),$.scrollTop<$.scrollHeight-$.clientHeight&&(F.current=requestAnimationFrame(Mt));};F.current=requestAnimationFrame(Mt);}else if(Ue<Ze&&$.scrollTop>0){let It=Math.max(1,Math.round(le*(1-Math.max(0,Ue)/Ze))),Mt=()=>{$.scrollTop-=It,xe(),$.scrollTop>0&&(F.current=requestAnimationFrame(Mt));};F.current=requestAnimationFrame(Mt);}},V=Z=>{ee=Z.clientY,xe(),T();},G=Z=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",G),de(),document.body.style.cursor="",document.body.style.userSelect="",R(null);let Ze=se(Z.clientY),le=St.find(Tr=>Tr.task.id===fe)?.task;if(!le)return;let Ue=gr(le,it),mt=Math.min(Qe,Ze),It=Math.max(Qe,Ze),Mt=[];for(let Tr=mt;Tr<=It;Tr++){if(Tr===Qe)continue;let Gr=St[Tr]?.task;!Gr||Gr.subtasks&&Gr.subtasks.length>0||Mt.push(Gr.id);}Mt.length!==0&&x?.(Mt,it,Ue);};window.addEventListener("mousemove",V),window.addEventListener("mouseup",G);},Yt=ne=>{if(!re)return false;let fe=Math.min(re.sourceIndex,re.targetIndex),it=Math.max(re.sourceIndex,re.targetIndex);return ne>=fe&&ne<=it},fr=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,At=ne=>{U(ne.id),we(ne.name),$t(true);},qr=ne=>{B.trim()&&B!==e.find(fe=>fe.id===ne)?.name&&E?.(ne,B.trim()),U(null),we(""),$t(false);},jt=()=>{U(null),we(""),$t(false);},_t=(ne,fe)=>{fe.stopPropagation(),L?.(ne.id);},la=(ne,fe)=>{fe.preventDefault(),Nt.current=fe.clientY,ue(ne),Le.current=false,lt(false),Ct({x:fe.clientX,y:fe.clientY});},ta=ne=>{if(!Be||(Math.abs(ne.clientY-Nt.current)>Re&&!Le.current&&(Le.current=true,lt(true)),Ct({x:ne.clientX,y:ne.clientY}),!Le.current))return;if(K?.current){let se=K.current,ee=se.getBoundingClientRect(),$=60,de=12;F.current&&(cancelAnimationFrame(F.current),F.current=null);let xe=ne.clientY-ee.top,T=ee.bottom-ne.clientY;if(xe<$&&se.scrollTop>0){let V=Math.round(de*(1-xe/$)),G=()=>{se.scrollTop-=V,Le.current&&se.scrollTop>0&&(F.current=requestAnimationFrame(G));};F.current=requestAnimationFrame(G);}else if(T<$&&se.scrollTop<se.scrollHeight-se.clientHeight){let V=Math.round(de*(1-T/$)),G=()=>{se.scrollTop+=V,Le.current&&se.scrollTop<se.scrollHeight-se.clientHeight&&(F.current=requestAnimationFrame(G));};F.current=requestAnimationFrame(G);}}let it=document.querySelectorAll("[data-task-row]"),Qe=null,_=null;it.forEach(se=>{let ee=se.getBoundingClientRect(),$=se.getAttribute("data-task-row");if($&&$!==Be&&ne.clientY>=ee.top&&ne.clientY<=ee.bottom){Qe=$;let de=ne.clientY-ee.top,xe=ee.height;de<xe*.25?_="above":de>xe*.75?_="below":_="child";}}),ze(Qe),Tt(_);},Xe=()=>{if(Le.current&&Be&&Ke&&Ae){if(Ae==="child")P?.(Be,Ke);else if(Ae==="above"||Ae==="below"){let ne=(se,ee,$=null)=>{for(let de of se){if(de.id===ee)return $;if(de.subtasks){let xe=ne(de.subtasks,ee,de.id);if(xe!==void 0)return xe}}},fe=N&&N.length>0?N:e,it=ne(fe,Be,null),Qe=ne(fe,Ke,null),_=(se,ee,$,de)=>{let xe=se.findIndex(G=>G.id===ee),T=de?se.findIndex(G=>G.id===$):-1,V=Ae==="below"?xe+1:xe;return de&&T!==-1&&T<xe&&(V-=1),Math.max(0,V)};if(Qe===null){let ee=_(fe,Ke,Be,it===null);P?.(Be,null,ee);}else {let se=ss(fe,Qe);if(se?.subtasks){let ee=it===Qe,$=_(se.subtasks,Ke,Be,ee);P?.(Be,Qe,$);}}}}F.current&&(cancelAnimationFrame(F.current),F.current=null),ue(null),ze(null),Tt(null),Ct(null),Le.current=false,lt(false);};useEffect(()=>{if(Be)return document.addEventListener("mousemove",ta),document.addEventListener("mouseup",Xe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ta),document.removeEventListener("mouseup",Xe),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,Ke,Ae]);let Je=(ne,fe,it)=>{let Qe=fe.subtasks&&fe.subtasks.length>0;switch(ne.id){case "name":let _=j===fe.id,se=I===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${it*20}px`},children:[P&&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:se?1:.3},onMouseDown:le=>la(fe.id,le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:le=>{le.stopPropagation(),i?.(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"}),_?jsx("input",{ref:Ge,type:"text",value:B,onChange:le=>we(le.target.value),onKeyDown:le=>{le.key==="Enter"?qr(fe.id):le.key==="Escape"&&jt();},onBlur:()=>qr(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:le=>le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",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:{flex:1,minWidth:0,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),"%"]}),H&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),H&&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"]})]}),se&&!_&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:le=>le.stopPropagation(),children:[jsx("button",{onClick:le=>_t(fe,le),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:le=>{le.stopPropagation(),At(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 $=ne.id==="startDate"?"startDate":"endDate",de=fe[$],xe=X?.taskId===fe.id&&X?.field===$,T=le=>le?(typeof le=="string"?new Date(le):le).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:le=>le.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:Qe?.5:1,cursor:Qe?"default":"pointer"},title:Qe?"Auto-calculated from subtasks":void 0,onClick:le=>{if(!Qe)if(xe)O(null);else {let Ue=le.currentTarget.getBoundingClientRect();O({taskId:fe.id,field:$,month:de?typeof de=="string"?new Date(de):de:new Date,position:{top:Ue.bottom+4,left:Ue.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:T(de)}),Qe&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),xe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>O(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:X?.position.top,left:X?.position.left},onClick:le=>le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let le=new Date,Ue=new Date(le);Ue.setDate(le.getDate()+1);let mt=new Date(le);mt.setDate(le.getDate()+7);let It=new Date(le);return It.setDate(le.getDate()+14),[{label:"Hoy",date:le},{label:"Ma\xF1ana",date:Ue},{label:"Pr\xF3xima semana",date:mt},{label:"2 semanas",date:It}].map((Tr,Gr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:za=>za.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:za=>za.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[$]:Tr.date}),O(null);},children:Tr.label},Gr))})(),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:le=>le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[$]:void 0}),O(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:()=>O(le=>le?{...le,month:new Date(le.month.getFullYear(),le.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:X?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>O(le=>le?{...le,month:new Date(le.month.getFullYear(),le.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((le,Ue)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:le},Ue))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let le=X?.month||new Date,Ue=le.getFullYear(),mt=le.getMonth(),It=new Date(Ue,mt,1).getDay(),Mt=new Date(Ue,mt+1,0).getDate(),Tr=new Date,Gr=[];for(let lr=It-1;lr>=0;lr--)Gr.push({day:new Date(Ue,mt,-lr).getDate(),date:new Date(Ue,mt-1,new Date(Ue,mt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=Mt;lr++)Gr.push({day:lr,date:new Date(Ue,mt,lr),isCurrentMonth:true});let za=42-Gr.length;for(let lr=1;lr<=za;lr++)Gr.push({day:lr,date:new Date(Ue,mt+1,lr),isCurrentMonth:false});return Gr.map((lr,Ra)=>{let Ho=lr.date.toDateString()===Tr.toDateString(),jn=(de?typeof de=="string"?new Date(de):de:null)?.toDateString()===lr.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:lr.isCurrentMonth?jn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:jn?"#00E5CC":"transparent",boxShadow:Ho&&!jn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{g?.(fe.id,{[$]:lr.date}),O(null);},children:lr.day},Ra)})})()})]})]})]}),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:fr(fe)})});case "assignees":if(Qe)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 V=a.filter(le=>fe.assignees?.some(Ue=>Ue.id?Ue.id===le.id:Ue.name===le.name||Ue.initials===le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsx(ko,{assignedUsers:V,availableUsers:a,onChange:le=>{let Ue=le.map(mt=>({id:mt.id,name:mt.name,initials:mt.initials,color:mt.color}));g?.(fe.id,{assignees:Ue});}})});case "status":if(Qe){let le=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:le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsx(tp,{status:fe.status||"todo",onChange:le=>{g?.(fe.id,{status:le,progress:le==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:Qe?.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 G={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Z={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ze=G[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:le=>le.stopPropagation(),children:jsx(vo,{priority:Ze,onChange:le=>{le&&g?.(fe.id,{priority:Z[le]||"medium"});}})});default:return null}},zr=ne=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],Cr=ne=>{let fe=ne.subtasks&&ne.subtasks.length>0,it=Mo(e),Qe=tt.size>1&&tt.has(ne.id),_=Qe?it.filter(xe=>tt.has(xe.id)):[ne],se=_.map(xe=>xe.id),ee=_.filter(xe=>!(xe.subtasks&&xe.subtasks.length>0)),$=Qe?` (${se.length})`:"",de=()=>{S?S(se,ne.name):v?.(se);};return fe?[{id:"addSubtask",label:Q?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{L?.(ne.id);}},{id:"duplicate",label:(Q?.contextMenu?.duplicateTask||"Duplicate Task")+$,icon:tr.Duplicate,onClick:()=>{w?.(se);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Q?.contextMenu?.deleteTask||"Delete Task")+$,icon:tr.Delete,onClick:de}]:[{id:"edit",label:Q?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{c?.(ne);}},{id:"addSubtask",label:Q?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{L?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(Q?.contextMenu?.markIncomplete||"Mark Incomplete")+$,icon:tr.MarkIncomplete,onClick:()=>{ee.forEach(xe=>g?.(xe.id,{status:"todo",progress:0}));},disabled:ee.length===0||ee.every(xe=>xe.status==="todo")},{id:"setInProgress",label:(Q?.contextMenu?.setInProgress||"Set In Progress")+$,icon:tr.SetInProgress,onClick:()=>{ee.forEach(xe=>g?.(xe.id,{status:"in-progress"}));},disabled:ee.length===0||ee.every(xe=>xe.status==="in-progress")},{id:"markComplete",label:(Q?.contextMenu?.markComplete||"Mark Complete")+$,icon:tr.MarkComplete,onClick:()=>{ee.forEach(xe=>g?.(xe.id,{status:"completed",progress:100}));},disabled:ee.length===0||ee.every(xe=>xe.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(Q?.contextMenu?.duplicateTask||"Duplicate Task")+$,icon:tr.Duplicate,onClick:()=>{w?.(se);}},{id:"split",label:Q?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Q?.contextMenu?.deleteTask||"Delete Task")+$,icon:tr.Delete,onClick:de}]},ir=u.filter(ne=>ne.visible),fa=ir.reduce((ne,fe)=>ne+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:fa},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Wt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ir.map((ne,fe)=>{let it=fe===ir.length-1,Qe=ne.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Qe?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(Qe?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:Qe&&ir.length===1?1:0,flexGrow:Qe&&ir.length===1?1:0,borderRight:it?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:_=>{_.preventDefault(),He({isOpen:true,x:_.clientX,y:_.clientY,type:"header",columnId:ne.id});},onMouseEnter:_=>{_.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:_=>{_.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Pe===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:_=>{_.preventDefault(),_.stopPropagation(),be(ne.id),he(_.clientX),Se(ne.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Pe===ne.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(qi,{columns:u,onToggleColumn:p,theme:t}),jsx("button",{onClick:()=>Te(!J),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"})}),J&&jsxs("div",{ref:me,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>Te(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:rr},children:St.map(({task:ne,level:fe},it)=>{let Qe=Ye(ne.id),_=Yt(it),se=Ke===ne.id,ee=se&&Ae==="above",$=se&&Ae==="below",de=se&&Ae==="child",xe={};return de&&(xe.backgroundColor=`${t.accent}15`,xe.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${Be===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:Qe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Qe?t.accentLight:de?`${t.accent}15`:it%2===0?t.bgPrimary:t.bgGrid,opacity:H?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...xe},onMouseEnter:()=>q(ne.id),onMouseLeave:()=>q(null),onClick:T=>{let G=Mo(e).map(le=>le.id),Ze=navigator.platform.toUpperCase().indexOf("MAC")>=0?T.metaKey:T.ctrlKey;ot(ne.id,G,Ze,T.shiftKey),o?.(ne.id),!Ze&&!T.shiftKey&&s?.(ne);},onDoubleClick:T=>{T.stopPropagation(),c?.(ne);},onContextMenu:T=>{T.preventDefault(),He({isOpen:true,x:T.clientX,y:T.clientY,type:"task",task:ne}),l?.(ne,T);},whileHover:{backgroundColor:Qe?t.accentLight:t.hoverBg},children:[ee&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),$&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ir.map((T,V)=>{let G=V===ir.length-1,Z=T.id==="name",Ze=!!(ne.subtasks&&ne.subtasks.length>0),le=T.id==="assignees"||T.id==="startDate"||T.id==="endDate"?T.id:null,mt=!!le&&!Ze&&I===ne.id&&!re,It=_&&!!re&&re.column===T.id;return jsxs("div",{className:`px-4 flex items-center ${Z?"justify-start":"justify-center"}`,style:{position:"relative",width:`${T.width}px`,minWidth:`${T.minWidth??(Z?200:60)}px`,maxWidth:`${T.maxWidth??2e3}px`,flexShrink:Z&&ir.length===1?1:0,flexGrow:Z&&ir.length===1?1:0,borderRight:G?"none":`1px solid ${I===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:It?`${t.accent}22`:void 0,boxShadow:It?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Je(T,ne,Z?fe:0),mt&&le&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Mt=>ia(Mt,ne.id,le,it),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ne.id}-${T.id}`)})]},ne.id)})}),jsx(os,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,items:Fe.type==="header"&&Fe.columnId?zr(Fe.columnId):Fe.type==="task"&&Fe.task?Cr(Fe.task):[],onClose:()=>He({...Fe,isOpen:false}),theme:t}),Ie&&ut&&Be&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=St.find(fe=>fe.task.id===Be)?.task;return ne?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function $m(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,c]=useState(e),[l,i]=useState(t),[d,u]=useState(null),[p,m]=useState(null),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,C]=useState(0),[E,L]=useState(null),[k,S]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:u,hoveredTaskId:p,setHoveredTaskId:m,activeZone:g,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:E,setHoveredSegmentIndex:L,isHovered:k,setIsHovered:S,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(Q,I)=>{a("none"),u(null),m(null),c(Q),i(I),C(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:u,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:g,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let C=$m(t,a),E=useRef(null),L=useRef(false),k=useRef(null),S=useRef(null),{dragMode:P,setDragMode:N,dragOffset:K,setDragOffset:H,ghostX:Q,setGhostX:I,ghostWidth:q,setGhostWidth:j,connectionLine:U,setConnectionLine:B,hoveredTaskId:we,setHoveredTaskId:Ge,activeZone:Pe,setActiveZone:be,draggedSegmentIndex:ve,setDraggedSegmentIndex:he,draggedSegmentStartX:Oe,setDraggedSegmentStartX:Se,segmentDragOffsetX:Fe,setSegmentDragOffsetX:He,hoveredSegmentIndex:Be,setHoveredSegmentIndex:ue,isHovered:Ke,setIsHovered:ze,isDragging:Ae,isResizing:Tt,isConnecting:Nt,resetDragState:Re}=C,Le=18,ut=!!n.executionBarBg,Ct=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ie=ut?3:6,lt=e.subtasks&&e.subtasks.length>0,F=useRef(null),[re,R]=(()=>{let _=useRef(null),[,se]=useState(0);return [_.current,ee=>{_.current=ee,se($=>$+1);}]})(),X=!!w&&!v&&!lt&&!e.segments&&!!e.startDate&&!!e.endDate,O=e.endDate&&(()=>{let _=new Date;_.setHours(0,0,0,0);let se=new Date(e.endDate);return se.setHours(0,0,0,0),se<_})()&&e.progress<100,J=h&&e.isCriticalPath,Te=n.name==="neutral"||n.today==="#1C1917",me=e.status==="completed"||e.progress===100,tt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ye=h&&e.isCriticalPath||O?"#EF4444":e.color?e.color:e.priority&&tt[e.priority]?tt[e.priority]:n.taskBarPrimary,$t=v?"default":Ae?Nt?"crosshair":Tt?"ew-resize":"grabbing":"grab",Dt=v?"default":"ew-resize",Wt=(_=>_>=80?20:_>=60?15:_>=50?12:10)(a),rr=a<50,gr=a<40;useEffect(()=>{x&&(!Ke||Ae||e.segments)&&x(null);},[Ke,Ae,e.segments,x]);let ia=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Yt=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},fr=_=>Math.round(_/s)*s,At=_=>{let se=Math.round(_/s),ee=new Date(o);return ee.setDate(ee.getDate()+se),ee},qr=(_,se)=>{for(let ee of m){if(ee.id===e.id)continue;let $=5;if(_>=ee.x-$&&_<=ee.x+ee.width+$&&se>=ee.y-$&&se<=ee.y+ee.height+$)return ee.id}return null},jt=useCallback((_,se,ee)=>{if(v)return;_.preventDefault(),_.stopPropagation();let $=E.current?.ownerSVGElement;if(!$)return;let de=$.createSVGPoint();de.x=_.clientX,de.y=_.clientY;let xe=de.matrixTransform($.getScreenCTM()?.inverse()),T=ee!==void 0?ee:t,V=se;if(!V){let G=xe.x-T;_.shiftKey?(V="connect",B({x:t+a,y:r+Le/2})):_.ctrlKey||_.metaKey?V="move":_.altKey?V=G<a/2?"resize-start":"resize-end":gr?G<a/2?V="move":V="resize-end":rr?G<=Wt/2?V="resize-start":G>=a-Wt/2?V="resize-end":V="move":G<=Wt?V="resize-start":G>=a-Wt?V="resize-end":V="move";}L.current=false,N(V),ze(false),be(null),V==="move"?H(xe.x-T):V==="connect"?B({x:t+a,y:r+Le/2}):H(0),I(T),j(a);},[t,a,r,Le,v]),_t=useCallback(_=>{let se=E.current?.ownerSVGElement;if(!se)return;let ee=se.closest(".gantt-timeline-scroll");if(!ee)return;let $=ee.getBoundingClientRect(),de=60,xe=15,T=0;if(_.clientX<$.left+de){let V=$.left+de-_.clientX;T=-Math.min(xe,V/2);}else if(_.clientX>$.right-de){let V=_.clientX-($.right-de);T=Math.min(xe,V/2);}return T!==0&&(ee.scrollLeft+=T),T!==0},[]),la=useCallback(_=>{if(P==="none")return;L.current=true,S.current=_;let se=E.current?.ownerSVGElement;if(!se)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let de=_t(_);de&&!k.current?k.current=window.setInterval(()=>{S.current&&(_t(S.current),la(S.current));},16):!de&&k.current&&(window.clearInterval(k.current),k.current=null);}let ee=se.createSVGPoint();ee.x=_.clientX,ee.y=_.clientY;let $=ee.matrixTransform(se.getScreenCTM()?.inverse());if(P==="connect"){B({x:$.x,y:$.y});let de=qr($.x,$.y);Ge(de);}else if(P==="move"){let de=$.x-K,xe=fr(de);I(xe),j(a);let T=Math.round((xe-t)/s);if(g?.(e.id,T,true),e.segments&&e.segments.length>0&&ve!==null){let V=xe-Oe;He(V);}}else if(P==="resize-start"){let de=$.x,xe=fr(de),T=t+a-xe;T>=s&&(I(xe),j(T));}else if(P==="resize-end"){let de=$.x,T=fr(de)-t;T>=s&&j(T);}},[P,t,a,s,K,e,fr,ve,Oe,qr,Ge,B,I,j,He,g,_t]),ta=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),S.current=null,P!=="none"){if(P==="connect")we&&p&&p(e,we),B(null),Ge(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),se,ee,$=true;if(P==="move"){if(se=At(Q),ee=new Date(se.getTime()+_),e.segments&&e.segments.length>0&&ve!==null){let de=Math.round(Fe/s),xe=e.segments.map((Z,Ze)=>{if(Ze===ve){let le=new Date(Z.startDate),Ue=new Date(Z.endDate);return le.setDate(le.getDate()+de),Ue.setDate(Ue.getDate()+de),{startDate:le,endDate:Ue}}return Z}),T=xe.flatMap(Z=>[Z.startDate,Z.endDate]),V=new Date(Math.min(...T.map(Z=>Z.getTime()))),G=new Date(Math.max(...T.map(Z=>Z.getTime())));u?.({...e,segments:xe},V,G),Re(t,a);return}}else P==="resize-start"?(se=At(Q),ee=e.endDate,se>ee&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(se=e.startDate,ee=At(Q+q),ee.setDate(ee.getDate()-1),ee<se&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&se&&ee&&(ee.getTime()<se.getTime()?console.warn("Invalid date range: end date cannot be before start date"):u?.(e,se,ee));}g?.(e.id,0,false),Re(t,a);}},[P,Q,q,e,u,we,p,t,a,s,At,Fe,ve,Re,g]);useEffect(()=>{if(P==="none")return;let _=ee=>{la(ee);},se=()=>{ta();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",se),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",se),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,la,ta]);let Xe=Ae&&!Nt?Q:t,Je=Ae&&!Nt?q:a,zr=c.taskClass(e),Cr=24,ir=h?e.isCriticalPath?1:.25:1,fa=useCallback(_=>{if(!X)return;_.stopPropagation(),_.preventDefault();let ee=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;F.current={barRect:ee,initialPct:e.progress||0},_.currentTarget.setPointerCapture(_.pointerId),R(e.progress||0);},[X,e.progress,R]),ne=useCallback(_=>{let se=F.current;if(!se)return;let $=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??se.barRect;if(!$||$.width<=0)return;let de=(_.clientX-$.left)/$.width,xe=Math.round(Math.max(0,Math.min(1,de))*100);_.shiftKey&&(xe=Math.round(xe/25)*25),R(xe);},[R]),fe=useCallback(_=>{let se=F.current;if(!se)return;_.stopPropagation(),_.preventDefault();try{_.currentTarget.releasePointerCapture(_.pointerId);}catch{}let ee=re;F.current=null,R(null),ee!=null&&ee!==se.initialPct&&w&&w(e,ee);},[re,w,e,R]),it=useCallback(_=>{_.stopPropagation(),_.preventDefault();},[]),Qe=re??(e.progress||0);return jsxs("g",{ref:E,"data-task-bar":"true",style:{opacity:ir,transition:"opacity 300ms ease"},onClick:()=>{!Ae&&!L.current&&l?.(e),L.current=false;},onDoubleClick:_=>{!Ae&&!L.current&&(_.stopPropagation(),i?.(e));},onContextMenu:_=>{_.preventDefault(),d?.(e,_);},onMouseEnter:()=>!Ae&&ze(true),onMouseMove:_=>{x&&Ke&&!Ae&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Le,showBelow:false,mouseX:_.clientX,mouseY:_.clientY});},onMouseLeave:()=>{Ae||(ze(false),be(null));},children:[jsx("rect",{x:t,y:r,width:a+Cr,height:Le,fill:"transparent",style:{pointerEvents:"all"}}),Ke&&!Ae&&!rr&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:Wt,height:Le,fill:Pe==="resize-start"?n.accent:"transparent",opacity:Pe==="resize-start"?.15:0,style:{cursor:Dt,pointerEvents:"all"},onMouseEnter:()=>be("resize-start"),onMouseDown:_=>jt(_,"resize-start")}),jsx("rect",{x:t+Wt,y:r,width:a-Wt*2,height:Le,fill:Pe==="move"?n.accent:"transparent",opacity:Pe==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>be("move"),onMouseDown:_=>jt(_,"move")}),jsx("rect",{x:t+a-Wt,y:r,width:Wt,height:Le,fill:Pe==="resize-end"?n.accent:"transparent",opacity:Pe==="resize-end"?.15:0,style:{cursor:Dt,pointerEvents:"all"},onMouseEnter:()=>be("resize-end"),onMouseDown:_=>jt(_,"resize-end")})]}),Ke&&!Ae&&gr&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Le,fill:Pe==="move"?n.accent:"transparent",opacity:Pe==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>be("move"),onMouseDown:_=>jt(_,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Le,fill:Pe==="resize-end"?n.accent:"transparent",opacity:Pe==="resize-end"?.2:0,style:{cursor:Dt,pointerEvents:"all"},onMouseEnter:()=>be("resize-end"),onMouseDown:_=>jt(_,"resize-end")}),Ke&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Le-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ae&&!Nt&&!e.segments&&jsx(motion.rect,{x:Q,y:r,width:q,height:Le,rx:Ie,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Ae&&(()=>{let _=e.baselineStartDate.getTime(),se=e.baselineEndDate.getTime(),ee=o.getTime(),$=864e5,de=(_-ee)/$,xe=(se-_)/$,T=de*s,V=Math.max(xe*s,s),G=Xe+Je,Z=T+V,Ze=e.endDate?.getTime()??0,le=Math.ceil((Ze-se)/$),Ue=le>0,mt=le<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:T,y:r,width:V,height:Le,rx:Ie,fill:"none",stroke:Ct?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ue&&G>Z&&jsx("rect",{x:Z,y:r,width:G-Z,height:Le,rx:0,fill:"#EF4444",opacity:.2}),Ue&&jsxs("text",{x:Math.max(G,Z)+6,y:r+Le/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",le,"d"]}),mt&&jsxs("text",{x:G+6,y:r+Le/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[le,"d"]})]})})(),!e.segments&&ut&<&&(()=>{let se=r+(Le-8)/2,ee=4,$=e.progress||0,de=new Date;de.setHours(0,0,0,0);let xe=e.startDate&&de>=e.startDate,T=e.endDate&&(()=>{let Ue=new Date(e.endDate);return Ue.setHours(0,0,0,0),de>Ue})(),V=e.startDate&&de<e.startDate,G=1;if(xe&&e.startDate&&e.endDate&&!V){let Ue=new Date(e.startDate);Ue.setHours(0,0,0,0);let mt=new Date(e.endDate);mt.setHours(0,0,0,0);let It=Math.max(1,(mt.getTime()-Ue.getTime())/(1e3*60*60*24)),Tr=Math.min((de.getTime()-Ue.getTime())/(1e3*60*60*24),It)/It*100;G=Tr>0?$/Tr:1;}let Z;$>=100?Z="#00E5CC":V?Z="#4B5563":T&&$<100?Z="#EF4444":G>=.95?Z="#22C55E":G>=.8?Z="#F59E0B":Z="#EF4444";let Ze=Math.max($/100*Je,$>0?ee*2:0),le=Je>100&&$>0;return jsxs("g",{"data-task-class":zr,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Xe,y:se,width:Je,height:8,rx:ee,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:Xe,y:se,width:Ze,height:8,rx:ee,fill:Z}),le&&jsxs("text",{x:Xe+Ze+6,y:se+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($),"%"]})]})})(),!e.segments&&ut&&!lt&&jsx(motion.rect,{x:Xe,y:r,width:Je,height:Le,rx:Ie,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":zr,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Ae&&!Nt?.15:e.parentId?.6:1,scale:Ke&&!Ae?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>jt(_),style:{cursor:$t,pointerEvents:"all"}}),!e.segments&&!ut&&jsx(motion.rect,{x:Xe,y:r,width:Je,height:Le,rx:Ie,fill:Ye,"data-task-class":zr,initial:{opacity:0,scale:.95},animate:{opacity:Ae&&!Nt?.15:e.parentId?.6:Ke?.9:.8,scale:Ke&&!Ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:lt?void 0:_=>jt(_),style:{cursor:lt?"default":$t,pointerEvents:"all"}}),ut&&(O||J)&&!e.segments&&jsx("rect",{x:Xe,y:r,width:Je,height:Le,rx:Ie,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&Qe>0&&!lt&&jsx("rect",{x:Xe,y:r,width:Math.max(Je*(Qe/100),Ie*2),height:Le,rx:Ie,fill:Ye,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!lt&&e.progress<100&&(()=>{let _=e.progress>0?Je*(e.progress/100):0,se=Xe+_,ee=Je-_,$=e.progress===0?Ie:0,de=e.progress===0?Xe:se,xe=e.progress===0?Je:ee;return jsxs(Fragment,{children:[jsx("rect",{x:de,y:r,width:xe,height:Le,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:de,y:r,width:xe,height:Le,rx:$,fill:"none",stroke:Ye,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ut&&!e.segments&&e.progress>0&&e.progress<100&&!lt&&!Ae&&re===null&&(()=>{let _=Xe+Je*(e.progress/100),se=8,ee=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:_,cy:r+Le/2,r:se,fill:ee?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:_,y:r+Le/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ee?.initials||ee?.name?.charAt(0)?.toUpperCase()||""})]})})(),X&&!Ae&&Je>=40&&(re!==null||Qe<88)&&(()=>{let _=Xe+Je*(Qe/100),se=r+Le/2,ee=re!==null,$=ee?7:Ke?6:5,de=ee||Ke?1:.35,xe=Xe+Je-_,T=Math.max(4,Math.min(12,xe-10)),V=12;return jsxs("g",{children:[jsx("rect",{x:_-V,y:se-12,width:V+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:fa,onPointerMove:ne,onPointerUp:fe,onPointerCancel:fe,onClick:it,onDoubleClick:it,onMouseDown:G=>G.stopPropagation()}),jsx("circle",{cx:_,cy:se,r:$,fill:"#FFFFFF",stroke:Ye,strokeWidth:2,opacity:de,style:{pointerEvents:"none",filter:ee?`drop-shadow(0 0 4px ${Ye})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ee&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_-20,y:se-28,width:40,height:18,rx:4,fill:Ct?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ye,strokeWidth:1}),jsxs("text",{x:_,y:se-16,textAnchor:"middle",dominantBaseline:"central",fill:Ct?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[re,"%"]})]})]})})(),e.segments&&e.segments.map((_,se)=>{let ee=(_.startDate.getTime()-o.getTime())/864e5*s,de=(_.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ee+s,xe=Ae&&P==="move"&&ve===se,T=Be===se,V=xe?ee+Fe:ee;return jsxs("g",{onMouseEnter:()=>!Ae&&ue(se),onMouseLeave:()=>!Ae&&ue(null),children:[jsx(motion.rect,{x:V,y:r,width:de,height:Le,rx:Ie,fill:Ye,initial:{opacity:0,scale:.95},animate:{opacity:xe||e.parentId?.6:T?.9:.8,scale:T&&!Ae?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:G=>{G.stopPropagation(),he(se),Se(ee),jt(G,void 0,ee);},style:{cursor:$t,pointerEvents:"all"}}),jsx("rect",{x:V,y:r,width:de*(e.progress/100),height:Le,rx:Ie,fill:Ye,opacity:1,style:{pointerEvents:"none"}})]},`segment-${se}`)}),Te&&(O||J)&&!e.segments&&jsxs(Fragment,{children:[J&&!O&&jsx("rect",{x:Xe,y:r,width:Je,height:Le,rx:Ie,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),O&&jsx("rect",{x:Xe,y:r,width:Je,height:Le,rx:Ie,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Je>60&&!e.segments&&!(ut&<)&&(()=>{let _=c.taskLabel(e),se=typeof _=="string"?_:e.name,ee=se.length>Math.floor(Je/8)?`${se.substring(0,Math.floor(Je/8))}...`:se;return jsx("text",{x:Xe+8,y:r+Le/2,dominantBaseline:"middle",fill:me?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:me?"line-through":"none"},children:ee})})(),!Ae&&!e.segments&&!lt&&e.progress>0&&e.progress<100&&(ut?jsxs("text",{x:Xe+Je+6,y:r+Le/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Je>100?jsxs("text",{x:Xe+Je-12,y:r+Le/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&&Je>80&&!Ae&&!e.segments&&!(ut&<)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Xe+Je-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Xe+Je-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ke||Tt)&&!Nt&&!e.segments&&!lt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Xe-2,y:r,width:16,height:Le,fill:"transparent",style:{cursor:Dt},onMouseEnter:()=>be("resize-start"),onMouseLeave:()=>be(null),onMouseDown:_=>{_.stopPropagation(),jt(_,"resize-start");}}),jsx(motion.rect,{x:Xe+4,y:r+8,width:3,height:Le-16,rx:1.5,fill:Pe==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Xe+Je-14,y:r,width:16,height:Le,fill:"transparent",style:{cursor:Dt},onMouseEnter:()=>be("resize-end"),onMouseLeave:()=>be(null),onMouseDown:_=>{_.stopPropagation(),jt(_,"resize-end");}}),jsx(motion.rect,{x:Xe+Je-7,y:r+8,width:3,height:Le-16,rx:1.5,fill:Pe==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ke&&!Ae&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Le/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>be("connect"),onMouseLeave:()=>be(null),onMouseDown:_=>{_.stopPropagation(),jt(_,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Le/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Pe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Nt&&U&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Le/2,x2:U.x,y2:U.y,stroke:we?n.statusCompleted:n.accent,strokeWidth:we?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:we?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:U.x,cy:U.y,r:we?8:6,fill:we?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),we&&jsx(motion.text,{x:U.x+15,y:U.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:U.x+10},animate:{opacity:1,x:U.x+15},transition:{duration:.2},children:"Connect"})]}),(Ke||Ae)&&!Nt&&!e.segments&&jsx(motion.rect,{x:Xe-1,y:r-1,width:Je+2,height:Le+2,rx:Ie+1,fill:"none",stroke:Ae?n.accent:ut?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ut?1:2,opacity:Ae||ut?.6:.4,initial:{opacity:0},animate:{opacity:Ae||ut?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Tt&&jsxs(Fragment,{children:[jsx("line",{x1:Q,y1:0,x2:Q,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:Q+q,y1:0,x2:Q+q,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ke&&!Ae&&!e.segments&&!x&&(()=>{let ee=r<100,$=ee?r+Le+13:r-82-13,de=ee?`M ${Xe+Je/2-6} ${r+Le+3} L ${Xe+Je/2} ${r+Le+13} L ${Xe+Je/2+6} ${r+Le+3}`:`M ${Xe+Je/2-6} ${r-13} L ${Xe+Je/2} ${r-3} L ${Xe+Je/2+6} ${r-13}`,xe=$+22,T=$+40,V=$+55,G=$+70,Z=ee?$+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:ee?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ee?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:de,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Xe+Je/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Xe+Je/2,y:xe,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Xe+Je/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Xe+Je/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ia(e.startDate)}),jsx("text",{x:Xe+Je/2-110,y:V,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Xe+Je/2-70,y:V,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ia(e.endDate)}),jsx("text",{x:Xe+Je/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Xe+Je/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Yt()}),jsx("text",{x:Xe+Je/2+10,y:V,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Xe+Je/2+65,y:V,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Xe+Je/2-110,y:G,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Xe+Je/2-50,y:G,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ze=>Ze.name).join(", ").substring(0,30),e.assignees.map(Ze=>Ze.name).join(", ").length>30?"...":""]})]}),!ee&&jsx("text",{x:Xe+Je/2,y:Z,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:gr?"Left: move \u2022 Right: resize":rr?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var od=260,ls=8,Um=16,tw=-12;function Wm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,E=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,L=v.lastActivity!=null,k=(E?155:105)+(L?28:0),S=w+Um,P=C+tw-k;S+od>window.innerWidth-ls&&(S=w-od-Um),S<ls&&(S=ls);let N=P<ls;N&&(P=C+20),P+k>window.innerHeight-ls&&(P=window.innerHeight-ls-k),s({left:S,top:P,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,E=0,L=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;L.getTime()<=k.getTime();){let P=L.getDay();v[P]&&!w.has(C(L))&&E++,L.setDate(L.getDate()+1);}let S=Math.max(0,E);return r==="es"?`${S} d\xEDa${S!==1?"s":""}`:`${S} day${S!==1?"s":""}`},u=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},p=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:od,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:p,valueColor:m}),jsx(Qi,{label:l.duration,value:d(),labelColor:p,valueColor:m}),jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:p,valueColor:m}),jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:p,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:p},children:[l.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),c&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:p,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function $c({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxs("div",{className:f("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:f("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(l).map(([i,d])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:d.map(m=>jsxs("button",{onClick:()=>c(m),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Hc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=useState("export"),[l,i]=useState("json"),[d,m]=useState(null),u=useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,y=await Au(e,l,x);Iu(y,l);},g=async x=>{let y=x.target.files?.[0];if(y){try{let b=await $u(y),h=y.name.endsWith(".json")?"json":"csv",v=Bu(b,h);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:f("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:p,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:u,type:"file",accept:".json,.csv",onChange:g,className:"hidden"}),jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxs("div",{className:f("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:f("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Mx=["URGENT","HIGH","MEDIUM","LOW"],Px=[{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"}],Fx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Uc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:g}){let[x,y]=useState(true),b=useCallback(E=>{r({search:E.target.value});},[r]),h=useCallback(E=>{r({dateFilter:E.target.value});},[r]),v=useCallback(E=>{a({by:E.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),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 ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),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)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[m&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:E=>{let F=E.target.value;r({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Mx.map(E=>jsx("option",{value:E,children:E},E))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let F=E.target.value;r({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),l.map(E=>jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let F=E.target.value;r({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsx("option",{value:E,children:E},E))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Px.map(E=>jsx("option",{value:E.value,children:E.label},E.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),g&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:p,onChange:E=>g(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Fx.map(E=>jsx("option",{value:E.value,children:E.label},E.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=useState(false),m=useRef(null);useEffect(()=>{let p=g=>{m.current&&!m.current.contains(g.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxs("div",{className:f("relative",a),ref:m,children:[jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>u(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 zc={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Gc={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Vc={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"}},So={dark:zc,light:Gc,neutral:Vc},Vi="dark";var ji=createContext(void 0),Wx="asakaa-theme";function dm({children:e,defaultTheme:t=Vi,storageKey:r=Wx}){let[a,n]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=So[a];Object.entries(l.colors).forEach(([d,m])=>{m&&c.style.setProperty(`--theme-${zx(d)}`,m);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([d,m])=>{let u=l.colors[d];u&&c.style.setProperty(m,u);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:So};return jsx(ji.Provider,{value:o,children:e})}function es(){let e=useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function zx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function jc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=es();return e?jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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(So).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),a===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var lt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function um(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return lt[e]||lt.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",lt[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",lt[e].bgSecondary),bgGrid:a("--theme-bg-card",lt[e].bgGrid),bgWeekend:a("--theme-bg-hover",lt[e].bgWeekend),border:a("--theme-border-primary",lt[e].border),borderLight:a("--theme-border-subtle",lt[e].borderLight),textPrimary:a("--theme-text-primary",lt[e].textPrimary),textSecondary:a("--theme-text-secondary",lt[e].textSecondary),textTertiary:a("--theme-text-tertiary",lt[e].textTertiary),accent:a("--theme-accent-primary",lt[e].accent),accentHover:a("--theme-accent-hover",lt[e].accentHover),accentLight:a("--theme-accent-primary",lt[e].accentLight),taskBarPrimary:a("--theme-accent-primary",lt[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",lt[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",lt[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",lt[e].dependency),dependencyHover:a("--theme-border-secondary",lt[e].dependencyHover),criticalPath:a("--theme-error",lt[e].criticalPath),criticalPathLight:a("--theme-error",lt[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",lt[e].today):e==="neutral"?a("--theme-text-primary",lt[e].today):a("--theme-error",lt[e].today),todayLight:e==="light"?a("--theme-accent-primary",lt[e].todayLight):e==="neutral"?a("--theme-text-primary",lt[e].todayLight):a("--theme-error",lt[e].todayLight),milestone:a("--theme-warning",lt[e].milestone),milestoneLight:a("--theme-warning",lt[e].milestoneLight),statusTodo:a("--theme-text-tertiary",lt[e].statusTodo),statusInProgress:a("--theme-accent-primary",lt[e].statusInProgress),statusCompleted:a("--theme-success",lt[e].statusCompleted),hoverBg:a("--theme-bg-hover",lt[e].hoverBg),focusRing:a("--theme-accent-primary",lt[e].focusRing),...lt[e].dotGrid&&{dotGrid:lt[e].dotGrid},...lt[e].glassHeader&&{glassHeader:lt[e].glassHeader},...lt[e].glassToolbar&&{glassToolbar:lt[e].glassToolbar},...lt[e].forecastHud&&{forecastHud:lt[e].forecastHud},...lt[e].neonRedGlow&&{neonRedGlow:lt[e].neonRedGlow},...lt[e].executionBarBg&&{executionBarBg:lt[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},pm={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"}},_c={en:_i,es:pm};function mm(e){return _c[e]||_c.en}function Kc(e,t){let r=mm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var rs=createContext(_i);function qa(){return useContext(rs)}function Gs(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function km({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=useState(false),[i,d]=useState(null),m=useRef(null),u=useRef(null),p=qa(),g=Gs(m,c,"right",176);if(useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:u,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:g.top,left:g.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function fm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=useState(false),[l,i]=useState(null),[d,m]=useState(false),u=useRef(null),p=useRef(null),g=qa(),x=Gs(u,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=g.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=E=>{let F=E.target;u.current&&!u.current.contains(F)&&p.current&&!p.current.contains(F)&&c(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let h=[{id:"png",label:g.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:g.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:g.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:g.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),v=async(C,E)=>{if(E){i(C);try{await E();}catch(F){console.error(`Export ${C} failed:`,F);}finally{i(null),c(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>c(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:g.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((C,E)=>jsxs(motion.button,{onClick:()=>v(C.id,C.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:E*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:d?g.toolbar.copied:g.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function dv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function uv({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function bm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),c=useRef(null),l=qa(),i=Gs(o,n,"left");useEffect(()=>{if(!n)return;let u=p=>{let g=p.target;o.current&&!o.current.contains(g)&&c.current&&!c.current.contains(g)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:d.map((u,p)=>{let g=t===u.value;return jsxs(motion.button,{onClick:()=>{r(u.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:g?e.accentLight:"transparent",borderBottom:p<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:g?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:p*.03},children:[jsx("span",{className:"text-[11px]",style:{color:g?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:g?600:500},children:u.label}),g&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function hm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),c=useRef(null),l=useRef(null),i=qa(),d=Gs(c,s,"left");useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(g),l._cleanup&&l._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:c,onClick:g=>{g.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"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:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(g=>{let x=t===g.value&&!a,y=()=>g.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):g.icon;return jsxs(motion.button,{onClick:()=>{r(g.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?g.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:g.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},g.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function pv({value:e,onChange:t,theme:r}){let a=qa(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function mv({theme:e,forecast:t}){let r=qa(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",g=t?.budgetVariancePercent,x=g!=null&&g!==0,y=g!=null?g>0?`+${g.toFixed(0)}% ${r.toolbar.budgetOver}`:`${g.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=g!=null&&g>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:g!=null&&g<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace"},children:c})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function gv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=useState(false),g=useRef(null),x=useRef(null),y=qa(),b=Gs(g,u,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!u)return;let E=F=>{let k=F.target;g.current&&!g.current.contains(k)&&x.current&&!x.current.contains(k)&&p(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:c,onChange:l}],C=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:u&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((E,F)=>{let k=E.icon,S=E.disabled,P=E.tooltip;return jsxs(motion.button,{onClick:()=>!S&&E.onChange?.(!E.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:S?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:S?"not-allowed":"pointer"},whileHover:S?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:S?h?"rgba(255,255,255,0.2)":"#D1D5DB":E.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:E.label}),E.active&&!S&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((E,F)=>{let k=i===E.value;return jsxs(motion.button,{onClick:()=>d(E.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:E.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:g,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:C="execution",onViewModeChange:E,projectForecast:F,hideForecastHud:k,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportCSV:K,onExportJSON:U,onExportMSProject:ae,showCriticalPath:I=true,onShowCriticalPathChange:_,showDependencies:j=true,onShowDependenciesChange:W,highlightWeekends:B=true,onHighlightWeekendsChange:ve,showBaseline:je=false,onShowBaselineChange:Pe,onCopySnapshotLink:me,hasDependencies:xe=true}){let he=qa(),We=S||P||N||K||U||ae,Se=!!e.glassToolbar,Re=[{value:"day",label:he.toolbar.day},{value:"week",label:he.toolbar.week},{value:"month",label:he.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"})}],Ye=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let se=Ye?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:E&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Ye?"#000000":e.bgSecondary,border:`1px solid ${Ye?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>E("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Ye?"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:he.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>E("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Ye?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:C==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:he.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(pv,{value:t,onChange:r,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),g&&jsx(hm,{theme:e,value:p,onChange:g,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),jsx(gv,{theme:e,showCriticalPath:I,onShowCriticalPathChange:_,showBaseline:je,onShowBaselineChange:Pe,highlightWeekends:B,onHighlightWeekendsChange:ve,showDependencies:j,onShowDependenciesChange:W,rowDensity:c,onRowDensityChange:l,hasDependencies:xe}),jsx(fm,{theme:e,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportMSProject:ae,onCopySnapshotLink:me}),d&&u&&jsxs(motion.button,{onClick:u,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 ${Ye?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Ye?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||he.toolbar.createTask})]})]})]}),F&&!k&&jsx(mv,{theme:e,forecast:F})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(uv,{options:Re,value:t,onChange:se=>r(se),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsx(bm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),g&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(hm,{theme:e,value:p,onChange:g,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||he.toolbar.createTask})]}),(We||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(fm,{theme:e,onExportPNG:S,onExportPDF:P,onExportExcel:N,onExportMSProject:ae,onCopySnapshotLink:me}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(dv,{options:Ae,value:s,onChange:se=>o(se),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!a)return;let d=m=>{c.current&&!c.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(ar,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:d.label}),d.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function os({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[c,l]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,g=window.innerHeight,x=t,y=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>g&&(y=g-m-u,y<u&&(y=u)),l({x,y});},[e,t,r,a.length]),useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.map(d=>jsxs("div",{children:[d.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var er={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 Mm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=useRef(false),g=useCallback(v=>{p.current=v;},[]),x=useCallback(v=>{let w=[],C=E=>{for(let F of E)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&C(F.subtasks);};return C(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let C=x(e);if(C.length===0)return;let E=y();if(!E){r(C[0].id,false);return}let F=C.findIndex(P=>P.id===E.id);if(F===-1)return;let k=v==="up"?F-1:F+1;if(k<0||k>=C.length)return;let S=C[k];r(S.id,w);},[e,y,x,r]),h=useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),S=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(S&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!S.isExpanded||v.key==="ArrowLeft"&&S.isExpanded)&&d(S.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!F){S&&(v.preventDefault(),a(S.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){S&&(v.preventDefault(),a(S.id,"above"));return}if(v.key==="Enter"&&F){S&&(v.preventDefault(),m(S.id));return}if(v.key==="F2"){S&&(v.preventDefault(),i(S.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&F&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[u,t,y,b,a,n,s,o,c,l,i,d,m]);return useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:g}}function Fm(e){let[t,r]=useState(new Set),[a,n]=useState(null);useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=useCallback(u=>{r(new Set([u])),n(u);},[]),o=useCallback(u=>{r(p=>{let g=new Set(p);return g.has(u)?g.delete(u):g.add(u),g}),n(u);},[]),c=useCallback((u,p)=>{if(!a){s(u);return}let g=p.indexOf(a),x=p.indexOf(u);if(g===-1||x===-1){s(u);return}let y=Math.min(g,x),b=Math.max(g,x),h=p.slice(y,b+1);r(new Set(h)),n(u);},[a,s]),l=useCallback((u,p,g,x)=>{x?c(u,p):g?o(u):s(u);},[s,o,c]),i=useCallback((u,p)=>{p?r(g=>{let x=new Set(g);return x.add(u),x}):s(u);},[s]),d=useCallback(()=>{r(new Set),n(null);},[]),m=useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:c,handleTaskClick:l,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function Qc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Qc(t.subtasks):t.subtasks}))}function Mo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ss(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ss(r.subtasks,t);if(a)return a}}return null}function Jc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Jc(r.subtasks,t);if(a)return a}return null}function Zc(e,t){if(t.length===0)return e;let r=Mo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let g=[];return {tasks:u.filter(y=>{if(p.has(y.id))return g.push(y),false;if(y.subtasks){let b=o(y.subtasks,p);y.subtasks=b.tasks,g.push(...b.removed);}return true}),removed:g}},c=(u,p,g)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...g],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,p,g)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),m=c(i,s.id,d);return Qc(m)}function ed(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Jc(r,a);if(!n)continue;let s=Jc(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let g=p.subtasks.findIndex(x=>x.id===m);if(g!==-1){let[x]=p.subtasks.splice(g,1);return x}}if(p.subtasks){let g=o(p.subtasks,d,m);if(g)return g}}return null},c=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&c(p.subtasks,d,m);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Qc(r)}function td(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(m=>m.id===c);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function rd(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=l=>{let i=l.findIndex(p=>p.id===n);if(i===-1){for(let p of l)if(p.subtasks){let g=o(p.subtasks);if(g)return g}return null}let d=l[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return l.splice(i+1,0,u),u},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Lm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},c=l=>{let i=l.findIndex(m=>m.id===t);if(i===-1){for(let m of l)if(m.subtasks&&c(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function ad(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ad(a.subtasks,t,r)}:a)}function nd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:nd(r.subtasks,t)}:r)}function od(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let g=r(p.subtasks);if(g)return g}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let g=l(p.subtasks);if(g>=0)return g}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let g=p.subtasks||[];return {...p,subtasks:[...g,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Am(e,t,r,a){if(t===r)return e;let n=ss(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((g,x)=>({...g,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ya(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ya(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:c,onTaskDblClick:l,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:g,onTaskUpdate:x,onBulkFill:y,onTaskIndent:b,onTaskOutdent:h,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:E,onTaskRename:F,onCreateSubtask:k,onOpenTaskModal:S,onDeleteRequest:P,onTaskReparent:N,allTasks:K,scrollContainerRef:U,showCriticalPath:ae=false}){let I=useContext(rs),[_,j]=useState(null),[W,B]=useState(null),[ve,je]=useState(""),Pe=useRef(null),[me,xe]=useState(null),[he,We]=useState(0),[Se,Re]=useState(0),[Ae,Ye]=useState({isOpen:false,x:0,y:0,type:"header"}),[se,Xe]=useState(null),[Be,$e]=useState(null),[mt,Nt]=useState(null),ze=useRef(0),Fe=5,nt=useRef(false),[It,Ie]=useState(null),[ot,L]=useState(false),Q=useRef(null),[R,J]=useState(null),[O,Y]=useState(null),[Te,ge]=useState(false),Ze=useRef(null);useEffect(()=>{function le(de){Ze.current&&!Ze.current.contains(de.target)&&ge(false);}if(Te)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[Te]),useEffect(()=>{W&&Pe.current&&(Pe.current.focus(),Pe.current.select());},[W]),useEffect(()=>{if(!me)return;let le=dt=>{let V=dt.clientX-he,be=Se+V;g?.(me,be);},de=()=>{xe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",de),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",de),document.body.style.cursor="",document.body.style.userSelect="";}},[me,he,Se,g]);let{selectedTaskIds:et,handleTaskClick:Je,isTaskSelected:Bt}=Fm(c),{setIsEditing:Tt}=Mm({tasks:e,selectedTaskIds:et,onTaskSelect:(le,de)=>{let V=Mo(e).map(be=>be.id);Je(le,V,de||false,false),o?.(le);},onTaskCreate:E||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:le=>{let de=Mo(e).find(dt=>dt.id===le);de&&Kr(de);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:le=>{let de=Mo(e).find(dt=>dt.id===le);de&&S&&S(de);},enableKeyboard:true}),zt=(le,de=0,dt="")=>{let V=[],be=[...le].sort((Z,$)=>(Z.position??0)-($.position??0));for(let Z=0;Z<be.length;Z++){let $=be[Z],te=Z+1,we=dt?`${dt}.${te}`:`${te}.0`,T=$.wbsCode||we;if($.wbsCode=T,V.push({task:$,level:de}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let ue=$.wbsCode?.replace(/\.0$/,"")||(dt?`${dt}.${te}`:`${te}`);V.push(...zt($.subtasks,de+1,ue));}}return V},kt=zt(e),tr=48,ur=Math.max(kt.length*r,600-tr),da=(le,de)=>de==="assignees"?le.assignees:de==="startDate"?le.startDate:le.endDate,Gt=(le,de,dt,V)=>{le.preventDefault(),le.stopPropagation(),J({sourceTaskId:de,column:dt,sourceIndex:V,targetIndex:V}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let be=le.currentTarget.closest("[data-grid-body]"),Z=ke=>{let st=be?.getBoundingClientRect().top??0,re=Math.floor((ke-st)/r);return re=Math.max(0,Math.min(kt.length-1,re)),re<V&&(re=V),re},$=le.clientY,te=U?.current??null,we=()=>{Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);},T=()=>{let ke=Z($);J(st=>st&&{...st,targetIndex:ke});},H=()=>{if(we(),!te)return;let ke=te.getBoundingClientRect(),st=60,re=12,it=$-ke.top,pt=ke.bottom-$;if(pt<st&&te.scrollTop<te.scrollHeight-te.clientHeight){let St=Math.max(1,Math.round(re*(1-Math.max(0,pt)/st))),br=()=>{te.scrollTop+=St,T(),te.scrollTop<te.scrollHeight-te.clientHeight&&(Q.current=requestAnimationFrame(br));};Q.current=requestAnimationFrame(br);}else if(it<st&&te.scrollTop>0){let St=Math.max(1,Math.round(re*(1-Math.max(0,it)/st))),br=()=>{te.scrollTop-=St,T(),te.scrollTop>0&&(Q.current=requestAnimationFrame(br));};Q.current=requestAnimationFrame(br);}},ue=ke=>{$=ke.clientY,T(),H();},q=ke=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",q),we(),document.body.style.cursor="",document.body.style.userSelect="",J(null);let st=Z(ke.clientY),re=kt.find(fa=>fa.task.id===de)?.task;if(!re)return;let it=da(re,dt),pt=Math.min(V,st),St=Math.max(V,st),br=[];for(let fa=pt;fa<=St;fa++){if(fa===V)continue;let Pr=kt[fa]?.task;!Pr||Pr.subtasks&&Pr.subtasks.length>0||br.push(Pr.id);}br.length!==0&&y?.(br,dt,it);};window.addEventListener("mousemove",ue),window.addEventListener("mouseup",q);},gr=le=>{if(!R)return false;let de=Math.min(R.sourceIndex,R.targetIndex),dt=Math.max(R.sourceIndex,R.targetIndex);return le>=de&&le<=dt},Rt=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,Kr=le=>{B(le.id),je(le.name),Tt(true);},Vt=le=>{ve.trim()&&ve!==e.find(de=>de.id===le)?.name&&F?.(le,ve.trim()),B(null),je(""),Tt(false);},Jt=()=>{B(null),je(""),Tt(false);},Gr=(le,de)=>{de.stopPropagation(),k?.(le.id);},ua=(le,de)=>{de.preventDefault(),ze.current=de.clientY,Xe(le),nt.current=false,L(false),Ie({x:de.clientX,y:de.clientY});},tt=le=>{if(!se||(Math.abs(le.clientY-ze.current)>Fe&&!nt.current&&(nt.current=true,L(true)),Ie({x:le.clientX,y:le.clientY}),!nt.current))return;if(U?.current){let Z=U.current,$=Z.getBoundingClientRect(),te=60,we=12;Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);let T=le.clientY-$.top,H=$.bottom-le.clientY;if(T<te&&Z.scrollTop>0){let ue=Math.round(we*(1-T/te)),q=()=>{Z.scrollTop-=ue,nt.current&&Z.scrollTop>0&&(Q.current=requestAnimationFrame(q));};Q.current=requestAnimationFrame(q);}else if(H<te&&Z.scrollTop<Z.scrollHeight-Z.clientHeight){let ue=Math.round(we*(1-H/te)),q=()=>{Z.scrollTop+=ue,nt.current&&Z.scrollTop<Z.scrollHeight-Z.clientHeight&&(Q.current=requestAnimationFrame(q));};Q.current=requestAnimationFrame(q);}}let dt=document.querySelectorAll("[data-task-row]"),V=null,be=null;dt.forEach(Z=>{let $=Z.getBoundingClientRect(),te=Z.getAttribute("data-task-row");if(te&&te!==se&&le.clientY>=$.top&&le.clientY<=$.bottom){V=te;let we=le.clientY-$.top,T=$.height;we<T*.25?be="above":we>T*.75?be="below":be="child";}}),$e(V),Nt(be);},_e=()=>{if(nt.current&&se&&Be&&mt){if(mt==="child")N?.(se,Be);else if(mt==="above"||mt==="below"){let le=(Z,$,te=null)=>{for(let we of Z){if(we.id===$)return te;if(we.subtasks){let T=le(we.subtasks,$,we.id);if(T!==void 0)return T}}},de=K&&K.length>0?K:e,dt=le(de,se,null),V=le(de,Be,null),be=(Z,$,te,we)=>{let T=Z.findIndex(q=>q.id===$),H=we?Z.findIndex(q=>q.id===te):-1,ue=mt==="below"?T+1:T;return we&&H!==-1&&H<T&&(ue-=1),Math.max(0,ue)};if(V===null){let $=be(de,Be,se,dt===null);N?.(se,null,$);}else {let Z=ss(de,V);if(Z?.subtasks){let $=dt===V,te=be(Z.subtasks,Be,se,$);N?.(se,V,te);}}}}Q.current&&(cancelAnimationFrame(Q.current),Q.current=null),Xe(null),$e(null),Nt(null),Ie(null),nt.current=false,L(false);};useEffect(()=>{if(se)return document.addEventListener("mousemove",tt),document.addEventListener("mouseup",_e),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",_e),document.body.style.cursor="",document.body.style.userSelect="";}},[se,Be,mt]);let ga=(le,de,dt)=>{let V=de.subtasks&&de.subtasks.length>0;switch(le.id){case "name":let be=W===de.id,Z=_===de.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${dt*20}px`},children:[N&&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:Z?1:.3},onMouseDown:re=>ua(de.id,re),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),de.subtasks&&de.subtasks.length>0?jsx("button",{onClick:re=>{re.stopPropagation(),d?.(de.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:de.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"}),be?jsx("input",{ref:Pe,type:"text",value:ve,onChange:re=>je(re.target.value),onKeyDown:re=>{re.key==="Enter"?Vt(de.id):re.key==="Escape"&&Jt();},onBlur:()=>Vt(de.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:re=>re.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:de.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:de.parentId?"13px":"14px",fontWeight:de.isMilestone?600:de.parentId?400:600,letterSpacing:de.parentId?"0":"-0.01em"},title:de.name,children:[de.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:de.wbsCode}),de.isHighlighted&&de.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:de.name}),de.subtasks&&de.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(de.progress||0),"%"]}),ae&&de.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ae&&de.cpmData&&jsxs("span",{style:{color:de.cpmData.totalFloat<=0?"#EF4444":de.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(de.cpmData.totalFloat),"d"]})]}),Z&&!be&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:re=>re.stopPropagation(),children:[jsx("button",{onClick:re=>Gr(de,re),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:re=>{re.stopPropagation(),Kr(de);},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 te=le.id==="startDate"?"startDate":"endDate",we=de[te],T=O?.taskId===de.id&&O?.field===te,H=re=>re?(typeof re=="string"?new Date(re):re).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:re=>re.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:V?.5:1,cursor:V?"default":"pointer"},title:V?"Auto-calculated from subtasks":void 0,onClick:re=>{if(!V)if(T)Y(null);else {let it=re.currentTarget.getBoundingClientRect();Y({taskId:de.id,field:te,month:we?typeof we=="string"?new Date(we):we:new Date,position:{top:it.bottom+4,left:it.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:H(we)}),V&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),T&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Y(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:O?.position.top,left:O?.position.left},onClick:re=>re.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let re=new Date,it=new Date(re);it.setDate(re.getDate()+1);let pt=new Date(re);pt.setDate(re.getDate()+7);let St=new Date(re);return St.setDate(re.getDate()+14),[{label:"Hoy",date:re},{label:"Ma\xF1ana",date:it},{label:"Pr\xF3xima semana",date:pt},{label:"2 semanas",date:St}].map((fa,Pr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:tn=>tn.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:tn=>tn.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(de.id,{[te]:fa.date}),Y(null);},children:fa.label},Pr))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(de.id,{[te]:void 0}),Y(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:()=>Y(re=>re?{...re,month:new Date(re.month.getFullYear(),re.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:O?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Y(re=>re?{...re,month:new Date(re.month.getFullYear(),re.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((re,it)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:re},it))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let re=O?.month||new Date,it=re.getFullYear(),pt=re.getMonth(),St=new Date(it,pt,1).getDay(),br=new Date(it,pt+1,0).getDate(),fa=new Date,Pr=[];for(let ir=St-1;ir>=0;ir--)Pr.push({day:new Date(it,pt,-ir).getDate(),date:new Date(it,pt-1,new Date(it,pt,-ir).getDate()),isCurrentMonth:false});for(let ir=1;ir<=br;ir++)Pr.push({day:ir,date:new Date(it,pt,ir),isCurrentMonth:true});let tn=42-Pr.length;for(let ir=1;ir<=tn;ir++)Pr.push({day:ir,date:new Date(it,pt+1,ir),isCurrentMonth:false});return Pr.map((ir,Ra)=>{let Ho=ir.date.toDateString()===fa.toDateString(),_n=(we?typeof we=="string"?new Date(we):we:null)?.toDateString()===ir.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:ir.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:Ho&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(de.id,{[te]:ir.date}),Y(null);},children:ir.day},Ra)})})()})]})]})]}),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:Rt(de)})});case "assignees":if(V)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 ue=a.filter(re=>de.assignees?.some(it=>it.id?it.id===re.id:it.name===re.name||it.initials===re.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(ko,{assignedUsers:ue,availableUsers:a,onChange:re=>{let it=re.map(pt=>({id:pt.id,name:pt.name,initials:pt.initials,color:pt.color}));x?.(de.id,{assignees:it});}})});case "status":if(V){let re=de.progress===100?"\u2713":de.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:re})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(rp,{status:de.status||"todo",onChange:re=>{x?.(de.id,{status:re,progress:re==="completed"?100:de.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:V?.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:`${de.progress}%`,backgroundColor:de.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:[de.progress,"%"]})]});case "priority":let q={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ke={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},st=q[de.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:re=>re.stopPropagation(),children:jsx(vo,{priority:st,onChange:re=>{re&&x?.(de.id,{priority:ke[re]||"medium"});}})});default:return null}},sr=le=>[{id:"hide",label:"Hide Column",icon:er.Hide,onClick:()=>p(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:er.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:er.SortDesc,onClick:()=>{}}],Zr=le=>{let de=le.subtasks&&le.subtasks.length>0,dt=Mo(e),V=et.size>1&&et.has(le.id),be=V?dt.filter(T=>et.has(T.id)):[le],Z=be.map(T=>T.id),$=be.filter(T=>!(T.subtasks&&T.subtasks.length>0)),te=V?` (${Z.length})`:"",we=()=>{P?P(Z,le.name):w?.(Z);};return de?[{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:er.Add,onClick:()=>{k?.(le.id);}},{id:"duplicate",label:(I?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:er.Duplicate,onClick:()=>{C?.(Z);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(I?.contextMenu?.deleteTask||"Delete Task")+te,icon:er.Delete,onClick:we}]:[{id:"edit",label:I?.contextMenu?.editTask||"Edit Task",icon:er.Pencil,onClick:()=>{l?.(le);}},{id:"addSubtask",label:I?.contextMenu?.addSubtask||"Add Subtask",icon:er.Add,onClick:()=>{k?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(I?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:er.MarkIncomplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(T=>T.status==="todo")},{id:"setInProgress",label:(I?.contextMenu?.setInProgress||"Set In Progress")+te,icon:er.SetInProgress,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"in-progress"}));},disabled:$.length===0||$.every(T=>T.status==="in-progress")},{id:"markComplete",label:(I?.contextMenu?.markComplete||"Mark Complete")+te,icon:er.MarkComplete,onClick:()=>{$.forEach(T=>x?.(T.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(T=>T.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(I?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:er.Duplicate,onClick:()=>{C?.(Z);}},{id:"split",label:I?.contextMenu?.splitTask||"Split Task",icon:er.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(I?.contextMenu?.deleteTask||"Delete Task")+te,icon:er.Delete,onClick:we}]},fr=u.filter(le=>le.visible),wa=fr.reduce((le,de)=>le+de.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:wa},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${tr}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:fr.map((le,de)=>{let dt=de===fr.length-1,V=le.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${V?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(V?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:V&&fr.length===1?1:0,flexGrow:V&&fr.length===1?1:0,borderRight:dt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:be=>{be.preventDefault(),Ye({isOpen:true,x:be.clientX,y:be.clientY,type:"header",columnId:le.id});},onMouseEnter:be=>{be.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:be=>{be.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:"12px",marginRight:"-6px",backgroundColor:me===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),xe(le.id),We(be.clientX),Re(le.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:me===le.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},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(qi,{columns:u,onToggleColumn:p,theme:t}),jsx("button",{onClick:()=>ge(!Te),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"})}),Te&&jsxs("div",{ref:Ze,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick: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:()=>ge(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:ur},children:kt.map(({task:le,level:de},dt)=>{let V=Bt(le.id),be=gr(dt),Z=Be===le.id,$=Z&&mt==="above",te=Z&&mt==="below",we=Z&&mt==="child",T={};return we&&(T.backgroundColor=`${t.accent}15`,T.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${se===le.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:V?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:V?t.accentLight:we?`${t.accent}15`:dt%2===0?t.bgPrimary:t.bgGrid,opacity:ae?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...T},onMouseEnter:()=>j(le.id),onMouseLeave:()=>j(null),onClick:H=>{let q=Mo(e).map(re=>re.id),st=navigator.platform.toUpperCase().indexOf("MAC")>=0?H.metaKey:H.ctrlKey;Je(le.id,q,st,H.shiftKey),o?.(le.id),!st&&!H.shiftKey&&s?.(le);},onDoubleClick:H=>{H.stopPropagation(),l?.(le);},onContextMenu:H=>{H.preventDefault(),Ye({isOpen:true,x:H.clientX,y:H.clientY,type:"task",task:le}),i?.(le,H);},whileHover:{backgroundColor:V?t.accentLight:t.hoverBg},children:[$&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),fr.map((H,ue)=>{let q=ue===fr.length-1,ke=H.id==="name",st=!!(le.subtasks&&le.subtasks.length>0),re=H.id==="assignees"||H.id==="startDate"||H.id==="endDate"?H.id:null,pt=!!re&&!st&&_===le.id&&!R,St=be&&!!R&&R.column===H.id;return jsxs("div",{className:`px-4 flex items-center ${ke?"justify-start":"justify-center"}`,style:{position:"relative",width:`${H.width}px`,minWidth:`${H.minWidth??(ke?200:60)}px`,maxWidth:`${H.maxWidth??2e3}px`,flexShrink:ke&&fr.length===1?1:0,flexGrow:ke&&fr.length===1?1:0,borderRight:q?"none":`1px solid ${_===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:St?`${t.accent}22`:void 0,boxShadow:St?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ga(H,le,ke?de:0),pt&&re&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:br=>Gt(br,le.id,re,dt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${le.id}-${H.id}`)})]},le.id)})}),jsx(os,{isOpen:Ae.isOpen,x:Ae.x,y:Ae.y,items:Ae.type==="header"&&Ae.columnId?sr(Ae.columnId):Ae.type==="task"&&Ae.task?Zr(Ae.task):[],onClose:()=>Ye({...Ae,isOpen:false}),theme:t}),ot&&It&&se&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:It.x+12,top:It.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=kt.find(de=>de.task.id===se)?.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 Om(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,c]=useState(e),[l,i]=useState(t),[d,m]=useState(null),[u,p]=useState(null),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,C]=useState(0),[E,F]=useState(null),[k,S]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:g,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:E,setHoveredSegmentIndex:F,isHovered:k,setIsHovered:S,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ae,I)=>{a("none"),m(null),p(null),c(ae),i(I),C(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:g,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let C=Om(t,a),E=useRef(null),F=useRef(false),k=useRef(null),S=useRef(null),{dragMode:P,setDragMode:N,dragOffset:K,setDragOffset:U,ghostX:ae,setGhostX:I,ghostWidth:_,setGhostWidth:j,connectionLine:W,setConnectionLine:B,hoveredTaskId:ve,setHoveredTaskId:je,activeZone:Pe,setActiveZone:me,draggedSegmentIndex:xe,setDraggedSegmentIndex:he,draggedSegmentStartX:We,setDraggedSegmentStartX:Se,segmentDragOffsetX:Re,setSegmentDragOffsetX:Ae,hoveredSegmentIndex:Ye,setHoveredSegmentIndex:se,isHovered:Xe,setIsHovered:Be,isDragging:$e,isResizing:mt,isConnecting:Nt,resetDragState:ze}=C,Fe=18,nt=!!n.executionBarBg,It=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ie=nt?3:6,ot=e.subtasks&&e.subtasks.length>0,L=useRef(null),[Q,R]=(()=>{let V=useRef(null),[,be]=useState(0);return [V.current,Z=>{V.current=Z,be($=>$+1);}]})(),J=!!w&&!v&&!ot&&!e.segments&&!!e.startDate&&!!e.endDate,O=e.endDate&&(()=>{let V=new Date;V.setHours(0,0,0,0);let be=new Date(e.endDate);return be.setHours(0,0,0,0),be<V})()&&e.progress<100,Y=h&&e.isCriticalPath,Te=n.name==="neutral"||n.today==="#1C1917",ge=e.status==="completed"||e.progress===100,Ze={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Je=h&&e.isCriticalPath||O?"#EF4444":e.color?e.color:e.priority&&Ze[e.priority]?Ze[e.priority]:n.taskBarPrimary,Bt=v?"default":$e?Nt?"crosshair":mt?"ew-resize":"grabbing":"grab",Tt=v?"default":"ew-resize",kt=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),tr=a<50,ur=a<40;useEffect(()=>{x&&(!Xe||$e||e.segments)&&x(null);},[Xe,$e,e.segments,x]);let da=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Gt=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},gr=V=>Math.round(V/s)*s,Rt=V=>{let be=Math.round(V/s),Z=new Date(o);return Z.setDate(Z.getDate()+be),Z},Kr=(V,be)=>{for(let Z of p){if(Z.id===e.id)continue;let $=5;if(V>=Z.x-$&&V<=Z.x+Z.width+$&&be>=Z.y-$&&be<=Z.y+Z.height+$)return Z.id}return null},Vt=useCallback((V,be,Z)=>{if(v)return;V.preventDefault(),V.stopPropagation();let $=E.current?.ownerSVGElement;if(!$)return;let te=$.createSVGPoint();te.x=V.clientX,te.y=V.clientY;let we=te.matrixTransform($.getScreenCTM()?.inverse()),T=Z!==void 0?Z:t,H=be;if(!H){let ue=we.x-T;V.shiftKey?(H="connect",B({x:t+a,y:r+Fe/2})):V.ctrlKey||V.metaKey?H="move":V.altKey?H=ue<a/2?"resize-start":"resize-end":ur?ue<a/2?H="move":H="resize-end":tr?ue<=kt/2?H="resize-start":ue>=a-kt/2?H="resize-end":H="move":ue<=kt?H="resize-start":ue>=a-kt?H="resize-end":H="move";}F.current=false,N(H),Be(false),me(null),H==="move"?U(we.x-T):H==="connect"?B({x:t+a,y:r+Fe/2}):U(0),I(T),j(a);},[t,a,r,Fe,v]),Jt=useCallback(V=>{let be=E.current?.ownerSVGElement;if(!be)return;let Z=be.closest(".gantt-timeline-scroll");if(!Z)return;let $=Z.getBoundingClientRect(),te=60,we=15,T=0;if(V.clientX<$.left+te){let H=$.left+te-V.clientX;T=-Math.min(we,H/2);}else if(V.clientX>$.right-te){let H=V.clientX-($.right-te);T=Math.min(we,H/2);}return T!==0&&(Z.scrollLeft+=T),T!==0},[]),Gr=useCallback(V=>{if(P==="none")return;F.current=true,S.current=V;let be=E.current?.ownerSVGElement;if(!be)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let te=Jt(V);te&&!k.current?k.current=window.setInterval(()=>{S.current&&(Jt(S.current),Gr(S.current));},16):!te&&k.current&&(window.clearInterval(k.current),k.current=null);}let Z=be.createSVGPoint();Z.x=V.clientX,Z.y=V.clientY;let $=Z.matrixTransform(be.getScreenCTM()?.inverse());if(P==="connect"){B({x:$.x,y:$.y});let te=Kr($.x,$.y);je(te);}else if(P==="move"){let te=$.x-K,we=gr(te);I(we),j(a);let T=Math.round((we-t)/s);if(g?.(e.id,T,true),e.segments&&e.segments.length>0&&xe!==null){let H=we-We;Ae(H);}}else if(P==="resize-start"){let te=$.x,we=gr(te),T=t+a-we;T>=s&&(I(we),j(T));}else if(P==="resize-end"){let te=$.x,T=gr(te)-t;T>=s&&j(T);}},[P,t,a,s,K,e,gr,xe,We,Kr,je,B,I,j,Ae,g,Jt]),ua=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),S.current=null,P!=="none"){if(P==="connect")ve&&u&&u(e,ve),B(null),je(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),be,Z,$=true;if(P==="move"){if(be=Rt(ae),Z=new Date(be.getTime()+V),e.segments&&e.segments.length>0&&xe!==null){let te=Math.round(Re/s),we=e.segments.map((q,ke)=>{if(ke===xe){let st=new Date(q.startDate),re=new Date(q.endDate);return st.setDate(st.getDate()+te),re.setDate(re.getDate()+te),{startDate:st,endDate:re}}return q}),T=we.flatMap(q=>[q.startDate,q.endDate]),H=new Date(Math.min(...T.map(q=>q.getTime()))),ue=new Date(Math.max(...T.map(q=>q.getTime())));m?.({...e,segments:we},H,ue),ze(t,a);return}}else P==="resize-start"?(be=Rt(ae),Z=e.endDate,be>Z&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(be=e.startDate,Z=Rt(ae+_),Z.setDate(Z.getDate()-1),Z<be&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&be&&Z&&(Z.getTime()<be.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,be,Z));}g?.(e.id,0,false),ze(t,a);}},[P,ae,_,e,m,ve,u,t,a,s,Rt,Re,xe,ze,g]);useEffect(()=>{if(P==="none")return;let V=Z=>{Gr(Z);},be=()=>{ua();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",be),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",be),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,Gr,ua]);let tt=$e&&!Nt?ae:t,_e=$e&&!Nt?_:a,ga=c.taskClass(e),sr=24,Zr=h?e.isCriticalPath?1:.25:1,fr=useCallback(V=>{if(!J)return;V.stopPropagation(),V.preventDefault();let Z=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:Z,initialPct:e.progress||0},V.currentTarget.setPointerCapture(V.pointerId),R(e.progress||0);},[J,e.progress,R]),wa=useCallback(V=>{let be=L.current;if(!be)return;let $=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??be.barRect;if(!$||$.width<=0)return;let te=(V.clientX-$.left)/$.width,we=Math.round(Math.max(0,Math.min(1,te))*100);V.shiftKey&&(we=Math.round(we/25)*25),R(we);},[R]),le=useCallback(V=>{let be=L.current;if(!be)return;V.stopPropagation(),V.preventDefault();try{V.currentTarget.releasePointerCapture(V.pointerId);}catch{}let Z=Q;L.current=null,R(null),Z!=null&&Z!==be.initialPct&&w&&w(e,Z);},[Q,w,e,R]),de=useCallback(V=>{V.stopPropagation(),V.preventDefault();},[]),dt=Q??(e.progress||0);return jsxs("g",{ref:E,"data-task-bar":"true",style:{opacity:Zr,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!F.current&&l?.(e),F.current=false;},onDoubleClick:V=>{!$e&&!F.current&&(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),d?.(e,V);},onMouseEnter:()=>!$e&&Be(true),onMouseMove:V=>{x&&Xe&&!$e&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Fe,showBelow:false,mouseX:V.clientX,mouseY:V.clientY});},onMouseLeave:()=>{$e||(Be(false),me(null));},children:[jsx("rect",{x:t,y:r,width:a+sr,height:Fe,fill:"transparent",style:{pointerEvents:"all"}}),Xe&&!$e&&!tr&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:kt,height:Fe,fill:Pe==="resize-start"?n.accent:"transparent",opacity:Pe==="resize-start"?.15:0,style:{cursor:Tt,pointerEvents:"all"},onMouseEnter:()=>me("resize-start"),onMouseDown:V=>Vt(V,"resize-start")}),jsx("rect",{x:t+kt,y:r,width:a-kt*2,height:Fe,fill:Pe==="move"?n.accent:"transparent",opacity:Pe==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>me("move"),onMouseDown:V=>Vt(V,"move")}),jsx("rect",{x:t+a-kt,y:r,width:kt,height:Fe,fill:Pe==="resize-end"?n.accent:"transparent",opacity:Pe==="resize-end"?.15:0,style:{cursor:Tt,pointerEvents:"all"},onMouseEnter:()=>me("resize-end"),onMouseDown:V=>Vt(V,"resize-end")})]}),Xe&&!$e&&ur&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Fe,fill:Pe==="move"?n.accent:"transparent",opacity:Pe==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>me("move"),onMouseDown:V=>Vt(V,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Fe,fill:Pe==="resize-end"?n.accent:"transparent",opacity:Pe==="resize-end"?.2:0,style:{cursor:Tt,pointerEvents:"all"},onMouseEnter:()=>me("resize-end"),onMouseDown:V=>Vt(V,"resize-end")}),Xe&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Fe-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!Nt&&!e.segments&&jsx(motion.rect,{x:ae,y:r,width:_,height:Fe,rx:Ie,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let V=e.baselineStartDate.getTime(),be=e.baselineEndDate.getTime(),Z=o.getTime(),$=864e5,te=(V-Z)/$,we=(be-V)/$,T=te*s,H=Math.max(we*s,s),ue=tt+_e,q=T+H,ke=e.endDate?.getTime()??0,st=Math.ceil((ke-be)/$),re=st>0,it=st<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:T,y:r,width:H,height:Fe,rx:Ie,fill:"none",stroke:It?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),re&&ue>q&&jsx("rect",{x:q,y:r,width:ue-q,height:Fe,rx:0,fill:"#EF4444",opacity:.2}),re&&jsxs("text",{x:Math.max(ue,q)+6,y:r+Fe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",st,"d"]}),it&&jsxs("text",{x:ue+6,y:r+Fe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[st,"d"]})]})})(),!e.segments&&nt&&ot&&(()=>{let be=r+(Fe-8)/2,Z=4,$=e.progress||0,te=new Date;te.setHours(0,0,0,0);let we=e.startDate&&te>=e.startDate,T=e.endDate&&(()=>{let re=new Date(e.endDate);return re.setHours(0,0,0,0),te>re})(),H=e.startDate&&te<e.startDate,ue=1;if(we&&e.startDate&&e.endDate&&!H){let re=new Date(e.startDate);re.setHours(0,0,0,0);let it=new Date(e.endDate);it.setHours(0,0,0,0);let pt=Math.max(1,(it.getTime()-re.getTime())/(1e3*60*60*24)),br=Math.min((te.getTime()-re.getTime())/(1e3*60*60*24),pt)/pt*100;ue=br>0?$/br:1;}let q;$>=100?q="#00E5CC":H?q="#4B5563":T&&$<100?q="#EF4444":ue>=.95?q="#22C55E":ue>=.8?q="#F59E0B":q="#EF4444";let ke=Math.max($/100*_e,$>0?Z*2:0),st=_e>100&&$>0;return jsxs("g",{"data-task-class":ga,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:tt,y:be,width:_e,height:8,rx:Z,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:tt,y:be,width:ke,height:8,rx:Z,fill:q}),st&&jsxs("text",{x:tt+ke+6,y:be+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($),"%"]})]})})(),!e.segments&&nt&&!ot&&jsx(motion.rect,{x:tt,y:r,width:_e,height:Fe,rx:Ie,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ga,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Nt?.15:e.parentId?.6:1,scale:Xe&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>Vt(V),style:{cursor:Bt,pointerEvents:"all"}}),!e.segments&&!nt&&jsx(motion.rect,{x:tt,y:r,width:_e,height:Fe,rx:Ie,fill:Je,"data-task-class":ga,initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Nt?.15:e.parentId?.6:Xe?.9:.8,scale:Xe&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ot?void 0:V=>Vt(V),style:{cursor:ot?"default":Bt,pointerEvents:"all"}}),nt&&(O||Y)&&!e.segments&&jsx("rect",{x:tt,y:r,width:_e,height:Fe,rx:Ie,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&dt>0&&!ot&&jsx("rect",{x:tt,y:r,width:Math.max(_e*(dt/100),Ie*2),height:Fe,rx:Ie,fill:Je,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!ot&&e.progress<100&&(()=>{let V=e.progress>0?_e*(e.progress/100):0,be=tt+V,Z=_e-V,$=e.progress===0?Ie:0,te=e.progress===0?tt:be,we=e.progress===0?_e:Z;return jsxs(Fragment,{children:[jsx("rect",{x:te,y:r,width:we,height:Fe,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:te,y:r,width:we,height:Fe,rx:$,fill:"none",stroke:Je,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),nt&&!e.segments&&e.progress>0&&e.progress<100&&!ot&&!$e&&Q===null&&(()=>{let V=tt+_e*(e.progress/100),be=8,Z=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:V,cy:r+Fe/2,r:be,fill:Z?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:V,y:r+Fe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Z?.initials||Z?.name?.charAt(0)?.toUpperCase()||""})]})})(),J&&!$e&&_e>=40&&(Q!==null||dt<88)&&(()=>{let V=tt+_e*(dt/100),be=r+Fe/2,Z=Q!==null,$=Z?7:Xe?6:5,te=Z||Xe?1:.35,we=tt+_e-V,T=Math.max(4,Math.min(12,we-10)),H=12;return jsxs("g",{children:[jsx("rect",{x:V-H,y:be-12,width:H+T,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:fr,onPointerMove:wa,onPointerUp:le,onPointerCancel:le,onClick:de,onDoubleClick:de,onMouseDown:ue=>ue.stopPropagation()}),jsx("circle",{cx:V,cy:be,r:$,fill:"#FFFFFF",stroke:Je,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:Z?`drop-shadow(0 0 4px ${Je})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:V-20,y:be-28,width:40,height:18,rx:4,fill:It?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Je,strokeWidth:1}),jsxs("text",{x:V,y:be-16,textAnchor:"middle",dominantBaseline:"central",fill:It?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[Q,"%"]})]})]})})(),e.segments&&e.segments.map((V,be)=>{let Z=(V.startDate.getTime()-o.getTime())/864e5*s,te=(V.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Z+s,we=$e&&P==="move"&&xe===be,T=Ye===be,H=we?Z+Re:Z;return jsxs("g",{onMouseEnter:()=>!$e&&se(be),onMouseLeave:()=>!$e&&se(null),children:[jsx(motion.rect,{x:H,y:r,width:te,height:Fe,rx:Ie,fill:Je,initial:{opacity:0,scale:.95},animate:{opacity:we||e.parentId?.6:T?.9:.8,scale:T&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>{ue.stopPropagation(),he(be),Se(Z),Vt(ue,void 0,Z);},style:{cursor:Bt,pointerEvents:"all"}}),jsx("rect",{x:H,y:r,width:te*(e.progress/100),height:Fe,rx:Ie,fill:Je,opacity:1,style:{pointerEvents:"none"}})]},`segment-${be}`)}),Te&&(O||Y)&&!e.segments&&jsxs(Fragment,{children:[Y&&!O&&jsx("rect",{x:tt,y:r,width:_e,height:Fe,rx:Ie,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),O&&jsx("rect",{x:tt,y:r,width:_e,height:Fe,rx:Ie,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&_e>60&&!e.segments&&!(nt&&ot)&&(()=>{let V=c.taskLabel(e),be=typeof V=="string"?V:e.name,Z=be.length>Math.floor(_e/8)?`${be.substring(0,Math.floor(_e/8))}...`:be;return jsx("text",{x:tt+8,y:r+Fe/2,dominantBaseline:"middle",fill:ge?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ge?"line-through":"none"},children:Z})})(),!$e&&!e.segments&&!ot&&e.progress>0&&e.progress<100&&(nt?jsxs("text",{x:tt+_e+6,y:r+Fe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):_e>100?jsxs("text",{x:tt+_e-12,y:r+Fe/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&&_e>80&&!$e&&!e.segments&&!(nt&&ot)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:tt+_e-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:tt+_e-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Xe||mt)&&!Nt&&!e.segments&&!ot&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:tt-2,y:r,width:16,height:Fe,fill:"transparent",style:{cursor:Tt},onMouseEnter:()=>me("resize-start"),onMouseLeave:()=>me(null),onMouseDown:V=>{V.stopPropagation(),Vt(V,"resize-start");}}),jsx(motion.rect,{x:tt+4,y:r+8,width:3,height:Fe-16,rx:1.5,fill:Pe==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:tt+_e-14,y:r,width:16,height:Fe,fill:"transparent",style:{cursor:Tt},onMouseEnter:()=>me("resize-end"),onMouseLeave:()=>me(null),onMouseDown:V=>{V.stopPropagation(),Vt(V,"resize-end");}}),jsx(motion.rect,{x:tt+_e-7,y:r+8,width:3,height:Fe-16,rx:1.5,fill:Pe==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Xe&&!$e&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Fe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>me("connect"),onMouseLeave:()=>me(null),onMouseDown:V=>{V.stopPropagation(),Vt(V,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Fe/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Pe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Nt&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Fe/2,x2:W.x,y2:W.y,stroke:ve?n.statusCompleted:n.accent,strokeWidth:ve?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ve?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:ve?8:6,fill:ve?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ve&&jsx(motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(Xe||$e)&&!Nt&&!e.segments&&jsx(motion.rect,{x:tt-1,y:r-1,width:_e+2,height:Fe+2,rx:Ie+1,fill:"none",stroke:$e?n.accent:nt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:nt?1:2,opacity:$e||nt?.6:.4,initial:{opacity:0},animate:{opacity:$e||nt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),mt&&jsxs(Fragment,{children:[jsx("line",{x1:ae,y1:0,x2:ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ae+_,y1:0,x2:ae+_,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Xe&&!$e&&!e.segments&&!x&&(()=>{let Z=r<100,$=Z?r+Fe+13:r-82-13,te=Z?`M ${tt+_e/2-6} ${r+Fe+3} L ${tt+_e/2} ${r+Fe+13} L ${tt+_e/2+6} ${r+Fe+3}`:`M ${tt+_e/2-6} ${r-13} L ${tt+_e/2} ${r-3} L ${tt+_e/2+6} ${r-13}`,we=$+22,T=$+40,H=$+55,ue=$+70,q=Z?$+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:Z?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Z?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:tt+_e/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:tt+_e/2,y:we,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:tt+_e/2-110,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:tt+_e/2-70,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.startDate)}),jsx("text",{x:tt+_e/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:tt+_e/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.endDate)}),jsx("text",{x:tt+_e/2+10,y:T,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:tt+_e/2+65,y:T,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Gt()}),jsx("text",{x:tt+_e/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:tt+_e/2+65,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:tt+_e/2-110,y:ue,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:tt+_e/2-50,y:ue,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ke=>ke.name).join(", ").substring(0,30),e.assignees.map(ke=>ke.name).join(", ").length>30?"...":""]})]}),!Z&&jsx("text",{x:tt+_e/2,y:q,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ur?"Left: move \u2022 Right: resize":tr?"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 sd=260,ls=8,Wm=16,aw=-12;function zm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:C}=e,E=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,k=(E?155:105)+(F?28:0),S=w+Wm,P=C+aw-k;S+sd>window.innerWidth-ls&&(S=w-sd-Wm),S<ls&&(S=ls);let N=P<ls;N&&(P=C+20),P+k>window.innerHeight-ls&&(P=window.innerHeight-ls-k),s({left:S,top:P,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),C=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,E=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=k.getTime();){let P=F.getDay();v[P]&&!w.has(C(F))&&E++,F.setDate(F.getDate()+1);}let S=Math.max(0,E);return r==="es"?`${S} d\xEDa${S!==1?"s":""}`:`${S} day${S!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),C=v%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:sd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.duration,value:d(),labelColor:u,valueColor:p}),jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:u},children:[l.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),c&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:u},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(h,document.body)}function Qi({label:e,value:t,labelColor:r,valueColor:a}){return jsxs("div",{children:[jsxs("span",{style:{color:r},children:[e,": "]}),jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Ks({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:c=false,onHoverChange:l,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=
|
|
130
|
+
`})]});return createPortal(h,document.body)}function Qi({label:e,value:t,labelColor:r,valueColor:a}){return jsxs("div",{children:[jsxs("span",{style:{color:r},children:[e,": "]}),jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Ks({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:c=false,onHoverChange:l,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:m,glowFilter:u}){let[,p]=useState(false),[g,x]=useState(null),y=a-t,b=y>0,h=Math.abs(y)<5,v=20,w=!h&&r<=e,C,E,F=r-e,k=e+F/2;E=k;let S=8;if(o==="squared")if(h)C=`M ${e} ${t} L ${r} ${a}`;else if(w){let Se=e+15,Re=r-v,Ae=b?t+20:t-20;E=Re;let Ye=b?1:-1;C=`M ${e} ${t} L ${Se-S} ${t} Q ${Se} ${t} ${Se} ${t+Ye*S} L ${Se} ${Ae-Ye*S} Q ${Se} ${Ae} ${Se-S} ${Ae} L ${Re+S} ${Ae} Q ${Re} ${Ae} ${Re} ${Ae+Ye*S} L ${Re} ${a-Ye*S} Q ${Re} ${a} ${Re+S} ${a} L ${r} ${a}`;}else {E=r-v;let We=b?1:-1;C=`M ${e} ${t} L ${E-S} ${t} Q ${E} ${t} ${E} ${t+We*S} L ${E} ${a-We*S} Q ${E} ${a} ${E+S} ${a} L ${r} ${a}`;}else C=`M ${e} ${t} C ${k} ${t}, ${k} ${a}, ${r} ${a}`;let P=6,N=5,K=`M ${r} ${a} L ${r-P} ${a-N/2} L ${r-P} ${a+N/2} Z`,U=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ae=d||(U?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),I=m||1,_=n.dependencyHover||(U?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),j="#f87171",W="rgba(248, 113, 113, 0.15)",B=E,ve=(t+a)/2;if(g)if(o==="squared")if(h)B=Math.max(e+10,Math.min(r-10,g.x)),ve=t;else if(w){let We=e+15,Se=r-v,Re=b?t+20:t-20,Ae=[[e,t,We,t],[We,t,We,Re],[We,Re,Se,Re],[Se,Re,Se,a],[Se,a,r,a]],Ye=1/0,se={x:B,y:ve};for(let Xe of Ae){let Be=je(g.x,g.y,Xe[0],Xe[1],Xe[2],Xe[3]),$e=Math.hypot(g.x-Be.x,g.y-Be.y);$e<Ye&&(Ye=$e,se=Be);}B=se.x,ve=se.y;}else {let We=[[e,t,E,t],[E,t,E,a],[E,a,r,a]],Se=1/0,Re={x:B,y:ve};for(let Ae of We){let Ye=je(g.x,g.y,Ae[0],Ae[1],Ae[2],Ae[3]),se=Math.hypot(g.x-Ye.x,g.y-Ye.y);se<Se&&(Se=se,Re=Ye);}B=Re.x,ve=Re.y;}else {let We=k,Se=t,Re=k,Ae=a,Ye=1/0,se=B,Xe=ve;for(let Be=0;Be<=1;Be+=.02){let $e=1-Be,mt=$e*$e*$e*e+3*$e*$e*Be*We+3*$e*Be*Be*Re+Be*Be*Be*r,Nt=$e*$e*$e*t+3*$e*$e*Be*Se+3*$e*Be*Be*Ae+Be*Be*Be*a,ze=Math.hypot(g.x-mt,g.y-Nt);ze<Ye&&(Ye=ze,se=mt,Xe=Nt);}B=se,ve=Xe;}function je(We,Se,Re,Ae,Ye,se){let Xe=Ye-Re,Be=se-Ae,$e=Xe*Xe+Be*Be;if($e===0)return {x:Re,y:Ae};let mt=((We-Re)*Xe+(Se-Ae)*Be)/$e;return mt=Math.max(0,Math.min(1,mt)),{x:Re+mt*Xe,y:Ae+mt*Be}}let Pe=We=>{let Se=We.currentTarget.ownerSVGElement;if(!Se)return;let Re=Se.getScreenCTM();if(!Re)return;let Ae=Re.inverse();x({x:Ae.a*We.clientX+Ae.c*We.clientY+Ae.e,y:Ae.b*We.clientX+Ae.d*We.clientY+Ae.f});},me=()=>{p(false),x(null),l?.(false);},xe=()=>{p(true),l?.(true);},he=We=>s?jsxs(motion.g,{initial:We,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:B,cy:ve,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:B,cy:ve,r:9,fill:W,stroke:j,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:B-3,y1:ve-3,x2:B+3,y2:ve+3,stroke:j,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:B+3,y1:ve-3,x2:B-3,y2:ve+3,stroke:j,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return c?jsxs("g",{"data-dependency-line":"true",onMouseLeave:me,onMouseMove:Pe,children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:C,fill:"none",stroke:_,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:C,fill:"none",stroke:_,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:_,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:r,cy:a,r:4,fill:_,opacity:.9,style:{pointerEvents:"none"}}),he({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:xe,onMouseLeave:me,onMouseMove:Pe,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:_,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:_,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:_,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:r,cy:a,r:3.5,fill:_,style:{pointerEvents:"none"}}),he({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:xe,onMouseLeave:me,onMouseMove:Pe,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:C,fill:"none",stroke:ae,strokeWidth:I,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:u||"none"}}),jsx(motion.path,{d:K,fill:ae,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:r,cy:a,r:3,fill:ae,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function rl({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=useState(false),c=16,l=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var De={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,c=new Set,l=i=>{if(!o.has(i)){o.add(i),c.add(i);let d=a.get(i)||[];for(let m of d){if(!o.has(m)&&l(m))return true;if(c.has(m))return true}}return c.delete(i),false};return l(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=De.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=De.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=De.findTaskById(e,n);if(s)r.unshift(s),n=s.parentId;else break}return r},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=De.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(s.join(","));}),a.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=De.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=De.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>De.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=De.findTaskById(e,t);return !r||!r.dependencies?[]:De.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>De.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=De.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let s=t[n];if(!r||s===void 0||s>=r.length||(a=r[s],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>De.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,s=De.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(l=>{let i=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0;return [l.name,l.startDate?De.formatDate(l.startDate):"N/A",l.endDate?De.formatDate(l.endDate):"N/A",i>0?`${i} days`:"N/A",`${l.progress}%`,l.status||"N/A"]});a(n,{head:o,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t,r)=>{let a=await import('xlsx'),n=De.flattenTasks(e),s=r?.rateMap,o=r?.defaultRate||0,c=y=>{if(!s||!y.assignees||y.assignees.length===0)return o;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?o:b.reduce((h,v)=>h+v,0)/b.length},l=new Map,i=(y,b="")=>{[...y].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let C=b?`${b}.${w+1}`:`${w+1}`;l.set(v.id,C),v.subtasks?.length&&i(v.subtasks,C);});};i(e);let d=s&&Object.keys(s).length>0||n.some(y=>y._costRate>0),m=n.map(y=>{let b=y.startDate&&y.endDate?De.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,w=y.soldEffortMinutes,C=typeof h=="number"?+(h/60).toFixed(1):0,E=typeof v=="number"?+(v/60).toFixed(1):0,F=typeof w=="number"?+(w/60).toFixed(1):0,k=y._costRate>0?y._costRate:c(y),S={WBS:l.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?De.formatDate(y.startDate):"","End Date":y.endDate?De.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(N=>N.name).join(", ")||"","Estimated (h)":C||"","Logged (h)":E||"","Quoted (h)":F||""};d&&(S["$ Estimated"]=C>0&&k>0?Math.round(C*k):"",S["$ Executed"]=E>0&&k>0?Math.round(E*k):"",S["$ Quoted"]=F>0&&k>0?Math.round(F*k):"",S["Rate ($/h)"]=k>0?k:"");let P=y.weight;return S["Weight (%)"]=typeof P=="number"&&P>0?P:"",S["Is Milestone"]=y.isMilestone?"Yes":"No",S}),u=r?.projectName||"";if(u||m.length>0){let y=0,b=0,h=0,v=0,w=0,C=0,E=0,F=0,k=n.filter(N=>N.startDate).map(N=>N.startDate.getTime()),S=n.filter(N=>N.endDate).map(N=>N.endDate.getTime());for(let N of m)typeof N["Estimated (h)"]=="number"&&(y+=N["Estimated (h)"]),typeof N["Logged (h)"]=="number"&&(b+=N["Logged (h)"]),typeof N["Quoted (h)"]=="number"&&(h+=N["Quoted (h)"]),d&&(typeof N["$ Estimated"]=="number"&&(v+=N["$ Estimated"]),typeof N["$ Executed"]=="number"&&(w+=N["$ Executed"]),typeof N["$ Quoted"]=="number"&&(C+=N["$ Quoted"])),typeof N["Progress (%)"]=="number"&&(E+=N["Progress (%)"],F++);let P={WBS:"0","Task Name":`\u{1F4CB} ${u||"PROJECT TOTAL"}`,"Start Date":k.length>0?De.formatDate(new Date(Math.min(...k))):"","End Date":S.length>0?De.formatDate(new Date(Math.max(...S))):"","Duration (days)":k.length>0&&S.length>0?De.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...S))):"","Progress (%)":F>0?Math.round(E/F):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};d&&(P["$ Estimated"]=v||"",P["$ Executed"]=w||"",P["$ Quoted"]=C||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",m.unshift(P);}let p=a.utils.json_to_sheet(m),g=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...d?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];p["!cols"]=g;let x=a.utils.book_new();if(a.utils.book_append_sheet(x,p,"Gantt Tasks"),!t){let y=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}a.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=De.flattenTasks(e),n=new Map;a.forEach((u,p)=>{n.set(u.id,p+1);});let s=u=>u.toISOString().replace("Z",""),o=De.getEarliestStartDate(e)||new Date,c=De.getLatestEndDate(e)||new Date,l=a.map((u,p)=>{let g=n.get(u.id),x=u.startDate&&u.endDate?De.calculateDuration(u.startDate,u.endDate):0,y=(u.dependencies||[]).filter(b=>n.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${n.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -138,37 +138,37 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
138
138
|
</PredecessorLink>`).join("");return `
|
|
139
139
|
<Task>
|
|
140
140
|
<UID>${g}</UID>
|
|
141
|
-
<ID>${
|
|
142
|
-
<Name>${
|
|
141
|
+
<ID>${p+1}</ID>
|
|
142
|
+
<Name>${u.name.replace(/[<>&'"]/g,b=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[b]||b)}</Name>
|
|
143
143
|
<Type>0</Type>
|
|
144
144
|
<IsNull>0</IsNull>
|
|
145
145
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
146
|
-
<WBS>${
|
|
147
|
-
<OutlineNumber>${
|
|
148
|
-
<OutlineLevel>${
|
|
146
|
+
<WBS>${p+1}</WBS>
|
|
147
|
+
<OutlineNumber>${p+1}</OutlineNumber>
|
|
148
|
+
<OutlineLevel>${u.level||0}</OutlineLevel>
|
|
149
149
|
<Priority>500</Priority>
|
|
150
|
-
<Start>${
|
|
151
|
-
<Finish>${
|
|
150
|
+
<Start>${u.startDate?s(u.startDate):""}</Start>
|
|
151
|
+
<Finish>${u.endDate?s(u.endDate):""}</Finish>
|
|
152
152
|
<Duration>PT${x*8}H0M0S</Duration>
|
|
153
153
|
<DurationFormat>7</DurationFormat>
|
|
154
154
|
<Work>PT${x*8}H0M0S</Work>
|
|
155
|
-
<Stop>${
|
|
156
|
-
<Resume>${
|
|
155
|
+
<Stop>${u.endDate?s(u.endDate):""}</Stop>
|
|
156
|
+
<Resume>${u.startDate?s(u.startDate):""}</Resume>
|
|
157
157
|
<ResumeValid>0</ResumeValid>
|
|
158
158
|
<EffortDriven>1</EffortDriven>
|
|
159
159
|
<Recurring>0</Recurring>
|
|
160
160
|
<OverAllocated>0</OverAllocated>
|
|
161
161
|
<Estimated>0</Estimated>
|
|
162
|
-
<Milestone>${
|
|
163
|
-
<Summary>${
|
|
164
|
-
<Critical>${
|
|
162
|
+
<Milestone>${u.isMilestone?"1":"0"}</Milestone>
|
|
163
|
+
<Summary>${u.subtasks&&u.subtasks.length>0?"1":"0"}</Summary>
|
|
164
|
+
<Critical>${u.isCriticalPath?"1":"0"}</Critical>
|
|
165
165
|
<IsSubproject>0</IsSubproject>
|
|
166
166
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
167
167
|
<ExternalTask>0</ExternalTask>
|
|
168
|
-
<EarlyStart>${
|
|
169
|
-
<EarlyFinish>${
|
|
170
|
-
<LateStart>${
|
|
171
|
-
<LateFinish>${
|
|
168
|
+
<EarlyStart>${u.startDate?s(u.startDate):""}</EarlyStart>
|
|
169
|
+
<EarlyFinish>${u.endDate?s(u.endDate):""}</EarlyFinish>
|
|
170
|
+
<LateStart>${u.startDate?s(u.startDate):""}</LateStart>
|
|
171
|
+
<LateFinish>${u.endDate?s(u.endDate):""}</LateFinish>
|
|
172
172
|
<StartVariance>0</StartVariance>
|
|
173
173
|
<FinishVariance>0</FinishVariance>
|
|
174
174
|
<WorkVariance>0</WorkVariance>
|
|
@@ -176,22 +176,22 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
176
176
|
<TotalSlack>0</TotalSlack>
|
|
177
177
|
<FixedCost>0</FixedCost>
|
|
178
178
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
179
|
-
<PercentComplete>${
|
|
180
|
-
<PercentWorkComplete>${
|
|
179
|
+
<PercentComplete>${u.progress}</PercentComplete>
|
|
180
|
+
<PercentWorkComplete>${u.progress}</PercentWorkComplete>
|
|
181
181
|
<Cost>0</Cost>
|
|
182
182
|
<OvertimeCost>0</OvertimeCost>
|
|
183
183
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
184
|
-
<ActualStart>${
|
|
185
|
-
<ActualFinish>${
|
|
186
|
-
<ActualDuration>PT${Math.round(x*
|
|
184
|
+
<ActualStart>${u.progress>0&&u.startDate?s(u.startDate):""}</ActualStart>
|
|
185
|
+
<ActualFinish>${u.progress===100&&u.endDate?s(u.endDate):""}</ActualFinish>
|
|
186
|
+
<ActualDuration>PT${Math.round(x*u.progress/100)*8}H0M0S</ActualDuration>
|
|
187
187
|
<ActualCost>0</ActualCost>
|
|
188
188
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
189
|
-
<ActualWork>PT${Math.round(x*
|
|
189
|
+
<ActualWork>PT${Math.round(x*u.progress/100)*8}H0M0S</ActualWork>
|
|
190
190
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
191
191
|
<RegularWork>PT${x*8}H0M0S</RegularWork>
|
|
192
|
-
<RemainingDuration>PT${Math.round(x*(100-
|
|
192
|
+
<RemainingDuration>PT${Math.round(x*(100-u.progress)/100)*8}H0M0S</RemainingDuration>
|
|
193
193
|
<RemainingCost>0</RemainingCost>
|
|
194
|
-
<RemainingWork>PT${Math.round(x*(100-
|
|
194
|
+
<RemainingWork>PT${Math.round(x*(100-u.progress)/100)*8}H0M0S</RemainingWork>
|
|
195
195
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
196
196
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
197
197
|
<ACWP>0</ACWP>
|
|
@@ -214,8 +214,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
214
214
|
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
215
215
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
216
216
|
<SaveVersion>14</SaveVersion>
|
|
217
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
218
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
217
|
+
<Name>${t.replace(/[<>&'"]/g,u=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[u]||u)}</Name>
|
|
218
|
+
<Title>${t.replace(/[<>&'"]/g,u=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[u]||u)}</Title>
|
|
219
219
|
<CreationDate>${s(new Date)}</CreationDate>
|
|
220
220
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
221
221
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${l}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(d),u.download=r,u.click(),URL.revokeObjectURL(u.href);},calculateCriticalPath:e=>{let t=Ce.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let d=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,u=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let g=t.find(x=>x.id===m);if(g){n(g);let x=a.get(m)?.ef||0;u=Math.max(u,x);}}let p=u+d;a.set(i.id,{es:u,ef:p});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,c=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,u=t.filter(g=>g.dependencies&&g.dependencies.includes(i.id)),p=s;if(u.length>0)for(let g of u){c(g);let x=o.get(g.id)?.ls||0;p=Math.min(p,x);}let m=p-d;o.set(i.id,{ls:m,lf:p});};r.forEach(c);let l=[];for(let i of r){let d=a.get(i.id),u=o.get(i.id);if(d&&u){let p=u.ls-d.es;Math.abs(p)<.01&&l.push(i.id);}}return l},calculateCriticalPathFull:e=>{let t=new Map,a=Ce.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(a.length===0)return t;let n=new Map(a.map(p=>[p.id,p])),s=new Map;for(let p of a)s.has(p.id)||s.set(p.id,[]);for(let p of a)if(p.dependencies){for(let m of p.dependencies)if(n.has(m)){let g=s.get(m);g&&g.push(p.id);}}let o=new Map;for(let p of a)o.set(p.id,0);for(let p of a)if(p.dependencies)for(let m of p.dependencies)n.has(m)&&o.set(p.id,(o.get(p.id)||0)+1);let c=new Map,l=[],i=[];for(let p of a)(o.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();l.push(p);let m=n.get(p);if(!m||!m.startDate||!m.endDate)continue;let g=Ce.calculateDuration(m.startDate,m.endDate),x=0;if(m.dependencies)for(let b of m.dependencies){let h=c.get(b);h&&(x=Math.max(x,h.ef));}c.set(p,{es:x,ef:x+g});let y=s.get(p)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(l.length<a.length)return t;let d=Math.max(...Array.from(c.values()).map(p=>p.ef)),u=new Map;for(let p=l.length-1;p>=0;p--){let m=l[p];if(!m)continue;let g=n.get(m);if(!g||!g.startDate||!g.endDate)continue;let x=Ce.calculateDuration(g.startDate,g.endDate),y=s.get(m)||[],b=d;if(y.length>0)for(let h of y){let v=u.get(h);v&&(b=Math.min(b,v.ls));}u.set(m,{ls:b-x,lf:b});}for(let p of l){let m=c.get(p),g=u.get(p),x=g.ls-m.es,y=s.get(p)||[],b;y.length>0?b=Math.min(...y.map(h=>c.get(h).es))-m.ef:b=d-m.ef,t.set(p,{earlyStart:m.es,earlyFinish:m.ef,lateStart:g.ls,lateFinish:g.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Ce.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Ce.calculateCriticalPath(e).includes(t))return 0;let n=Ce.getDependentTasks(e,t);if(n.length===0){let c=Ce.getLatestEndDate(e);if(!c)return null;let l=Ce.calculateDuration(r.endDate,c);return Math.max(0,l)}let s=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!s)return null;let o=Ce.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ce.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Ce.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ce.getDependentTasks(e,t);if(o.length===0)return e;let c=[...e];for(let l of o){if(n.has(l.id)||!l.startDate||!l.endDate)continue;let i=Ce.calculateDuration(l.startDate,l.endDate),d;if(r!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let m=new Date(s.endDate),g=new Date(m);g.setDate(g.getDate()+1),d<g&&(d=g);}let u=Ce.calculateEndDate(d,i),p=m=>m.map(g=>g.id===l.id?{...g,startDate:d,endDate:u}:g.subtasks?{...g,subtasks:p(g.subtasks)}:g);c=p(c),c=Ce.autoScheduleDependents(c,l.id,r,n);}return c},calculateCascadePreview:(e,t,r,a,n,s,o,c)=>{if(r===0)return [];let l=[],i=n.getTime(),d=1e3*60*60*24,u=Ce.findTaskById(e,t);if(!u||!u.endDate)return [];let p=(m,g,x=new Set)=>{if(x.has(m))return;x.add(m);let y=Ce.getDependentTasks(e,m);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=a.findIndex(N=>N.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),C=(b.endDate.getTime()-v)/d,L=(v-i)/d*s,k=L+g*s,S=Math.max(C*s,s),P=c+h*o+(o-18)/2;l.push({taskId:b.id,taskName:b.name,originalX:L,previewX:k,width:S,y:P,rowIndex:h,daysDelta:g,color:b.color}),p(b.id,g,x);}};return p(t,r),l},splitTask:(e,t,r,a=3)=>{let n=Ce.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:c}],i=d=>d.map(u=>u.id===n.id?{...u,endDate:c,segments:l}:u.subtasks?{...u,subtasks:i(u.subtasks)}:u);return i(e)}};function al({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:c="en",templates:l,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:u,onTaskDblClick:p,onTaskContextMenu:m,onTaskDateChange:g,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:C,onTaskProgressDrag:E,workingDaysConfig:L}){let S=_a(),P=useRef(null),[N,K]=useState([]),[H,Q]=useState(null),[I,q]=useState(null),[j,U]=useState(null),B=useRef(false),[we,Ge]=useState(new Set),[Pe,be]=useState(null),ve=useCallback(R=>{if(j&&!B.current){let X=R.target,O=false;for(;X&&X!==R.currentTarget;){if(X.getAttribute?.("data-dependency-line")==="true"||X.getAttribute?.("data-dependency-hover-overlay")==="true"){O=true;break}X=X.parentElement;}O||U(null);}},[j]),he=useCallback(R=>{q(R);},[]),Oe=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=a==="day"?60:a==="week"?20:8,Fe=Oe*Se*o,He=R=>{let X=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),O=X.getUTCDay()||7;X.setUTCDate(X.getUTCDate()+4-O);let J=new Date(Date.UTC(X.getUTCFullYear(),0,1));return Math.ceil(((X.getTime()-J.getTime())/864e5+1)/7)},Be=R=>{let X=R.getDay();return X===0||X===6},ue=useMemo(()=>{let R=L?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[L?.holidayDates]),Ke=R=>{if(!ue)return false;let X=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return ue.has(X)},ze=useCallback(R=>{let X=Math.round(R/(Se*o)),O=new Date(n);return O.setDate(O.getDate()+X),O},[n,Se,o]),Ae=useCallback((R,X)=>{if(X.startDate&&X.endDate)return;let O=R.currentTarget.ownerSVGElement;if(!O)return;let J=O.createSVGPoint();J.x=R.clientX,J.y=R.clientY;let Te=J.matrixTransform(O.getScreenCTM()?.inverse()),me=ze(Te.x),tt=new Date(me);tt.setDate(tt.getDate()+1),be(null),g?.(X,me,tt);},[ze,g]),Tt=useCallback((R,X,O)=>{let J=R.currentTarget.ownerSVGElement;if(!J)return;let Te=J.createSVGPoint();Te.x=R.clientX,Te.y=R.clientY;let me=Te.matrixTransform(J.getScreenCTM()?.inverse()),tt=ze(me.x),Ye=Math.round(me.x/(Se*o))*Se*o;be({taskId:X.id,x:Ye,y:O*r+r/2,date:tt});},[ze,Se,o,r]),Nt=useCallback(()=>{be(null);},[]),Re=useMemo(()=>{let R=Te=>Te.map(me=>{if(me.subtasks&&me.subtasks.length>0){let tt=R(me.subtasks),ot=tt.filter(Ye=>Ye.startDate&&Ye.endDate);if(ot.length>0){let Ye=ot.map(Wt=>Wt.startDate.getTime()),$t=ot.map(Wt=>Wt.endDate.getTime()),Dt=new Date(Math.min(...Ye)),St=new Date(Math.max(...$t));return {...me,subtasks:tt,startDate:Dt,endDate:St}}return {...me,subtasks:tt}}return me}),X=(Te,me=[])=>{let tt=[...Te].sort((ot,Ye)=>(ot.position??0)-(Ye.position??0));for(let ot of tt)me.push(ot),ot.subtasks&&ot.subtasks.length>0&&(ot.isExpanded===void 0||ot.isExpanded)&&X(ot.subtasks,me);return me},O=R(e);return X(O)},[e]),Le=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let X=R.startDate.getTime(),O=R.endDate.getTime(),J=n.getTime(),Te=(X-J)/(1e3*60*60*24),me=(O-X)/(1e3*60*60*24)+1,tt=Te*Se*o,ot=Math.max(Se*o,40),Ye=Math.max(me*Se*o,ot);return {x:tt,width:Ye}},[n,Se,o]),ut=useMemo(()=>Re.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:X,width:O}=Le(R),Te=Re.findIndex(me=>me.id===R.id)*r+(r-18)/2;return {id:R.id,x:X,y:Te,width:O,height:18}}),[Re,Le]),Ct=useCallback((R,X,O)=>{if(!O){K([]),Q(null);return}if(Q({taskId:R,daysDelta:X}),X===0){K([]);return}let J=Ce.calculateCascadePreview(e,R,X,Re,n,Se*o,r,48);K(J);},[e,Re,n,Se,o,r,48]),Ie=useCallback((R,X)=>{if(!H)return X;let O=Se*o,J=H.daysDelta*O;if(R===H.taskId)return {x:X.x+J,width:X.width};let Te=N.find(me=>me.taskId===R);return Te?{x:Te.previewX,width:Te.width}:X},[H,N,Se,o]),lt=useMemo(()=>{let R=[],X=new Date(n);for(;X<=s;){let Te=(X.getTime()-n.getTime())/864e5*Se*o;if(a==="day")R.push({date:new Date(X),label:X.toLocaleDateString(c,{day:"numeric",month:"short"}),x:Te}),X.setDate(X.getDate()+1);else if(a==="week"){let me=He(X);R.push({date:new Date(X),label:`${S.labels.week} ${me}`,x:Te}),X.setDate(X.getDate()+7);}else R.push({date:new Date(X),label:X.toLocaleDateString(c,{month:"short",year:"numeric"}),x:Te}),X.setMonth(X.getMonth()+1);}return R},[n,s,a,Se,o,c,S.labels.week]),F=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),re=Math.max(Re.length*r,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(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}),lt.map((R,X)=>jsxs("g",{children:[X>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!Be(R.date)&&Ke(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${X}`)),F>=0&&F<=Fe&&jsxs("g",{children:[jsx("circle",{cx:F,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:F,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${F-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(Fe,1e3),height:re,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:ve,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:re,fill:t.bgPrimary}),Re.map((R,X)=>jsx("rect",{x:0,y:X*r,width:Math.max(Fe,1e3),height:r,fill:X%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),lt.map((R,X)=>X>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Re.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${X}`):null),lt.map((R,X)=>{let O=lt[X+1]?.x||Fe,J=w&&Be(R.date),Te=a==="day"&&!Be(R.date)&&Ke(R.date);return J||Te?jsxs("g",{children:[jsx("rect",{x:R.x,y:0,width:O-R.x,height:Re.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:O-R.x,height:Re.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${X}`):null}),Re.map((R,X)=>{let O=R.startDate&&R.endDate;return jsx("g",{children:!O&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:X*r,width:Fe,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:J=>Ae(J,R),onMouseMove:J=>Tt(J,R,X),onMouseLeave:()=>{Nt();}},`clickable-${R.id}`),Pe&&Pe.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:Pe.x,y1:X*r+4,x2:Pe.x,y2:X*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:Pe.x,cy:Pe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:Pe.x,cy:Pe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${Pe.x}, ${X*r-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Pe.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Pe||Pe.taskId!==R.id)&&jsx("text",{x:F>0?F:100,y:X*r+r/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-${R.id}`)]})},`row-group-${R.id}`)}),Re.map((R,X)=>{if(!R.startDate||!R.endDate)return null;let{x:O,width:J}=Le(R),Te=X*r+(r-18)/2,me=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(rl,{task:R,x:O+J/2,y:Te+12,theme:t,onClick:u},R.id);if(me){let tt=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ot=8,Ye=Te+(r-18)/2+(18-ot)/2,$t=4,Dt=R.progress||0,St=new Date;St.setHours(0,0,0,0);let Wt=R.startDate&&St>=R.startDate,rr=R.endDate&&(()=>{let _t=new Date(R.endDate);return _t.setHours(0,0,0,0),St>_t})(),gr=R.startDate&&St<R.startDate,ia=1;if(Wt&&R.startDate&&R.endDate&&!gr){let _t=new Date(R.startDate);_t.setHours(0,0,0,0);let la=new Date(R.endDate);la.setHours(0,0,0,0);let ta=Math.max(1,(la.getTime()-_t.getTime())/(1e3*60*60*24)),Je=Math.min((St.getTime()-_t.getTime())/(1e3*60*60*24),ta)/ta*100;ia=Je>0?Dt/Je:1;}let Yt;Dt>=100?Yt="#00E5CC":gr?Yt="#4B5563":rr&&Dt<100?Yt="#EF4444":ia>=.95?Yt="#22C55E":ia>=.8?Yt="#F59E0B":Yt="#EF4444";let fr=Math.max(Dt/100*J,Dt>0?$t*2:0),At=J>100&&Dt>0,qr=R.isCriticalPath;return jsxs("g",{onClick:()=>u?.(R),onContextMenu:_t=>{_t.preventDefault(),_t.stopPropagation(),m?.(R,_t);},onMouseMove:_t=>{he({task:R,x:O,y:Ye,width:J,height:ot,showBelow:Ye<100,mouseX:_t.clientX,mouseY:_t.clientY});},onMouseLeave:()=>he(null),style:{cursor:"default",opacity:h?qr?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:O,y:Te,width:J,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:O,y:Ye,width:J,height:ot,rx:$t,fill:tt?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Dt>0&&jsx("rect",{x:O,y:Ye,width:fr,height:ot,rx:$t,fill:Yt}),h&&qr&&jsx("rect",{x:O,y:Ye,width:J,height:ot,rx:$t,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),At&&jsxs("text",{x:O+fr+6,y:Ye+ot/2,dominantBaseline:"central",fill:tt?"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(Dt),"%"]})]},R.id)}return jsx(Ji,{task:R,x:O,y:Te,width:J,theme:t,dayWidth:Se*o,startDate:n,templates:l,onClick:u,onDoubleClick:p,onContextMenu:m,onDateChange:g,onDependencyCreate:x,allTaskPositions:ut,onDragMove:Ct,onHoverChange:he,showBaseline:b,showTaskBarLabels:d,showCriticalPath:h,readOnly:C?!C(R):false,onProgressChange:E},R.id)}),v&&Re.map((R,X)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(O=>{let J=Re.find(Yt=>Yt.id===O);if(!J||!J.startDate||!J.endDate)return null;let Te=Re.findIndex(Yt=>Yt.id===O),me=Ie(J.id,Le(J)),tt=Ie(R.id,Le(R)),ot=me.x+me.width,Ye=Te*r+26,$t=tt.x,Dt=X*r+26,St=`dep-${O}-${R.id}`;if(we.has(St))return null;let Wt=h&&R.isCriticalPath&&J.isCriticalPath;return jsx(Ks,{x1:ot,y1:Ye,x2:$t,y2:Dt,theme:t,lineStyle:i,colorOverride:h?Wt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?Wt?2:1:void 0,glowFilter:Wt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(R.id,O),onHoverChange:Yt=>{B.current=Yt,Yt&&U({key:St,fromId:O,toId:R.id,exitX:ot,exitY:Ye,enterX:$t,enterY:Dt});}},St)})),N.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&j&&jsx(Ks,{x1:j.exitX,y1:j.exitY,x2:j.enterX,y2:j.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=j.key;U(null),B.current=false,Ge(X=>new Set(X).add(R)),y?.(j.toId,j.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||U(null);}},`${j.key}-hover-overlay`),F>=0&&F<=Fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:F,y1:0,x2:F,y2:re,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:F,y1:0,x2:F,y2:re,stroke:t.today,strokeWidth:1,opacity:1})]})]}),I&&jsx(Wm,{tooltipData:I,theme:t,locale:c==="es"?"es":"en",workingDaysConfig:L})]})}var ow=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Vm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),sw=()=>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"})}),iw=()=>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"})}),lw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),cw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function sl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:c,onDependencyDelete:l}){let[i,d]=useState(false),[u,p]=useState(false),[m,g]=useState([]),[x,y]=useState(""),[b,h]=useState(false),[v,w]=useState(true),[C,E]=useState(""),[L,k]=useState(-1),[S,P]=useState(false),[N,K]=useState(0),H=useRef(null),Q=useRef(null),I=useRef(null),q=useRef(null),{enabled:j=true,placeholder:U='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:we,suggestions:Ge=ow,maxHistory:Pe=50,persistHistory:be,mentionableUsers:ve=[]}=r,he=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Oe=he?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=he?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Fe=he?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",He=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Be=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ue=he?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ke=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",ze=he?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ae=he?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Tt=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Nt=he?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Re=he?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Le=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ut=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Ct=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ie=he?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",lt=he?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",F=he?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",re=he?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=he?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",X="rgba(0, 229, 204, 0.04)",O=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",J=he?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Te=he?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",me=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",tt=he?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ot=he?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ye=he?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",$t=he?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Dt="rgba(0, 229, 204, 0.06)",St=he?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Wt=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",rr=he?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",gr=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ia=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Yt=he?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",fr=he?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",At=he?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",qr=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",jt=he?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",_t=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",la=he?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ta=he?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Xe=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Je=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",zr=be?.storageKey||"gantt-ai-history",Cr=be?.maxMessages??5,ir=ve.filter($=>{if(!C)return true;let de=C.toLowerCase();return $.name.toLowerCase().includes(de)||$.email&&$.email.toLowerCase().includes(de)}).slice(0,5),fa=useCallback($=>{if(y($),ve.length===0)return;let de=H.current;if(!de)return;let xe=de.selectionStart||$.length,T=$.slice(0,xe),V=T.lastIndexOf("@");if(V>=0&&((V>0?T[V-1]:" ")===" "||V===0)){let Z=T.slice(V+1);if(Z.length<=40){E(Z),k(V),P(true),K(0);return}}P(false),E(""),k(-1);},[ve.length]),ne=useCallback($=>{let de=x.slice(0,L),xe=x.slice(L+1+C.length),T=`${de}@${$.name} ${xe}`;y(T),P(false),E(""),k(-1),setTimeout(()=>H.current?.focus(),0);},[x,L,C]),fe=useCallback($=>{if(!S||ir.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),K(de=>de<ir.length-1?de+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),K(de=>de>0?de-1:ir.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let de=ir[N];return de&&ne(de),true}return $.key==="Escape"?(P(false),true):false},[S,ir,N,ne]);useEffect(()=>{if(be?.enabled)try{let $=localStorage.getItem(zr);if($){let xe=JSON.parse($).map(T=>({...T,timestamp:new Date(T.timestamp)}));g(xe.slice(-Cr));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[be?.enabled,zr,Cr]),useEffect(()=>{if(be?.enabled&&m.length>0)try{let $=m.filter(de=>!de.isLoading).slice(-Cr);localStorage.setItem(zr,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[m,be?.enabled,zr,Cr]),useEffect(()=>{Q.current&&Q.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!u&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,u]);let it=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&c?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&l?.($.taskId,$.dependencyFrom);break}},[n,s,o,c,l]),Qe=useCallback(async $=>{if(!$.trim()||b)return;let de={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};g(T=>[...T.slice(-(Pe-1)),de]),y(""),w(false),h(true);let xe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};g(T=>[...T,xe]);try{if(we){let T=m.filter(G=>!G.isLoading&&G.content).slice(-6).map(G=>({role:G.role,content:G.content})),V=await we($,e,T);g(G=>{let Z=G.filter(le=>!le.isLoading),Ze={id:`assistant-${Date.now()}`,role:"assistant",content:V.message,timestamp:new Date,command:V};return [...Z,Ze]}),it(V);}else g(T=>[...T.filter(G=>!G.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(T){g(V=>[...V.filter(Z=>!Z.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,Pe,we,e,it]),_=$=>{$.preventDefault(),Qe(x);},se=$=>{y($),H.current?.focus();};if(useEffect(()=>{let $=de=>{(de.metaKey||de.ctrlKey)&&de.key==="k"&&(de.preventDefault(),d(xe=>!xe),i||p(false)),de.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),useEffect(()=>{if(!i)return;let $=xe=>{let T=xe.target;I.current&&!I.current.contains(T)&&d(false);},de=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(de),document.removeEventListener("mousedown",$);}},[i]),!j)return null;let ee={"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(nr,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ee[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Oe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Fe,overflow:"visible"},onClick:()=>d(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Vm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:ze,background:ue,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ke}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(d),m.download=r,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let d=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let g=t.find(x=>x.id===p);if(g){n(g);let x=a.get(p)?.ef||0;m=Math.max(m,x);}}let u=m+d;a.set(i.id,{es:m,ef:u});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,c=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,m=t.filter(g=>g.dependencies&&g.dependencies.includes(i.id)),u=s;if(m.length>0)for(let g of m){c(g);let x=o.get(g.id)?.ls||0;u=Math.min(u,x);}let p=u-d;o.set(i.id,{ls:p,lf:u});};r.forEach(c);let l=[];for(let i of r){let d=a.get(i.id),m=o.get(i.id);if(d&&m){let u=m.ls-d.es;Math.abs(u)<.01&&l.push(i.id);}}return l},calculateCriticalPathFull:e=>{let t=new Map,a=De.flattenTasks(e).filter(u=>u.startDate&&u.endDate);if(a.length===0)return t;let n=new Map(a.map(u=>[u.id,u])),s=new Map;for(let u of a)s.has(u.id)||s.set(u.id,[]);for(let u of a)if(u.dependencies){for(let p of u.dependencies)if(n.has(p)){let g=s.get(p);g&&g.push(u.id);}}let o=new Map;for(let u of a)o.set(u.id,0);for(let u of a)if(u.dependencies)for(let p of u.dependencies)n.has(p)&&o.set(u.id,(o.get(u.id)||0)+1);let c=new Map,l=[],i=[];for(let u of a)(o.get(u.id)||0)===0&&i.push(u.id);for(;i.length>0;){let u=i.shift();l.push(u);let p=n.get(u);if(!p||!p.startDate||!p.endDate)continue;let g=De.calculateDuration(p.startDate,p.endDate),x=0;if(p.dependencies)for(let b of p.dependencies){let h=c.get(b);h&&(x=Math.max(x,h.ef));}c.set(u,{es:x,ef:x+g});let y=s.get(u)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(l.length<a.length)return t;let d=Math.max(...Array.from(c.values()).map(u=>u.ef)),m=new Map;for(let u=l.length-1;u>=0;u--){let p=l[u];if(!p)continue;let g=n.get(p);if(!g||!g.startDate||!g.endDate)continue;let x=De.calculateDuration(g.startDate,g.endDate),y=s.get(p)||[],b=d;if(y.length>0)for(let h of y){let v=m.get(h);v&&(b=Math.min(b,v.ls));}m.set(p,{ls:b-x,lf:b});}for(let u of l){let p=c.get(u),g=m.get(u),x=g.ls-p.es,y=s.get(u)||[],b;y.length>0?b=Math.min(...y.map(h=>c.get(h).es))-p.ef:b=d-p.ef,t.set(u,{earlyStart:p.es,earlyFinish:p.ef,lateStart:g.ls,lateFinish:g.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=De.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let n=De.getDependentTasks(e,t);if(n.length===0){let c=De.getLatestEndDate(e);if(!c)return null;let l=De.calculateDuration(r.endDate,c);return Math.max(0,l)}let s=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!s)return null;let o=De.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>De.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=De.findTaskById(e,t);if(!s||!s.endDate)return e;let o=De.getDependentTasks(e,t);if(o.length===0)return e;let c=[...e];for(let l of o){if(n.has(l.id)||!l.startDate||!l.endDate)continue;let i=De.calculateDuration(l.startDate,l.endDate),d;if(r!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let p=new Date(s.endDate),g=new Date(p);g.setDate(g.getDate()+1),d<g&&(d=g);}let m=De.calculateEndDate(d,i),u=p=>p.map(g=>g.id===l.id?{...g,startDate:d,endDate:m}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);c=u(c),c=De.autoScheduleDependents(c,l.id,r,n);}return c},calculateCascadePreview:(e,t,r,a,n,s,o,c)=>{if(r===0)return [];let l=[],i=n.getTime(),d=1e3*60*60*24,m=De.findTaskById(e,t);if(!m||!m.endDate)return [];let u=(p,g,x=new Set)=>{if(x.has(p))return;x.add(p);let y=De.getDependentTasks(e,p);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=a.findIndex(N=>N.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),C=(b.endDate.getTime()-v)/d,F=(v-i)/d*s,k=F+g*s,S=Math.max(C*s,s),P=c+h*o+(o-18)/2;l.push({taskId:b.id,taskName:b.name,originalX:F,previewX:k,width:S,y:P,rowIndex:h,daysDelta:g,color:b.color}),u(b.id,g,x);}};return u(t,r),l},splitTask:(e,t,r,a=3)=>{let n=De.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:c}],i=d=>d.map(m=>m.id===n.id?{...m,endDate:c,segments:l}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function al({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:c="en",templates:l,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:m,onTaskDblClick:u,onTaskContextMenu:p,onTaskDateChange:g,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:C,onTaskProgressDrag:E,workingDaysConfig:F}){let S=qa(),P=useRef(null),[N,K]=useState([]),[U,ae]=useState(null),[I,_]=useState(null),[j,W]=useState(null),B=useRef(false),[ve,je]=useState(new Set),[Pe,me]=useState(null),xe=useCallback(R=>{if(j&&!B.current){let J=R.target,O=false;for(;J&&J!==R.currentTarget;){if(J.getAttribute?.("data-dependency-line")==="true"||J.getAttribute?.("data-dependency-hover-overlay")==="true"){O=true;break}J=J.parentElement;}O||W(null);}},[j]),he=useCallback(R=>{_(R);},[]),We=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=a==="day"?60:a==="week"?20:8,Re=We*Se*o,Ae=R=>{let J=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),O=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-O);let Y=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-Y.getTime())/864e5+1)/7)},Ye=R=>{let J=R.getDay();return J===0||J===6},se=useMemo(()=>{let R=F?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[F?.holidayDates]),Xe=R=>{if(!se)return false;let J=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return se.has(J)},Be=useCallback(R=>{let J=Math.round(R/(Se*o)),O=new Date(n);return O.setDate(O.getDate()+J),O},[n,Se,o]),$e=useCallback((R,J)=>{if(J.startDate&&J.endDate)return;let O=R.currentTarget.ownerSVGElement;if(!O)return;let Y=O.createSVGPoint();Y.x=R.clientX,Y.y=R.clientY;let Te=Y.matrixTransform(O.getScreenCTM()?.inverse()),ge=Be(Te.x),Ze=new Date(ge);Ze.setDate(Ze.getDate()+1),me(null),g?.(J,ge,Ze);},[Be,g]),mt=useCallback((R,J,O)=>{let Y=R.currentTarget.ownerSVGElement;if(!Y)return;let Te=Y.createSVGPoint();Te.x=R.clientX,Te.y=R.clientY;let ge=Te.matrixTransform(Y.getScreenCTM()?.inverse()),Ze=Be(ge.x),Je=Math.round(ge.x/(Se*o))*Se*o;me({taskId:J.id,x:Je,y:O*r+r/2,date:Ze});},[Be,Se,o,r]),Nt=useCallback(()=>{me(null);},[]),ze=useMemo(()=>{let R=Te=>Te.map(ge=>{if(ge.subtasks&&ge.subtasks.length>0){let Ze=R(ge.subtasks),et=Ze.filter(Je=>Je.startDate&&Je.endDate);if(et.length>0){let Je=et.map(kt=>kt.startDate.getTime()),Bt=et.map(kt=>kt.endDate.getTime()),Tt=new Date(Math.min(...Je)),zt=new Date(Math.max(...Bt));return {...ge,subtasks:Ze,startDate:Tt,endDate:zt}}return {...ge,subtasks:Ze}}return ge}),J=(Te,ge=[])=>{let Ze=[...Te].sort((et,Je)=>(et.position??0)-(Je.position??0));for(let et of Ze)ge.push(et),et.subtasks&&et.subtasks.length>0&&(et.isExpanded===void 0||et.isExpanded)&&J(et.subtasks,ge);return ge},O=R(e);return J(O)},[e]),Fe=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let J=R.startDate.getTime(),O=R.endDate.getTime(),Y=n.getTime(),Te=(J-Y)/(1e3*60*60*24),ge=(O-J)/(1e3*60*60*24)+1,Ze=Te*Se*o,et=Math.max(Se*o,40),Je=Math.max(ge*Se*o,et);return {x:Ze,width:Je}},[n,Se,o]),nt=useMemo(()=>ze.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:J,width:O}=Fe(R),Te=ze.findIndex(ge=>ge.id===R.id)*r+(r-18)/2;return {id:R.id,x:J,y:Te,width:O,height:18}}),[ze,Fe]),It=useCallback((R,J,O)=>{if(!O){K([]),ae(null);return}if(ae({taskId:R,daysDelta:J}),J===0){K([]);return}let Y=De.calculateCascadePreview(e,R,J,ze,n,Se*o,r,48);K(Y);},[e,ze,n,Se,o,r,48]),Ie=useCallback((R,J)=>{if(!U)return J;let O=Se*o,Y=U.daysDelta*O;if(R===U.taskId)return {x:J.x+Y,width:J.width};let Te=N.find(ge=>ge.taskId===R);return Te?{x:Te.previewX,width:Te.width}:J},[U,N,Se,o]),ot=useMemo(()=>{let R=[],J=new Date(n);for(;J<=s;){let Te=(J.getTime()-n.getTime())/864e5*Se*o;if(a==="day")R.push({date:new Date(J),label:J.toLocaleDateString(c,{day:"numeric",month:"short"}),x:Te}),J.setDate(J.getDate()+1);else if(a==="week"){let ge=Ae(J);R.push({date:new Date(J),label:`${S.labels.week} ${ge}`,x:Te}),J.setDate(J.getDate()+7);}else R.push({date:new Date(J),label:J.toLocaleDateString(c,{month:"short",year:"numeric"}),x:Te}),J.setMonth(J.getMonth()+1);}return R},[n,s,a,Se,o,c,S.labels.week]),L=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),Q=Math.max(ze.length*r,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Re,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Re,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ot.map((R,J)=>jsxs("g",{children:[J>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!Ye(R.date)&&Xe(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${J}`)),L>=0&&L<=Re&&jsxs("g",{children:[jsx("circle",{cx:L,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:L,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${L-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(Re,1e3),height:Q,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:xe,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Re,1e3),height:Q,fill:t.bgPrimary}),ze.map((R,J)=>jsx("rect",{x:0,y:J*r,width:Math.max(Re,1e3),height:r,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),ot.map((R,J)=>J>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:ze.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${J}`):null),ot.map((R,J)=>{let O=ot[J+1]?.x||Re,Y=w&&Ye(R.date),Te=a==="day"&&!Ye(R.date)&&Xe(R.date);return Y||Te?jsxs("g",{children:[jsx("rect",{x:R.x,y:0,width:O-R.x,height:ze.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:O-R.x,height:ze.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${J}`):null}),ze.map((R,J)=>{let O=R.startDate&&R.endDate;return jsx("g",{children:!O&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:J*r,width:Re,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>$e(Y,R),onMouseMove:Y=>mt(Y,R,J),onMouseLeave:()=>{Nt();}},`clickable-${R.id}`),Pe&&Pe.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:Pe.x,y1:J*r+4,x2:Pe.x,y2:J*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:Pe.x,cy:Pe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:Pe.x,cy:Pe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${Pe.x}, ${J*r-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Pe.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Pe||Pe.taskId!==R.id)&&jsx("text",{x:L>0?L:100,y:J*r+r/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-${R.id}`)]})},`row-group-${R.id}`)}),ze.map((R,J)=>{if(!R.startDate||!R.endDate)return null;let{x:O,width:Y}=Fe(R),Te=J*r+(r-18)/2,ge=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(rl,{task:R,x:O+Y/2,y:Te+12,theme:t,onClick:m},R.id);if(ge){let Ze=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),et=8,Je=Te+(r-18)/2+(18-et)/2,Bt=4,Tt=R.progress||0,zt=new Date;zt.setHours(0,0,0,0);let kt=R.startDate&&zt>=R.startDate,tr=R.endDate&&(()=>{let Jt=new Date(R.endDate);return Jt.setHours(0,0,0,0),zt>Jt})(),ur=R.startDate&&zt<R.startDate,da=1;if(kt&&R.startDate&&R.endDate&&!ur){let Jt=new Date(R.startDate);Jt.setHours(0,0,0,0);let Gr=new Date(R.endDate);Gr.setHours(0,0,0,0);let ua=Math.max(1,(Gr.getTime()-Jt.getTime())/(1e3*60*60*24)),_e=Math.min((zt.getTime()-Jt.getTime())/(1e3*60*60*24),ua)/ua*100;da=_e>0?Tt/_e:1;}let Gt;Tt>=100?Gt="#00E5CC":ur?Gt="#4B5563":tr&&Tt<100?Gt="#EF4444":da>=.95?Gt="#22C55E":da>=.8?Gt="#F59E0B":Gt="#EF4444";let gr=Math.max(Tt/100*Y,Tt>0?Bt*2:0),Rt=Y>100&&Tt>0,Kr=R.isCriticalPath;return jsxs("g",{onClick:()=>m?.(R),onContextMenu:Jt=>{Jt.preventDefault(),Jt.stopPropagation(),p?.(R,Jt);},onMouseMove:Jt=>{he({task:R,x:O,y:Je,width:Y,height:et,showBelow:Je<100,mouseX:Jt.clientX,mouseY:Jt.clientY});},onMouseLeave:()=>he(null),style:{cursor:"default",opacity:h?Kr?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:O,y:Te,width:Y,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:O,y:Je,width:Y,height:et,rx:Bt,fill:Ze?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Tt>0&&jsx("rect",{x:O,y:Je,width:gr,height:et,rx:Bt,fill:Gt}),h&&Kr&&jsx("rect",{x:O,y:Je,width:Y,height:et,rx:Bt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Rt&&jsxs("text",{x:O+gr+6,y:Je+et/2,dominantBaseline:"central",fill:Ze?"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(Tt),"%"]})]},R.id)}return jsx(Ji,{task:R,x:O,y:Te,width:Y,theme:t,dayWidth:Se*o,startDate:n,templates:l,onClick:m,onDoubleClick:u,onContextMenu:p,onDateChange:g,onDependencyCreate:x,allTaskPositions:nt,onDragMove:It,onHoverChange:he,showBaseline:b,showTaskBarLabels:d,showCriticalPath:h,readOnly:C?!C(R):false,onProgressChange:E},R.id)}),v&&ze.map((R,J)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(O=>{let Y=ze.find(Gt=>Gt.id===O);if(!Y||!Y.startDate||!Y.endDate)return null;let Te=ze.findIndex(Gt=>Gt.id===O),ge=Ie(Y.id,Fe(Y)),Ze=Ie(R.id,Fe(R)),et=ge.x+ge.width,Je=Te*r+26,Bt=Ze.x,Tt=J*r+26,zt=`dep-${O}-${R.id}`;if(ve.has(zt))return null;let kt=h&&R.isCriticalPath&&Y.isCriticalPath;return jsx(Ks,{x1:et,y1:Je,x2:Bt,y2:Tt,theme:t,lineStyle:i,colorOverride:h?kt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?kt?2:1:void 0,glowFilter:kt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(R.id,O),onHoverChange:Gt=>{B.current=Gt,Gt&&W({key:zt,fromId:O,toId:R.id,exitX:et,exitY:Je,enterX:Bt,enterY:Tt});}},zt)})),N.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&j&&jsx(Ks,{x1:j.exitX,y1:j.exitY,x2:j.enterX,y2:j.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=j.key;W(null),B.current=false,je(J=>new Set(J).add(R)),y?.(j.toId,j.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||W(null);}},`${j.key}-hover-overlay`),L>=0&&L<=Re&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:1,opacity:1})]})]}),I&&jsx(zm,{tooltipData:I,theme:t,locale:c==="es"?"es":"en",workingDaysConfig:F})]})}var iw=['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"'],jm=({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"})}),lw=()=>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"})}),cw=()=>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"})}),dw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),uw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function sl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:c,onDependencyDelete:l}){let[i,d]=useState(false),[m,u]=useState(false),[p,g]=useState([]),[x,y]=useState(""),[b,h]=useState(false),[v,w]=useState(true),[C,E]=useState(""),[F,k]=useState(-1),[S,P]=useState(false),[N,K]=useState(0),U=useRef(null),ae=useRef(null),I=useRef(null),_=useRef(null),{enabled:j=true,placeholder:W='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:ve,suggestions:je=iw,maxHistory:Pe=50,persistHistory:me,mentionableUsers:xe=[]}=r,he=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",We=he?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=he?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Re=he?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ae=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ye=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",se=he?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Be=he?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=he?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Nt=he?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",ze=he?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Fe=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",nt=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",It=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ie=he?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ot=he?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=he?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Q=he?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=he?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",J="rgba(0, 229, 204, 0.04)",O=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",Y=he?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Te=he?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ge=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ze=he?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",et=he?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Je=he?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Bt=he?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Tt="rgba(0, 229, 204, 0.06)",zt=he?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",kt=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",tr=he?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ur=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",da=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Gt=he?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gr=he?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Rt=he?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Kr=he?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Vt=he?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Jt=he?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Gr=he?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ua=he?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",tt=he?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",_e=he?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ga=me?.storageKey||"gantt-ai-history",sr=me?.maxMessages??5,Zr=xe.filter($=>{if(!C)return true;let te=C.toLowerCase();return $.name.toLowerCase().includes(te)||$.email&&$.email.toLowerCase().includes(te)}).slice(0,5),fr=useCallback($=>{if(y($),xe.length===0)return;let te=U.current;if(!te)return;let we=te.selectionStart||$.length,T=$.slice(0,we),H=T.lastIndexOf("@");if(H>=0&&((H>0?T[H-1]:" ")===" "||H===0)){let q=T.slice(H+1);if(q.length<=40){E(q),k(H),P(true),K(0);return}}P(false),E(""),k(-1);},[xe.length]),wa=useCallback($=>{let te=x.slice(0,F),we=x.slice(F+1+C.length),T=`${te}@${$.name} ${we}`;y(T),P(false),E(""),k(-1),setTimeout(()=>U.current?.focus(),0);},[x,F,C]),le=useCallback($=>{if(!S||Zr.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),K(te=>te<Zr.length-1?te+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),K(te=>te>0?te-1:Zr.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let te=Zr[N];return te&&wa(te),true}return $.key==="Escape"?(P(false),true):false},[S,Zr,N,wa]);useEffect(()=>{if(me?.enabled)try{let $=localStorage.getItem(ga);if($){let we=JSON.parse($).map(T=>({...T,timestamp:new Date(T.timestamp)}));g(we.slice(-sr));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[me?.enabled,ga,sr]),useEffect(()=>{if(me?.enabled&&p.length>0)try{let $=p.filter(te=>!te.isLoading).slice(-sr);localStorage.setItem(ga,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[p,me?.enabled,ga,sr]),useEffect(()=>{ae.current&&ae.current.scrollIntoView({behavior:"smooth"});},[p]),useEffect(()=>{i&&!m&&U.current&&setTimeout(()=>U.current?.focus(),100);},[i,m]);let de=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&c?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&l?.($.taskId,$.dependencyFrom);break}},[n,s,o,c,l]),dt=useCallback(async $=>{if(!$.trim()||b)return;let te={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};g(T=>[...T.slice(-(Pe-1)),te]),y(""),w(false),h(true);let we={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};g(T=>[...T,we]);try{if(ve){let T=p.filter(ue=>!ue.isLoading&&ue.content).slice(-6).map(ue=>({role:ue.role,content:ue.content})),H=await ve($,e,T);g(ue=>{let q=ue.filter(st=>!st.isLoading),ke={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...q,ke]}),de(H);}else g(T=>[...T.filter(ue=>!ue.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(T){g(H=>[...H.filter(q=>!q.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,Pe,ve,e,de]),V=$=>{$.preventDefault(),dt(x);},be=$=>{y($),U.current?.focus();};if(useEffect(()=>{let $=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),d(we=>!we),i||u(false)),te.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),useEffect(()=>{if(!i)return;let $=we=>{let T=we.target;I.current&&!I.current.contains(T)&&d(false);},te=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(te),document.removeEventListener("mousedown",$);}},[i]),!j)return null;let Z={"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(ar,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Z[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:We,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Re,overflow:"visible"},onClick:()=>d(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ae}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Ye}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(jm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Be,background:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Xe}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:u?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ee[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ae,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Tt}`,boxShadow:Nt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Re,borderBottom:`1px solid ${Le}`},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:ut,border:`1px solid ${Ct}`,color:"#00E5CC"},children:jsx(Vm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ie},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:lt},onMouseEnter:$=>{$.currentTarget.style.background=re,$.currentTarget.style.color=F;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=lt;},children:jsx(lw,{})}),jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:lt},onMouseEnter:$=>{$.currentTarget.style.background=re,$.currentTarget.style.color=F;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=lt;},children:jsx(iw,{})})]})]}),jsx(AnimatePresence,{children:!u&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Ge.slice(0,4).map(($,de)=>jsx("button",{onClick:()=>se($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:X,color:J,border:`1px solid ${O}`},onMouseEnter:xe=>{xe.currentTarget.style.borderColor=Te,xe.currentTarget.style.color="#00E5CC";},onMouseLeave:xe=>{xe.currentTarget.style.borderColor=O,xe.currentTarget.style.color=J;},children:$.length>30?$.slice(0,30)+"...":$},de))})]}),m.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?me:ot,color:$.role==="user"?"#00E5CC":$t,border:$.role==="user"?`1px solid ${tt}`:`1px solid ${Ye}`},children:[$.isLoading?jsx(cw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:Q})]}),jsxs("form",{onSubmit:$=>{if(S&&ir.length>0){$.preventDefault();return}_($);},className:"p-3 relative",style:{borderTop:`1px solid ${Dt}`},children:[jsx(AnimatePresence,{children:S&&ir.length>0&&jsx(motion.div,{ref:q,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 ${qr}`,boxShadow:jt,backdropFilter:"blur(12px)"},children:ir.map(($,de)=>jsxs("button",{type:"button",onClick:()=>ne($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:de===N?_t:"transparent",color:la},onMouseEnter:()=>K(de),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Xe,border:`1px solid ${Je}`,color:"#00E5CC"},children:$.name.split(" ").map(xe=>xe[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsx("div",{className:"text-xs truncate",style:{color:ta},children:$.email})]})]},$.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:St,border:`1px solid ${Wt}`},children:[jsx("input",{ref:H,type:"text",value:x,onChange:$=>fa($.target.value),onKeyDown:$=>{fe($);},placeholder:U,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:rr,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?gr:"transparent",color:x.trim()?"#00E5CC":Yt,border:x.trim()?`1px solid ${ia}`:"1px solid transparent"},children:jsx(sw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:fr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function jm(e,t=50){let[r,a]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,d=true)=>{a(u=>{let p=typeof i=="function"?i(u.present):i;if(n.current)return {...u,present:p};if(!d)return {...u,present:p};let m=[...u.past,u.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),o=useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],u=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:u,present:d,future:[i.present,...i.future]}});},[]),c=useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],u=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:u}});},[]),l=useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function _m({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?o.metaKey:o.ctrlKey;if(l&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!c&&l&&o.key==="y"){o.preventDefault(),t();return}if(c&&l&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var mw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ce.formatDate(e.startDate)} - ${Ce.formatDate(e.endDate)}`);let r=Ce.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ce.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Km(e){return {...mw,...e}}var ww=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Jm=forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:i=true,onExportSuccess:d,projectName:u,availableUsers:p=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:C,showCreateTaskButton:E=false,createTaskLabel:L,onCreateTask:k,taskFilter:S,onTaskFilterChange:P,toolbarRightContent:N,showBaseline:K,viewMode:H,onViewModeChange:Q,projectForecast:I,hideForecastHud:q,onThemeChange:j,onTaskClick:U,onTaskSelectionChange:B,onTaskDblClick:we,onTaskContextMenu:Ge,onTaskUpdate:Pe,onDependentTasksScheduled:be,onProgressChange:ve,onTaskEdit:he,onTaskAddSubtask:Oe,onTaskMarkIncomplete:Se,onTaskSetInProgress:Fe,onDependencyCreate:He,onDependencyDelete:Be,onBeforeTaskAdd:ue,onAfterTaskAdd:Ke,onBeforeTaskUpdate:ze,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Tt,onAfterTaskDelete:Nt,permissions:Re,onCopySnapshotLink:Le}=r,Ct=useContext(ji)?.theme,[Ie,lt]=useState(Ct||s||"dark"),[F,re]=useState(o),[R,X]=useState(c),[O,J]=useState(1),[Te,me]=useState("all"),[tt,ot]=useState(H||"execution"),Ye=H??tt,$t=useCallback(M=>{ot(M),Q?.(M);},[Q]),Dt=K??Ye==="oracle",[St,Wt]=useState(r.showCriticalPath!==false),[rr,gr]=useState(r.showDependencies!==false),[ia,Yt]=useState(r.highlightWeekends!==false),fr=useCallback(M=>{Wt(M),r.onShowCriticalPathChange?.(M);},[r.onShowCriticalPathChange]),At=useCallback(M=>{gr(M),r.onShowDependenciesChange?.(M);},[r.onShowDependenciesChange]),qr=useCallback(M=>{Yt(M),r.onHighlightWeekendsChange?.(M);},[r.onHighlightWeekendsChange]);useEffect(()=>{r.onTimeScaleChange?.(F);},[F]),useEffect(()=>{r.onZoomChange?.(O);},[O]);let jt=useRef(r.onDateRangeChange);jt.current=r.onDateRangeChange;let _t=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[la,ta]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let W=JSON.parse(A);if(W.taskFilter)return W.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Xe=S??la,Je=P??ta,[zr,Cr]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let W=JSON.parse(A);if(typeof W.hideCompleted=="boolean")return W.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=_t();if(M)try{let A={taskFilter:Xe,hideCompleted:zr};localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[Xe,zr,_t]);let ir=useRef(h);useEffect(()=>{if(ir.current!==h&&h!==void 0){ta("all"),Cr(false);let M=_t();if(M)try{localStorage.removeItem(M);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}ir.current=h;},[h,_t]);let[fa,ne]=useState(0),[fe,it]=useState(false),[Qe,_]=useState(null),[se,ee]=useState({isOpen:false,x:0,y:0,task:null}),[$,de]=useState(null),[xe,T]=useState(null);useEffect(()=>{Ct&&Ct!==Ie&<(Ct);},[Ct]),useEffect(()=>{s&&s!==Ie&<(s);},[s]);let V=useCallback(M=>{lt(M),j?.(M);},[j]),{state:G,setState:Z,undo:Ze,redo:le,canUndo:Ue,canRedo:mt,clearHistory:It}=jm(t,50),Mt=useMemo(()=>{let M=(A,W=0)=>{let Y=W;for(let oe of A)oe.subtasks?.length&&(Y=Math.max(Y,M(oe.subtasks,W+1)));return Y};return M(G)+1},[G]),Tr=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Gr=useRef(new Map),za=useRef(false);if(!za.current&&x){za.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let A=localStorage.getItem(M);if(A){let W=JSON.parse(A);Array.isArray(W)&&(Gr.current=new Map(W));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let lr=useCallback(()=>{let M=Tr();if(M)try{let A=Array.from(Gr.current.entries());localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[Tr]),Ra=useRef(0),Ho=useRef(G);useEffect(()=>{Ho.current=G;},[G]);let Pn=useRef(false),jn=useCallback(M=>{me(M),Ra.current+=1,Z(A=>{let W=(oe,ge=0)=>oe.map(je=>{let _e=M==="all"||ge<M-1;return je.subtasks?.length&&Gr.current.set(je.id,_e),{...je,isExpanded:_e,subtasks:je.subtasks?W(je.subtasks,ge+1):void 0}}),Y=W(A);return lr(),Y});},[Z,lr]);useEffect(()=>{if(Ra.current>0){Ra.current-=1;return}let M=W=>{let Y=new Map;for(let oe of W){let ge=oe.id;Y.get(ge)||Y.set(ge,oe);}return Array.from(Y.values())},A=W=>W.map(Y=>{let oe=Gr.current.get(Y.id),ge=oe!==void 0?{...Y,isExpanded:oe}:Y;if(ge.subtasks?.length){let je=M(ge.subtasks);return {...ge,subtasks:A(je)}}return ge});if(Gr.current.size>0)Z(Ka(A(t)));else {let W=Y=>Y.map(oe=>oe.subtasks?.length?{...oe,subtasks:M(W(oe.subtasks))}:oe);Z(Ka(W(t)));}},[t,Z]);let Uo=useRef(t),pi=useRef(true);useEffect(()=>{if(pi.current){pi.current=false,Uo.current=G;return}if(Pn.current){Pn.current=false,Uo.current=G;return}if(!a)return;let M=JSON.stringify(Uo.current),A=JSON.stringify(G);M!==A&&(Uo.current=G,a(G));},[G,a]);let Yr=useMemo(()=>_c(w,C),[w,C]),bo=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),ba=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Za,en]=useState(()=>{let M=bo(Yr);if(!b)return M;try{let A=typeof b=="string"?b:"gantt-columns-state",W=localStorage.getItem(A);if(!W)return M;let Y=JSON.parse(W),oe=new Map(Y.map(ge=>[ge.id,ge]));return M.map(ge=>{let je=oe.get(ge.id);return je?{...ge,visible:je.visible??ge.visible,width:je.width??ge.width}:ge})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),M}}),_n=useRef(ba);useEffect(()=>{if(_n.current===ba)return;_n.current=ba;let M=bo(Yr);if(!ba){en(M);return}try{let A=localStorage.getItem(ba);if(!A){en(M);return}let W=JSON.parse(A),Y=new Map(W.map(oe=>[oe.id,oe]));en(M.map(oe=>{let ge=Y.get(oe.id);return ge?{...oe,visible:ge.visible??oe.visible,width:ge.width??oe.width}:oe}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),en(M);}},[ba,bo,Yr]),useEffect(()=>{if(ba&&_n.current===ba)try{let M=Za.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(ba,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[Za,ba]),useEffect(()=>{en(M=>M.map(A=>({...A,label:Yr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Yr]);let D=useMemo(()=>Za.filter(A=>A.visible).reduce((A,W)=>A+W.width,0),[Za]),te=useRef(Za.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Za.filter(Y=>Y.visible),A=M.map(Y=>Y.id).join(","),W=te.current;if(A!==W){let Y=M.some(ge=>ge.id!=="name"),oe=W.includes(",");Y?!oe&&Y&&_(null):_(null),te.current=A;}},[Za]);let pe=60,ke=.6,Ne=useMemo(()=>{let A=D+pe,W=typeof window<"u"?window.innerWidth*ke:800,Y=Math.max(A,W);return Qe!==null?Math.max(200,Math.min(Qe,Y)):Math.max(200,A)},[Qe,D]),We=useRef(null),ce=useRef(null),Ee=useRef(null),Ve=useRef(null),rt=useRef(null),et=useMemo(()=>dm(Ie),[Ie]),pt=useMemo(()=>({theme:et,themeName:Ie}),[et,Ie]),dt=useMemo(()=>Km(m),[m]),pr=useMemo(()=>{if(!g||!St)return G;let M=Ce.calculateCriticalPathFull(G),A=W=>W.map(Y=>{let oe=M.get(Y.id),ge=Y.subtasks?A(Y.subtasks):void 0,je=ge?.some(Zt=>Zt.isCriticalPath||Zt.subtasks&&Zt.subtasks.some(Ht=>Ht.isCriticalPath))||false,_e=oe?oe.isCritical:je;return {...Y,isCriticalPath:_e,cpmData:oe||void 0,subtasks:ge}});return A(G)},[G,g,St]),vr=useMemo(()=>Ce.flattenTasks(G).some(A=>A.dependencies&&A.dependencies.length>0),[G]),Vr=useMemo(()=>{let M=(A,W="")=>[...A].sort((oe,ge)=>(oe.position??0)-(ge.position??0)).map((oe,ge)=>{let je=ge+1,_e=W?`${W}.${je}`:`${je}.0`,Zt=W?`${W}.${je}`:`${je}`;return {...oe,wbsCode:_e,subtasks:oe.subtasks?.length?M(oe.subtasks,Zt):oe.subtasks}});return M(pr)},[pr]),Ot=useMemo(()=>{if(Xe==="all"&&!zr)return Vr;let M=A=>{let W=[];for(let Y of A){let oe=Y.subtasks?.length?M(Y.subtasks):void 0,ge=false;if(zr)ge=Y.progress<100;else switch(Xe){case "all":ge=true;break;case "incomplete":ge=Y.progress<100;break;case "in_progress":ge=Y.progress>0&&Y.progress<100;break;case "completed":ge=Y.progress===100;break}(ge||oe&&oe.length>0)&&W.push({...Y,subtasks:oe});}return W};return M(Vr)},[Vr,Xe,zr]),zt=ww(R);_m({undo:Ze,redo:le,canUndo:Ue,canRedo:mt,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>Ce.findTaskById(G,M),addTask:(M,A)=>{Z(W=>{if(!A)return [...W,{...M,level:0}];let Y=oe=>oe.map(ge=>ge.id===A?{...ge,subtasks:[...ge.subtasks||[],{...M,parentId:A,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:Y(ge.subtasks)}:ge);return Y(W)});},updateTask:(M,A)=>{Z(W=>{let Y=oe=>oe.map(ge=>ge.id===M?{...ge,...A}:ge.subtasks?{...ge,subtasks:Y(ge.subtasks)}:ge);return Y(W)});},deleteTask:M=>{Z(A=>{let W=Y=>Y.filter(oe=>oe.id===M?false:(oe.subtasks&&(oe.subtasks=W(oe.subtasks)),true));return W(A)});},deleteTasks:M=>{Z(A=>td(A,M));},duplicateTask:M=>{if(r.onTaskDuplicate){let A=Ce.findTaskById(G,M);A&&r.onTaskDuplicate(A);}else Z(A=>js(A,[M]).tasks);},splitTask:(M,A,W=3)=>{Z(Y=>Ce.splitTask(Y,M,A,W));},calculateEndDate:Ce.calculateEndDate,calculateDuration:Ce.calculateDuration,validateDependency:(M,A)=>!Ce.validateDependencies(G,M,A),getAllTasks:()=>Ce.flattenTasks(G),getTasksByStatus:M=>Ce.flattenTasks(G).filter(A=>A.status===M),getTasksByParent:M=>M?Ce.findTaskById(G,M)?.subtasks||[]:G.filter(W=>!W.parentId),getCriticalPath:()=>Ce.flattenTasks(G).filter(M=>M.isCriticalPath),indentTask:M=>{Z(A=>Ka(Qc(A,[M])));},outdentTask:M=>{Z(A=>Ka(Zc(A,[M])));},moveTask:(M,A)=>{Z(W=>ed(W,[M],A));},createSubtask:async M=>{let{tasks:A,newTask:W}=nd(G,M);if(ue){let Y=ue({...W,parentId:M});if((Y instanceof Promise?await Y:Y)===false)return}Z(Ka(A)),Ke&&Ke({...W,parentId:M});},scrollToTask:M=>{let W=Ce.flattenTasks(G).findIndex(Y=>Y.id===M);if(W!==-1&&We.current){let Y=W*zt;We.current.scrollTo({top:Y,behavior:"smooth"}),Ee.current&&Ee.current.scrollTo({top:Y,behavior:"smooth"});}},highlightTask:(M,A=2e3)=>{},expandTask:M=>{Z(A=>{let W=Y=>Y.map(oe=>oe.id===M?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(A)});},collapseTask:M=>{Z(A=>{let W=Y=>Y.map(oe=>oe.id===M?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(A)});},expandAll:()=>{Z(M=>{let A=W=>W.map(Y=>({...Y,isExpanded:true,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(M)});},collapseAll:()=>{Z(M=>{let A=W=>W.map(Y=>({...Y,isExpanded:false,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(M)});},collapseToLevel:M=>{jn(M);},undo:Ze,redo:le,canUndo:()=>Ue,canRedo:()=>mt,clearHistory:It,exportToPNG:async()=>{if(!Ve.current||!We.current||!Ee.current)throw new Error("Gantt container not found");let M=Ve.current,A=We.current,W=ce.current||A.querySelector(".gantt-grid-scroll"),Y=Ee.current,oe=W?.scrollTop||0,ge=Y.scrollTop,je=M.style.overflow,_e=M.style.height,Zt=A.style.overflow;try{let Ht=W?.querySelector(".gantt-taskgrid-content"),ar=Y.querySelector("svg"),ga=Ht?.scrollHeight||W?.scrollHeight||600,Ba=ar?.getBoundingClientRect().height||Y.scrollHeight,yo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ga,Ba)+20;W&&(W.scrollTop=0),Y.scrollTop=0,M.style.overflow="visible",M.style.height=`${yo}px`,A.style.overflow="visible",await new Promise(Go=>setTimeout(Go,100));let yn=await toPng(M,{backgroundColor:et.bgPrimary,pixelRatio:2,filter:Go=>{if(!(Go instanceof Element))return !0;let mi=window.getComputedStyle(Go),Ns=parseInt(mi.zIndex,10);return (isNaN(Ns)||Ns<50)&&mi.position!=="fixed"}});return await(await fetch(yn)).blob()}finally{M.style.overflow=je,M.style.height=_e,A.style.overflow=Zt,W&&(W.scrollTop=oe),Y.scrollTop=ge;}},exportToPDF:async M=>{await Ce.exportToPDF(G,M);},exportToExcel:async M=>{await Ce.exportToExcel(G,M,zl.current);},exportToJSON:()=>Ce.exportToJSON(G),exportToCSV:()=>Ce.exportToCSV(G),importFromJSON:M=>{let A=Ce.importFromJSON(M);Z(A);},getTasks:()=>G,refresh:()=>{Z(M=>[...M]);},clearAll:()=>{Z([]);},scrollToToday:()=>{let M=Ee.current,A=rt.current;if(!M||!A)return;let Y=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),oe=A.timeScale==="day"?60:A.timeScale==="week"?20:8,ge=Y*oe*A.zoom,je=M.clientWidth,_e=Math.max(0,ge-je/2);M.scrollTo({left:_e,behavior:"smooth"});}}),[G,Ze,le,Ue,mt,It,et,zt]);let wt=useCallback(M=>{en(A=>A.map(W=>W.id===M?{...W,visible:!W.visible}:W));},[]),Pt=useCallback((M,A)=>{en(W=>W.map(Y=>{if(Y.id!==M)return Y;let oe=Y.minWidth??100,ge=Y.maxWidth??800,je=Math.max(oe,Math.min(ge,A));return {...Y,width:je}}));},[]),Lr=useCallback(M=>{Z(A=>{let W=ad(A,M),Y=oe=>{for(let ge of oe){if(ge.id===M){Gr.current.set(M,ge.isExpanded??true);return}ge.subtasks?.length&&Y(ge.subtasks);}};return Y(W),lr(),W}),r.onTaskToggleExpand?.(M);},[r,lr]),Nr=useCallback((M,A)=>{if(ze&&ze(M,A)===false)return;let Y=Ce.findTaskById(G,M)?.progress,oe=je=>je.map(_e=>_e.id===M?{..._e,...A}:_e.subtasks?{..._e,subtasks:oe(_e.subtasks)}:_e);Z(je=>oe(je));let ge=Ce.findTaskById(oe(G),M);ge&&(Pe?.(ge),Ae?.(ge),A.progress!==void 0&&Y!==void 0&&A.progress!==Y&&ve?.(M,Y,A.progress));},[G,Pe,ze,Ae,ve]),wa=useCallback((M,A,W)=>{if(M.length===0)return;let Y=new Set(M),oe=ge=>ge.map(je=>{let _e=Y.has(je.id)?{...je,[A]:W}:je;return _e.subtasks?{..._e,subtasks:oe(_e.subtasks)}:_e});Z(ge=>{let je=oe(ge);return r.onBulkFill?.(M,A,W,je),je});},[r]),ma=useCallback(M=>{M.length!==0&&(Ra.current+=1,Pn.current=true,Z(A=>Ka(Qc(A,M))),r.onTaskIndent?.(M[0]));},[r]),Xr=useCallback(M=>{M.length!==0&&(Ra.current+=1,Pn.current=true,Z(A=>Ka(Zc(A,M))),r.onTaskOutdent?.(M[0]));},[r]),ho=useCallback((M,A,W)=>{Ra.current+=1,Pn.current=true,Z(Y=>Ka(Lm(Y,M,A,W))),r.onTaskReparent?.(M,A,W);},[r]),Cs=useCallback((M,A)=>{M.length!==0&&(Ra.current+=1,Pn.current=true,Z(W=>ed(W,M,A)),r.onTaskMove?.(M[0],A));},[r]),Fn=useCallback(async M=>{let A=[];for(let W of M)Tt&&await Promise.resolve(Tt(W))===false||A.push(W);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(Z(W=>Ka(td(W,A))),A.forEach(W=>r.onTaskDelete?.(W))),Nt&&A.forEach(W=>Nt(W)));},[r,Tt,Nt]),Qf=useCallback(M=>{r.onTaskDuplicate?M.forEach(A=>{let W=Ce.findTaskById(G,A);W&&r.onTaskDuplicate(W);}):Z(A=>js(A,M).tasks);},[r,G]),Zf=useCallback((M,A)=>{Z(W=>{let{tasks:Y,newTask:oe}=Fm(W,M,A);return ue&&ue(oe)===false?W:(r.onTaskCreate?.(oe.parentId,oe.position||0),Ke?.(oe),Y)});},[r,ue,Ke]),eb=useCallback((M,A)=>{Z(W=>rd(W,M,A)),r.onTaskRename?.(M,A);},[r]),Ul=useCallback(M=>{let{onTaskAddSubtask:A}=r;if(A){let W=ss(G,M);if(W){A(W);return}}Z(W=>{let{tasks:Y}=nd(W,M);return r.onTaskCreate?.(M,0),Y});},[r,G]),tb=useCallback((M,A)=>{let W=Math.max(0,Math.min(100,Math.round(A))),Y={progress:W};W===100?Y.status="completed":W>0?Y.status="in-progress":Y.status="todo",Nr(M.id,Y);},[Nr]),rb=useCallback((M,A,W)=>{let Y=!M.startDate&&!M.endDate,oe=M.startDate?Math.round((A.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,ge=Ht=>Ht.map(ar=>ar.id===M.id?{...ar,startDate:A,endDate:W,...M.segments&&{segments:M.segments}}:ar.subtasks?{...ar,subtasks:ge(ar.subtasks)}:ar),je=ge(G),_e=je;je=Ce.autoScheduleDependents(je,M.id,oe),je=Ka(je),Z(je);let Zt={...M,startDate:A,endDate:W};if(Y&&r?.onTaskDateChange?r.onTaskDateChange(M,A,W):Pe?.(Zt),be&&oe!==0){let Ht=Ce.flattenTasks(_e),ar=Ce.flattenTasks(je),ga=[];for(let Ba of ar){if(Ba.id===M.id)continue;let Kn=Ht.find(yn=>yn.id===Ba.id);if(!Kn)continue;let zo=Ba.startDate?.getTime()!==Kn.startDate?.getTime(),yo=Ba.endDate?.getTime()!==Kn.endDate?.getTime();(zo||yo)&&ga.push(Ba);}ga.length>0&&be(ga);}},[G,Pe,be,r]),ab=useCallback((M,A)=>{Ge?.(M,A),ee({isOpen:true,x:A.clientX,y:A.clientY,task:M});},[Ge]),nb=useCallback((M,A)=>{let W=Ce.splitTask(G,M.id,A);Z(W),ee({isOpen:false,x:0,y:0,task:null});},[G]),hu=useCallback(M=>{let A=Ce.findTaskById(G,M.id)||M;we?.(A),he||de(A);},[G,we,he]),yu=useCallback((M,A,W)=>{let Y=new Map,oe=Ht=>{Ht.forEach(ar=>{ar.dependencies&&Y.set(ar.id,ar.dependencies),ar.subtasks&&oe(ar.subtasks);});};oe(W);let ge=Y.get(A)||[];Y.set(A,[...ge,M]);let je=new Set,_e=new Set,Zt=Ht=>{if(!je.has(Ht)){je.add(Ht),_e.add(Ht);let ar=Y.get(Ht)||[];for(let ga of ar){if(!je.has(ga)&&Zt(ga))return true;if(_e.has(ga))return true}}return _e.delete(Ht),false};return Zt(A)},[]),xu=useCallback((M,A)=>{if(yu(M.id,A,Ho.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Z[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Nt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ze,borderBottom:`1px solid ${Fe}`},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:nt,border:`1px solid ${It}`,color:"#00E5CC"},children:jsx(jm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ie},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>u($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:ot},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ot;},children:jsx(dw,{})}),jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ot},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ot;},children:jsx(cw,{})})]})]}),jsx(AnimatePresence,{children:!m&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[p.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:je.slice(0,4).map(($,te)=>jsx("button",{onClick:()=>be($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:J,color:Y,border:`1px solid ${O}`},onMouseEnter:we=>{we.currentTarget.style.borderColor=Te,we.currentTarget.style.color="#00E5CC";},onMouseLeave:we=>{we.currentTarget.style.borderColor=O,we.currentTarget.style.color=Y;},children:$.length>30?$.slice(0,30)+"...":$},te))})]}),p.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?ge:et,color:$.role==="user"?"#00E5CC":Bt,border:$.role==="user"?`1px solid ${Ze}`:`1px solid ${Je}`},children:[$.isLoading?jsx(uw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:ae})]}),jsxs("form",{onSubmit:$=>{if(S&&Zr.length>0){$.preventDefault();return}V($);},className:"p-3 relative",style:{borderTop:`1px solid ${Tt}`},children:[jsx(AnimatePresence,{children:S&&Zr.length>0&&jsx(motion.div,{ref:_,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Rt,border:`1px solid ${Kr}`,boxShadow:Vt,backdropFilter:"blur(12px)"},children:Zr.map(($,te)=>jsxs("button",{type:"button",onClick:()=>wa($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:te===N?Jt:"transparent",color:Gr},onMouseEnter:()=>K(te),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:tt,border:`1px solid ${_e}`,color:"#00E5CC"},children:$.name.split(" ").map(we=>we[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsx("div",{className:"text-xs truncate",style:{color:ua},children:$.email})]})]},$.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:zt,border:`1px solid ${kt}`},children:[jsx("input",{ref:U,type:"text",value:x,onChange:$=>fr($.target.value),onKeyDown:$=>{le($);},placeholder:W,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:tr,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?ur:"transparent",color:x.trim()?"#00E5CC":Gt,border:x.trim()?`1px solid ${da}`:"1px solid transparent"},children:jsx(lw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function _m(e,t=50){let[r,a]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,d=true)=>{a(m=>{let u=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:u};if(!d)return {...m,present:u};let p=[...m.past,m.present];return p.length>t&&p.shift(),{past:p,present:u,future:[]}});},[t]),o=useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:d,future:[i.present,...i.future]}});},[]),c=useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:m}});},[]),l=useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function Km({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?o.metaKey:o.ctrlKey;if(l&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!c&&l&&o.key==="y"){o.preventDefault(),t();return}if(c&&l&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var fw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let r=De.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function qm(e){return {...fw,...e}}var Cw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Qm=forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:i=true,onExportSuccess:d,projectName:m,availableUsers:u=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:C,showCreateTaskButton:E=false,createTaskLabel:F,onCreateTask:k,taskFilter:S,onTaskFilterChange:P,toolbarRightContent:N,showBaseline:K,viewMode:U,onViewModeChange:ae,projectForecast:I,hideForecastHud:_,onThemeChange:j,onTaskClick:W,onTaskSelectionChange:B,selectedTaskId:ve,onTaskDblClick:je,onTaskContextMenu:Pe,onTaskUpdate:me,onDependentTasksScheduled:xe,onProgressChange:he,onTaskEdit:We,onTaskAddSubtask:Se,onTaskMarkIncomplete:Re,onTaskSetInProgress:Ae,onDependencyCreate:Ye,onDependencyDelete:se,onBeforeTaskAdd:Xe,onAfterTaskAdd:Be,onBeforeTaskUpdate:$e,onAfterTaskUpdate:mt,onBeforeTaskDelete:Nt,onAfterTaskDelete:ze,permissions:Fe,onCopySnapshotLink:nt}=r,Ie=useContext(ji)?.theme,[ot,L]=useState(Ie||s||"dark"),[Q,R]=useState(o),[J,O]=useState(c),[Y,Te]=useState(1),[ge,Ze]=useState("all"),[et,Je]=useState(U||"execution"),Bt=U??et,Tt=useCallback(M=>{Je(M),ae?.(M);},[ae]),zt=K??Bt==="oracle",[kt,tr]=useState(r.showCriticalPath!==false),[ur,da]=useState(r.showDependencies!==false),[Gt,gr]=useState(r.highlightWeekends!==false),Rt=useCallback(M=>{tr(M),r.onShowCriticalPathChange?.(M);},[r.onShowCriticalPathChange]),Kr=useCallback(M=>{da(M),r.onShowDependenciesChange?.(M);},[r.onShowDependenciesChange]),Vt=useCallback(M=>{gr(M),r.onHighlightWeekendsChange?.(M);},[r.onHighlightWeekendsChange]);useEffect(()=>{r.onTimeScaleChange?.(Q);},[Q]),useEffect(()=>{r.onZoomChange?.(Y);},[Y]);let Jt=useRef(r.onDateRangeChange);Jt.current=r.onDateRangeChange;let Gr=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[ua,tt]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let z=JSON.parse(A);if(z.taskFilter)return z.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),_e=S??ua,ga=P??tt,[sr,Zr]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let z=JSON.parse(A);if(typeof z.hideCompleted=="boolean")return z.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=Gr();if(M)try{let A={taskFilter:_e,hideCompleted:sr};localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[_e,sr,Gr]);let fr=useRef(h);useEffect(()=>{if(fr.current!==h&&h!==void 0){tt("all"),Zr(false);let M=Gr();if(M)try{localStorage.removeItem(M);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}fr.current=h;},[h,Gr]);let[wa,le]=useState(0),[de,dt]=useState(false),[V,be]=useState(null),[Z,$]=useState({isOpen:false,x:0,y:0,task:null}),[te,we]=useState(null),[T,H]=useState(null);useEffect(()=>{Ie&&Ie!==ot&&L(Ie);},[Ie]),useEffect(()=>{s&&s!==ot&&L(s);},[s]);let ue=useCallback(M=>{L(M),j?.(M);},[j]),{state:q,setState:ke,undo:st,redo:re,canUndo:it,canRedo:pt,clearHistory:St}=_m(t,50),br=useMemo(()=>{let M=(A,z=0)=>{let X=z;for(let ie of A)ie.subtasks?.length&&(X=Math.max(X,M(ie.subtasks,z+1)));return X};return M(q)+1},[q]),fa=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Pr=useRef(new Map),tn=useRef(false);if(!tn.current&&x){tn.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let A=localStorage.getItem(M);if(A){let z=JSON.parse(A);Array.isArray(z)&&(Pr.current=new Map(z));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let ir=useCallback(()=>{let M=fa();if(M)try{let A=Array.from(Pr.current.entries());localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[fa]),Ra=useRef(0),Ho=useRef(q);useEffect(()=>{Ho.current=q;},[q]);let Fn=useRef(false),_n=useCallback(M=>{Ze(M),Ra.current+=1,ke(A=>{let z=(ie,fe=0)=>ie.map(Ge=>{let Ve=M==="all"||fe<M-1;return Ge.subtasks?.length&&Pr.current.set(Ge.id,Ve),{...Ge,isExpanded:Ve,subtasks:Ge.subtasks?z(Ge.subtasks,fe+1):void 0}}),X=z(A);return ir(),X});},[ke,ir]);useEffect(()=>{if(Ra.current>0){Ra.current-=1;return}let M=z=>{let X=new Map;for(let ie of z){let fe=ie.id;X.get(fe)||X.set(fe,ie);}return Array.from(X.values())},A=z=>z.map(X=>{let ie=Pr.current.get(X.id),fe=ie!==void 0?{...X,isExpanded:ie}:X;if(fe.subtasks?.length){let Ge=M(fe.subtasks);return {...fe,subtasks:A(Ge)}}return fe});if(Pr.current.size>0)ke(Ya(A(t)));else {let z=X=>X.map(ie=>ie.subtasks?.length?{...ie,subtasks:M(z(ie.subtasks))}:ie);ke(Ya(z(t)));}},[t,ke]);let Uo=useRef(t),pi=useRef(true);useEffect(()=>{if(pi.current){pi.current=false,Uo.current=q;return}if(Fn.current){Fn.current=false,Uo.current=q;return}if(!a)return;let M=JSON.stringify(Uo.current),A=JSON.stringify(q);M!==A&&(Uo.current=q,a(q));},[q,a]);let Fr=useMemo(()=>Kc(w,C),[w,C]),Ln=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Ba=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Ga,Va]=useState(()=>{let M=Ln(Fr);if(!b)return M;try{let A=typeof b=="string"?b:"gantt-columns-state",z=localStorage.getItem(A);if(!z)return M;let X=JSON.parse(z),ie=new Map(X.map(fe=>[fe.id,fe]));return M.map(fe=>{let Ge=ie.get(fe.id);return Ge?{...fe,visible:Ge.visible??fe.visible,width:Ge.width??fe.width}:fe})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),M}}),D=useRef(Ba);useEffect(()=>{if(D.current===Ba)return;D.current=Ba;let M=Ln(Fr);if(!Ba){Va(M);return}try{let A=localStorage.getItem(Ba);if(!A){Va(M);return}let z=JSON.parse(A),X=new Map(z.map(ie=>[ie.id,ie]));Va(M.map(ie=>{let fe=X.get(ie.id);return fe?{...ie,visible:fe.visible??ie.visible,width:fe.width??ie.width}:ie}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),Va(M);}},[Ba,Ln,Fr]),useEffect(()=>{if(Ba&&D.current===Ba)try{let M=Ga.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(Ba,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[Ga,Ba]),useEffect(()=>{Va(M=>M.map(A=>({...A,label:Fr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Fr]);let ee=useMemo(()=>Ga.filter(A=>A.visible).reduce((A,z)=>A+z.width,0),[Ga]),pe=useRef(Ga.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Ga.filter(X=>X.visible),A=M.map(X=>X.id).join(","),z=pe.current;if(A!==z){let X=M.some(fe=>fe.id!=="name"),ie=z.includes(",");X?!ie&&X&&be(null):be(null),pe.current=A;}},[Ga]);let Ce=60,Ne=.6,Ke=useMemo(()=>{let A=ee+Ce,z=typeof window<"u"?window.innerWidth*Ne:800,X=Math.max(A,z);return V!==null?Math.max(200,Math.min(V,X)):Math.max(200,A)},[V,ee]),oe=useRef(null),Le=useRef(null),Oe=useRef(null),Qe=useRef(null),$t=useRef(null),He=useMemo(()=>um(ot),[ot]),ut=useMemo(()=>({theme:He,themeName:ot}),[He,ot]),pr=useMemo(()=>qm(p),[p]),hr=useMemo(()=>{if(!g||!kt)return q;let M=De.calculateCriticalPathFull(q),A=z=>z.map(X=>{let ie=M.get(X.id),fe=X.subtasks?A(X.subtasks):void 0,Ge=fe?.some(Qt=>Qt.isCriticalPath||Qt.subtasks&&Qt.subtasks.some(Ot=>Ot.isCriticalPath))||false,Ve=ie?ie.isCritical:Ge;return {...X,isCriticalPath:Ve,cpmData:ie||void 0,subtasks:fe}});return A(q)},[q,g,kt]),oa=useMemo(()=>De.flattenTasks(q).some(A=>A.dependencies&&A.dependencies.length>0),[q]),Et=useMemo(()=>{let M=(A,z="")=>[...A].sort((ie,fe)=>(ie.position??0)-(fe.position??0)).map((ie,fe)=>{let Ge=fe+1,Ve=z?`${z}.${Ge}`:`${Ge}.0`,Qt=z?`${z}.${Ge}`:`${Ge}`;return {...ie,wbsCode:Ve,subtasks:ie.subtasks?.length?M(ie.subtasks,Qt):ie.subtasks}});return M(hr)},[hr]),jt=useMemo(()=>{if(_e==="all"&&!sr)return Et;let M=A=>{let z=[];for(let X of A){let ie=X.subtasks?.length?M(X.subtasks):void 0,fe=false;if(sr)fe=X.progress<100;else switch(_e){case "all":fe=true;break;case "incomplete":fe=X.progress<100;break;case "in_progress":fe=X.progress>0&&X.progress<100;break;case "completed":fe=X.progress===100;break}(fe||ie&&ie.length>0)&&z.push({...X,subtasks:ie});}return z};return M(Et)},[Et,_e,sr]),ft=Cw(J);Km({undo:st,redo:re,canUndo:it,canRedo:pt,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>De.findTaskById(q,M),addTask:(M,A)=>{ke(z=>{if(!A)return [...z,{...M,level:0}];let X=ie=>ie.map(fe=>fe.id===A?{...fe,subtasks:[...fe.subtasks||[],{...M,parentId:A,level:(fe.level||0)+1}],isExpanded:true}:fe.subtasks?{...fe,subtasks:X(fe.subtasks)}:fe);return X(z)});},updateTask:(M,A)=>{ke(z=>{let X=ie=>ie.map(fe=>fe.id===M?{...fe,...A}:fe.subtasks?{...fe,subtasks:X(fe.subtasks)}:fe);return X(z)});},deleteTask:M=>{ke(A=>{let z=X=>X.filter(ie=>ie.id===M?false:(ie.subtasks&&(ie.subtasks=z(ie.subtasks)),true));return z(A)});},deleteTasks:M=>{ke(A=>rd(A,M));},duplicateTask:M=>{if(r.onTaskDuplicate){let A=De.findTaskById(q,M);A&&r.onTaskDuplicate(A);}else ke(A=>js(A,[M]).tasks);},splitTask:(M,A,z=3)=>{ke(X=>De.splitTask(X,M,A,z));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(M,A)=>!De.validateDependencies(q,M,A),getAllTasks:()=>De.flattenTasks(q),getTasksByStatus:M=>De.flattenTasks(q).filter(A=>A.status===M),getTasksByParent:M=>M?De.findTaskById(q,M)?.subtasks||[]:q.filter(z=>!z.parentId),getCriticalPath:()=>De.flattenTasks(q).filter(M=>M.isCriticalPath),indentTask:M=>{ke(A=>Ya(Zc(A,[M])));},outdentTask:M=>{ke(A=>Ya(ed(A,[M])));},moveTask:(M,A)=>{ke(z=>td(z,[M],A));},createSubtask:async M=>{let{tasks:A,newTask:z}=od(q,M);if(Xe){let X=Xe({...z,parentId:M});if((X instanceof Promise?await X:X)===false)return}ke(Ya(A)),Be&&Be({...z,parentId:M});},scrollToTask:M=>{let z=De.flattenTasks(q).findIndex(X=>X.id===M);if(z!==-1&&oe.current){let X=z*ft;oe.current.scrollTo({top:X,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:X,behavior:"smooth"});}},highlightTask:(M,A=2e3)=>{},expandTask:M=>{ke(A=>{let z=X=>X.map(ie=>ie.id===M?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:z(ie.subtasks)}:ie);return z(A)});},collapseTask:M=>{ke(A=>{let z=X=>X.map(ie=>ie.id===M?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:z(ie.subtasks)}:ie);return z(A)});},expandAll:()=>{ke(M=>{let A=z=>z.map(X=>({...X,isExpanded:true,subtasks:X.subtasks?A(X.subtasks):void 0}));return A(M)});},collapseAll:()=>{ke(M=>{let A=z=>z.map(X=>({...X,isExpanded:false,subtasks:X.subtasks?A(X.subtasks):void 0}));return A(M)});},collapseToLevel:M=>{_n(M);},undo:st,redo:re,canUndo:()=>it,canRedo:()=>pt,clearHistory:St,exportToPNG:async()=>{if(!Qe.current||!oe.current||!Oe.current)throw new Error("Gantt container not found");let M=Qe.current,A=oe.current,z=Le.current||A.querySelector(".gantt-grid-scroll"),X=Oe.current,ie=z?.scrollTop||0,fe=X.scrollTop,Ge=M.style.overflow,Ve=M.style.height,Qt=A.style.overflow;try{let Ot=z?.querySelector(".gantt-taskgrid-content"),rr=X.querySelector("svg"),ma=Ot?.scrollHeight||z?.scrollHeight||600,$a=rr?.getBoundingClientRect().height||X.scrollHeight,yo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ma,$a)+20;z&&(z.scrollTop=0),X.scrollTop=0,M.style.overflow="visible",M.style.height=`${yo}px`,A.style.overflow="visible",await new Promise(Go=>setTimeout(Go,100));let xn=await toPng(M,{backgroundColor:He.bgPrimary,pixelRatio:2,filter:Go=>{if(!(Go instanceof Element))return !0;let mi=window.getComputedStyle(Go),Ns=parseInt(mi.zIndex,10);return (isNaN(Ns)||Ns<50)&&mi.position!=="fixed"}});return await(await fetch(xn)).blob()}finally{M.style.overflow=Ge,M.style.height=Ve,A.style.overflow=Qt,z&&(z.scrollTop=ie),X.scrollTop=fe;}},exportToPDF:async M=>{await De.exportToPDF(q,M);},exportToExcel:async M=>{await De.exportToExcel(q,M,Gl.current);},exportToJSON:()=>De.exportToJSON(q),exportToCSV:()=>De.exportToCSV(q),importFromJSON:M=>{let A=De.importFromJSON(M);ke(A);},getTasks:()=>q,refresh:()=>{ke(M=>[...M]);},clearAll:()=>{ke([]);},scrollToToday:()=>{let M=Oe.current,A=$t.current;if(!M||!A)return;let X=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),ie=A.timeScale==="day"?60:A.timeScale==="week"?20:8,fe=X*ie*A.zoom,Ge=M.clientWidth,Ve=Math.max(0,fe-Ge/2);M.scrollTo({left:Ve,behavior:"smooth"});}}),[q,st,re,it,pt,St,He,ft]);let Mt=useCallback(M=>{Va(A=>A.map(z=>z.id===M?{...z,visible:!z.visible}:z));},[]),Lr=useCallback((M,A)=>{Va(z=>z.map(X=>{if(X.id!==M)return X;let ie=X.minWidth??100,fe=X.maxWidth??800,Ge=Math.max(ie,Math.min(fe,A));return {...X,width:Ge}}));},[]),ba=useCallback(M=>{ke(A=>{let z=nd(A,M),X=ie=>{for(let fe of ie){if(fe.id===M){Pr.current.set(M,fe.isExpanded??true);return}fe.subtasks?.length&&X(fe.subtasks);}};return X(z),ir(),z}),r.onTaskToggleExpand?.(M);},[r,ir]),Ar=useCallback((M,A)=>{if($e&&$e(M,A)===false)return;let X=De.findTaskById(q,M)?.progress,ie=Ge=>Ge.map(Ve=>Ve.id===M?{...Ve,...A}:Ve.subtasks?{...Ve,subtasks:ie(Ve.subtasks)}:Ve);ke(Ge=>ie(Ge));let fe=De.findTaskById(ie(q),M);fe&&(me?.(fe),mt?.(fe),A.progress!==void 0&&X!==void 0&&A.progress!==X&&he?.(M,X,A.progress));},[q,me,$e,mt,he]),pa=useCallback((M,A,z)=>{if(M.length===0)return;let X=new Set(M),ie=fe=>fe.map(Ge=>{let Ve=X.has(Ge.id)?{...Ge,[A]:z}:Ge;return Ve.subtasks?{...Ve,subtasks:ie(Ve.subtasks)}:Ve});ke(fe=>{let Ge=ie(fe);return r.onBulkFill?.(M,A,z,Ge),Ge});},[r]),qr=useCallback(M=>{M.length!==0&&(Ra.current+=1,Fn.current=true,ke(A=>Ya(Zc(A,M))),r.onTaskIndent?.(M[0]));},[r]),bo=useCallback(M=>{M.length!==0&&(Ra.current+=1,Fn.current=true,ke(A=>Ya(ed(A,M))),r.onTaskOutdent?.(M[0]));},[r]),Cs=useCallback((M,A,z)=>{Ra.current+=1,Fn.current=true,ke(X=>Ya(Am(X,M,A,z))),r.onTaskReparent?.(M,A,z);},[r]),ho=useCallback((M,A)=>{M.length!==0&&(Ra.current+=1,Fn.current=true,ke(z=>td(z,M,A)),r.onTaskMove?.(M[0],A));},[r]),Ul=useCallback(async M=>{let A=[];for(let z of M)Nt&&await Promise.resolve(Nt(z))===false||A.push(z);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(ke(z=>Ya(rd(z,A))),A.forEach(z=>r.onTaskDelete?.(z))),ze&&A.forEach(z=>ze(z)));},[r,Nt,ze]),Zf=useCallback(M=>{r.onTaskDuplicate?M.forEach(A=>{let z=De.findTaskById(q,A);z&&r.onTaskDuplicate(z);}):ke(A=>js(A,M).tasks);},[r,q]),eb=useCallback((M,A)=>{ke(z=>{let{tasks:X,newTask:ie}=Lm(z,M,A);return Xe&&Xe(ie)===false?z:(r.onTaskCreate?.(ie.parentId,ie.position||0),Be?.(ie),X)});},[r,Xe,Be]),tb=useCallback((M,A)=>{ke(z=>ad(z,M,A)),r.onTaskRename?.(M,A);},[r]),Wl=useCallback(M=>{let{onTaskAddSubtask:A}=r;if(A){let z=ss(q,M);if(z){A(z);return}}ke(z=>{let{tasks:X}=od(z,M);return r.onTaskCreate?.(M,0),X});},[r,q]),rb=useCallback((M,A)=>{let z=Math.max(0,Math.min(100,Math.round(A))),X={progress:z};z===100?X.status="completed":z>0?X.status="in-progress":X.status="todo",Ar(M.id,X);},[Ar]),ab=useCallback((M,A,z)=>{let X=!M.startDate&&!M.endDate,ie=M.startDate?Math.round((A.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,fe=Ot=>Ot.map(rr=>rr.id===M.id?{...rr,startDate:A,endDate:z,...M.segments&&{segments:M.segments}}:rr.subtasks?{...rr,subtasks:fe(rr.subtasks)}:rr),Ge=fe(q),Ve=Ge;Ge=De.autoScheduleDependents(Ge,M.id,ie),Ge=Ya(Ge),ke(Ge);let Qt={...M,startDate:A,endDate:z};if(X&&r?.onTaskDateChange?r.onTaskDateChange(M,A,z):me?.(Qt),xe&&ie!==0){let Ot=De.flattenTasks(Ve),rr=De.flattenTasks(Ge),ma=[];for(let $a of rr){if($a.id===M.id)continue;let Kn=Ot.find(xn=>xn.id===$a.id);if(!Kn)continue;let zo=$a.startDate?.getTime()!==Kn.startDate?.getTime(),yo=$a.endDate?.getTime()!==Kn.endDate?.getTime();(zo||yo)&&ma.push($a);}ma.length>0&&xe(ma);}},[q,me,xe,r]),nb=useCallback((M,A)=>{Pe?.(M,A),$({isOpen:true,x:A.clientX,y:A.clientY,task:M});},[Pe]),ob=useCallback((M,A)=>{let z=De.splitTask(q,M.id,A);ke(z),$({isOpen:false,x:0,y:0,task:null});},[q]),yu=useCallback(M=>{let A=De.findTaskById(q,M.id)||M;je?.(A),We||we(A);},[q,je,We]),xu=useCallback((M,A,z)=>{let X=new Map,ie=Ot=>{Ot.forEach(rr=>{rr.dependencies&&X.set(rr.id,rr.dependencies),rr.subtasks&&ie(rr.subtasks);});};ie(z);let fe=X.get(A)||[];X.set(A,[...fe,M]);let Ge=new Set,Ve=new Set,Qt=Ot=>{if(!Ge.has(Ot)){Ge.add(Ot),Ve.add(Ot);let rr=X.get(Ot)||[];for(let ma of rr){if(!Ge.has(ma)&&Qt(ma))return true;if(Ve.has(ma))return true}}return Ve.delete(Ot),false};return Qt(A)},[]),vu=useCallback((M,A)=>{if(xu(M.id,A,Ho.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 W=Y=>Y.map(oe=>{if(oe.id===A){let ge=oe.dependencies||[];if(!ge.includes(M.id))return {...oe,dependencies:[...ge,M.id]}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});Ra.current+=1,Z(Y=>W(Y)),He?.(M.id,A);},[He,yu]),vu=useCallback((M,A)=>{let W=Y=>Y.map(oe=>{if(oe.id===M&&oe.dependencies){let ge=oe.dependencies.filter(je=>je!==A);return {...oe,dependencies:ge}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});Ra.current+=1,Z(Y=>W(Y)),Be?.(M,A);},[Be]),{startDate:Ln,endDate:Wl}=useMemo(()=>{let M=G.filter(ge=>ge.startDate&&ge.endDate);if(M.length===0){let ge=new Date,je=new Date(ge);je.setDate(je.getDate()-30);let _e=new Date(ge);return _e.setDate(_e.getDate()+60),{startDate:je,endDate:_e}}let A=M.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),W=new Date(Math.min(...A.map(ge=>ge.getTime()))),Y=new Date(Math.max(...A.map(ge=>ge.getTime()))),oe=F==="day"?7:F==="week"?14:30;return W.setDate(W.getDate()-oe),Y.setDate(Y.getDate()+oe),{startDate:W,endDate:Y}},[G,F]);useEffect(()=>{jt.current?.(Ln,Wl);},[Ln,Wl]);let ob=useCallback(async()=>{if(!Ve.current||!We.current||!Ee.current)return;await new Promise(yo=>setTimeout(yo,200));let M=Ve.current,A=We.current,W=ce.current||A.querySelector(".gantt-grid-scroll"),Y=Ee.current,oe=W?.scrollTop||0,ge=W?.scrollLeft||0,je=Y.scrollTop,_e=Y.scrollLeft,Zt=M.style.overflow,Ht=M.style.height,ar=W?.style.overflow||"",ga=Y.style.overflow,Ba=A.style.overflow,Kn=M.style.width,zo=Y.style.width;try{let yo=W?.querySelector(".gantt-taskgrid-content"),yn=Y.querySelector("svg"),jl=yn?.getAttribute("height")?parseInt(yn.getAttribute("height"),10):yn?.getBoundingClientRect().height||0,Go=yo?.scrollHeight||W?.scrollHeight||600,mi=Math.max(jl,Y.scrollHeight),Ns=yn?.getAttribute("width")?parseInt(yn.getAttribute("width"),10):yn?.getBoundingClientRect().width||Y.scrollWidth,mb=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,_l=Math.max(Go,mi,jl),Tu=mb+_l+50,Nu=(W?.offsetWidth||A.offsetWidth||300)+Ns+10;W&&(W.scrollTop=0,W.scrollLeft=0),Y.scrollTop=0,Y.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Tu}px`,M.style.width=`${Nu}px`,A.style.overflow="visible",W&&(W.style.overflow="visible",W.style.height=`${_l+50}px`),Y.style.overflow="visible",Y.style.height=`${_l+50}px`,Y.style.width=`${Ns+10}px`,await new Promise(gi=>setTimeout(gi,150));let gb=await toPng(M,{backgroundColor:et.bgPrimary,pixelRatio:2,width:Nu,height:Tu,skipFonts:!1,filter:gi=>{if(!(gi instanceof Element))return !0;let Du=window.getComputedStyle(gi),Su=parseInt(Du.zIndex,10);return !(!isNaN(Su)&&Su>=50||Du.position==="fixed")}}),Kl=document.createElement("a");Kl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Kl.href=gb,Kl.click();}finally{M.style.overflow=Zt,M.style.height=Ht,M.style.width=Kn,A.style.overflow=Ba,W&&(W.style.overflow=ar,W.style.height="",W.scrollTop=oe,W.scrollLeft=ge),Y.style.overflow=ga,Y.style.height="",Y.style.width=zo,Y.scrollTop=je,Y.scrollLeft=_e;}d?.("png");},[et,d]),sb=useCallback(async()=>{await Ce.exportToPDF(G),d?.("pdf");},[G,d]),zl=useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:u});zl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:u};let ib=useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let M=new Date,A=oe=>String(oe).padStart(2,"0"),W=`${M.getFullYear()}-${A(M.getMonth()+1)}-${A(M.getDate())}_${A(M.getHours())}${A(M.getMinutes())}`,Y=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ce.exportToExcel(G,`${Y}_${W}.xlsx`,zl.current),d?.("excel");},[G,u,d,r.onExportExcel]),lb=useCallback(()=>{let M=Ce.exportToCSV(G),A=new Blob([M],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(A),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href),d?.("csv");},[G,d]),cb=useCallback(()=>{let M=Ce.exportToJSON(G),A=new Blob([M],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(A),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href),d?.("json");},[G,d]),db=useCallback(()=>{Ce.exportToMSProject(G,"Gantt Project","project.xml"),d?.("msproject");},[G,d]),ub=M=>{M.preventDefault(),it(true);},Wo=useRef(false),[Gl,wu]=useState(false),Ts=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Ee.current,A=We.current?.querySelector(".gantt-grid-scroll");if(!M||!A)return;let W=()=>{if(Wo.current)return;Wo.current=true;let _e=M.scrollTop;ne(_e),A.scrollTop=_e,requestAnimationFrame(()=>{Wo.current=false;});},Y=()=>{if(Wo.current)return;Wo.current=true;let _e=A.scrollTop;ne(_e),M.scrollTop=_e,requestAnimationFrame(()=>{Wo.current=false;});},oe=_e=>{if(fe&&A){let Ht=A.parentElement?.getBoundingClientRect()?.left||0,ar=_e.clientX-Ht,ga=200,Ba=D+pe,Kn=window.innerWidth*ke,zo=Math.max(Ba,Kn);ar>=ga&&ar<=zo&&_(ar);}if(Gl&&M){let Zt=_e.clientX-Ts.current.x,Ht=_e.clientY-Ts.current.y;M.scrollLeft=Ts.current.scrollLeft-Zt,M.scrollTop=Ts.current.scrollTop-Ht;}},ge=()=>{it(false),wu(false);},je=_e=>{if(_e.button!==0)return;let Zt=_e.target;Zt.closest("[data-task-bar]")||Zt.closest("[data-dependency-line]")||Zt.closest("button")||Zt.closest('[role="button"]')||Zt.tagName==="rect"&&Zt.getAttribute("data-clickable")==="true"||(wu(true),Ts.current={x:_e.clientX,y:_e.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},_e.preventDefault());};return M.addEventListener("scroll",W),A.addEventListener("scroll",Y),M.addEventListener("mousedown",je),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ge),()=>{M.removeEventListener("scroll",W),A.removeEventListener("scroll",Y),M.removeEventListener("mousedown",je),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ge);}},[fe,Gl,D]),rt.current={startDate:Ln,timeScale:F,zoom:O};let Vl=r.onTodayVisibilityChange,ku=useRef(null);useEffect(()=>{if(!Vl)return;let M=Ee.current;if(!M)return;let A=F==="day"?60:F==="week"?20:8,W=()=>{let ge=(new Date().getTime()-Ln.getTime())/(1e3*60*60*24)*A*O,je=M.scrollLeft,_e=je+M.clientWidth,Zt=ge>=je&&ge<=_e;ku.current!==Zt&&(ku.current=Zt,Vl(Zt));};return W(),M.addEventListener("scroll",W,{passive:true}),window.addEventListener("resize",W),()=>{M.removeEventListener("scroll",W),window.removeEventListener("resize",W);}},[Vl,Ln,F,O]);let Cu=useRef(false),pb=useRef(null);return useLayoutEffect(()=>{if(Cu.current||G.length===0||!Ee.current)return;Cu.current=true,pb.current=Ln;let M=Ee.current,A=new Date,W=F==="day"?60:F==="week"?20:8,Y=(A.getTime()-Ln.getTime())/(1e3*60*60*24),oe=M.clientWidth,je=Y*W*O-oe/2;Y>=0&&oe>0&&(M.scrollLeft=Math.max(0,je));},[G.length,Ln,F,O]),jsx(rs.Provider,{value:Yr,children:jsx(Ql.Provider,{value:pt,children:jsxs("div",{ref:Ve,className:"flex flex-col h-full w-full",style:{backgroundColor:et.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...et.dotGrid&&{backgroundImage:`radial-gradient(circle, ${et.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ki,{theme:et,timeScale:F,onTimeScaleChange:re,zoom:O,onZoomChange:J,currentTheme:Ie,onThemeChange:V,rowDensity:R,onRowDensityChange:X,showThemeSelector:l,showCreateTaskButton:E&&Re?.canCreateTask!==false&&!Re?.canCreateSubtaskOnly,createTaskLabel:L,onCreateTask:k,taskFilter:Xe,onTaskFilterChange:Je,hideCompleted:zr,onHideCompletedChange:Cr,toolbarRightContent:N,wbsLevel:Te,onWbsLevelChange:jn,maxWbsDepth:Mt,viewMode:Ye,onViewModeChange:$t,projectForecast:I,hideForecastHud:q,onExportPNG:i?ob:void 0,onExportPDF:i?sb:void 0,onExportExcel:i?ib:void 0,onExportCSV:i?lb:void 0,onExportJSON:i?cb:void 0,onExportMSProject:i?db:void 0,showCriticalPath:St,onShowCriticalPathChange:fr,showDependencies:rr,onShowDependenciesChange:At,highlightWeekends:ia,onHighlightWeekendsChange:qr,showBaseline:Dt,onShowBaselineChange:M=>{M&&Ye!=="oracle"&&$t("oracle"),!M&&Ye==="oracle"&&$t("execution");},onCopySnapshotLink:Le,hasDependencies:vr})}),jsxs("div",{ref:We,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:ce,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ne,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Xi,{tasks:Ot,allTasks:Vr,theme:et,rowHeight:zt,availableUsers:p,templates:dt,showCriticalPath:St,onTaskClick:U,onTaskSelectionChange:B,onTaskDblClick:hu,onTaskContextMenu:Ge,onTaskToggle:Lr,scrollTop:fa,columns:Za,onToggleColumn:wt,onColumnResize:Pt,onTaskUpdate:Nr,onBulkFill:wa,onTaskIndent:ma,onTaskOutdent:Xr,onTaskMove:Cs,onMultiTaskDelete:Fn,onTaskDuplicate:Qf,onTaskCreate:Zf,onTaskRename:eb,onCreateSubtask:Ul,onOpenTaskModal:U?M=>U(M):void 0,onDeleteRequest:(M,A)=>T({taskIds:M,taskName:A}),onTaskReparent:ho,scrollContainerRef:ce})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:et.border,zIndex:15},onMouseDown:ub}),jsx("div",{ref:Ee,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Gl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(al,{tasks:Ot,theme:et,rowHeight:zt,timeScale:F,startDate:Ln,endDate:Wl,zoom:O,locale:w,templates:dt,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:U,onTaskDblClick:hu,onTaskContextMenu:ab,onTaskDateChange:rb,onTaskProgressDrag:tb,onDependencyCreate:xu,onDependencyDelete:vu,showBaseline:Dt,showCriticalPath:St,showDependencies:rr,highlightWeekends:ia,canEditTask:Re?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),se.task&&jsx(os,{isOpen:se.isOpen,x:se.x,y:se.y,theme:et,onClose:()=>ee({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=se.task;if(!M)return [];let A=Ce.findTaskById(G,M.id)||M,W=A.subtasks&&A.subtasks.length>0,Y=Re?.canCreateTask!==false,oe=Re?.canDeleteTask!==false;if(W){let Ht=[],ar=Re?.canDuplicateTask!==false;return Y&&Ht.push({id:"addSubtask",label:Yr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Oe?Oe(A):Ul(A.id);}}),ar&&Ht.push({id:"duplicate",label:Yr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):Z(ga=>js(ga,[A.id]).tasks),ee({isOpen:false,x:0,y:0,task:null});}}),oe&&(Ht.length>0&&Ht.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ht.push({id:"delete",label:Yr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{T({taskIds:[A.id],taskName:A.name});}})),Ht}let ge=Re?.canUpdateTask!==false,je=Re?.canDuplicateTask!==false,_e=[];return ge&&_e.push({id:"edit",label:Yr.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{he?he(A):de(A);}}),Y&&_e.push({id:"addSubtask",label:Yr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Oe?Oe(A):Ul(A.id);}}),_e.length>0&&ge&&_e.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(_e.push({id:"markIncomplete",label:Yr.contextMenu?.markIncomplete||"Mark Incomplete",icon:tr.MarkIncomplete,onClick:()=>{Se?Se(A):Nr(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),_e.push({id:"setInProgress",label:Yr.contextMenu?.setInProgress||"Set In Progress",icon:tr.SetInProgress,onClick:()=>{Fe?Fe(A):Nr(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),_e.push({id:"markComplete",label:Yr.contextMenu?.markComplete||"Mark Complete",icon:tr.MarkComplete,onClick:()=>{Nr(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(je||ge&&A.startDate&&A.endDate)&&_e.length>0&&_e.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),je&&_e.push({id:"duplicate",label:Yr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):Z(Ht=>js(Ht,[A.id]).tasks),ee({isOpen:false,x:0,y:0,task:null});}}),ge&&A.startDate&&A.endDate&&_e.push({id:"split",label:Yr.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{let Ht=A.startDate.getTime(),ar=A.endDate.getTime(),ga=Ht+(ar-Ht)/2,Ba=new Date(ga);nb(A,Ba);}}),oe&&(_e.length>0&&_e.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),_e.push({id:"delete",label:Yr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{T({taskIds:[A.id],taskName:A.name});}})),_e})()}),jsx(No,{task:$,isOpen:!!$,onClose:()=>de(null),onTaskUpdate:M=>{$&&(Nr($.id,M),de(null));},theme:Ie==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:xe&&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:()=>T(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:et.bgSecondary,border:`1px solid ${et.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${et.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:et.textPrimary,fontFamily:"Inter, sans-serif"},children:[Yr.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:et.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:et.textSecondary,fontFamily:"Inter, sans-serif"},children:xe.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:et.textPrimary},children:[xe.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:et.textPrimary},children:['"',xe.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:et.bgPrimary,borderTop:`1px solid ${et.border}`},children:[jsx("button",{onClick:()=>T(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:et.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=et.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Fn(xe.taskIds),T(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsx(sl,{tasks:G,theme:et,config:v,onTasksUpdate:Z,onTaskUpdate:Nr,onTaskCreate:M=>{Z(A=>[...A,M]);},onTaskDelete:M=>{Fn([M]);},onDependencyCreate:(M,A)=>{let W=Ce.findTaskById(G,M);W&&xu(W,A);},onDependencyDelete:vu})]})})})});function Lw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Aw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],ld=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function eg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:c=r?"edit":"create",theme:l="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:u,attachments:p=[],onUploadAttachments:m,onDeleteAttachment:g,defaultStatus:x}){let y=[...id,...i.filter(F=>!id.some(re=>re.id===F.id))],b=st[l]||st.dark,[h,v]=useState(false),[w,C]=useState(false),[E,L]=useState(false),[k,S]=useState(false),[P,N]=useState({top:0,left:0}),[K,H]=useState(null),[Q,I]=useState(new Date),[q,j]=useState({top:0,left:0}),[U,B]=useState(false),[we,Ge]=useState([]),[Pe,be]=useState(false),[ve,he]=useState(""),Oe=useRef(null),Se=useRef(null),Fe=useRef(null),He=useRef(null),Be=useRef(null),[ue,Ke]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[ze,Ae]=useState({});useEffect(()=>{r?(Ke({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&B(true)):(Ke({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),Ge([]));},[r,e,x]),useEffect(()=>{let F=re=>{Oe.current&&!Oe.current.contains(re.target)&&v(false),Se.current&&!Se.current.contains(re.target)&&C(false),Fe.current&&!Fe.current.contains(re.target)&&L(false),He.current&&!He.current.contains(re.target)&&S(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let Tt=()=>{let F={};return ue.name.trim()||(F.name="El nombre es requerido"),ue.startDate&&ue.endDate&&ue.startDate>ue.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),Ae(F),Object.keys(F).length===0},Nt=async F=>{if(F.preventDefault(),!!Tt())try{let re=c==="create"&&we.length>0?{...ue,pendingFiles:we}:ue;await s(re),Ge([]),t();}catch(re){console.error("Error submitting task:",re);}},Re=(F,re)=>{Ke(R=>{let X={...R,[F]:re};if(F==="status"){let O=re;O==="todo"?X.progress=0:O==="in-progress"?(R.progress===0||R.progress===100)&&(X.progress=50):O==="completed"||O==="closed"?X.progress=100:(O==="in-review"||O==="review")&&(X.progress=75);}if(F==="progress"){let O=typeof re=="number"?re:parseInt(re,10);O===100&&R.status!=="completed"?X.status="completed":O>0&&O<100&&R.status==="todo"?X.status="in-progress":O===0&&R.status!=="todo"&&(X.status="todo");}return X}),ze[F]&&Ae(R=>{let X={...R};return delete X[F],X});},Le=y.find(F=>F.id===ue.status)??id[0],ut=ld.find(F=>F.id===ue.priority)??ld[1],Ct=To.find(F=>F.value===ue.color)??To[0],Ie=l==="dark",lt={backgroundColor:Ie?"#1d1f27":b.bgSecondary,border:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ie?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":l,style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Ie?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:F=>F.stopPropagation(),children:jsxs("form",{onSubmit:Nt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ue.name,onChange:F=>Re("name",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),ze.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),ze.name]}),jsx("textarea",{value:ue.description||"",onChange:F=>Re("description",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Oe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...lt,borderColor:Le.color,backgroundColor:`${Le.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Le.color}}),jsx("span",{style:{color:Le.color},children:Le.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Le.color}})]}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("status",F.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,ue.status===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),jsxs("div",{ref:Se,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsx("span",{children:ut.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:ld.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("priority",F.id),C(false);},children:[jsx("span",{children:F.icon}),F.label,ue.priority===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),n.length>0&&jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&L(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:o,children:[ue.assignees&&ue.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ue.assignees.slice(0,3).map((F,re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:F.color||b.accent,borderColor:b.bgSecondary},children:F.initials},re))}),ue.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",ue.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(F=>{let re=ue.assignees?.some(R=>R.name===F.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=re?(ue.assignees||[]).filter(X=>X.name!==F.name):[...ue.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(X=>X[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Re("assignees",R);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:F.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},F.id)})})})]}),jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(k)S(false);else {if(He.current){let F=He.current.getBoundingClientRect(),re=window.innerHeight,R=120,O=re-F.bottom<R?F.top-R-8:F.bottom+8;N({top:O,left:F.left});}S(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ue.color}}),jsx("span",{children:Ct.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsxs(nr,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:To.slice(0,18).map(F=>{let re=ue.color===F.value;return jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),Re("color",F.value),S(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:F.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:re?`2px solid ${F.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},F.value)})})})})]})})]}),d.length>0||u?jsx(Ko,{selectedTags:ue.tags||[],availableTags:d,onChange:F=>Re("tags",F),onCreateTag:u,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ie?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Ie?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:Be,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!ue.isMilestone)if(K==="start")H(null);else {if(Be.current){let F=Be.current.getBoundingClientRect();j({top:F.bottom+8,left:Math.max(16,F.left-40)});}H("start"),I(ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...lt,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:o||ue.isMilestone,children:ue.startDate?ue.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!ue.isMilestone)if(K==="end")H(null);else {if(Be.current){let F=Be.current.getBoundingClientRect();j({top:F.bottom+8,left:Math.max(16,F.left-40)});}H("end"),I(ue.endDate||ue.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...lt,opacity:ue.isMilestone?.5:1,cursor:ue.isMilestone?"not-allowed":"pointer"},disabled:o||ue.isMilestone,children:ue.endDate?ue.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(nr,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${q.top}px`,left:`${q.left}px`,zIndex:99999,backgroundColor:Ie?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ie?"#262626":b.border}`},children:[(()=>{let F=new Date,re=new Date(F);re.setDate(F.getDate()+1);let R=new Date(F);R.setDate(F.getDate()+7);let X=new Date(F);return X.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:X}].map((J,Te)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:me=>me.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(Re("startDate",J.date),(!ue.endDate||J.date>ue.endDate)&&Re("endDate",J.date),H("end")):(Re("endDate",J.date),(!ue.startDate||J.date<ue.startDate)&&Re("startDate",J.date),H(null));},children:J.label},Te))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{Re("startDate",void 0),Re("endDate",void 0),H(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>I(new Date(Q.getFullYear(),Q.getMonth()-1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Q.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(new Date(Q.getFullYear(),Q.getMonth()+1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((F,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:F},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=Q.getFullYear(),re=Q.getMonth(),R=new Date(F,re,1).getDay(),X=new Date(F,re+1,0).getDate(),O=new Date,J=[];for(let me=R-1;me>=0;me--)J.push({day:new Date(F,re,-me).getDate(),date:new Date(F,re-1,new Date(F,re,-me).getDate()),isCurrentMonth:false});for(let me=1;me<=X;me++)J.push({day:me,date:new Date(F,re,me),isCurrentMonth:true});let Te=42-J.length;for(let me=1;me<=Te;me++)J.push({day:me,date:new Date(F,re+1,me),isCurrentMonth:false});return J.map((me,tt)=>{let ot=me.date.toDateString()===O.toDateString(),Ye=ue.startDate?.toDateString()===me.date.toDateString(),$t=ue.endDate?.toDateString()===me.date.toDateString(),Dt=ue.startDate&&ue.endDate&&me.date>=ue.startDate&&me.date<=ue.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:me.isCurrentMonth?Ye||$t?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ye?b.accent:$t?"#7C3AED":Dt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ot&&!Ye&&!$t?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{K==="start"?(Re("startDate",me.date),ue.endDate&&me.date>ue.endDate&&Re("endDate",me.date),H("end")):(Re("endDate",me.date),ue.startDate&&me.date<ue.startDate&&Re("startDate",me.date),H(null));},children:me.day},tt)})})()})]})]})]})})]}),ze.endDate&&jsx("span",{className:"text-xs text-red-400",children:ze.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ue.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ie?"#33343c":"#E5E7EB"},onClick:F=>{if(o)return;let re=F.currentTarget.getBoundingClientRect(),R=Math.round((F.clientX-re.left)/re.width*100/5)*5;Re("progress",Math.max(0,Math.min(100,R)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ie?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!U),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${U?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:U&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ue.effortMinutes?Lw(ue.effortMinutes):"",onChange:F=>{let re=Aw(F.target.value);Re("effortMinutes",re);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ue.parentId||"",onChange:F=>Re("parentId",F.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(F=>F.id!==r?.id).map(F=>jsx("option",{value:F.id,children:F.name},F.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ue.location||"",onChange:F=>Re("location",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ue.equipment||"",onChange:F=>Re("equipment",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||p.length>0||c==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",c==="create"?we.length>0&&`(${we.length})`:p.length>0&&`(${p.length})`]})]}),c==="create"?jsx(Jo,{cardId:"pending",attachments:we.map((F,re)=>({id:`pending-${re}`,cardId:"pending",name:F.name,size:F.size,type:F.type,url:URL.createObjectURL(F),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:F=>Ge(re=>[...re,...F]),onDelete:F=>{let re=parseInt(F.replace("pending-",""),10);Ge(R=>R.filter((X,O)=>O!==re));},maxSizeMB:10,maxFiles:20}):jsx(Jo,{cardId:r?.id||"new",attachments:p,onUpload:m&&r?.id?F=>m(r.id,F):void 0,onDelete:g,maxSizeMB:10,maxFiles:20}),c==="create"&&we.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[we.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ue.isMilestone,onChange:F=>Re("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ue.dependencies&&ue.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ue.dependencies.map(F=>{let re=a.find(R=>R.id===F);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[re?.name||F.slice(0,8),jsx("button",{type:"button",onClick:()=>{let R=(ue.dependencies||[]).filter(X=>X!==F);Re("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},F)})}),jsxs("button",{type:"button",onClick:()=>{be(!Pe),he("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{be(false),he("");}}),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:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:ve,onChange:F=>he(F.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(F=>F.id!==r?.id).filter(F=>ve===""||F.name.toLowerCase().includes(ve.toLowerCase())).map(F=>{let re=ue.dependencies?.includes(F.id);return jsxs("button",{type:"button",onClick:()=>{let R=ue.dependencies||[],X;re?X=R.filter(O=>O!==F.id):X=[...R,F.id],Re("dependencies",X);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:re?`${b.accent}10`:"transparent"},onMouseEnter:R=>{re||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=re?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:re?b.accent:"transparent",borderColor:re?b.accent:b.borderLight},children:re&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:F.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:F.id.slice(0,8)})]})]},F.id)}),a.filter(F=>F.id!==r?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Ie?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:F=>F.currentTarget.style.color=b.textPrimary,onMouseLeave:F=>F.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:F=>!o&&(F.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:F=>!o&&(F.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var tg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let z=X=>X.map(ie=>{if(ie.id===A){let fe=ie.dependencies||[];if(!fe.includes(M.id))return {...ie,dependencies:[...fe,M.id]}}return ie.subtasks?{...ie,subtasks:z(ie.subtasks)}:ie});Ra.current+=1,ke(X=>z(X)),Ye?.(M.id,A);},[Ye,xu]),wu=useCallback((M,A)=>{let z=X=>X.map(ie=>{if(ie.id===M&&ie.dependencies){let fe=ie.dependencies.filter(Ge=>Ge!==A);return {...ie,dependencies:fe}}return ie.subtasks?{...ie,subtasks:z(ie.subtasks)}:ie});Ra.current+=1,ke(X=>z(X)),se?.(M,A);},[se]),{startDate:An,endDate:zl}=useMemo(()=>{let M=q.filter(fe=>fe.startDate&&fe.endDate);if(M.length===0){let fe=new Date,Ge=new Date(fe);Ge.setDate(Ge.getDate()-30);let Ve=new Date(fe);return Ve.setDate(Ve.getDate()+60),{startDate:Ge,endDate:Ve}}let A=M.flatMap(fe=>[fe.startDate,fe.endDate]).filter(fe=>fe!==void 0),z=new Date(Math.min(...A.map(fe=>fe.getTime()))),X=new Date(Math.max(...A.map(fe=>fe.getTime()))),ie=Q==="day"?7:Q==="week"?14:30;return z.setDate(z.getDate()-ie),X.setDate(X.getDate()+ie),{startDate:z,endDate:X}},[q,Q]);useEffect(()=>{Jt.current?.(An,zl);},[An,zl]);let sb=useCallback(async()=>{if(!Qe.current||!oe.current||!Oe.current)return;await new Promise(yo=>setTimeout(yo,200));let M=Qe.current,A=oe.current,z=Le.current||A.querySelector(".gantt-grid-scroll"),X=Oe.current,ie=z?.scrollTop||0,fe=z?.scrollLeft||0,Ge=X.scrollTop,Ve=X.scrollLeft,Qt=M.style.overflow,Ot=M.style.height,rr=z?.style.overflow||"",ma=X.style.overflow,$a=A.style.overflow,Kn=M.style.width,zo=X.style.width;try{let yo=z?.querySelector(".gantt-taskgrid-content"),xn=X.querySelector("svg"),_l=xn?.getAttribute("height")?parseInt(xn.getAttribute("height"),10):xn?.getBoundingClientRect().height||0,Go=yo?.scrollHeight||z?.scrollHeight||600,mi=Math.max(_l,X.scrollHeight),Ns=xn?.getAttribute("width")?parseInt(xn.getAttribute("width"),10):xn?.getBoundingClientRect().width||X.scrollWidth,gb=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Kl=Math.max(Go,mi,_l),Nu=gb+Kl+50,Du=(z?.offsetWidth||A.offsetWidth||300)+Ns+10;z&&(z.scrollTop=0,z.scrollLeft=0),X.scrollTop=0,X.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Nu}px`,M.style.width=`${Du}px`,A.style.overflow="visible",z&&(z.style.overflow="visible",z.style.height=`${Kl+50}px`),X.style.overflow="visible",X.style.height=`${Kl+50}px`,X.style.width=`${Ns+10}px`,await new Promise(gi=>setTimeout(gi,150));let fb=await toPng(M,{backgroundColor:He.bgPrimary,pixelRatio:2,width:Du,height:Nu,skipFonts:!1,filter:gi=>{if(!(gi instanceof Element))return !0;let Su=window.getComputedStyle(gi),Eu=parseInt(Su.zIndex,10);return !(!isNaN(Eu)&&Eu>=50||Su.position==="fixed")}}),ql=document.createElement("a");ql.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ql.href=fb,ql.click();}finally{M.style.overflow=Qt,M.style.height=Ot,M.style.width=Kn,A.style.overflow=$a,z&&(z.style.overflow=rr,z.style.height="",z.scrollTop=ie,z.scrollLeft=fe),X.style.overflow=ma,X.style.height="",X.style.width=zo,X.scrollTop=Ge,X.scrollLeft=Ve;}d?.("png");},[He,d]),ib=useCallback(async()=>{await De.exportToPDF(q),d?.("pdf");},[q,d]),Gl=useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m});Gl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m};let lb=useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let M=new Date,A=ie=>String(ie).padStart(2,"0"),z=`${M.getFullYear()}-${A(M.getMonth()+1)}-${A(M.getDate())}_${A(M.getHours())}${A(M.getMinutes())}`,X=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(q,`${X}_${z}.xlsx`,Gl.current),d?.("excel");},[q,m,d,r.onExportExcel]),cb=useCallback(()=>{let M=De.exportToCSV(q),A=new Blob([M],{type:"text/csv;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(A),z.download="gantt-chart.csv",z.click(),URL.revokeObjectURL(z.href),d?.("csv");},[q,d]),db=useCallback(()=>{let M=De.exportToJSON(q),A=new Blob([M],{type:"application/json;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(A),z.download="gantt-chart.json",z.click(),URL.revokeObjectURL(z.href),d?.("json");},[q,d]),ub=useCallback(()=>{De.exportToMSProject(q,"Gantt Project","project.xml"),d?.("msproject");},[q,d]),pb=M=>{M.preventDefault(),dt(true);},Wo=useRef(false),[Vl,ku]=useState(false),Ts=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Oe.current,A=oe.current?.querySelector(".gantt-grid-scroll");if(!M||!A)return;let z=()=>{if(Wo.current)return;Wo.current=true;let Ve=M.scrollTop;le(Ve),A.scrollTop=Ve,requestAnimationFrame(()=>{Wo.current=false;});},X=()=>{if(Wo.current)return;Wo.current=true;let Ve=A.scrollTop;le(Ve),M.scrollTop=Ve,requestAnimationFrame(()=>{Wo.current=false;});},ie=Ve=>{if(de&&A){let Ot=A.parentElement?.getBoundingClientRect()?.left||0,rr=Ve.clientX-Ot,ma=200,$a=ee+Ce,Kn=window.innerWidth*Ne,zo=Math.max($a,Kn);rr>=ma&&rr<=zo&&be(rr);}if(Vl&&M){let Qt=Ve.clientX-Ts.current.x,Ot=Ve.clientY-Ts.current.y;M.scrollLeft=Ts.current.scrollLeft-Qt,M.scrollTop=Ts.current.scrollTop-Ot;}},fe=()=>{dt(false),ku(false);},Ge=Ve=>{if(Ve.button!==0)return;let Qt=Ve.target;Qt.closest("[data-task-bar]")||Qt.closest("[data-dependency-line]")||Qt.closest("button")||Qt.closest('[role="button"]')||Qt.tagName==="rect"&&Qt.getAttribute("data-clickable")==="true"||(ku(true),Ts.current={x:Ve.clientX,y:Ve.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},Ve.preventDefault());};return M.addEventListener("scroll",z),A.addEventListener("scroll",X),M.addEventListener("mousedown",Ge),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",fe),()=>{M.removeEventListener("scroll",z),A.removeEventListener("scroll",X),M.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",fe);}},[de,Vl,ee]),$t.current={startDate:An,timeScale:Q,zoom:Y};let jl=r.onTodayVisibilityChange,Cu=useRef(null);useEffect(()=>{if(!jl)return;let M=Oe.current;if(!M)return;let A=Q==="day"?60:Q==="week"?20:8,z=()=>{let fe=(new Date().getTime()-An.getTime())/(1e3*60*60*24)*A*Y,Ge=M.scrollLeft,Ve=Ge+M.clientWidth,Qt=fe>=Ge&&fe<=Ve;Cu.current!==Qt&&(Cu.current=Qt,jl(Qt));};return z(),M.addEventListener("scroll",z,{passive:true}),window.addEventListener("resize",z),()=>{M.removeEventListener("scroll",z),window.removeEventListener("resize",z);}},[jl,An,Q,Y]);let Tu=useRef(false),mb=useRef(null);return useLayoutEffect(()=>{if(Tu.current||q.length===0||!Oe.current)return;Tu.current=true,mb.current=An;let M=Oe.current,A=new Date,z=Q==="day"?60:Q==="week"?20:8,X=(A.getTime()-An.getTime())/(1e3*60*60*24),ie=M.clientWidth,Ge=X*z*Y-ie/2;X>=0&&ie>0&&(M.scrollLeft=Math.max(0,Ge));},[q.length,An,Q,Y]),jsx(rs.Provider,{value:Fr,children:jsx(Zl.Provider,{value:ut,children:jsxs("div",{ref:Qe,className:"flex flex-col h-full w-full",style:{backgroundColor:He.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...He.dotGrid&&{backgroundImage:`radial-gradient(circle, ${He.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ki,{theme:He,timeScale:Q,onTimeScaleChange:R,zoom:Y,onZoomChange:Te,currentTheme:ot,onThemeChange:ue,rowDensity:J,onRowDensityChange:O,showThemeSelector:l,showCreateTaskButton:E&&Fe?.canCreateTask!==false&&!Fe?.canCreateSubtaskOnly,createTaskLabel:F,onCreateTask:k,taskFilter:_e,onTaskFilterChange:ga,hideCompleted:sr,onHideCompletedChange:Zr,toolbarRightContent:N,wbsLevel:ge,onWbsLevelChange:_n,maxWbsDepth:br,viewMode:Bt,onViewModeChange:Tt,projectForecast:I,hideForecastHud:_,onExportPNG:i?sb:void 0,onExportPDF:i?ib:void 0,onExportExcel:i?lb:void 0,onExportCSV:i?cb:void 0,onExportJSON:i?db:void 0,onExportMSProject:i?ub:void 0,showCriticalPath:kt,onShowCriticalPathChange:Rt,showDependencies:ur,onShowDependenciesChange:Kr,highlightWeekends:Gt,onHighlightWeekendsChange:Vt,showBaseline:zt,onShowBaselineChange:M=>{M&&Bt!=="oracle"&&Tt("oracle"),!M&&Bt==="oracle"&&Tt("execution");},onCopySnapshotLink:nt,hasDependencies:oa})}),jsxs("div",{ref:oe,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Le,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ke,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Xi,{tasks:jt,allTasks:Et,theme:He,rowHeight:ft,availableUsers:u,templates:pr,showCriticalPath:kt,onTaskClick:W,onTaskSelectionChange:B,selectedTaskId:ve,onTaskDblClick:yu,onTaskContextMenu:Pe,onTaskToggle:ba,scrollTop:wa,columns:Ga,onToggleColumn:Mt,onColumnResize:Lr,onTaskUpdate:Ar,onBulkFill:pa,onTaskIndent:qr,onTaskOutdent:bo,onTaskMove:ho,onMultiTaskDelete:Ul,onTaskDuplicate:Zf,onTaskCreate:eb,onTaskRename:tb,onCreateSubtask:Wl,onOpenTaskModal:W?M=>W(M):void 0,onDeleteRequest:(M,A)=>H({taskIds:M,taskName:A}),onTaskReparent:Cs,scrollContainerRef:Le})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:He.border,zIndex:15},onMouseDown:pb}),jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Vl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(al,{tasks:jt,theme:He,rowHeight:ft,timeScale:Q,startDate:An,endDate:zl,zoom:Y,locale:w,templates:pr,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:W,onTaskDblClick:yu,onTaskContextMenu:nb,onTaskDateChange:ab,onTaskProgressDrag:rb,onDependencyCreate:vu,onDependencyDelete:wu,showBaseline:zt,showCriticalPath:kt,showDependencies:ur,highlightWeekends:Gt,canEditTask:Fe?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),Z.task&&jsx(os,{isOpen:Z.isOpen,x:Z.x,y:Z.y,theme:He,onClose:()=>$({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Z.task;if(!M)return [];let A=De.findTaskById(q,M.id)||M,z=A.subtasks&&A.subtasks.length>0,X=Fe?.canCreateTask!==false,ie=Fe?.canDeleteTask!==false;if(z){let Ot=[],rr=Fe?.canDuplicateTask!==false;return X&&Ot.push({id:"addSubtask",label:Fr.contextMenu?.addSubtask||"Add Subtask",icon:er.Add,onClick:()=>{Se?Se(A):Wl(A.id);}}),rr&&Ot.push({id:"duplicate",label:Fr.contextMenu?.duplicateTask||"Duplicate Task",icon:er.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):ke(ma=>js(ma,[A.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),ie&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:Fr.contextMenu?.deleteTask||"Delete Task",icon:er.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),Ot}let fe=Fe?.canUpdateTask!==false,Ge=Fe?.canDuplicateTask!==false,Ve=[];return fe&&Ve.push({id:"edit",label:Fr.contextMenu?.editTask||"Edit Task",icon:er.Pencil,onClick:()=>{We?We(A):we(A);}}),X&&Ve.push({id:"addSubtask",label:Fr.contextMenu?.addSubtask||"Add Subtask",icon:er.Add,onClick:()=>{Se?Se(A):Wl(A.id);}}),Ve.length>0&&fe&&Ve.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),fe&&(Ve.push({id:"markIncomplete",label:Fr.contextMenu?.markIncomplete||"Mark Incomplete",icon:er.MarkIncomplete,onClick:()=>{Re?Re(A):Ar(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),Ve.push({id:"setInProgress",label:Fr.contextMenu?.setInProgress||"Set In Progress",icon:er.SetInProgress,onClick:()=>{Ae?Ae(A):Ar(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),Ve.push({id:"markComplete",label:Fr.contextMenu?.markComplete||"Mark Complete",icon:er.MarkComplete,onClick:()=>{Ar(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(Ge||fe&&A.startDate&&A.endDate)&&Ve.length>0&&Ve.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&Ve.push({id:"duplicate",label:Fr.contextMenu?.duplicateTask||"Duplicate Task",icon:er.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):ke(Ot=>js(Ot,[A.id]).tasks),$({isOpen:false,x:0,y:0,task:null});}}),fe&&A.startDate&&A.endDate&&Ve.push({id:"split",label:Fr.contextMenu?.splitTask||"Split Task",icon:er.Split,onClick:()=>{let Ot=A.startDate.getTime(),rr=A.endDate.getTime(),ma=Ot+(rr-Ot)/2,$a=new Date(ma);ob(A,$a);}}),ie&&(Ve.length>0&&Ve.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ve.push({id:"delete",label:Fr.contextMenu?.deleteTask||"Delete Task",icon:er.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),Ve})()}),jsx(No,{task:te,isOpen:!!te,onClose:()=>we(null),onTaskUpdate:M=>{te&&(Ar(te.id,M),we(null));},theme:ot==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsx(AnimatePresence,{children:T&&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:()=>H(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:He.bgSecondary,border:`1px solid ${He.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${He.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:He.textPrimary,fontFamily:"Inter, sans-serif"},children:[Fr.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:He.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:He.textSecondary,fontFamily:"Inter, sans-serif"},children:T.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:He.textPrimary},children:[T.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:He.textPrimary},children:['"',T.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:He.bgPrimary,borderTop:`1px solid ${He.border}`},children:[jsx("button",{onClick:()=>H(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:He.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=He.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ul(T.taskIds),H(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsx(sl,{tasks:q,theme:He,config:v,onTasksUpdate:ke,onTaskUpdate:Ar,onTaskCreate:M=>{ke(A=>[...A,M]);},onTaskDelete:M=>{Ul([M]);},onDependencyCreate:(M,A)=>{let z=De.findTaskById(q,M);z&&vu(z,A);},onDependencyDelete:wu})]})})})});function Iw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Rw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],cd=[{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 tg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:c=r?"edit":"create",theme:l="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:m,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:g,defaultStatus:x}){let y=[...ld,...i.filter(L=>!ld.some(Q=>Q.id===L.id))],b=lt[l]||lt.dark,[h,v]=useState(false),[w,C]=useState(false),[E,F]=useState(false),[k,S]=useState(false),[P,N]=useState({top:0,left:0}),[K,U]=useState(null),[ae,I]=useState(new Date),[_,j]=useState({top:0,left:0}),[W,B]=useState(false),[ve,je]=useState([]),[Pe,me]=useState(false),[xe,he]=useState(""),We=useRef(null),Se=useRef(null),Re=useRef(null),Ae=useRef(null),Ye=useRef(null),[se,Xe]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Be,$e]=useState({});useEffect(()=>{r?(Xe({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),je([]));},[r,e,x]),useEffect(()=>{let L=Q=>{We.current&&!We.current.contains(Q.target)&&v(false),Se.current&&!Se.current.contains(Q.target)&&C(false),Re.current&&!Re.current.contains(Q.target)&&F(false),Ae.current&&!Ae.current.contains(Q.target)&&S(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let mt=()=>{let L={};return se.name.trim()||(L.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(L),Object.keys(L).length===0},Nt=async L=>{if(L.preventDefault(),!!mt())try{let Q=c==="create"&&ve.length>0?{...se,pendingFiles:ve}:se;await s(Q),je([]),t();}catch(Q){console.error("Error submitting task:",Q);}},ze=(L,Q)=>{Xe(R=>{let J={...R,[L]:Q};if(L==="status"){let O=Q;O==="todo"?J.progress=0:O==="in-progress"?(R.progress===0||R.progress===100)&&(J.progress=50):O==="completed"||O==="closed"?J.progress=100:(O==="in-review"||O==="review")&&(J.progress=75);}if(L==="progress"){let O=typeof Q=="number"?Q:parseInt(Q,10);O===100&&R.status!=="completed"?J.status="completed":O>0&&O<100&&R.status==="todo"?J.status="in-progress":O===0&&R.status!=="todo"&&(J.status="todo");}return J}),Be[L]&&$e(R=>{let J={...R};return delete J[L],J});},Fe=y.find(L=>L.id===se.status)??ld[0],nt=cd.find(L=>L.id===se.priority)??cd[1],It=To.find(L=>L.value===se.color)??To[0],Ie=l==="dark",ot={backgroundColor:Ie?"#1d1f27":b.bgSecondary,border:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ie?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":l,style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Ie?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:L=>L.stopPropagation(),children:jsxs("form",{onSubmit:Nt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:se.name,onChange:L=>ze("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Be.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Be.name]}),jsx("textarea",{value:se.description||"",onChange:L=>ze("description",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:We,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ot,borderColor:Fe.color,backgroundColor:`${Fe.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Fe.color}}),jsx("span",{style:{color:Fe.color},children:Fe.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Fe.color}})]}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("status",L.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,se.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),jsxs("div",{ref:Se,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ot,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsx("span",{children:nt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:cd.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("priority",L.id),C(false);},children:[jsx("span",{children:L.icon}),L.label,se.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),n.length>0&&jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&F(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ot,disabled:o,children:[se.assignees&&se.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:se.assignees.slice(0,3).map((L,Q)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||b.accent,borderColor:b.bgSecondary},children:L.initials},Q))}),se.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",se.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let Q=se.assignees?.some(R=>R.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=Q?(se.assignees||[]).filter(J=>J.name!==L.name):[...se.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(J=>J[0]).join("").toUpperCase().slice(0,2),color:b.accent}];ze("assignees",R);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Q&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},L.id)})})})]}),jsxs("div",{ref:Ae,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(k)S(false);else {if(Ae.current){let L=Ae.current.getBoundingClientRect(),Q=window.innerHeight,R=120,O=Q-L.bottom<R?L.top-R-8:L.bottom+8;N({top:O,left:L.left});}S(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ot,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsx("span",{children:It.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsxs(ar,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:To.slice(0,18).map(L=>{let Q=se.color===L.value;return jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),ze("color",L.value),S(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:Q?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),d.length>0||m?jsx(Ko,{selectedTags:se.tags||[],availableTags:d,onChange:L=>ze("tags",L),onCreateTag:m,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ie?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Ie?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:Ye,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(K==="start")U(null);else {if(Ye.current){let L=Ye.current.getBoundingClientRect();j({top:L.bottom+8,left:Math.max(16,L.left-40)});}U("start"),I(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ot,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.startDate?se.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(K==="end")U(null);else {if(Ye.current){let L=Ye.current.getBoundingClientRect();j({top:L.bottom+8,left:Math.max(16,L.left-40)});}U("end"),I(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ot,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.endDate?se.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(ar,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${_.top}px`,left:`${_.left}px`,zIndex:99999,backgroundColor:Ie?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ie?"#262626":b.border}`},children:[(()=>{let L=new Date,Q=new Date(L);Q.setDate(L.getDate()+1);let R=new Date(L);R.setDate(L.getDate()+7);let J=new Date(L);return J.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:Q},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:J}].map((Y,Te)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(ze("startDate",Y.date),(!se.endDate||Y.date>se.endDate)&&ze("endDate",Y.date),U("end")):(ze("endDate",Y.date),(!se.startDate||Y.date<se.startDate)&&ze("startDate",Y.date),U(null));},children:Y.label},Te))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("startDate",void 0),ze("endDate",void 0),U(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>I(new Date(ae.getFullYear(),ae.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ae.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(new Date(ae.getFullYear(),ae.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,Q)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:L},Q))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=ae.getFullYear(),Q=ae.getMonth(),R=new Date(L,Q,1).getDay(),J=new Date(L,Q+1,0).getDate(),O=new Date,Y=[];for(let ge=R-1;ge>=0;ge--)Y.push({day:new Date(L,Q,-ge).getDate(),date:new Date(L,Q-1,new Date(L,Q,-ge).getDate()),isCurrentMonth:false});for(let ge=1;ge<=J;ge++)Y.push({day:ge,date:new Date(L,Q,ge),isCurrentMonth:true});let Te=42-Y.length;for(let ge=1;ge<=Te;ge++)Y.push({day:ge,date:new Date(L,Q+1,ge),isCurrentMonth:false});return Y.map((ge,Ze)=>{let et=ge.date.toDateString()===O.toDateString(),Je=se.startDate?.toDateString()===ge.date.toDateString(),Bt=se.endDate?.toDateString()===ge.date.toDateString(),Tt=se.startDate&&se.endDate&&ge.date>=se.startDate&&ge.date<=se.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ge.isCurrentMonth?Je||Bt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Je?b.accent:Bt?"#7C3AED":Tt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:et&&!Je&&!Bt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{K==="start"?(ze("startDate",ge.date),se.endDate&&ge.date>se.endDate&&ze("endDate",ge.date),U("end")):(ze("endDate",ge.date),se.startDate&&ge.date<se.startDate&&ze("startDate",ge.date),U(null));},children:ge.day},Ze)})})()})]})]})]})})]}),Be.endDate&&jsx("span",{className:"text-xs text-red-400",children:Be.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[se.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ie?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let Q=L.currentTarget.getBoundingClientRect(),R=Math.round((L.clientX-Q.left)/Q.width*100/5)*5;ze("progress",Math.max(0,Math.min(100,R)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${se.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ie?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!W),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${W?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:W&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:se.effortMinutes?Iw(se.effortMinutes):"",onChange:L=>{let Q=Rw(L.target.value);ze("effortMinutes",Q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:se.parentId||"",onChange:L=>ze("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(L=>L.id!==r?.id).map(L=>jsx("option",{value:L.id,children:L.name},L.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:se.location||"",onChange:L=>ze("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:se.equipment||"",onChange:L=>ze("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(p||u.length>0||c==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",c==="create"?ve.length>0&&`(${ve.length})`:u.length>0&&`(${u.length})`]})]}),c==="create"?jsx(Jo,{cardId:"pending",attachments:ve.map((L,Q)=>({id:`pending-${Q}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>je(Q=>[...Q,...L]),onDelete:L=>{let Q=parseInt(L.replace("pending-",""),10);je(R=>R.filter((J,O)=>O!==Q));},maxSizeMB:10,maxFiles:20}):jsx(Jo,{cardId:r?.id||"new",attachments:u,onUpload:p&&r?.id?L=>p(r.id,L):void 0,onDelete:g,maxSizeMB:10,maxFiles:20}),c==="create"&&ve.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[ve.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:L=>ze("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),se.dependencies&&se.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:se.dependencies.map(L=>{let Q=a.find(R=>R.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[Q?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let R=(se.dependencies||[]).filter(J=>J!==L);ze("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{me(!Pe),he("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{me(false),he("");}}),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:Ie?"#0a0a0a":b.bgPrimary,backdropFilter:Ie?"blur(16px)":void 0,border:`1px solid ${Ie?"#262626":b.border}`,boxShadow:Ie?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:xe,onChange:L=>he(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(L=>L.id!==r?.id).filter(L=>xe===""||L.name.toLowerCase().includes(xe.toLowerCase())).map(L=>{let Q=se.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let R=se.dependencies||[],J;Q?J=R.filter(O=>O!==L.id):J=[...R,L.id],ze("dependencies",J);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Q?`${b.accent}10`:"transparent"},onMouseEnter:R=>{Q||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=Q?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Q?b.accent:"transparent",borderColor:Q?b.accent:b.borderLight},children:Q&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),a.filter(L=>L.id!==r?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ie?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Ie?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=b.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:L=>!o&&(L.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:L=>!o&&(L.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var rg=`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 ag(e){return `CURRENT TASKS:
|
|
410
|
+
${ng(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",s=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",o=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${s}, ${a.progress}%, ${a.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function ag(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=ag(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function cd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let p=new Date(a);return p.setDate(p.getDate()+1),p}if(r==="yesterday"||r==="ayer"){let p=new Date(a);return p.setDate(p.getDate()-1),p}if(r==="next week"||r==="la pr\xF3xima semana"){let p=new Date(a);return p.setDate(p.getDate()+7),p}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(m!==void 0){let g=new Date(a),x=g.getDay(),y=m-x;return y<=0&&(y+=7),g.setDate(g.getDate()+y),g}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),m=s[2].toLowerCase(),g=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?g.setDate(g.getDate()+p):m==="week"||m==="semana"||m==="semanas"?g.setDate(g.getDate()+p*7):(m==="month"||m==="mes"||m==="meses")&&g.setMonth(g.getMonth()+p),g}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let p=parseInt(c[1],10),m=parseInt(c[2],10)-1,g=parseInt(c[3],10);return new Date(g,m,p)}let l={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),m=l[i[2].toLowerCase()],g=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(g,m,p)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},u=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(u&&u[1]&&u[2]){let p=d[u[1].toLowerCase()],m=parseInt(u[2],10),g=u[3]?parseInt(u[3],10):a.getFullYear();if(p!==void 0)return new Date(g,p,m)}return null}function dd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function ud(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function ng(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function og(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),u=Un(t,i),p=cd(d);if(!u)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:u.id,taskName:u.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=u.startDate&&u.endDate?Math.round((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24)):1,g=new Date(p);return g.setDate(g.getDate()+m),{type:"move_task",taskId:u.id,taskName:u.name,updates:{startDate:p,endDate:g},message:`Moved "${u.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),u=Un(t,i),p=dd(d);if(!u)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!u.endDate)return {type:"resize_task",taskId:u.id,taskName:u.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let m=new Date(u.endDate);return m.setDate(m.getDate()+p),{type:"resize_task",taskId:u.id,taskName:u.name,updates:{endDate:m},message:`Extended "${u.name}" by ${p} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),u=Un(t,i),p=ud(d);return u?p===null?{type:"set_progress",taskId:u.id,taskName:u.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:u.id,taskName:u.name,updates:{progress:p},message:`Set "${u.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),u=Un(t,i);return u?{type:"rename_task",taskId:u.id,taskName:u.name,updates:{name:d},message:`Renamed "${u.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),u=Un(t,i),p=Un(t,d);return u?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:u.id,dependencyTo:p.id,message:`Linked "${u.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function sg(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Iw(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 Rw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function cl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let u=r.find(p=>p.id===d);return u?{name:u.name,initials:u.initials,color:u.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>cl(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Iw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function ig(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:Rw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function lg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>cl(a,e,t))}var pd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},md={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},dl={en:pd,es:md};function gd(e){return dl[e]||dl.en}function ul(e,t){let r=gd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var fd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function cg(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function dg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let m=g=>{c.current&&!c.current.contains(g.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let l=cg(e),i=fd[0],d=fd.find(m=>m.value===l)??i,u=d.icon,p=m=>{switch(cg(m)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(u,{className:f("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:f("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(u,{className:f("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:f("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:f("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:fd.map(m=>{let g=m.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(m.value),o(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(g,{className:f("w-4 h-4",m.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:p(m.value)})]},m.value)})})]})}var bd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function pg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let d=u=>{c.current&&!c.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=bd.find(d=>d.value===e)??bd[4],i=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:f("w-4 h-4",l.color)}),jsx("span",{className:f("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:f("w-4 h-4",l.color)}),jsx("span",{className:f("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsx(ChevronDown,{className:f("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:bd.map(d=>jsxs("button",{onClick:u=>{u.stopPropagation(),t(d.value),o(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:f("w-2 h-2 rounded-full",d.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function Qs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function hd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function yd({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),u=useRef(null);useEffect(()=>{let x=y=>{d.current&&!d.current.contains(y.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&u.current&&u.current.focus();},[o]);let p=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),m=x=>e.some(y=>y.name===x),g=x=>{if(r){if(m(x.name))r(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Qs(x.name),color:x.color||hd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,y]);}c(false),i("");}};return s||!r?e.length===0?jsx("span",{className:f("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&hd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:f("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:f("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&hd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxs("span",{className:f("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:u,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let y=m(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),g(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Qs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function yg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=useState(false),[u,p]=useState(n),[m,g]=useState(()=>{let N=n==="start"?e:t;if(N){let K=N instanceof Date?N:new Date(N);return new Date(K.getFullYear(),K.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),y=useRef(null),b=useRef(null),[h,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=K=>{let H=K.target;x.current&&x.current.contains(H)||b.current&&b.current.contains(H)||d(false);};return i&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let N=()=>{let K=y.current?.getBoundingClientRect();if(!K)return;let H=520,Q=360,I=window.innerHeight-K.bottom,q=I<Q&&K.top>I,j=q?K.top-4:K.bottom+4,U=Math.min(Math.max(K.left,8),window.innerWidth-H-8);v({top:j,left:U,flipUp:q});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[i]),useEffect(()=>{i&&p(a?n:"start");},[i,a,n]);let E=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",L=useCallback(()=>{let N=m.getFullYear(),K=m.getMonth(),H=new Date(N,K,1),I=new Date(N,K+1,0).getDate(),q=H.getDay(),j=[],B=new Date(N,K,0).getDate();for(let Ge=q-1;Ge>=0;Ge--)j.push({date:new Date(N,K-1,B-Ge),isCurrentMonth:false});for(let Ge=1;Ge<=I;Ge++)j.push({date:new Date(N,K,Ge),isCurrentMonth:true});let we=42-j.length;for(let Ge=1;Ge<=we;Ge++)j.push({date:new Date(N,K+1,Ge),isCurrentMonth:false});return j},[m]),k=N=>{if(a)n==="start"?r(N,C||void 0):r(w||void 0,N),d(false);else if(u==="start"){let K=C&&N>C?N:C;r(N,K||void 0),p("end");}else {let K=w&&N<w?N:w;r(K||void 0,N),d(false);}},S=()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let H=new Date(N);H.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Q=new Date(N);Q.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let I=new Date(N);I.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let q=new Date(N);q.setDate(N.getDate()+14);let j=new Date(N);return j.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:H,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Q,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:q,display:q.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let N=a&&n==="start"?w:C;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:f("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm",s?"text-white/60":"text-gray-500"),children:E(N)})]})}let P=a&&n==="start"?w:C;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:y,onClick:N=>{N.stopPropagation(),d(!i);let K=n==="start"?w:C;K&&g(new Date(K.getFullYear(),K.getMonth(),1));},className:f("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:f("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm",s?"text-white/60":"text-gray-500"),children:E(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:f("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((N,K)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>k(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:f("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},K)),jsx("div",{className:f("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,C||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!a&&jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:u==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>g(new Date),className:f("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>g(new Date(m.getFullYear(),m.getMonth()-1)),className:f("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:f("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>g(new Date(m.getFullYear(),m.getMonth()+1)),className:f("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:f("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:L().map((N,K)=>{let H=N.date.toDateString()===new Date().toDateString(),Q=w?.toDateString()===N.date.toDateString(),I=C?.toDateString()===N.date.toDateString(),q=Q||I,j=!a&&w&&C&&N.date>=w&&N.date<=C;return jsx("button",{onClick:()=>k(new Date(N.date)),className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),H&&"ring-2 ring-[#00E5CC]",Q&&"bg-[#00E5CC] text-white",I&&!Q&&"bg-[#7C3AED] text-white",j&&!q&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!q&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},K)})})]})]}),document.body)]})}function fl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(yg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(p,m)=>{t&&t(s==="start"?p:m);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function ms(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function bl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[c,l]=useState(false),i=useRef(e),d=useRef([]);return useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let u=i.current??0,p=e,m=p-u,g=a/n;l(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(u+m*h);o(v),x===n&&(l(false),o(p));},g*x);d.current.push(y);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function xg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,c]=useState(0),l=useRef(null),i=useRef(null),d=useCallback(m=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(m),c(0);let g=Date.now();i.current=setInterval(()=>{let x=Date.now()-g,y=Math.min(x/r*100,100);c(y);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),c(0);},r);},[r,e]),u=useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:u}}function wg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),{isFlashing:u,triggerFlash:p}=ms(),{displayValue:m,isAnimating:g}=bl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),E=w.clientX-C.left,L=Math.round(E/C.width*100),k=Math.max(0,Math.min(100,L));k!==e&&(t(k),s&&p());},y=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&p());}},[l,t,e,s,p]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=m??e;return jsxs("div",{className:f("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",u&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:f("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:f("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",g&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:f("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:f("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:f("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",g&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Tg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},u=p=>{p.key==="Enter"?d():p.key==="Escape"&&(l(e),o(false));};return n||!t?jsx("span",{className:f("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:c,onChange:p=>l(p.target.value),onBlur:d,onKeyDown:u,onClick:p=>p.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),o(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Sg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=useState(false),[u,p]=useState(e?.toString()||""),m=useRef(null),{isFlashing:g,triggerFlash:x}=ms(),{displayValue:y,isAnimating:b}=bl(e,{enabled:c&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(u);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),l&&x());}d(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(p(e?.toString()||""),d(false));};return o||!t?jsx("span",{className:f("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:a}):i?jsx("input",{ref:m,type:"number",value:u,onChange:w=>p(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(r?"text-white/30":"text-gray-400"),g&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:a})}function Eg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=useState(false),l=useRef(null);return useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsx("span",{className:f("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:f("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:f("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:f("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Pg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=xg(t,{delay:s}),u=m=>{m.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},p=c?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:u,disabled:a||!t,className:f("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&p&&"ring-green-500/50",c&&!p&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsx("button",{onClick:m=>{m.stopPropagation(),d();},className:f("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Ag({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:f("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function xk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function vk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Aa({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[u,p]=useState(false),[m,g]=useState(""),x=useRef(null),{isFlashing:y,triggerFlash:b}=ms(),h=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=h&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:xk(e,a);useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),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,u]);let C=()=>{let k=vk(m);k!==e&&(t?.(k),o&&b()),p(false);},E=k=>{k.key==="Enter"?C():k.key==="Escape"&&p(false);};if(c)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:f("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let L=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(L,{className:f("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):u?jsx("input",{ref:x,type:"text",value:m,onChange:k=>g(k.target.value),onBlur:C,onKeyDown:E,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),p(true);},className:f("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",y&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(L,{className:f("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function $g({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:f("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:f("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function Hg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,u=j=>d?`$${Math.round(j*l).toLocaleString("en-US")}`:`${j}h`,[p,m]=useState(false),[g,x]=useState(false),[y,b]=useState(null),h=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,E=Math.round(v/60*10)/10,L=Math.round(w/60*10)/10,k=w>0?v/w*100:0,S=k>100?Math.round((v-w)/60*10)/10:0,P=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!g&&!y)return;let j=U=>{h.current&&!h.current.contains(U.target)&&(x(false),b(null));};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[g,y]);let N=j=>{if(j.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(U=>!U),b(null);return}o&&o(e);},K=j=>{x(false),b(j);},H=async(j,U)=>{y==="log"&&a&&j?a(e,j,U):y==="estimate"&&n?n(e,j):y==="quoted"&&s&&s(e,j),b(null);},Q=a||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(j=>j.show),q=y==="estimate"?w:y==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:j=>j.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:f("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&Q&&jsx("button",{onClick:N,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:g&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:U=>{U.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(vn,{mode:y,locale:r,isDark:t,currentValue:q||void 0,onSave:H,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:j=>j.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let j=v===0,B=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:j?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:u(E)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",u(L)]}),S>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",u(S)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Q&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:g&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:U=>{U.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:U=>{U.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(vn,{mode:y,locale:r,isDark:t,currentValue:q||void 0,onSave:H,onClose:()=>b(null)})})})})]})}function Sk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Ek(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Ug({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:f(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:f(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Wg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Sk(e);if(d.length===0)return null;let u=d.slice(0,3),p=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:u.map((m,g)=>jsx(Ug,{assignee:m,size:24,isDark:t},m.name+g))}),p>0&&jsxs("span",{className:f("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(m=>m.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("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:f("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Ek(c):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Ug,{assignee:s,size:28,isDark:t}),jsx("span",{className:f("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[c,"% LOAD"]})]})}var Mk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Gg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:f("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:f("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Mk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function Vk(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function jk(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function Xg({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:u,onReportBlocker:p,onCopyTaskLink:m,onTaskMove:g,onTaskIndent:x,onTaskOutdent:y}){let b=useRef(null),h=a==="es"?_g.es:_g.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let S=b.current;if(!S)return;let P=S.getBoundingClientRect(),N=8,K=e.x,H=e.y;e.y+P.height>window.innerHeight-N&&(H=Math.max(N,e.y-P.height)),e.x+P.width>window.innerWidth-N&&(K=Math.max(N,window.innerWidth-P.width-N)),(K!==e.x||H!==e.y)&&w({left:K,top:H});},[e.x,e.y,e.isOpen]),useEffect(()=>{let S=N=>{b.current&&!b.current.contains(N.target)&&t();},P=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",S),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let S=[];return n&&S.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),S.push({id:"sep1",label:"",icon:null,separator:true}),c&&(S.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),S.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&S.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],H=N.some(Q=>Q.name===P.name)?N.filter(Q=>Q.name!==P.name):[...N,{name:P.name,initials:Vk(P.name),color:P.color||jk(P.name),avatar:P.avatarUrl}];c({...e.task,assignees:H}),t();}}))})),u&&S.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&S.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),m&&S.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),S.push({id:"sep2",label:"",icon:null,separator:true}),s&&S.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(g||x||y)&&(S.push({id:"sep3",label:"",icon:null,separator:true}),g&&(S.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{g(e.task.id,"up"),t();}}),S.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{g(e.task.id,"down"),t();}})),x&&S.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&S.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&S.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),S},E=()=>{if(!e.columnId)return [];let S=[];return i&&(S.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),S.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(S.push({id:"sep-hide",label:"",icon:null,separator:true}),S.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),S},L=e.type==="task"?C():E(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:k,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:L.map(S=>S.separator?jsx("div",{className:f("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},S.id):S.submenu?jsx(_k,{item:S,isDark:r},S.id):jsxs("button",{onClick:S.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",S.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:f(S.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:S.icon}),S.label]},S.id))})}function _k({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:f("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:f("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(c=>jsxs("button",{onClick:c.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var _g={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var n0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},c1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function s0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=useState(""),[d,u]=useState(null),[p,m]=useState(null),g=useRef(null),x=c==="es"?o0.es:o0.en;useLayoutEffect(()=>{if(!e||!g.current)return;let L=()=>{if(!g.current)return;let k=g.current.parentElement;if(k){let K=k.getBoundingClientRect();m({top:K.bottom+4,right:window.innerWidth-K.right});}let S=g.current.getBoundingClientRect(),N=window.innerHeight-S.top-20;u(Math.max(300,N));};return requestAnimationFrame(L),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[e]),useEffect(()=>{if(!e)return;let L=setTimeout(()=>{let k=P=>{g.current&&!g.current.contains(P.target)&&t();},S=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",S),g._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(L),g._cleanup&&g._cleanup();}},[e,t]);let y=useMemo(()=>{let L=new Set([...c1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&L.add(k.type);}),Array.from(L)},[r]);if(!e)return null;let b=L=>{let k=x.columns[L];if(k)return k;let S=r.find(P=>P.type===L);return S?.label?S.label:L},h=L=>{if(L==="name")return;let k=r.map(S=>S.id===L?{...S,visible:!S.visible}:S);n(k);},v=(L,k)=>{let S=r.find(N=>N.type===L&&(!k||N.customFieldId===k));if(S){h(S.id);return}let P={id:k||L,type:L,label:k?a.find(N=>N.id===k)?.name||L:b(L),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,P]);},w=y.filter(L=>L!=="assignees"&&b(L).toLowerCase().includes(l.toLowerCase())),C=a.filter(L=>L.name.toLowerCase().includes(l.toLowerCase())),E=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:g,style:{...d?{maxHeight:`${d}px`}:{},...p?{top:p.top,right:p.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",L.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:L=>i(L.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:L=>{L&&L.style.setProperty("--focus-border",E);},onFocus:L=>{L.currentTarget.style.borderColor=E,L.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:L=>{L.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:L=>L.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(L=>{let k=r.find(N=>N.type===L&&!N.customFieldId),S=k?.visible??false,P=L==="name";return jsxs("button",{onClick:()=>{P||(k?h(k.id):v(L));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:N=>{P||(N.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&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:S?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:n0[L]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(L),children:b(L)})]},L)})})]}),C.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(L=>{let S=r.find(P=>P.customFieldId===L.id)?.visible??false;return jsxs("button",{onClick:()=>v(L.type,L.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&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:S?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:n0[L.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:L.name})]},L.id)})})]})]})]})}var o0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var y1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function c0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[c,l]=useState("text"),[i,d]=useState([""]),u=n==="es"?l0.es:l0.en;useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let p=()=>{if(!s.trim())return;let y={name:s.trim(),type:c};c==="dropdown"&&(y.options=i.filter(b=>b.trim())),r(y),t();},m=()=>{d([...i,""]);},g=(y,b)=>{let h=[...i];h[y]=b,d(h);},x=y=>{i.length>1&&d(i.filter((b,h)=>h!==y));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:f("text-lg font-semibold",a?"text-white":"text-gray-900"),children:u.title}),jsx("button",{onClick:t,className:f("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:f("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:u.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:y1.map(y=>jsxs("button",{onClick:()=>l(y.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:f("text-xs",c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:u.types[y.type]})]},y.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>g(b,h.target.value),placeholder:`${u.option} ${b+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(b),className:f("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:m,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),u.addOption]})]})]})]}),jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:u.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:u.create})]})]})]}):null}var l0={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var p0={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function m0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=useState(false),l=useRef(null),i=useRef(0),d=s==="es"?p0.es:p0.en;useEffect(()=>{if(!o)return;let m=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},g=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",g);}},[o]);let u=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(i.current=Date.now()),c(g=>!g);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),d.filters,p&&jsx("span",{className:f("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:f("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:u.map(m=>{let g=e===m.value&&!t,x=()=>m.value==="all"?g?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{r(m.value),a(false),c(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",g&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:f(g?m.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:f("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),g&&jsx(Check,{className:f("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:f("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;a(m),m&&r("all"),c(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:f("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:f("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function g0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function mo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function f0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxs("div",{className:f("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:f("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:f("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:f("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,u=l-d,p=l>0?Math.round(u/l*100):0,m=l-i,g=l>0?Math.round(m/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,y=d>l&&l>0,b=y?"#F87171":"#00E5CC";return jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(l)})]}),(()=>{let h=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,E=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:f("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(i)})]}),C&&jsxs(Fragment,{children:[E(o?"Mano de obra":"Labor",h),v>0&&E(o?"Activos":"Equipment",v),w>0&&E(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let h=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,E=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:f("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:f("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:mo(d)})]}),C&&jsxs(Fragment,{children:[E(o?"Mano de obra":"Labor",h),v>0&&E(o?"Activos":"Equipment",v),w>0&&E(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsx("div",{className:f("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(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:f("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[m>=0?"+":"",mo(m),l>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",g,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:f("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[u>=0?`+${mo(u)} ${o?"disponible (caja)":"available (cash)"}`:`${mo(Math.abs(u))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,m=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:g0(l)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:f("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:g0(i)})]}),i>0&&jsx("div",{className:f("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:f("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:f("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:f("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:f("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:f("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxs("button",{onClick:()=>s?.(l.id),className:f("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:f("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let l=e.scheduleVarianceDays??0,i=l>0,d=l<0,u=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:f("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxs("span",{className:f("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsx("div",{className:f("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var I1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function C0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...C0(n.subtasks,t+1,s));}return a}function R1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let u=(s.progress||0)/d;a+=u,n++;}return n>0?a/n:null}function xs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=xs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ys(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function B1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(o(String(e||"")),n(false));},className:f("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:f("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function w0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Rd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Rd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function T0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:u,filterDotColor:p="#00E5CC"}){let{theme:m="dark",locale:g="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:C=true,showCreateTaskButton:E=false,onCreateTask:L,persistFilter:k=false,financialBlur:S,healthSidebar:P,lens:N="hours",hourlyRate:K=0,rateMap:H,aggregateParentHours:Q=false,showProjectTotals:I=false,totalsDollarOverride:q}=t,j=ul(g,x),U=m==="dark",B=D=>{if(!H||!D.assignees||D.assignees.length===0)return K;let te=0,pe=0;for(let Ne of D.assignees){let We=Ne.id?H[Ne.id]:void 0;if(We==null||We<=0)continue;let ce=typeof Ne.estimatedMinutes=="number"?Ne.estimatedMinutes:0;ce>0&&(te+=We*ce,pe+=ce);}if(pe>0)return te/pe;let ke=D.assignees.map(Ne=>Ne.id?H[Ne.id]:void 0).filter(Ne=>Ne!=null&&Ne>0);return ke.length===0?K:ke.reduce((Ne,We)=>Ne+We,0)/ke.length},we=D=>{let te=0,pe=0,ke=0,Ne=We=>{for(let ce of We)if(ce.subtasks&&ce.subtasks.length>0){let Ee={s:te,a:pe,q:ke};if(Ne(ce.subtasks),te-Ee.s+(pe-Ee.a)+(ke-Ee.q)===0){let rt=B(ce);te+=(ce.timeLoggedMinutes??0)/60*rt,pe+=(ce.effortMinutes??0)/60*rt,ke+=(ce.soldEffortMinutes??0)/60*rt;}}else {let Ee=B(ce);te+=(ce.timeLoggedMinutes??0)/60*Ee,pe+=(ce.effortMinutes??0)/60*Ee,ke+=(ce.soldEffortMinutes??0)/60*Ee;}};return D.subtasks&&Ne(D.subtasks),{dollarSpent:te,dollarAllocated:pe,dollarQuoted:ke}},Ge=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let D=localStorage.getItem(k);if(D){let te=JSON.parse(D);return {statusFilter:te.statusFilter||"all",hideCompleted:te.hideCompleted||!1}}}catch(D){console.error("Error loading persisted filter:",D);}return {statusFilter:"all",hideCompleted:false}},[k]),Pe=useMemo(()=>{function D(te){let pe=0,ke=0,Ne=0,We=0,ce=0,Ee=0;for(let Ve of te)if(Ve.subtasks&&Ve.subtasks.length>0){let rt=D(Ve.subtasks);if(rt.spent+rt.allocated+rt.quoted>0)pe+=rt.spent,ke+=rt.allocated,Ne+=rt.quoted,We+=rt.dollarSpent,ce+=rt.dollarAllocated,Ee+=rt.dollarQuoted;else {let pt=Ve.timeLoggedMinutes??0,dt=Ve.effortMinutes??0,pr=Ve.soldEffortMinutes??0;pe+=pt,ke+=dt,Ne+=pr;let vr=B(Ve);We+=pt/60*vr,ce+=dt/60*vr,Ee+=pr/60*vr;}}else {let rt=Ve.timeLoggedMinutes??0,et=Ve.effortMinutes??0,pt=Ve.soldEffortMinutes??0;pe+=rt,ke+=et,Ne+=pt;let dt=B(Ve);We+=rt/60*dt,ce+=et/60*dt,Ee+=pt/60*dt;}return {spent:pe,allocated:ke,quoted:Ne,dollarSpent:We,dollarAllocated:ce,dollarQuoted:Ee}}return D(e)},[e]),be=useMemo(()=>{let D=new Map;function te(pe){let ke=0;for(let Ne of pe)if(Ne.subtasks&&Ne.subtasks.length>0){let We=te(Ne.subtasks);D.set(Ne.id,We),ke+=We;}else ke+=Ne.weight||0;return ke}return te(e),D},[e]),ve=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:Pe.spent,totalHoursAllocatedMinutes:Pe.allocated}},[P,Pe]),[he,Oe]=useState(true),[Se,Fe]=useState(null),[He,Be]=useState("position"),[ue,Ke]=useState("asc"),[ze,Ae]=useState(""),[Tt,Nt]=useState(()=>Ge().statusFilter),[Re,Le]=useState(()=>Ge().hideCompleted),[ut,Ct]=useState(h||I1),[Ie,lt]=useState(false),[F,re]=useState(false),[R,X]=useState({isOpen:false,x:0,y:0,type:"task"}),[O,J]=useState(null),[Te,me]=useState(false),[tt,ot]=useState(null),[Ye,$t]=useState(null),[Dt,St]=useState(null),Wt=useRef(0),rr=useRef(false),gr=!!(r.onTaskMove||r.onTaskReparent),[ia,Yt]=useState(null),[fr,At]=useState(null),qr=D=>D==="assignees"||D==="teamLoad"?"assignees":D==="startDate"?"startDate":D==="endDate"?"endDate":null,jt=useRef([]),_t=useCallback((D,te)=>{gr&&(te.preventDefault(),Wt.current=te.clientY,J(D),rr.current=false,me(false),St({x:te.clientX,y:te.clientY}));},[gr]),la=useCallback(D=>{if(!O||(Math.abs(D.clientY-Wt.current)>5&&!rr.current&&(rr.current=true,me(true)),St({x:D.clientX,y:D.clientY}),!rr.current))return;let pe=document.querySelectorAll("[data-listview-row]"),ke=null,Ne=null;pe.forEach(We=>{let ce=We.getBoundingClientRect(),Ee=We.getAttribute("data-listview-row");if(Ee&&Ee!==O&&D.clientY>=ce.top&&D.clientY<=ce.bottom){ke=Ee;let Ve=D.clientY-ce.top,rt=ce.height;Ne=Ve<rt*.25?"above":Ve>rt*.75?"below":"child";}}),ot(ke),$t(Ne);},[O]),ta=useCallback(()=>{if(rr.current&&O&&tt&&Ye){if(Ye==="child"&&r.onTaskReparent)r.onTaskReparent(O,tt);else if(Ye==="above"||Ye==="below"){let D=(ke,Ne,We=null)=>{for(let ce of ke){if(ce.id===Ne)return We;if(ce.subtasks){let Ee=D(ce.subtasks,Ne,ce.id);if(Ee!==void 0)return Ee}}},te=D(e,O,null),pe=D(e,tt,null);if(r.onTaskReparent){let ke=(rt,et)=>{if(et===null)return rt;for(let pt of rt){if(pt.id===et)return pt.subtasks||[];if(pt.subtasks){let dt=ke(pt.subtasks,et);if(dt.length>0||pt.subtasks.some(pr=>pr.id===et))return dt}}return []},Ne=ke(e,pe??null),We=Ne.findIndex(rt=>rt.id===tt),ce=te===pe,Ee=ce?Ne.findIndex(rt=>rt.id===O):-1,Ve=Ye==="below"?We+1:We;ce&&Ee!==-1&&Ee<We&&(Ve-=1),r.onTaskReparent(O,pe??null,Math.max(0,Ve));}}}J(null),ot(null),$t(null),St(null),rr.current=false,me(false);},[O,tt,Ye,e,r]),Xe=(D,te)=>te==="assignees"?D.assignees:te==="startDate"?D.startDate:D.endDate,Je=(D,te,pe,ke)=>{D.preventDefault(),D.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ne=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ne.map(wt=>wt.getAttribute("data-listview-row")||""),ce=Math.max(0,We.indexOf(te)),Ee=wt=>We.slice(ce,wt+1);At({sourceTaskId:te,column:pe,sourceIndex:ke,targetIndex:ke,rangeIds:new Set([te])});let rt=(wt=>{let Pt=wt?.parentElement??null;for(;Pt;){let wa=window.getComputedStyle(Pt).overflowY;if((wa==="auto"||wa==="scroll")&&Pt.scrollHeight>Pt.clientHeight)return Pt;Pt=Pt.parentElement;}let Lr=document.scrollingElement;return Lr&&Lr.scrollHeight>Lr.clientHeight?Lr:null})(D.currentTarget),et=wt=>{let Pt=ce,Lr=false;Ne.forEach((wa,ma)=>{let Xr=wa.getBoundingClientRect();wt>=Xr.top&&wt<=Xr.bottom&&(Pt=ma,Lr=true);});let Nr=Ne[Ne.length-1];if(!Lr&&Nr){let wa=Nr.getBoundingClientRect();wt>wa.bottom&&(Pt=Ne.length-1);}return Pt<ce&&(Pt=ce),Pt},pt=D.clientY,dt=null,pr=()=>{dt!==null&&(cancelAnimationFrame(dt),dt=null);},vr=()=>{let wt=et(pt),Pt=new Set(Ee(wt));At(Lr=>Lr&&{...Lr,targetIndex:wt,rangeIds:Pt});},Vr=()=>{if(pr(),!rt)return;let wt=rt,Lr=wt===document.scrollingElement?{top:0,bottom:window.innerHeight}:wt.getBoundingClientRect(),Nr=60,wa=12,ma=pt-Lr.top,Xr=Lr.bottom-pt,ho=wt.scrollHeight-wt.clientHeight;if(Xr<Nr&&wt.scrollTop<ho){let Cs=Math.max(1,Math.round(wa*(1-Math.max(0,Xr)/Nr))),Fn=()=>{wt.scrollTop+=Cs,vr(),wt.scrollTop<wt.scrollHeight-wt.clientHeight&&(dt=requestAnimationFrame(Fn));};dt=requestAnimationFrame(Fn);}else if(ma<Nr&&wt.scrollTop>0){let Cs=Math.max(1,Math.round(wa*(1-Math.max(0,ma)/Nr))),Fn=()=>{wt.scrollTop-=Cs,vr(),wt.scrollTop>0&&(dt=requestAnimationFrame(Fn));};dt=requestAnimationFrame(Fn);}},Ot=wt=>{pt=wt.clientY,vr(),Vr();},zt=wt=>{window.removeEventListener("mousemove",Ot),window.removeEventListener("mouseup",zt),pr(),document.body.style.cursor="",document.body.style.userSelect="",At(null);let Pt=et(wt.clientY),Lr=new Map(jt.current.map(Xr=>[Xr.id,Xr])),Nr=Lr.get(te);if(!Nr)return;let wa=Xe(Nr,pe),ma=[];for(let Xr of Ee(Pt)){if(Xr===te)continue;let ho=Lr.get(Xr);ho&&(ho.subtasks&&ho.subtasks.length>0||ma.push(Xr));}ma.length>0&&r.onBulkFill?.(ma,pe,wa);};window.addEventListener("mousemove",Ot),window.addEventListener("mouseup",zt);},zr=D=>fr?fr.rangeIds.has(D):false;useEffect(()=>{if(O)return document.addEventListener("mousemove",la),document.addEventListener("mouseup",ta),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",la),document.removeEventListener("mouseup",ta),document.body.style.cursor="",document.body.style.userSelect="";}},[O,la,ta]);let[Cr,ir]=useState("all"),[fa,ne]=useState(false),fe=useRef(null),it=useRef(null),Qe=useMemo(()=>{let D=0;function te(pe,ke){for(let Ne of pe)ke>D&&(D=ke),Ne.subtasks?.length&&te(Ne.subtasks,ke+1);}return te(e,1),D},[e]);useEffect(()=>{if(!fa)return;let D=te=>{fe.current?.contains(te.target)||it.current?.contains(te.target)||ne(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[fa]),useEffect(()=>{if(Cr==="all"){let pe=function(ke){for(let Ne of ke)Ne.subtasks?.length&&(Ne.isExpanded===false&&r.onTaskToggleExpand?.(Ne.id),pe(Ne.subtasks));};pe(e);}else {let pe=function(ke,Ne){for(let We of ke)if(We.subtasks?.length){let ce=Ne<Cr,Ee=We.isExpanded!==false;ce!==Ee&&r.onTaskToggleExpand?.(We.id),pe(We.subtasks,Ne+1);}};pe(e,1);}},[Cr]);let[_,se]=useState(null),[ee,$]=useState(0),[de,xe]=useState(0),T=useRef(null),[V,G]=useState(null),[Z,Ze]=useState(null);useEffect(()=>{h&&Ct(D=>{if(D.length===h.length){let te=true;for(let pe=0;pe<D.length;pe++){let ke=D[pe],Ne=h[pe];if(!ke||!Ne||ke.id!==Ne.id||ke.visible!==Ne.visible||ke.width!==Ne.width||ke.label!==Ne.label){te=false;break}}if(te)return D}return h});},[h]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:Tt,hideCompleted:Re}));}catch(D){console.error("Error persisting filter state:",D);}},[k,Tt,Re]);let le=useMemo(()=>{let D=new Set;function te(pe){for(let ke of pe)ke.subtasks?.length&&(ke.isExpanded!==false&&D.add(ke.id),te(ke.subtasks));}return te(e),D},[e]),Ue=useMemo(()=>ut.filter(D=>D.visible),[ut]),mt=useCallback(D=>{r.onTaskToggleExpand?.(D);},[r]),It=useCallback(D=>{He===D?Ke(te=>te==="asc"?"desc":"asc"):(Be(D),Ke("asc")),r.onSortChange?.({column:D,direction:ue==="asc"?"desc":"asc"});},[He,ue,r]),Mt=useCallback(D=>{Ct(D),r.onColumnsChange?.(D);},[r]),Tr=useCallback(D=>{let te=ut.map(pe=>pe.id===D?{...pe,visible:false}:pe);Mt(te);},[ut,Mt]),Gr=useCallback((D,te)=>{Be(D),Ke(te);},[]),za=useCallback((D,te,pe)=>{C&&(D.preventDefault(),X({isOpen:true,x:D.clientX,y:D.clientY,type:te?"task":"header",task:te,columnId:pe}));},[C]),lr=useCallback(()=>{X(D=>({...D,isOpen:false}));},[]),Ra=useCallback((D,te)=>{if(!w)return;D.preventDefault(),D.stopPropagation();let pe=ut.find(ke=>ke.id===te);pe&&(se(te),$(D.clientX),xe(pe.width));},[ut,w]);useEffect(()=>{if(!_)return;let D=ut,te=ke=>{let Ne=ke.clientX-ee,We=Math.max(50,de+Ne);D=D.map(ce=>ce.id===_?{...ce,width:We}:ce),Ct(D);},pe=()=>{r.onColumnsChange?.(D),se(null);};return document.addEventListener("mousemove",te),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",pe);}},[_,ee,de,r]);let Ho=useCallback((D,te)=>{if(te==="name"){D.preventDefault();return}G(te),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",te),D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="0.5");},[]),Pn=useCallback(D=>{D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="1"),G(null),Ze(null);},[]),jn=useCallback((D,te)=>{D.preventDefault(),te!=="name"&&(D.dataTransfer.dropEffect="move",Ze(te));},[]),Uo=useCallback(()=>{Ze(null);},[]),pi=useCallback((D,te)=>{if(D.preventDefault(),!V||V===te||te==="name")return;let pe=[...ut],ke=pe.findIndex(ce=>ce.id===V),Ne=pe.findIndex(ce=>ce.id===te);if(ke===-1||Ne===-1)return;let We=pe.splice(ke,1);We[0]&&(pe.splice(Ne,0,We[0]),Mt(pe),G(null),Ze(null));},[V,ut,Mt]),Yr=useCallback(async D=>{if(r.onCreateCustomField){let te={...D,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(te);}re(false);},[r]),bo=useCallback(D=>D.progress===100||D.status==="completed"?"completed":D.progress&&D.progress>0||D.status==="in-progress"?"in-progress":"todo",[]),ba=useMemo(()=>{let D=C0(e);if(ze.trim()){let te=ze.toLowerCase();D=D.filter(pe=>pe.name.toLowerCase().includes(te));}if(Tt!=="all"){let te=new Set(D.filter(pe=>bo(pe)===Tt).flatMap(pe=>pe.parentPath));D=D.filter(pe=>te.has(pe.id));}if(Re){let te=new Set(D.filter(pe=>bo(pe)!=="completed").flatMap(pe=>pe.parentPath));D=D.filter(pe=>te.has(pe.id));}return D.sort((te,pe)=>{let ke,Ne;switch(He){case "name":ke=te.name.toLowerCase(),Ne=pe.name.toLowerCase();break;case "startDate":ke=te.startDate?.getTime()||0,Ne=pe.startDate?.getTime()||0;break;case "endDate":ke=te.endDate?.getTime()||0,Ne=pe.endDate?.getTime()||0;break;case "progress":ke=te.progress||0,Ne=pe.progress||0;break;case "status":ke=te.status||"todo",Ne=pe.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ke=We[te.priority]??4,Ne=We[pe.priority]??4;break;case "position":return 0;default:return 0}return ke<Ne?ue==="asc"?-1:1:ke>Ne?ue==="asc"?1:-1:0}),D},[e,ze,Tt,Re,He,ue,bo]);jt.current=ba;let Za=useCallback((D,te)=>{let pe=We=>{r.onTaskUpdate?.({...D,...We});},ke=We=>We?D.customFields?.find(Ee=>Ee.fieldId===We)?.value:void 0,Ne=(We,ce)=>{if(!We)return;let Ve=[...D.customFields||[]],rt=Ve.findIndex(et=>et.fieldId===We);rt>=0?Ve[rt]={fieldId:We,value:ce}:Ve.push({fieldId:We,value:ce}),pe({customFields:Ve});};switch(te.type){case "name":return null;case "status":return jsx(dg,{value:D.status||(D.progress===100?"completed":D.progress&&D.progress>0?"in-progress":"todo"),onChange:ce=>{pe({status:ce,progress:ce==="completed"?100:ce==="in-progress"?50:0});},isDark:U,locale:g,translations:j.status});case "priority":return jsx(pg,{value:D.priority,onChange:ce=>pe({priority:ce}),isDark:U,locale:g});case "assignees":{let ce=D.hasChildren,Ee=D.assignees||[];if(ce&&D.subtasks?.length){let Ve=new Map,rt=et=>{(et||[]).forEach(pt=>{(pt.assignees||[]).forEach(dt=>{Ve.has(dt.name)||Ve.set(dt.name,dt);}),pt.subtasks?.length&&rt(pt.subtasks);});};rt(D.subtasks),Ee=Array.from(Ve.values());}else ce&&(Ee=[]);return jsx(yd,{value:Ee,availableUsers:c,onChange:Ve=>pe({assignees:Ve}),isDark:U,locale:g,disabled:ce})}case "startDate":return jsx(fl,{value:D.startDate,onChange:ce=>pe({startDate:ce}),isDark:U,locale:g,dateField:"start",startDate:D.startDate,endDate:D.endDate});case "endDate":return jsx(fl,{value:D.endDate,onChange:ce=>pe({endDate:ce}),isDark:U,locale:g,dateField:"end",startDate:D.startDate,endDate:D.endDate});case "progress":{let ce=!!(D.subtasks&&D.subtasks.length>0),Ee=ce?w0(Rd(D.subtasks||[])):D.progress||0;return jsx(wg,{value:Ee,onChange:ce?void 0:Ve=>{let rt=Ve===100?"completed":Ve>0?"in-progress":"todo";pe({progress:Ve,status:rt});},isDark:U,disabled:ce})}case "tags":return jsx(Ag,{value:D.tags||[],isDark:U});case "text":return jsx(Tg,{value:ke(te.customFieldId)||"",onChange:ce=>Ne(te.customFieldId,ce),isDark:U});case "number":return jsx(Sg,{value:ke(te.customFieldId)||0,onChange:ce=>Ne(te.customFieldId,ce),isDark:U});case "date":let We=ke(te.customFieldId);return jsx(fl,{value:We?new Date(We):void 0,onChange:ce=>Ne(te.customFieldId,ce),isDark:U,locale:g});case "dropdown":return jsx(Eg,{value:ke(te.customFieldId)||"",options:te.options||[],onChange:ce=>Ne(te.customFieldId,ce),isDark:U});case "checkbox":return jsx(Pg,{value:ke(te.customFieldId)||false,onChange:ce=>Ne(te.customFieldId,ce),isDark:U});case "estimatedTime":{let ce=D.status==="completed"||D.progress===100;return jsx(Aa,{value:D.estimatedTime,onChange:Ee=>pe({estimatedTime:Ee}),isDark:U,locale:g,disabled:ce,lens:N,hourlyRate:B(D)})}case "quotedTime":{let ce=D.status==="completed"||D.progress===100,Ee=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsx(Aa,{value:D.quotedTime,onChange:Ve=>pe({quotedTime:Ve}),isDark:U,locale:g,disabled:ce,isBlurred:Ee,lens:N,hourlyRate:B(D)})}case "elapsedTime":{let ce=D.status==="completed"||D.progress===100,Ee=D.executedDollarsCanonical;return jsx(Aa,{value:D.elapsedTime,onChange:Ve=>pe({elapsedTime:Ve}),isDark:U,locale:g,disabled:ce,lens:N,hourlyRate:B(D),financialOverride:Ee})}case "effortMinutes":{if(Q&&D.subtasks&&D.subtasks.length>0){let{allocated:et}=xs(D);if(N==="financial"){let pt=we(D),dt=Math.round(pt.dollarAllocated),pr=Math.round(pt.dollarQuoted),vr=pr-dt;return jsxs("div",{className:"flex flex-col",children:[dt>0?jsxs("span",{className:f("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",dt.toLocaleString("es-CO")]}):null,vr!==0&&dt>0&&pr>0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",vr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[vr>0?"+":"",Math.abs(vr)>=1e3?`$${(vr/1e3).toFixed(1)}K`:`$${vr}`]})]})}return jsx(Aa,{value:et>0?et:void 0,isDark:U,locale:g,disabled:true,lens:N,hourlyRate:K})}let ce=D.status==="completed"||D.progress===100,Ee=D.effortMinutes||0,Ve=D.soldEffortMinutes||0,rt=B(D);if(N==="financial"&&rt&&Ee>0&&Ve>0){let et=Math.round(Ee/60*rt),dt=Math.round(Ve/60*rt)-et;return jsxs("div",{className:"flex flex-col",children:[jsx(Aa,{value:Ee,onChange:pr=>pe({effortMinutes:pr}),isDark:U,locale:g,disabled:ce,lens:N,hourlyRate:B(D)}),dt!==0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",dt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[dt>0?"+":"",Math.abs(dt)>=1e3?`$${(dt/1e3).toFixed(1)}K`:`$${dt}`]})]})}return jsx(Aa,{value:Ee,onChange:et=>pe({effortMinutes:et}),isDark:U,locale:g,disabled:ce,lens:N,hourlyRate:B(D)})}case "timeLoggedMinutes":{let ce=D.executedDollarsCanonical;if(Q&&D.subtasks&&D.subtasks.length>0){let{spent:Ve}=xs(D);return jsx(Aa,{value:Ve>0?Ve:void 0,isDark:U,locale:g,disabled:true,lens:N,hourlyRate:B(D),financialOverride:ce})}let Ee=D.status==="completed"||D.progress===100;return jsx(Aa,{value:D.timeLoggedMinutes,onChange:r.onLogTime?Ve=>{r.onLogTime?.(D,Ve);}:void 0,isDark:U,locale:g,placeholder:g==="es"?"Agregar":"Add",disabled:Ee,lens:N,hourlyRate:B(D),financialOverride:ce})}case "soldEffortMinutes":{if(Q&&D.subtasks&&D.subtasks.length>0){let{quoted:Ve}=xs(D),rt=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Aa,{value:Ve>0?Ve:void 0,isDark:U,locale:g,disabled:true,isBlurred:rt,lens:N,hourlyRate:B(D)})}let ce=D.status==="completed"||D.progress===100,Ee=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Aa,{value:D.soldEffortMinutes,onChange:Ve=>pe({soldEffortMinutes:Ve}),isDark:U,locale:g,disabled:ce,isBlurred:Ee,lens:N,hourlyRate:B(D)})}case "scheduleVariance":{let ce=D.effortMinutes||0,Ee=D.soldEffortMinutes||0,Ve=D.timeLoggedMinutes||0,rt=ce>0||Ee>0||Ve>0;return jsx($g,{startDate:D.startDate,endDate:D.endDate,scheduleVariance:D.scheduleVariance,isDark:U,locale:g,hasTimeAllocated:rt})}case "hoursBar":{if(Q&&D.hasChildren){let{spent:ce,allocated:Ee,quoted:Ve}=xs(D),rt=ce>Ee&&Ee>0;return jsxs("span",{className:f("text-[11px] font-mono flex items-center gap-1.5",U?"text-white/50":"text-gray-500"),children:[jsx("span",{className:f("font-bold",rt?"text-[#FF453A]":U?"text-white/80":"text-gray-800"),children:ys(ce)}),Ee>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-white/60":"text-gray-600",children:ys(Ee)})]}),Ve>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-amber-400/70":"text-amber-600",children:ys(Ve)})]})]})}return jsx(Hg,{task:D,isDark:U,locale:g,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:N,hourlyRate:B(D)})}case "teamLoad":return D.hasChildren||D.subtasks&&D.subtasks.length>0?jsx(Wg,{task:D,isDark:U,locale:g}):jsx(yd,{value:D.assignees||[],availableUsers:c,onChange:Ee=>{r.onTaskUpdate?.({...D,assignees:Ee});},isDark:U,locale:g});case "blockers":return jsx(Gg,{blockers:D.blockers,isDark:U,locale:g});case "weight":{let ce=be.get(D.id);if(ce!==void 0)return jsx("span",{className:f("text-xs font-mono",ce>0?U?"text-white/50":"text-gray-400":U?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce>0?`${Number(ce.toFixed(2))}%`:"\u2014"});let Ee=D.weight||0;return jsx(B1,{value:Ee,onChange:Ve=>pe({weight:Ve}),isDark:U})}default:return jsx("span",{className:f("text-sm",U?"text-white/60":"text-gray-500"),children:"-"})}},[r,U,g,c,j,Q,be]),en=useCallback(D=>{let pe={name:j.columns.name,status:j.columns.status,priority:j.columns.priority,assignees:j.columns.assignees,startDate:j.columns.startDate,endDate:j.columns.endDate,progress:j.columns.progress,tags:j.columns.tags||(g==="es"?"Etiquetas":"Tags"),estimatedTime:j.columns.estimatedTime||(g==="es"?"Estimado":"Estimated"),quotedTime:j.columns.quotedTime||(g==="es"?"Ofertado":"Quoted"),elapsedTime:j.columns.elapsedTime||(g==="es"?"Ejecutado":"Executed"),soldEffortMinutes:j.columns.soldEffortMinutes||(g==="es"?"Ofertado":"Quoted"),effortMinutes:j.columns.effortMinutes||(g==="es"?"Estimado":"Estimated"),timeLoggedMinutes:j.columns.timeLoggedMinutes||(g==="es"?"Ejecutado":"Executed"),scheduleVariance:j.columns.scheduleVariance||(g==="es"?"Prog / Var":"Sched / Var"),hoursBar:j.columns.hoursBar||(g==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:j.columns.teamLoad||(g==="es"?"Equipo":"Team"),blockers:j.columns.blockers||(g==="es"?"Bloqueantes":"Blockers"),weight:j.columns.weight||(g==="es"?"Peso":"Weight")}[D.type]||D.label;return typeof pe=="string"?pe:String(pe||D.type)},[j,g]),_n=useMemo(()=>{let pe=Ue.reduce((Ne,We)=>Ne+We.width,0)+(v?48:0),ke={};for(let Ne of Ue)ke[Ne.id]=`${Ne.width/pe*100}%`;return ke},[Ue,v]);return a?jsx("div",{className:f("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:f("text-sm",U?"text-white/60":"text-gray-600"),children:[j.empty.noTasks,"..."]})]})}):n?jsx("div",{className:f("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:f("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",U?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:j.empty.noTasks}),jsx("p",{className:f("text-sm",U?"text-white/60":"text-gray-600"),children:j.empty.addFirstTask})]})}):jsxs("div",{ref:T,className:f(U?"bg-[#0D0D0D]":"bg-white",_&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",U?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:f("text-sm",U?"text-white/60":"text-gray-600"),children:[ba.length," ",j.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",U?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ze,onChange:D=>Ae(D.target.value),placeholder:j.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",U?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&Qe>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:fe,onClick:()=>ne(!fa),className:f("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",U?fa?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":fa?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),Cr==="all"?g==="es"?"Todos":"All":`L${Cr}`]}),fa&&jsx("div",{ref:it,className:f("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",U?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:g==="es"?"Todos":"All"},...Array.from({length:Math.min(Qe,5)},(D,te)=>({value:te+1,label:`L${te+1}`}))].map(D=>jsxs("button",{onClick:()=>{ir(D.value),ne(false);},className:f("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",U?Cr===D.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Cr===D.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:D.label}),Cr===D.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(D.value)))})]}),jsx(m0,{value:Tt,hideCompleted:Re,onChange:Nt,onHideCompletedChange:Le,isDark:U,locale:g}),ve?.enabled&&ve.data&&!he&&jsx("button",{onClick:()=>Oe(true),className:f("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",U?"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:g==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,E&&L&&jsxs(motion.button,{onClick:L,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:j.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",U?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[gr&&jsx("div",{className:"w-5 flex-shrink-0"}),Ue.map(D=>{let te=D.id!=="name",pe=Z===D.id&&V!==D.id;return jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",U?"text-white/60":"text-gray-500",te&&"cursor-grab",D.type!=="name"&&"justify-center",V===D.id&&"opacity-50",pe&&(U?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:_n[D.id],minWidth:D.minWidth},draggable:te,onDragStart:te?ke=>Ho(ke,D.id):void 0,onDragEnd:te?Pn:void 0,onDragOver:te?ke=>jn(ke,D.id):void 0,onDragLeave:te?Uo:void 0,onDrop:te?ke=>pi(ke,D.id):void 0,onContextMenu:ke=>za(ke,void 0,D.id),children:[te&&jsx(GripVertical,{className:f("w-3 h-3 flex-shrink-0 transition-opacity",U?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:ke=>{let Ne=ke.currentTarget.getBoundingClientRect();d(D.id,Ne);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[en(D),u?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),He===D.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):D.sortable?jsxs("button",{draggable:false,onClick:()=>It(D.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[en(D),u?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:f("w-3 h-3",He===D.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[en(D),u?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}})]}),w&&D.resizable&&jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",_===D.id&&"bg-[#00E5CC]"),onMouseDown:ke=>Ra(ke,D.id)})]},D.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:D=>{D.stopPropagation(),lt(te=>!te);},className:f("p-0.5 rounded transition-colors",U?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ie&&(U?"bg-white/[0.05]":"bg-gray-200")),title:g==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(s0,{isOpen:Ie,onClose:()=>lt(false),columns:ut,customFields:l,onColumnsChange:Mt,onCreateCustomField:()=>{lt(false),re(true);},isDark:U,locale:g})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ba.map((D,te)=>{let pe=le.has(D.id),ke=Math.min(te*.01,.2),Ne=D.hasChildren&&D.level===0,We=D.subtasks?.length||0;if(Ne){let{spent:pt,allocated:dt,quoted:pr}=xs(D),vr=R1(D);return jsxs(motion.div,{"data-task-id":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ke},className:f("flex items-center border-y cursor-pointer transition-colors duration-500",U?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Se===D.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(D),children:[gr&&jsx("div",{className:"w-5 flex-shrink-0"}),Ue.map(Vr=>jsx("div",{className:f("flex items-center px-4 py-3 min-h-[56px]",Vr.type!=="name"&&"justify-center"),style:{width:_n[Vr.id],minWidth:Vr.minWidth},children:Vr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ot=>{Ot.stopPropagation(),mt(D.id);},className:f("p-0.5 rounded flex-shrink-0 mt-0.5",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:f("w-4 h-4",U?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:f("w-4 h-4",U?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ot=>{Ot.stopPropagation(),mt(D.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}})}),D.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:U?"#FFD60A":"#B45309"},children:D.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:f("text-[13px] font-bold uppercase tracking-wide",U?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:D.name}),jsxs("span",{className:f("text-[10px] font-mono",U?"text-white/30":"text-gray-500"),children:["(",We," ",g==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),vr!==null&&jsxs("span",{className:f("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",vr>=1?"text-[#32D74B] bg-[#32D74B]/10":vr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",vr.toFixed(2)]})]})]}):Vr.type==="timeLoggedMinutes"?N==="financial"?(()=>{let Ot=D.executedDollarsCanonical,zt=Ot!=null?Math.round(Ot):Math.round(we(D).dollarSpent);return zt>0?jsxs("span",{className:f("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",zt.toLocaleString("en-US")]}):null})():jsx(Aa,{value:pt>0?pt:void 0,isDark:U,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):Vr.type==="soldEffortMinutes"?N==="financial"?(()=>{let Ot=we(D),zt=Math.round(Ot.dollarQuoted);return zt>0?jsxs("span",{className:f("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",zt.toLocaleString("en-US")]}):null})():jsx(Aa,{value:pr>0?pr:void 0,isDark:U,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):Vr.type==="effortMinutes"?N==="financial"?(()=>{let Ot=we(D),zt=Math.round(Ot.dollarAllocated),wt=Math.round(Ot.dollarQuoted),Pt=wt-zt;return jsxs("div",{className:"flex flex-col",children:[zt>0?jsxs("span",{className:f("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",zt.toLocaleString("es-CO")]}):null,Pt!==0&&zt>0&&wt>0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Pt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Pt>0?"+":"",Math.abs(Pt)>=1e3?`$${(Pt/1e3).toFixed(1)}K`:`$${Pt}`]})]})})():jsx(Aa,{value:dt>0?dt:void 0,isDark:U,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):Za(D,Vr)},Vr.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)}let ce=O===D.id,Ee=tt===D.id,Ve=Ee&&Ye==="above",rt=Ee&&Ye==="below",et=Ee&&Ye==="child";return jsxs(motion.div,{"data-task-id":D.id,"data-listview-row":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ke},className:f("flex items-center border-b transition-colors relative group",U?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Se===D.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:ce?.4:1,backgroundColor:et?U?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:et?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(D),onDoubleClick:()=>r.onTaskDoubleClick?.(D),onContextMenu:pt=>za(pt,D),onMouseEnter:()=>Yt(D.id),onMouseLeave:()=>Yt(pt=>pt===D.id?null:pt),children:[Ve&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),rt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),gr&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:pt=>_t(D.id,pt),style:{color:U?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Ue.map(pt=>{let dt=!!(D.subtasks&&D.subtasks.length>0),pr=qr(pt.type),Vr=!!pr&&!dt&&ia===D.id&&!fr,Ot=!!fr&&!!pr&&fr.column===pr&&zr(D.id);return jsxs("div",{className:f("flex items-center px-4 py-3 min-h-[56px]",pt.type!=="name"&&"justify-center"),style:{width:_n[pt.id],minWidth:pt.minWidth,position:"relative",backgroundColor:Ot?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ot?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[pt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&D.level>0&&jsx("div",{style:{width:`${D.level*24}px`},className:"flex-shrink-0"}),b&&D.hasChildren&&jsx("button",{onClick:zt=>{zt.stopPropagation(),mt(D.id);},className:f("p-0.5 rounded flex-shrink-0",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:f("w-4 h-4",U?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:f("w-4 h-4",U?"text-white/60":"text-gray-400")})}),b&&!D.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(D.wbsCode||D.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[D.wbsCode&&jsx("span",{className:f("text-[10px] font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),children:D.wbsCode}),D.taskCode&&jsx("span",{className:f("text-[10px] font-mono",U?"text-white/40":"text-gray-400"),children:D.taskCode})]}),jsx("span",{className:f("truncate",D.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",D.progress===100?U?"line-through text-white/50":"line-through text-gray-400":D.hasChildren?U?"text-white":"text-gray-900":U?"text-[#D1D5DB]":"text-gray-600"),children:D.name}),D.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${D.tags[0].color}20`,color:D.tags[0].color},children:D.tags[0].name})]})]}):Za(D,pt),Vr&&pr&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:zt=>Je(zt,D.id,pr,te),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},pt.id)}),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)})}),I&&ba.length>0&&(()=>{let{spent:D,allocated:te,quoted:pe}=Pe,ke=te-D,Ne=ke<0,We=Ne?`+${ys(Math.abs(ke))} ${g==="es"?"EXCEDIDO":"OVER"}`:`+${ys(ke)} ${g==="es"?"AHORRADO":"SAVED"}`,ce=N==="financial"&&K>0,Ee=q?.breakdown,Ve=!!Ee&&((Ee.equipment??0)>0||(Ee.travel??0)>0),rt=Ee?.laborSpent!=null?Ee.laborSpent:q?.spent!=null?q.spent:Pe.dollarSpent,et=Ee?.laborAllocated!=null?Ee.laborAllocated:q?.allocated!=null?q.allocated:Pe.dollarAllocated,pt=q?.quoted!=null?q.quoted:Pe.dollarQuoted,dt=(Ot,zt)=>{if(ce){let wt=zt??Ot/60*K;return `$${Math.round(wt).toLocaleString("es-CO")}`}return ys(Ot)},pr=ce?Math.abs(et-rt):0,vr=ce?`+$${pr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ne?g==="es"?"EXCEDIDO":"OVER":g==="es"?"AHORRADO":"SAVED"}`:We,Vr=ce&&Ve?g==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:f("flex items-center sticky bottom-0 z-[5]",U?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:U?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[gr&&jsx("div",{className:"w-5 flex-shrink-0"}),Ue.map(Ot=>jsx("div",{className:f("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:_n[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:f("text-[11px] font-black uppercase tracking-widest",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:g==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Vr&&jsxs("span",{className:f("text-[9px] font-mono mt-0.5 flex items-center gap-1",U?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Vr]})]}):Ot.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:f("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:dt(D,ce?rt:void 0)}),jsx("span",{className:f("text-[11px]",U?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:f("text-[11px]",U?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:dt(te,ce?et:void 0)})]}),te>0&&jsx("span",{className:f("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ne?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce?vr:We})]}):Ot.type==="soldEffortMinutes"?jsx("span",{className:f("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?dt(pe,ce?pt:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(ce&&pe>0&&te>0){let zt=Math.round(pt),wt=Math.round(et),Pt=zt-wt,Lr=zt>0?Math.round(Pt/zt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:f("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:dt(te,et)}),jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Pt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Pt>=0?"+":"",Math.abs(Pt)>=1e3?`$${(Pt/1e3).toFixed(1)}K`:`$${Pt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Lr,"%)"]})]})]})}return jsx("span",{className:f("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:te>0?dt(te,ce?et:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsx("span",{className:f("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:D>0?dt(D,ce?rt:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let zt=w0(Rd(e||[]));return jsxs("span",{className:f("text-[12px] font-bold font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[zt,"%"]})})():Ot.type==="weight"?(()=>{let zt=e||[],wt=[],Pt=ma=>{for(let Xr of ma)wt.push(Xr),Xr.subtasks?.length&&Pt(Xr.subtasks);};Pt(zt);let Nr=wt.filter(ma=>!ma.subtasks?.length||ma.subtasks.length===0).reduce((ma,Xr)=>ma+(Xr.weight||0),0),wa=Math.abs(Nr-100)<.1;return jsxs("span",{className:f("text-[12px] font-bold font-mono",wa?U?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Nr.toFixed(1)),"%"]})})():jsx("span",{className:f("text-[11px]",U?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ba.length===0&&ze&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:f("w-12 h-12 mx-auto mb-4",U?"text-white/30":"text-gray-400")}),jsx("p",{className:f(U?"text-white/60":"text-gray-600"),children:j.empty.noResults})]})})]})}),ve?.enabled&&ve.data&&he&&jsx(f0,{data:ve.data,isDark:U,locale:g,onClose:()=>Oe(false),lens:t?.lens,onUnassignedTaskClick:D=>{let te=document.querySelector(`[data-task-id="${D}"]`);te&&(te.scrollIntoView({behavior:"smooth",block:"center"}),Fe(D),setTimeout(()=>Fe(null),2e3));}})]}),jsx(Xg,{state:R,onClose:lr,isDark:U,locale:g,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Tr,onColumnSort:Gr,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),Te&&Dt&&O&&createPortal(jsx("div",{style:{position:"fixed",left:Dt.x+12,top:Dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let te=Ce.flattenTasks(e).find(pe=>pe.id===O);return te?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:U?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${U?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:U?"#e6edf3":"#111827"},children:te.name})]}):null})()}),document.body),jsx(c0,{isOpen:F,onClose:()=>re(false),onSave:Yr,isDark:U,locale:g})]})}var N0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],D0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],S0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Bd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},$d={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Od={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Cl={dark:Bd,light:$d,neutral:Od};function E0(e){return Cl[e]||Cl.dark}function Tl(e,t,r,a,n=5){let s=[],o=[],c=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,g)=>m.startSerial-g.startSerial||g.endSerial-m.endSerial);for(let m of c){let g=Math.max(m.startSerial,r),x=Math.min(m.endSerial,a),y=0;for(;(s[y]||[]).some(([b,h])=>!(x<b||g>h));)y++;(s[y]=s[y]||[]).push([g,x]),o.push({t:m,s:g,e:x,lane:y,contL:m.startSerial<r,contR:m.endSerial>a});}let l={};for(let m=r;m<=a;m++)l[m]=new Set;o.forEach(m=>{for(let g=m.s;g<=m.e;g++)l[g].add(m.lane);});let i=[],d=[],u={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(u[m.serial]=u[m.serial]||[]).push(m);}),Object.keys(u).forEach(m=>{let g=+m,x=u[g],y=[];for(let b=0;b<n;b++)l[g].has(b)||y.push(b);if(x.length<=y.length)x.forEach((b,h)=>i.push({it:b,day:g,lane:y[h]}));else {let b=Math.max(y.length-1,0);x.slice(0,b).forEach((h,v)=>i.push({it:h,day:g,lane:y[v]})),d.push({day:g,lane:y[b]!=null?y[b]:n-1,count:x.length-b,items:x.slice(b)});}});let p=s.length;return i.forEach(m=>{p=Math.max(p,m.lane+1);}),d.forEach(m=>{p=Math.max(p,m.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(p,1)}}var $1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],O1=["MON","TUE","WED","THU","FRI","SAT","SUN"];function M0(e){return e==="es"?$1:O1}function P0(e){return (e.getDay()+6)%7}function F0(e,t){let r=new Date(e,t,1),a=P0(r),n=new Date(e,t,1-a),s=[];for(let u=0;u<6;u++)s.push({ws:u*7+1,we:u*7+7});let o=u=>{let p=new Date(n);return p.setDate(n.getDate()+(u-1)),p},c=u=>{let p=u.getTime()-n.getTime();return Math.floor(p/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function ai(e,t){return P0(e.serialToDate(t))>=5}function H1(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function L0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function A0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Nl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=H1(t),c=42,l=[];for(let{t:d,phaseId:u,phaseName:p}of o){let m=L0(d.startDate),g=L0(d.endDate);if(!m||!g)continue;let x=r.dateToSerial(m),y=r.dateToSerial(g);if(y<1||x>c)continue;let b=d.effortMinutes??0,h=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?A0(v):A0(h*n),C=d.assignees?.[0],E=C?.initials||(C?.name?z1(C.name):void 0),L=d.displayId||d.wbsCode||"",k=W1(L||d.id)?"":L||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(y,c),hrs:h,cost:w,critical:!!d.isCriticalPath,who:E,realStart:m,realEnd:g,phaseId:u,phaseName:p});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var U1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function W1(e){return U1.test(e)||/^task-\d+/.test(e)}function z1(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var G1=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],V1=["January","February","March","April","May","June","July","August","September","October","November","December"];function I0(e,t,r){return `${(r==="es"?G1:V1)[t]} ${e}`}var Hd=26,j1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Dl({locale:e}){let t=M0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Sl({bar:e,ws:t,money:r,projColor:a,slotH:n=Hd}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),c>=3?jsx("span",{className:"val",children:i}):null]})}function El({chip:e,ws:t,slotH:r=Hd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:j1[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Ml({more:e,ws:t,slotH:r=Hd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function R0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito / Desembolso"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var Y1=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function B0({view:e,onViewChange:t,money:r,onMoneyChange:a,projectLabel:n}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[n,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:Y1.map(s=>jsxs("button",{type:"button",className:e===s.id?"on":"",onClick:()=>t(s.id),children:[s.lbl,jsx("span",{className:"key",children:s.key})]},s.id))}),jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function $0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:u}){let p=o?o.length:0,[m,g]=useState(false),x=useRef(null),y=d==="es";useEffect(()=>{if(!m)return;let h=v=>{x.current&&!x.current.contains(v.target)&&g(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]);let b=l==="all"?y?"Todas":"All":c?.find(h=>h.id===l)?.name??(y?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:y?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>g(h=>!h),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:y?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),g(false);},children:jsx("span",{className:"nm",children:y?"Todas las fases":"All phases"})}),c.map(h=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(h.id),g(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,u,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",y?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-p,"/6"]})]})})]})}var X1=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones / Desembolsos",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function O0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:X1.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var Z1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},eC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function U0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(p){o.current&&!o.current.contains(p.target)&&n();}function u(p){p.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,u)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${u}`)),t.map((d,u)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:eC[d.type]},children:Z1[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${u}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var H0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones"}};function W0({monthLabel:e,upcomingMilestones:t=[],locale:r="es"}){let a=H0[r]||H0.es,n=r!=="en";return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:a.title}),n?jsxs("p",{children:["Arrastra tareas del ",jsx("b",{children:"backlog"})," o cr\xE9alas en el ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"El plan CPM proyectar\xE1 aqu\xED lo que toque ejecutar en ",jsx("b",{children:e}),"."]}):jsxs("p",{children:["Drag tasks from the ",jsx("b",{children:"backlog"})," or create them in the ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"The CPM plan will project here what needs running in ",jsx("b",{children:e}),"."]}),t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:a.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function G0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function aC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var z0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function nC(e){return z0[e%z0.length]}function oC(e){return e>1?"over":e>=.9?"warn":"ok"}var Ud="\xA0";function Ao(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function V0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(G0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:nC(l),initials:aC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(u=>{let p=s.get(u.userId);return {name:u.name,initials:p.initials,color:p.color,hours:Math.round((l.get(u.userId)??0)*100)/100,capacity:r}}),d=i.reduce((u,p)=>u+p.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function j0({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=G0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,u="cal-cap-cell "+(o?"off":oC(i))+(r===s?" sel":""),p=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:u,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:p,onClick:m=>{!l||!a||a(s,p,m.currentTarget);},onKeyDown:m=>{!l||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,p,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!l?jsx("span",{children:o?"\u2014":`0h${Ud}/${Ud}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ao(c.assigned),"h"]}),jsxs("span",{children:["/",Ud,Ao(c.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:l?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function _0({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=u=>{u.key==="Escape"&&r();},d=u=>{n.current&&!n.current.contains(u.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ao(s),"h asignadas / ",Ao(o),"h"]}),c?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ao(l),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,u=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/u*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ao(i.hours),"h / ",Ao(i.capacity),"h"]})]},i.name)})})]})}var Wd=28,iC=182;function q0({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:u,onCapDay:p}){let m=c==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((g,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(lC,{grid:e,ws:g.ws,we:g.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:u}),l&&l[x]?jsx(j0,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:p}):null]},g.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function lC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),u=useMemo(()=>new Set(n.filter(g=>g.type==="deadline").map(g=>g.serial)),[n]),p=[];for(let g=t;g<=r;g++)p.push(g);let m={height:`${iC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:p.map(g=>{let x=e.serialToDate(g),y=g>=e.monthStartSerial&&g<=e.monthEndSerial,b="cal-day";return ai(e,g)&&(b+=" wknd"),y||(b+=" out"),g===c&&(b+=" today"),u.has(g)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},g)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((g,x)=>jsx("div",{onClick:()=>l?.(g.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsx(Sl,{bar:g,ws:t,money:s,projColor:o,slotH:Wd})},`b${x}`)),d.chips.map((g,x)=>jsx(El,{chip:g,ws:t,slotH:Wd},`c${x}`)),d.more.map((g,x)=>jsx(Ml,{more:g,ws:t,slotH:Wd,onClick:()=>i(g.day,g.items,a.filter(y=>y.startSerial<=g.day&&y.endSerial>=g.day))},`m${x}`))]})]})}var cC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function dC(e){return cC.test(e)||/^task-\d+/.test(e)}function uC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Y0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function pC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function X0(e,t){let r=pC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?Y0(c):Y0(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?uC(i.name):void 0),u=n.displayId||n.wbsCode||"",p=dC(u||n.id)?"":u||n.id;a.push({taskId:n.id,id:p,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function J0({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function Q0({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function ws(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Z0({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=useRef(null),i=n==="es";useEffect(()=>{let g=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let d=r.wasCritical,u=r.projectEndDeltaDays,p=u>0?`+${u} ${i?u===1?"d\xEDa":"d\xEDas":u===1?"day":"days"} \xB7 ${ws(r.oldProjectEnd,n)} \u2192 ${ws(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=u>0?i?`Confirmar +${u} ${u===1?"d\xEDa":"d\xEDas"}`:`Confirm +${u} ${u===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[ws(r.oldStart,n)," \u2013 ",ws(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[ws(r.newStart,n)," \u2013 ",ws(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(g=>g.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:u>0?"v bad":"v good",children:p})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||u>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var bC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function ef({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=useMemo(()=>{let u=new Map,p=m=>(u.has(m)||u.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),u.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&p(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&p(m.serial).items.push(m);return [...u.values()].filter(m=>m.tasks.length||m.items.length).sort((m,g)=>m.serial-g.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=u=>u.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(u=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:u.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(u.date),u.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),u.tasks.map(p=>jsxs("button",{type:"button",onClick:()=>c?.(p.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),p.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,p.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:p.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?p.cost:`${p.hrs}h`})]},p.uid)),u.items.map((p,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:bC[p.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label})]},`it${m}`))]},u.serial))})}function hC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Pl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function zd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function tf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Pl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let u=Pl(d).filter(g=>r.has(g)),p=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let g of u){let x=c(g);x>p&&(p=x);}let m=zd(d)*864e5;return n.set(i,p),s.set(i,p+m),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function rf(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Pl(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let u of i){let p=s.get(u),m=a.get(u);p!=null&&m&&(d=Math.min(d,p-zd(m)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Pl(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Fl(e,t,r,a){let n=hC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=tf(n,new Map),i=rf(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),u=tf(d,new Map([[t,r.getTime()]])),p=rf(d,u.finish,u.projectEnd),m=new Map(d.map(b=>[b.id,b])),g=[];for(let b of n){if(b.id===t)continue;let h=l.start.get(b.id),v=u.start.get(b.id);if(h!=null&&v!=null&&Math.abs(v-h)>=864e5/2){let w=zd(m.get(b.id))*864e5;g.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((u.projectEnd-l.projectEnd)/864e5),y=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:g,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(u.projectEnd),wasCritical:i.has(t),stillCritical:p.has(t),slackDays:y}}function af(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var vC=132,Ll=26,wC="#5B7FD4";function nf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,canReschedule:d,onReschedule:u,members:p=[],holidayDates:m=[],timesheetSettings:g,onVisibleRangeChange:x}){let[y,b]=useState("mes"),[h,v]=useState(()=>{let O=new Date;return {y:O.getFullYear(),m:O.getMonth()}}),[w,C]=useState(false),[E,L]=useState([]),[k,S]=useState("all"),[P,N]=useState(null),[K,H]=useState(null),[Q,I]=useState(false),[q,j]=useState(null),[U,B]=useState(false),we=useMemo(()=>F0(h.y,h.m),[h.y,h.m]),Ge=a||wC,Pe=useMemo(()=>{let O=new Set;for(let J of m){let Te=new Date(`${J}T12:00:00`),me=we.dateToSerial(Te);me>=1&&me<=42&&O.add(me);}return O},[m,we]);useEffect(()=>{x?.({start:af(we.serialToDate(1)),end:af(we.serialToDate(42))});},[h.y,h.m]);let be=p.length,ve=useMemo(()=>{let O=g?.hoursPerDay;if(!O)return 8;let J=[O.monday,O.tuesday,O.wednesday,O.thursday,O.friday].map(Te=>Te||0).filter(Te=>Te>0);return J.length?Math.round(J.reduce((Te,me)=>Te+me,0)/J.length*10)/10:8},[g]),he=useMemo(()=>Nl({tasks:e,grid:we,projectColor:()=>Ge,hourlyRate:o,projectId:r}),[e,we,Ge,o,r]),Oe=useMemo(()=>{let O=new Map;for(let J of he.calTasks)J.phaseId&&J.phaseName&&O.set(J.phaseId,J.phaseName);return [...O.entries()].map(([J,Te])=>({id:J,name:Te})).sort((J,Te)=>J.name.localeCompare(Te.name))},[he.calTasks]),Se=!E.includes("tareas"),Fe=!E.includes("cpm"),He=useMemo(()=>{let O=Se?he.calTasks:[];return k!=="all"&&(O=O.filter(J=>J.phaseId===k)),Fe||(O=O.map(J=>J.critical?{...J,critical:false}:J)),O},[he.calTasks,Se,Fe,k]),Be=useMemo(()=>{let O=new Set;return E.includes("hitos")&&(O.add("hito"),O.add("desembolso")),E.includes("ext")&&O.add("ext"),E.includes("aus")&&O.add("aus"),he.dayItems.filter(J=>!O.has(J.type))},[he.dayItems,E]),ue=!E.includes("festivos"),Ke=new Date,ze=we.dateToSerial(new Date(Ke.getFullYear(),Ke.getMonth(),Ke.getDate())),Ae=O=>L(J=>J.includes(O)?J.filter(Te=>Te!==O):[...J,O]),Tt=()=>v(O=>{let J=new Date(O.y,O.m-1,1);return {y:J.getFullYear(),m:J.getMonth()}}),Nt=()=>v(O=>{let J=new Date(O.y,O.m+1,1);return {y:J.getFullYear(),m:J.getMonth()}}),Re=()=>{let O=new Date;v({y:O.getFullYear(),m:O.getMonth()});},Le=(O,J,Te)=>{if(!d||J===0)return;let me=he.calTasks.find(Dt=>Dt.uid===O);if(!me)return;let tt=J*864e5,ot=new Date(me.realStart.getTime()+tt),Ye=new Date(me.realEnd.getTime()+tt),$t=Fl(e,O,ot,Ye);$t&&j({uid:O,taskId:me.id,taskName:me.name,sim:$t,anchor:Te});},ut=async()=>{if(!q||!u)return;B(true);let O=[{id:q.uid,startDate:q.sim.newStart,endDate:q.sim.newEnd},...q.sim.movedSuccessors.map(Te=>({id:Te.id,startDate:Te.newStart,endDate:Te.newEnd}))],J=await u(O);B(false),J&&j(null);},Ct=I0(h.y,h.m,n),Ie=[{id:"",name:t,color:Ge}],lt=useMemo(()=>X0(e,o),[e,o]),F=useMemo(()=>{if(y==="lookahead"){let O=we.weeks.find(Te=>ze>=Te.ws&&ze<=Te.we)??we.weeks[0],J=we.weeks.indexOf(O);return we.weeks.slice(J,J+2)}return y==="semana"?[we.weeks.find(J=>ze>=J.ws&&ze<=J.we)??we.weeks[0]]:[]},[y,we.weeks,ze]),re=useMemo(()=>{let O={};return F.forEach((J,Te)=>{let me=[];for(let ot=J.ws;ot<=J.we;ot++)me.push({serial:ot,date:we.serialToDate(ot),isWeekend:ai(we,ot),isHoliday:Pe.has(ot)});let tt=V0(p,me,ve);O[Te]={days:me,capByDay:tt};}),O},[F,we,Pe,p,ve]),R=y==="semana"||y==="lookahead",X=y==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(B0,{view:y,onViewChange:b,money:c==="$"?"$":"hrs",onMoneyChange:O=>l(O==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx($0,{monthLabel:Ct,onPrev:Tt,onNext:Nt,onToday:Re,layersOpen:w,onToggleLayers:()=>C(O=>!O),layersOff:E,phases:Oe,phaseFilter:k,onPhaseChange:S,locale:n,children:w?jsx(O0,{off:E,onToggle:Ae}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:X?"hidden":void 0},children:[X?jsx(ef,{grid:we,tasks:He,items:Be,money:c,projColor:Ge,todaySerial:ze,locale:n,onTaskOpen:i}):R?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx(q0,{grid:we,weeks:F,tasks:He,items:Be,money:c,projColor:Ge,todaySerial:ze,locale:n,capRows:re,teamSize:be,onTaskOpen:i,onMore:(O,J,Te)=>N({day:O,items:J,tasks:Te}),onCapDay:(O,J,Te)=>{for(let me of Object.keys(re)){let tt=re[+me].capByDay.get(O);if(tt){H({dayLabel:J,perPerson:tt.perPerson,anchor:Te.getBoundingClientRect()});break}}}})]}):he.isEmpty?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:we.weeks.map(O=>jsx(of,{grid:we,ws:O.ws,we:O.we,todaySerial:ze,showFestivos:ue,holidaySerials:Pe,locale:n,deadlineDays:new Set},O.ws))}),jsx(W0,{monthLabel:Ct,locale:n})]}):jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:we.weeks.map(O=>jsx(kC,{grid:we,ws:O.ws,we:O.we,tasks:He,items:Be,money:c,projColor:Ge,todaySerial:ze,showFestivos:ue,holidaySerials:Pe,locale:n,onTaskOpen:i,onMore:(J,Te,me)=>N({day:J,items:Te,tasks:me}),canReschedule:d,onDragReschedule:Le,pendingGhost:q?{uid:q.uid,days:Math.round((q.sim.newStart.getTime()-q.sim.oldStart.getTime())/864e5)}:null},O.ws))})]}),P?jsx(U0,{dayLabel:`${we.serialToDate(P.day).getDate()}`,items:P.items,tasks:P.tasks.map(O=>({swatch:Ge,taskId:O.id,label:O.name,critical:O.critical,value:c==="$"?O.cost:`${O.hrs}h`})),onClose:()=>N(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,K?jsx(_0,{dayLabel:K.dayLabel,perPerson:K.perPerson,onClose:()=>H(null),style:{position:"fixed",top:`${K.anchor.top-8}px`,left:`${K.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,q?jsx(Z0,{taskName:q.taskName,taskId:q.sim.taskId,sim:q.sim,busy:U,locale:n,onConfirm:ut,onCancel:()=>j(null),style:{position:"fixed",top:`${q.anchor.top+12}px`,left:`${Math.min(q.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),Q?jsx(J0,{items:lt,money:c,projColor:Ge,onItemClick:O=>i?.(O),onCollapse:()=>I(false)}):jsx(Q0,{onExpand:()=>I(true)})]}),jsx(R0,{projects:Ie})]})}function of({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,u=n&&s.has(l),p="cal-day";return ai(e,l)&&(p+=" wknd"),u&&(p+=" festivo"),d||(p+=" out"),l===a&&(p+=" today"),o.has(l)&&(p+=" deadline-day"),jsxs("div",{className:p,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),u?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function kC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:u,onMore:p,canReschedule:m,onDragReschedule:g,pendingGhost:x}){let y=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(L=>L.type==="deadline").map(L=>L.serial)),[n]),h=Math.max(vC,y.laneCount*Ll+36),v=useRef(null),[w,C]=useState(null),E=(L,k)=>{if(!m||!g){u?.(k);return}L.preventDefault();let S=v.current;if(!S)return;let P=S.getBoundingClientRect().width/7,N=L.clientX,K=0,H=I=>{let q=Math.round((I.clientX-N)/P);K=q,C({id:k,days:q});},Q=I=>{if(window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",Q),C(null),K===0){u?.(k);return}let q=new DOMRect(I.clientX,I.clientY,0,0);g(k,K,q);};window.addEventListener("pointermove",H),window.addEventListener("pointerup",Q);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${h}px`},children:[jsx(of,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[y.bars.map((L,k)=>{let S=w?.id===L.t.uid?w.days:null,P=x?.uid===L.t.uid?x.days:null,N=S??P??0,K=S==null&&P!=null,H=N!==0?{...L,s:L.s+N,e:L.e+N}:L;return jsx("div",{onPointerDown:Q=>E(Q,L.t.uid),style:{cursor:m?"grab":u?"pointer":"default",display:"contents",opacity:K?.6:1},children:jsx(Sl,{bar:H,ws:t,money:s,projColor:o,slotH:Ll})},`b${k}`)}),y.chips.map((L,k)=>jsx(El,{chip:L,ws:t,slotH:Ll},`c${k}`)),y.more.map((L,k)=>jsx(Ml,{more:L,ws:t,slotH:Ll,onClick:()=>p(L.day,L.items,a.filter(S=>S.startSerial<=L.day&&S.endSerial>=L.day))},`m${k}`))]})]})}function TC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=useState(false),d=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),u=useMemo(()=>{let m=d.length,g=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),y=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:g,priorities:x,labels:y}},[d]),p=()=>{n?.(e.id);};return jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:u.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),l&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[u.uniqueAssignees," assignees"]})]}),u.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[u.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:d.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:d.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:g=>{g.stopPropagation(),s?.(e.id,m.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.id))})})]})}var lf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function oi(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function si(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function cf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function df({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=useMemo(()=>({...lf,...o}),[o]),[i,d]=useState(new Set),u=useRef(null),p=useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=h.get(w);C?C.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,E)=>E.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:m,uniqueTypes:g}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{d(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),C=Math.floor(w/6e4),E=Math.floor(w/36e5),L=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:E<24?`${E}h ago`:L<7?`${L}d ago`:h.toLocaleDateString()},b=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&u.current){let h=u.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:f("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:f("history-timeline",l.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),g.map(h=>jsxs("option",{value:h,children:[si(h)," ",h.replace("_"," ")]},h))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>r({...t,searchTerm:h.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:u,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((v,w)=>{let C=i.has(v.id),E=s===v.id,L=cf(v.type);return jsxs("div",{"data-event-id":v.id,className:f("history-timeline-event",C&&"expanded",E&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:L},children:l.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:si(v.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:L}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[l.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:oi(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,S])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,S])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function pf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],u=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:f("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:f("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:u&&si(u.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:u&&oi(u)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:u&&u.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:m=>c(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,g)=>jsx("div",{className:f("history-replay-progress-marker",g===e.currentIndex&&"active"),style:{left:`${g/(e.totalEvents-1)*100}%`},onClick:()=>c(g),title:oi(m)},m.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:d.map(m=>jsxs("button",{className:f("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>l(m),children:[m,"x"]},m))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:u&&u.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:f("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Vd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function jd(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function mf(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function gf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function PC(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let u=r/2,p=a/2;d.vx+=(u-d.x)*n.centerForce*i,d.vy+=(p-d.y)*n.centerForce*i,o.forEach(m=>{if(d.id===m.id)return;let g=d.x-m.x,x=d.y-m.y,y=Math.sqrt(g*g+x*x)||1,b=n.chargeStrength*i/(y*y);d.vx+=g/y*b,d.vy+=x/y*b;});}),t.forEach(d=>{let u=c.get(typeof d.source=="string"?d.source:d.source.id),p=c.get(typeof d.target=="string"?d.target:d.target.id);if(!u||!p)return;let m=p.x-u.x,g=p.y-u.y,x=Math.sqrt(m*m+g*g)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;u.vx+=m*y,u.vy+=g*y,p.vx-=m*y,p.vy-=g*y;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function ff({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=useRef(null),[d,u]=useState([]),[p,m]=useState(null),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let H=PC(e,t,r.width,r.height,r,150);u(H);},[e,t,r]);let E=useCallback((H,Q)=>{r.enableDragging&&(Q.stopPropagation(),m(H));},[r.enableDragging]),L=useCallback(H=>{if(!p||!i.current)return;let I=i.current.getBoundingClientRect(),q=(H.clientX-I.left-w.x)/h,j=(H.clientY-I.top-w.y)/h;u(U=>U.map(B=>B.id===p?{...B,x:q,y:j,fx:q,fy:j}:B));},[p,h,w]),k=useCallback(()=>{m(null);},[]),S=useCallback((H,Q)=>{Q.stopPropagation(),c?.({type:"node-click",node:H,position:{x:Q.clientX,y:Q.clientY}});},[c]),P=useCallback((H,Q)=>{Q.stopPropagation(),c?.({type:"edge-click",edge:H,position:{x:Q.clientX,y:Q.clientY}});},[c]),N=useCallback(H=>{let Q=d.find(I=>I.id===H);return Q?{x:Q.x,y:Q.y}:{x:0,y:0}},[d]),K=useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Q=H.card.priority;return Q==="URGENT"?"#ef4444":Q==="HIGH"?"#f59e0b":Q==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:f("relationships-graph-empty",l),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:f("relationships-graph",l),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.min(H+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Vd(H)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[mf(H)," ",jd(H)]})]},H))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:L,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let Q=N(typeof H.source=="string"?H.source:H.source.id),I=N(typeof H.target=="string"?H.target:H.target.id),q=gf(H.type),j=y===H.id,U=H.onCriticalPath;return jsxs("g",{className:f("relationships-graph-edge",j&&"hovered",U&&"critical"),onMouseEnter:()=>b(H.id),onMouseLeave:()=>b(null),onClick:B=>P(H,B),children:[jsx("line",{x1:Q.x,y1:Q.y,x2:I.x,y2:I.y,stroke:Vd(H.type),strokeWidth:U?r.edgeWidth*2:r.edgeWidth,strokeOpacity:j?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),r.showEdgeLabels&&j&&jsx("text",{x:(Q.x+I.x)/2,y:(Q.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:jd(H.type)})]},H.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map(H=>{let Q=g===H.id,I=H.onCriticalPath;return jsxs("g",{className:f("relationships-graph-node",Q&&"hovered",I&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:q=>E(H.id,q),onMouseEnter:()=>x(H.id),onMouseLeave:()=>x(null),onClick:q=>S(H,q),children:[jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:K(H),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:Q?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function yf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[c,l]=useState(false),[i,d]=useState(null),[u,p]=useState(null),m=useRef(null),g=c||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!g&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,g]);let x=()=>{g||(o(""),d(null),p(null),t());},y=async()=>{if(!(!s.trim()||g)){l(true),d(null),p(null);try{let h=await a(s.trim());p(h);}catch(h){d(h instanceof Error?h.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{u&&(r(u),x());};return e?jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:g,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:u?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),u.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:u.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",u.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:u.columns.map((h,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",u.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[u.cards.slice(0,10).map((h,v)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),u.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",u.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:m,value:s,onChange:h=>o(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:g}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,v)=>jsx("button",{onClick:()=>o(h),disabled:g,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:g&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:g,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),u?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||g,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:g?"Generating...":"Generate Plan"})]})]})]})})]}):null}var _d={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var LC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},AC={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 IC(e,t,r){let a=_d[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ii(e){return `$${e.toFixed(4)}`}var Kd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=IC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(u=>u.timestamp>=t.start&&u.timestamp<=t.end));let a=r.length,n=r.reduce((u,p)=>u+p.cost,0),s=r.reduce((u,p)=>u+p.inputTokens,0),o=r.reduce((u,p)=>u+p.outputTokens,0),c=r.filter(u=>u.success),l=r.reduce((u,p)=>u+p.duration,0),i={},d={};return r.forEach(u=>{i[u.feature]=(i[u.feature]||0)+1,d[u.feature]=(d[u.feature]||0)+u.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Ro=new Kd;function wf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(Ro.getStats()),[s,o]=useState(Ro.checkLimit(r));if(useEffect(()=>{if(!e)return;let l=setInterval(()=>{n(Ro.getStats()),o(Ro.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=Ro.getRecentOperations(5);return jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:l=>l.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ii(a.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,u=a.totalOperations>0?i/a.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:l.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(d)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${u}%`}})})]},l)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(l=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(l.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Tf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=useState(""),[l,i]=useState(""),[d,u]=useState(""),[p,m]=useState(false),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(null),w=useRef(null),C=p||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=N=>{N.key==="Escape"&&!C&&E();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,C]);let E=()=>{C||(c(""),i(""),u(""),x(null),b(null),v(null),t());},L=async()=>{if(!(!o.trim()||C)){m(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},k=()=>{y&&(r(y),E());};if(!e)return null;let S=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:E}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:E,disabled: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:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",S,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,N)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>c(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:l,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:d,onChange:P=>u(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]})]}),g&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:g}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,N)=>jsx("button",{onClick:()=>c(P),disabled: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:P},N))})]})]})}),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-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:E,disabled: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"}),y?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:L,disabled:!o.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Rl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(y=>{t&&yi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{a(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let C=w.columnId,E={...w,columnId:b,position:h},L=v.cards.map(P=>P.id===y?E:P),k=v.columns.map(P=>{if(P.id===C)return {...P,cardIds:P.cardIds.filter(N=>N!==y)};if(P.id===b){let N=L.filter(K=>K.columnId===b).sort((K,H)=>K.position-H.position);return {...P,cardIds:N.map(K=>K.id)}}return P}),S={...v,cards:L,columns:k};return n(S),S});},[n]),o=useCallback(async(y,b)=>{a(h=>{let v=h.cards.map(C=>C.id===y?{...C,...b}:C),w={...h,cards:v};return n(w),w});},[n]),c=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b},w=h.columns.map(E=>E.id===y.columnId?{...E,cardIds:[...E.cardIds,b]}:E),C={...h,cards:[...h.cards,v],columns:w};return n(C),C});},[n]),l=useCallback(async y=>{a(b=>{let h=b.cards.find(E=>E.id===y);if(!h)return b;let v=b.cards.filter(E=>E.id!==y),w=b.columns.map(E=>E.id===h.columnId?{...E,cardIds:E.cardIds.filter(L=>L!==y)}:E),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),d=useCallback(async(y,b)=>{a(h=>{let v=h.columns.map(C=>C.id===y?{...C,...b}:C),w={...h,columns:v};return n(w),w});},[n]),u=useCallback(async y=>{a(b=>{let h=b.cards.filter(C=>C.columnId!==y),v=b.columns.filter(C=>C.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),p=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),b},[c]),m=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),g=useCallback(()=>{a(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:u},setBoard:a,helpers:{addCard:p,addColumn:m,deleteCard:l,deleteColumn:u,clearBoard:g}}}function Df({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Rl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(u=>u.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(u=>u.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var li={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Ef={by:"none",order:"asc"};function Mf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...li,...e}),[s,o]=useState({...Ef,...t}),c=useCallback(x=>{n(y=>({...y,...x}));},[]),l=useCallback(x=>{o(y=>({...y,...x}));},[]),i=useCallback(()=>{n(li),o(Ef);},[]),d=useCallback(()=>{r&&n({...li,assignees:[r]});},[r]),u=useCallback(()=>{n({...li,dateFilter:"overdue"});},[]),p=useCallback(()=>{n({...li,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),g=useCallback(x=>{let y=[...x];if(a.search){let b=a.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${h}-${v}-${w}`;y=y.filter(E=>{if(!E.endDate&&!E.dueDate)return false;let L=E.endDate||E.dueDate;if(!L)return false;let k;if(typeof L=="string")k=L.split("T")[0]||L;else {let S=L.getUTCFullYear(),P=String(L.getUTCMonth()+1).padStart(2,"0"),N=String(L.getUTCDate()).padStart(2,"0");k=`${S}-${P}-${N}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let S=new Date(C+"T00:00:00"),P=new Date(k+"T00:00:00"),N=new Date(S);return N.setDate(N.getDate()+7),P>=S&&P<=N;case "custom":if(a.dateRange){let K=typeof L=="string"?new Date(L):L;return K>=a.dateRange.start&&K<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(y=y.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(y=y.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=h.createdAt?new Date(h.createdAt).getTime():0;v=w-C;break;case "priority":let E={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},L=E[b.priority||"LOW"],k=E[h.priority||"LOW"];v=L-k;break;case "dueDate":let S=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!S)return 1;if(!P)return -1;let N=typeof S=="string"?new Date(S).getTime():S.getTime(),K=typeof P=="string"?new Date(P).getTime():P.getTime();v=N-K;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let H=b.estimatedTime||0,Q=h.estimatedTime||0;v=H-Q;break;default:v=0;}return s.order==="asc"?v:-v}),y},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:u,filterHighPriority:p,applyFilters:g,hasActiveFilters:m}}var Ff,Lf;if(typeof window<"u")try{let e=fi("ai");Ff=e.generateObject,Lf=e.generateText;}catch{}function Af(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(Ff&&Lf&&e.apiKey),o=useCallback(async u=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",u),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${u}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let m=p instanceof Error?p:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),c=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",u.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let m=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),l=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let m=p instanceof Error?p:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",u.title),[{title:`Subtask 1 for: ${u.title}`,position:u.position+.1,columnId:u.columnId},{title:`Subtask 2 for: ${u.title}`,position:u.position+.2,columnId:u.columnId}]}catch(p){let m=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),d=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",u.title),{hours:8,confidence:.75}}catch(p){let m=p instanceof Error?p:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function Yd(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function If(e){let{cards:t}=e,[r,a]=Yd(),n=useCallback(u=>r.selectedCardIds.includes(u),[r.selectedCardIds]),s=useCallback((u,p)=>{if(!p){a({selectedCardIds:[u],lastSelectedCardId:u});return}let m=p.ctrlKey||p.metaKey,g=p.shiftKey;if(m)r.selectedCardIds.includes(u)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==u),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,u],lastSelectedCardId:u});else if(g&&r.lastSelectedCardId){let x=t.find(b=>b.id===u),y=t.find(b=>b.id===r.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,S)=>k.position-S.position),h=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===u),[w,C]=h<v?[h,v]:[v,h],E=b.slice(w,C+1).map(k=>k.id),L=Array.from(new Set([...r.selectedCardIds,...E]));a({selectedCardIds:L,lastSelectedCardId:u});}else a({selectedCardIds:[u],lastSelectedCardId:u});}else a({selectedCardIds:[u],lastSelectedCardId:u});},[t,r,a]),o=useCallback(u=>{a({selectedCardIds:r.selectedCardIds.filter(p=>p!==u),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=useCallback(()=>{a({selectedCardIds:t.map(u=>u.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(u=>{r.selectedCardIds.includes(u)?o(u):a({selectedCardIds:[...r.selectedCardIds,u],lastSelectedCardId:u});},[r,o,a]),d=useCallback(()=>t.filter(u=>r.selectedCardIds.includes(u.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Rf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Bf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Rf,...r}),[r]),[s,o]=useState([]),c=useCallback((x,y,b,h,v)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),u=useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),m=useCallback(async x=>{let y=t.filter(C=>C.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(E=>{h.has(E)||h.set(E,[]),h.get(E).push(C);});}),h.forEach((C,E)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${E}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${E}"`,confidence:.85});});let v=new Map;y.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(E=>{v.has(E)||v.set(E,[]),v.get(E).push(C);});}),v.forEach((C,E)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${E.slice(-4)}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,E)=>{if(C.length>=n.minCardsPerStack){let L={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[E.toLowerCase()]||"\u26AA";b.push({stack:{title:`${L} ${E} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:E==="high"||E==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${E} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of y){let L=(await a.findSimilar(C,y)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(L.length>=n.minCardsPerStack-1){let k=[C.id,...L.map(P=>P.card.id)],S=L.reduce((P,N)=>P+N.similarity,0)/L.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${L.length+1} similar tasks`,confidence:S});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,E)=>E.confidence-C.confidence).slice(0,5)},[t,n,a]),g=useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await m(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&g(h);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:u,getStacksForColumn:p,getSuggestions:m,applySuggestion:g,config:n}}var $f=createContext(null);function Of({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=fi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=fi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=fi("@libxai/core");c=new l(t.board);}a.current=new BoardStore({board:c,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx($f.Provider,{value:{store:n},children:e})}function Bl(){let e=useContext($f);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function di(){let e=Bl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=useCallback(h=>{e.updateBoard(h);},[e]),l=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),d=useCallback(h=>{e.deleteColumn(h);},[e]),u=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),m=useCallback((h,v)=>{e.updateCard(h,v);},[e]),g=useCallback(h=>{e.deleteCard(h);},[e]),x=useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:u,addCard:p,updateCard:m,deleteCard:g,moveCard:x,getCard:y,getCardsByColumn:b}}function Uf(e){let{cards:t}=di();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Wf(e="position",t="asc"){let{cards:r}=di();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var $l=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Pu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},JC=new $l;function Gf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),u=d.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:n,children:jsx("div",{style:m,children:u.map(g=>{let x=e[g.index];if(!x)return null;let y=l?l(x,g.index):g.index,b={position:"absolute",top:o?0:g.start,left:o?g.start:0,width:o?g.size:"100%",height:o?"100%":g.size};return jsx("div",{style:b,"data-index":g.index,children:a(x,g.index)},y)})})})}function Vf(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _f({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=useRef(null),u=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),p=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},g={width:`${u.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:m,className:s,children:jsx("div",{style:g,children:p.map(x=>{let y=e[x.index];if(!y)return null;let b=l?l(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function Kf(e){let t=useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function qf(e,t=10){return e>t}var Zd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},eu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},tu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ru={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},au={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},nu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ou={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},su={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},iu={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},lu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},cu={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},du={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Ol={spacing:Zd,borderRadius:eu,fontSize:tu,fontWeight:ru,lineHeight:au,zIndex:nu,duration:ou,easing:su,shadows:iu,opacity:lu,kanban:cu,gantt:du};function Yf(e,t,r){return e[t]??r}function uu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?uu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function e2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function pu(e="asakaa"){let t=uu(Ol),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=e2(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function ng(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Wn(e,t){let r=ng(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function dd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let p={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(p!==void 0){let g=new Date(a),x=g.getDay(),y=p-x;return y<=0&&(y+=7),g.setDate(g.getDate()+y),g}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),g=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?g.setDate(g.getDate()+u):p==="week"||p==="semana"||p==="semanas"?g.setDate(g.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&g.setMonth(g.getMonth()+u),g}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let u=parseInt(c[1],10),p=parseInt(c[2],10)-1,g=parseInt(c[3],10);return new Date(g,p,u)}let l={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=l[i[2].toLowerCase()],g=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(g,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),g=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(g,u,p)}return null}function ud(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function pd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function og(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 sg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Wn(t,i),u=dd(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,g=new Date(u);return g.setDate(g.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:g},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Wn(t,i),u=ud(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),m=Wn(t,i),u=pd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Wn(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),m=Wn(t,i),u=Wn(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Wn(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function ig(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 Bw(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 $w(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function cl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>cl(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Bw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function lg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:$w(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>cl(a,e,t))}var md={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"}},gd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},dl={en:md,es:gd};function fd(e){return dl[e]||dl.en}function ul(e,t){let r=fd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var bd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function dg(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 ug({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let p=g=>{c.current&&!c.current.contains(g.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=dg(e),i=bd[0],d=bd.find(p=>p.value===l)??i,m=d.icon,u=p=>{switch(dg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:f("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:f("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:f("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:f("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsx(ChevronDown,{className:f("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:bd.map(p=>{let g=p.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(g,{className:f("w-4 h-4",p.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var hd=[{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 mg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let d=m=>{c.current&&!c.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=hd.find(d=>d.value===e)??hd[4],i=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:f("w-4 h-4",l.color)}),jsx("span",{className:f("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:f("w-4 h-4",l.color)}),jsx("span",{className:f("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsx(ChevronDown,{className:f("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:hd.map(d=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:f("w-2 h-2 rounded-full",d.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function Qs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function xd({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),m=useRef(null);useEffect(()=>{let x=y=>{d.current&&!d.current.contains(y.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),p=x=>e.some(y=>y.name===x),g=x=>{if(r){if(p(x.name))r(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Qs(x.name),color:x.color||yd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,y]);}c(false),i("");}};return s||!r?e.length===0?jsx("span",{className:f("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&yd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:f("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:f("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&yd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxs("span",{className:f("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let y=p(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),g(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Qs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function xg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=useState(false),[m,u]=useState(n),[p,g]=useState(()=>{let N=n==="start"?e:t;if(N){let K=N instanceof Date?N:new Date(N);return new Date(K.getFullYear(),K.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),y=useRef(null),b=useRef(null),[h,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=K=>{let U=K.target;x.current&&x.current.contains(U)||b.current&&b.current.contains(U)||d(false);};return i&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let N=()=>{let K=y.current?.getBoundingClientRect();if(!K)return;let U=520,ae=360,I=window.innerHeight-K.bottom,_=I<ae&&K.top>I,j=_?K.top-4:K.bottom+4,W=Math.min(Math.max(K.left,8),window.innerWidth-U-8);v({top:j,left:W,flipUp:_});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[i]),useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let E=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",F=useCallback(()=>{let N=p.getFullYear(),K=p.getMonth(),U=new Date(N,K,1),I=new Date(N,K+1,0).getDate(),_=U.getDay(),j=[],B=new Date(N,K,0).getDate();for(let je=_-1;je>=0;je--)j.push({date:new Date(N,K-1,B-je),isCurrentMonth:false});for(let je=1;je<=I;je++)j.push({date:new Date(N,K,je),isCurrentMonth:true});let ve=42-j.length;for(let je=1;je<=ve;je++)j.push({date:new Date(N,K+1,je),isCurrentMonth:false});return j},[p]),k=N=>{if(a)n==="start"?r(N,C||void 0):r(w||void 0,N),d(false);else if(m==="start"){let K=C&&N>C?N:C;r(N,K||void 0),u("end");}else {let K=w&&N<w?N:w;r(K||void 0,N),d(false);}},S=()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let U=new Date(N);U.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let ae=new Date(N);ae.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let I=new Date(N);I.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let _=new Date(N);_.setDate(N.getDate()+14);let j=new Date(N);return j.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:U,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ae,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let N=a&&n==="start"?w:C;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:f("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm",s?"text-white/60":"text-gray-500"),children:E(N)})]})}let P=a&&n==="start"?w:C;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:y,onClick:N=>{N.stopPropagation(),d(!i);let K=n==="start"?w:C;K&&g(new Date(K.getFullYear(),K.getMonth(),1));},className:f("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:f("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm",s?"text-white/60":"text-gray-500"),children:E(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:f("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:f("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((N,K)=>jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>k(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:f("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},K)),jsx("div",{className:f("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,C||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!a&&jsx("div",{className:f("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:f("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>g(new Date),className:f("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>g(new Date(p.getFullYear(),p.getMonth()-1)),className:f("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:f("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>g(new Date(p.getFullYear(),p.getMonth()+1)),className:f("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:f("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:F().map((N,K)=>{let U=N.date.toDateString()===new Date().toDateString(),ae=w?.toDateString()===N.date.toDateString(),I=C?.toDateString()===N.date.toDateString(),_=ae||I,j=!a&&w&&C&&N.date>=w&&N.date<=C;return jsx("button",{onClick:()=>k(new Date(N.date)),className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),U&&"ring-2 ring-[#00E5CC]",ae&&"bg-[#00E5CC] text-white",I&&!ae&&"bg-[#7C3AED] text-white",j&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},K)})})]})]}),document.body)]})}function fl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(xg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function ms(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function bl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[c,l]=useState(false),i=useRef(e),d=useRef([]);return useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,g=a/n;l(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(m+p*h);o(v),x===n&&(l(false),o(u));},g*x);d.current.push(y);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function vg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,c]=useState(0),l=useRef(null),i=useRef(null),d=useCallback(p=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(p),c(0);let g=Date.now();i.current=setInterval(()=>{let x=Date.now()-g,y=Math.min(x/r*100,100);c(y);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),c(0);},r);},[r,e]),m=useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function kg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),{isFlashing:m,triggerFlash:u}=ms(),{displayValue:p,isAnimating:g}=bl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),E=w.clientX-C.left,F=Math.round(E/C.width*100),k=Math.max(0,Math.min(100,F));k!==e&&(t(k),s&&u());},y=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&u());}},[l,t,e,s,u]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=p??e;return jsxs("div",{className:f("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:f("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:f("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",g&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:f("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:f("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:f("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",g&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Ng({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(l(e),o(false));};return n||!t?jsx("span",{className:f("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:c,onChange:u=>l(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Eg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=useState(false),[m,u]=useState(e?.toString()||""),p=useRef(null),{isFlashing:g,triggerFlash:x}=ms(),{displayValue:y,isAnimating:b}=bl(e,{enabled:c&&!i});useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),useEffect(()=>{u(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(m);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),l&&x());}d(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsx("span",{className:f("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:a}):i?jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(r?"text-white/30":"text-gray-400"),g&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:a})}function Mg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=useState(false),l=useRef(null);return useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsx("span",{className:f("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:f("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:f("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:f("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Fg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=vg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},u=c?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:a||!t,className:f("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&u&&"ring-green-500/50",c&&!u&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:f("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Ig({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:f("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function wk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function kk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Aa({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=useState(false),[p,g]=useState(""),x=useRef(null),{isFlashing:y,triggerFlash:b}=ms(),h=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=h&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:wk(e,a);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),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,m]);let C=()=>{let k=kk(p);k!==e&&(t?.(k),o&&b()),u(false);},E=k=>{k.key==="Enter"?C():k.key==="Escape"&&u(false);};if(c)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:f("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let F=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(F,{className:f("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:f("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:p,onChange:k=>g(k.target.value),onBlur:C,onKeyDown:E,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:f("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),u(true);},className:f("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",y&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(F,{className:f("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function Og({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:f("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:f("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function Ug({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,m=j=>d?`$${Math.round(j*l).toLocaleString("en-US")}`:`${j}h`,[u,p]=useState(false),[g,x]=useState(false),[y,b]=useState(null),h=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,E=Math.round(v/60*10)/10,F=Math.round(w/60*10)/10,k=w>0?v/w*100:0,S=k>100?Math.round((v-w)/60*10)/10:0,P=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!g&&!y)return;let j=W=>{h.current&&!h.current.contains(W.target)&&(x(false),b(null));};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[g,y]);let N=j=>{if(j.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(W=>!W),b(null);return}o&&o(e);},K=j=>{x(false),b(j);},U=async(j,W)=>{y==="log"&&a&&j?a(e,j,W):y==="estimate"&&n?n(e,j):y==="quoted"&&s&&s(e,j),b(null);},ae=a||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(j=>j.show),_=y==="estimate"?w:y==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:j=>j.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsx("span",{className:f("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ae&&jsx("button",{onClick:N,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:g&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:W=>{W.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(wn,{mode:y,locale:r,isDark:t,currentValue:_||void 0,onSave:U,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:j=>j.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let j=v===0,B=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:j?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(E)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(F)]}),S>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(S)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ae&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:g&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:W=>{W.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(wn,{mode:y,locale:r,isDark:t,currentValue:_||void 0,onSave:U,onClose:()=>b(null)})})})})]})}function Mk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Pk(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 Wg({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:f(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:f(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function zg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Mk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((p,g)=>jsx(Wg,{assignee:p,size:24,isDark:t},p.name+g))}),u>0&&jsxs("span",{className:f("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:f("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:f("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Pk(c):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Wg,{assignee:s,size:28,isDark:t}),jsx("span",{className:f("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[c,"% LOAD"]})]})}var Fk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Vg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:f("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:f("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Fk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function _k(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Kk(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function Jg({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:g,onTaskIndent:x,onTaskOutdent:y}){let b=useRef(null),h=a==="es"?Kg.es:Kg.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let S=b.current;if(!S)return;let P=S.getBoundingClientRect(),N=8,K=e.x,U=e.y;e.y+P.height>window.innerHeight-N&&(U=Math.max(N,e.y-P.height)),e.x+P.width>window.innerWidth-N&&(K=Math.max(N,window.innerWidth-P.width-N)),(K!==e.x||U!==e.y)&&w({left:K,top:U});},[e.x,e.y,e.isOpen]),useEffect(()=>{let S=N=>{b.current&&!b.current.contains(N.target)&&t();},P=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",S),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let S=[];return n&&S.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),S.push({id:"sep1",label:"",icon:null,separator:true}),c&&(S.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),S.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&S.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],U=N.some(ae=>ae.name===P.name)?N.filter(ae=>ae.name!==P.name):[...N,{name:P.name,initials:_k(P.name),color:P.color||Kk(P.name),avatar:P.avatarUrl}];c({...e.task,assignees:U}),t();}}))})),m&&S.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&S.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&S.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),S.push({id:"sep2",label:"",icon:null,separator:true}),s&&S.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(g||x||y)&&(S.push({id:"sep3",label:"",icon:null,separator:true}),g&&(S.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{g(e.task.id,"up"),t();}}),S.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{g(e.task.id,"down"),t();}})),x&&S.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&S.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&S.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),S},E=()=>{if(!e.columnId)return [];let S=[];return i&&(S.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),S.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(S.push({id:"sep-hide",label:"",icon:null,separator:true}),S.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),S},F=e.type==="task"?C():E(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:k,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:F.map(S=>S.separator?jsx("div",{className:f("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},S.id):S.submenu?jsx(qk,{item:S,isDark:r},S.id):jsxs("button",{onClick:S.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",S.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:f(S.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:S.icon}),S.label]},S.id))})}function qk({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:f("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:f("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(c=>jsxs("button",{onClick:c.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var Kg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var o0={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"})},u1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function i0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=useState(""),[d,m]=useState(null),[u,p]=useState(null),g=useRef(null),x=c==="es"?s0.es:s0.en;useLayoutEffect(()=>{if(!e||!g.current)return;let F=()=>{if(!g.current)return;let k=g.current.parentElement;if(k){let K=k.getBoundingClientRect();p({top:K.bottom+4,right:window.innerWidth-K.right});}let S=g.current.getBoundingClientRect(),N=window.innerHeight-S.top-20;m(Math.max(300,N));};return requestAnimationFrame(F),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[e]),useEffect(()=>{if(!e)return;let F=setTimeout(()=>{let k=P=>{g.current&&!g.current.contains(P.target)&&t();},S=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",S),g._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(F),g._cleanup&&g._cleanup();}},[e,t]);let y=useMemo(()=>{let F=new Set([...u1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&F.add(k.type);}),Array.from(F)},[r]);if(!e)return null;let b=F=>{let k=x.columns[F];if(k)return k;let S=r.find(P=>P.type===F);return S?.label?S.label:F},h=F=>{if(F==="name")return;let k=r.map(S=>S.id===F?{...S,visible:!S.visible}:S);n(k);},v=(F,k)=>{let S=r.find(N=>N.type===F&&(!k||N.customFieldId===k));if(S){h(S.id);return}let P={id:k||F,type:F,label:k?a.find(N=>N.id===k)?.name||F:b(F),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,P]);},w=y.filter(F=>F!=="assignees"&&b(F).toLowerCase().includes(l.toLowerCase())),C=a.filter(F=>F.name.toLowerCase().includes(l.toLowerCase())),E=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:g,style:{...d?{maxHeight:`${d}px`}:{},...u?{top:u.top,right:u.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",F.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:F=>i(F.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:F=>{F&&F.style.setProperty("--focus-border",E);},onFocus:F=>{F.currentTarget.style.borderColor=E,F.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:F=>{F.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",F.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:F=>F.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(F=>{let k=r.find(N=>N.type===F&&!N.customFieldId),S=k?.visible??false,P=F==="name";return jsxs("button",{onClick:()=>{P||(k?h(k.id):v(F));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:N=>{P||(N.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&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:S?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:o0[F]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(F),children:b(F)})]},F)})})]}),C.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(F=>{let S=r.find(P=>P.customFieldId===F.id)?.visible??false;return jsxs("button",{onClick:()=>v(F.type,F.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&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:S?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:o0[F.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:F.name})]},F.id)})})]})]})]})}var s0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var v1=[{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 d0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[c,l]=useState("text"),[i,d]=useState([""]),m=n==="es"?c0.es:c0.en;useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let u=()=>{if(!s.trim())return;let y={name:s.trim(),type:c};c==="dropdown"&&(y.options=i.filter(b=>b.trim())),r(y),t();},p=()=>{d([...i,""]);},g=(y,b)=>{let h=[...i];h[y]=b,d(h);},x=y=>{i.length>1&&d(i.filter((b,h)=>h!==y));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:f("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:f("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:f("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:m.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:v1.map(y=>jsxs("button",{onClick:()=>l(y.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:f("text-xs",c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[y.type]})]},y.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:f("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>g(b,h.target.value),placeholder:`${m.option} ${b+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(b),className:f("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:p,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var c0={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 m0={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 g0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=useState(false),l=useRef(null),i=useRef(0),d=s==="es"?m0.es:m0.en;useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},g=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",g);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),c(g=>!g);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),d.filters,u&&jsx("span",{className:f("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:f("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(p=>{let g=e===p.value&&!t,x=()=>p.value==="all"?g?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs("button",{onClick:()=>{r(p.value),a(false),c(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",g&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:f(g?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:f("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),g&&jsx(Check,{className:f("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsx("div",{className:f("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),c(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:f("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:f("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function f0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function mo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function b0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxs("div",{className:f("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:f("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:f("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:f("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=l-d,u=l>0?Math.round(m/l*100):0,p=l-i,g=l>0?Math.round(p/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,y=d>l&&l>0,b=y?"#F87171":"#00E5CC";return jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(l)})]}),(()=>{let h=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,E=(F,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:F}),jsx("span",{className:f("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(i)})]}),C&&jsxs(Fragment,{children:[E(o?"Mano de obra":"Labor",h),v>0&&E(o?"Activos":"Equipment",v),w>0&&E(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let h=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,E=(F,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:F}),jsx("span",{className:f("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:f("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:mo(d)})]}),C&&jsxs(Fragment,{children:[E(o?"Mano de obra":"Labor",h),v>0&&E(o?"Activos":"Equipment",v),w>0&&E(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsx("div",{className:f("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(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:f("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[p>=0?"+":"",mo(p),l>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",g,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:f("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${mo(m)} ${o?"disponible (caja)":"available (cash)"}`:`${mo(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,p=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:f("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:f0(l)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:f("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:f0(i)})]}),i>0&&jsx("div",{className:f("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:f("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:f("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:f("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:f("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:f("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:f("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxs("button",{onClick:()=>s?.(l.id),className:f("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:f("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:f("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:f("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let l=e.scheduleVarianceDays??0,i=l>0,d=l<0,m=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:f("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:f("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:f("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxs("span",{className:f("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsx("div",{className:f("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var B1=[{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 T0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...T0(n.subtasks,t+1,s));}return a}function $1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function xs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=xs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ys(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function O1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(o(String(e||"")),n(false));},className:f("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:f("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function k0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Bd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Bd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function N0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:g="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:C=true,showCreateTaskButton:E=false,onCreateTask:F,persistFilter:k=false,financialBlur:S,healthSidebar:P,lens:N="hours",hourlyRate:K=0,rateMap:U,aggregateParentHours:ae=false,showProjectTotals:I=false,totalsDollarOverride:_}=t,j=ul(g,x),W=p==="dark",B=D=>{if(!U||!D.assignees||D.assignees.length===0)return K;let ee=0,pe=0;for(let Ne of D.assignees){let Ke=Ne.id?U[Ne.id]:void 0;if(Ke==null||Ke<=0)continue;let oe=typeof Ne.estimatedMinutes=="number"?Ne.estimatedMinutes:0;oe>0&&(ee+=Ke*oe,pe+=oe);}if(pe>0)return ee/pe;let Ce=D.assignees.map(Ne=>Ne.id?U[Ne.id]:void 0).filter(Ne=>Ne!=null&&Ne>0);return Ce.length===0?K:Ce.reduce((Ne,Ke)=>Ne+Ke,0)/Ce.length},ve=D=>{let ee=0,pe=0,Ce=0,Ne=Ke=>{for(let oe of Ke)if(oe.subtasks&&oe.subtasks.length>0){let Le={s:ee,a:pe,q:Ce};if(Ne(oe.subtasks),ee-Le.s+(pe-Le.a)+(Ce-Le.q)===0){let Qe=B(oe);ee+=(oe.timeLoggedMinutes??0)/60*Qe,pe+=(oe.effortMinutes??0)/60*Qe,Ce+=(oe.soldEffortMinutes??0)/60*Qe;}}else {let Le=B(oe);ee+=(oe.timeLoggedMinutes??0)/60*Le,pe+=(oe.effortMinutes??0)/60*Le,Ce+=(oe.soldEffortMinutes??0)/60*Le;}};return D.subtasks&&Ne(D.subtasks),{dollarSpent:ee,dollarAllocated:pe,dollarQuoted:Ce}},je=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let D=localStorage.getItem(k);if(D){let ee=JSON.parse(D);return {statusFilter:ee.statusFilter||"all",hideCompleted:ee.hideCompleted||!1}}}catch(D){console.error("Error loading persisted filter:",D);}return {statusFilter:"all",hideCompleted:false}},[k]),Pe=useMemo(()=>{function D(ee){let pe=0,Ce=0,Ne=0,Ke=0,oe=0,Le=0;for(let Oe of ee)if(Oe.subtasks&&Oe.subtasks.length>0){let Qe=D(Oe.subtasks);if(Qe.spent+Qe.allocated+Qe.quoted>0)pe+=Qe.spent,Ce+=Qe.allocated,Ne+=Qe.quoted,Ke+=Qe.dollarSpent,oe+=Qe.dollarAllocated,Le+=Qe.dollarQuoted;else {let He=Oe.timeLoggedMinutes??0,ut=Oe.effortMinutes??0,pr=Oe.soldEffortMinutes??0;pe+=He,Ce+=ut,Ne+=pr;let hr=B(Oe);Ke+=He/60*hr,oe+=ut/60*hr,Le+=pr/60*hr;}}else {let Qe=Oe.timeLoggedMinutes??0,$t=Oe.effortMinutes??0,He=Oe.soldEffortMinutes??0;pe+=Qe,Ce+=$t,Ne+=He;let ut=B(Oe);Ke+=Qe/60*ut,oe+=$t/60*ut,Le+=He/60*ut;}return {spent:pe,allocated:Ce,quoted:Ne,dollarSpent:Ke,dollarAllocated:oe,dollarQuoted:Le}}return D(e)},[e]),me=useMemo(()=>{let D=new Map;function ee(pe){let Ce=0;for(let Ne of pe)if(Ne.subtasks&&Ne.subtasks.length>0){let Ke=ee(Ne.subtasks);D.set(Ne.id,Ke),Ce+=Ke;}else Ce+=Ne.weight||0;return Ce}return ee(e),D},[e]),xe=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:Pe.spent,totalHoursAllocatedMinutes:Pe.allocated}},[P,Pe]),[he,We]=useState(true),[Se,Re]=useState(null),[Ae,Ye]=useState("position"),[se,Xe]=useState("asc"),[Be,$e]=useState(""),[mt,Nt]=useState(()=>je().statusFilter),[ze,Fe]=useState(()=>je().hideCompleted),[nt,It]=useState(h||B1),[Ie,ot]=useState(false),[L,Q]=useState(false),[R,J]=useState({isOpen:false,x:0,y:0,type:"task"}),[O,Y]=useState(null),[Te,ge]=useState(false),[Ze,et]=useState(null),[Je,Bt]=useState(null),[Tt,zt]=useState(null),kt=useRef(0),tr=useRef(false),ur=!!(r.onTaskMove||r.onTaskReparent),[da,Gt]=useState(null),[gr,Rt]=useState(null),Kr=D=>D==="assignees"||D==="teamLoad"?"assignees":D==="startDate"?"startDate":D==="endDate"?"endDate":null,Vt=useRef([]),Jt=useCallback((D,ee)=>{ur&&(ee.preventDefault(),kt.current=ee.clientY,Y(D),tr.current=false,ge(false),zt({x:ee.clientX,y:ee.clientY}));},[ur]),Gr=useCallback(D=>{if(!O||(Math.abs(D.clientY-kt.current)>5&&!tr.current&&(tr.current=true,ge(true)),zt({x:D.clientX,y:D.clientY}),!tr.current))return;let pe=document.querySelectorAll("[data-listview-row]"),Ce=null,Ne=null;pe.forEach(Ke=>{let oe=Ke.getBoundingClientRect(),Le=Ke.getAttribute("data-listview-row");if(Le&&Le!==O&&D.clientY>=oe.top&&D.clientY<=oe.bottom){Ce=Le;let Oe=D.clientY-oe.top,Qe=oe.height;Ne=Oe<Qe*.25?"above":Oe>Qe*.75?"below":"child";}}),et(Ce),Bt(Ne);},[O]),ua=useCallback(()=>{if(tr.current&&O&&Ze&&Je){if(Je==="child"&&r.onTaskReparent)r.onTaskReparent(O,Ze);else if(Je==="above"||Je==="below"){let D=(Ce,Ne,Ke=null)=>{for(let oe of Ce){if(oe.id===Ne)return Ke;if(oe.subtasks){let Le=D(oe.subtasks,Ne,oe.id);if(Le!==void 0)return Le}}},ee=D(e,O,null),pe=D(e,Ze,null);if(r.onTaskReparent){let Ce=(Qe,$t)=>{if($t===null)return Qe;for(let He of Qe){if(He.id===$t)return He.subtasks||[];if(He.subtasks){let ut=Ce(He.subtasks,$t);if(ut.length>0||He.subtasks.some(pr=>pr.id===$t))return ut}}return []},Ne=Ce(e,pe??null),Ke=Ne.findIndex(Qe=>Qe.id===Ze),oe=ee===pe,Le=oe?Ne.findIndex(Qe=>Qe.id===O):-1,Oe=Je==="below"?Ke+1:Ke;oe&&Le!==-1&&Le<Ke&&(Oe-=1),r.onTaskReparent(O,pe??null,Math.max(0,Oe));}}}Y(null),et(null),Bt(null),zt(null),tr.current=false,ge(false);},[O,Ze,Je,e,r]),tt=(D,ee)=>ee==="assignees"?D.assignees:ee==="startDate"?D.startDate:D.endDate,_e=(D,ee,pe,Ce)=>{D.preventDefault(),D.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ne=Array.from(document.querySelectorAll("[data-listview-row]")),Ke=Ne.map(ft=>ft.getAttribute("data-listview-row")||""),oe=Math.max(0,Ke.indexOf(ee)),Le=ft=>Ke.slice(oe,ft+1);Rt({sourceTaskId:ee,column:pe,sourceIndex:Ce,targetIndex:Ce,rangeIds:new Set([ee])});let Qe=(ft=>{let Mt=ft?.parentElement??null;for(;Mt;){let Ar=window.getComputedStyle(Mt).overflowY;if((Ar==="auto"||Ar==="scroll")&&Mt.scrollHeight>Mt.clientHeight)return Mt;Mt=Mt.parentElement;}let Lr=document.scrollingElement;return Lr&&Lr.scrollHeight>Lr.clientHeight?Lr:null})(D.currentTarget),$t=ft=>{let Mt=oe,Lr=false;Ne.forEach((Ar,pa)=>{let qr=Ar.getBoundingClientRect();ft>=qr.top&&ft<=qr.bottom&&(Mt=pa,Lr=true);});let ba=Ne[Ne.length-1];if(!Lr&&ba){let Ar=ba.getBoundingClientRect();ft>Ar.bottom&&(Mt=Ne.length-1);}return Mt<oe&&(Mt=oe),Mt},He=D.clientY,ut=null,pr=()=>{ut!==null&&(cancelAnimationFrame(ut),ut=null);},hr=()=>{let ft=$t(He),Mt=new Set(Le(ft));Rt(Lr=>Lr&&{...Lr,targetIndex:ft,rangeIds:Mt});},oa=()=>{if(pr(),!Qe)return;let ft=Qe,Lr=ft===document.scrollingElement?{top:0,bottom:window.innerHeight}:ft.getBoundingClientRect(),ba=60,Ar=12,pa=He-Lr.top,qr=Lr.bottom-He,bo=ft.scrollHeight-ft.clientHeight;if(qr<ba&&ft.scrollTop<bo){let Cs=Math.max(1,Math.round(Ar*(1-Math.max(0,qr)/ba))),ho=()=>{ft.scrollTop+=Cs,hr(),ft.scrollTop<ft.scrollHeight-ft.clientHeight&&(ut=requestAnimationFrame(ho));};ut=requestAnimationFrame(ho);}else if(pa<ba&&ft.scrollTop>0){let Cs=Math.max(1,Math.round(Ar*(1-Math.max(0,pa)/ba))),ho=()=>{ft.scrollTop-=Cs,hr(),ft.scrollTop>0&&(ut=requestAnimationFrame(ho));};ut=requestAnimationFrame(ho);}},Et=ft=>{He=ft.clientY,hr(),oa();},jt=ft=>{window.removeEventListener("mousemove",Et),window.removeEventListener("mouseup",jt),pr(),document.body.style.cursor="",document.body.style.userSelect="",Rt(null);let Mt=$t(ft.clientY),Lr=new Map(Vt.current.map(qr=>[qr.id,qr])),ba=Lr.get(ee);if(!ba)return;let Ar=tt(ba,pe),pa=[];for(let qr of Le(Mt)){if(qr===ee)continue;let bo=Lr.get(qr);bo&&(bo.subtasks&&bo.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,pe,Ar);};window.addEventListener("mousemove",Et),window.addEventListener("mouseup",jt);},ga=D=>gr?gr.rangeIds.has(D):false;useEffect(()=>{if(O)return document.addEventListener("mousemove",Gr),document.addEventListener("mouseup",ua),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Gr),document.removeEventListener("mouseup",ua),document.body.style.cursor="",document.body.style.userSelect="";}},[O,Gr,ua]);let[sr,Zr]=useState("all"),[fr,wa]=useState(false),le=useRef(null),de=useRef(null),dt=useMemo(()=>{let D=0;function ee(pe,Ce){for(let Ne of pe)Ce>D&&(D=Ce),Ne.subtasks?.length&&ee(Ne.subtasks,Ce+1);}return ee(e,1),D},[e]);useEffect(()=>{if(!fr)return;let D=ee=>{le.current?.contains(ee.target)||de.current?.contains(ee.target)||wa(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[fr]),useEffect(()=>{if(sr==="all"){let pe=function(Ce){for(let Ne of Ce)Ne.subtasks?.length&&(Ne.isExpanded===false&&r.onTaskToggleExpand?.(Ne.id),pe(Ne.subtasks));};pe(e);}else {let pe=function(Ce,Ne){for(let Ke of Ce)if(Ke.subtasks?.length){let oe=Ne<sr,Le=Ke.isExpanded!==false;oe!==Le&&r.onTaskToggleExpand?.(Ke.id),pe(Ke.subtasks,Ne+1);}};pe(e,1);}},[sr]);let[V,be]=useState(null),[Z,$]=useState(0),[te,we]=useState(0),T=useRef(null),[H,ue]=useState(null),[q,ke]=useState(null);useEffect(()=>{h&&It(D=>{if(D.length===h.length){let ee=true;for(let pe=0;pe<D.length;pe++){let Ce=D[pe],Ne=h[pe];if(!Ce||!Ne||Ce.id!==Ne.id||Ce.visible!==Ne.visible||Ce.width!==Ne.width||Ce.label!==Ne.label){ee=false;break}}if(ee)return D}return h});},[h]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:mt,hideCompleted:ze}));}catch(D){console.error("Error persisting filter state:",D);}},[k,mt,ze]);let st=useMemo(()=>{let D=new Set;function ee(pe){for(let Ce of pe)Ce.subtasks?.length&&(Ce.isExpanded!==false&&D.add(Ce.id),ee(Ce.subtasks));}return ee(e),D},[e]),re=useMemo(()=>nt.filter(D=>D.visible),[nt]),it=useCallback(D=>{r.onTaskToggleExpand?.(D);},[r]),pt=useCallback(D=>{Ae===D?Xe(ee=>ee==="asc"?"desc":"asc"):(Ye(D),Xe("asc")),r.onSortChange?.({column:D,direction:se==="asc"?"desc":"asc"});},[Ae,se,r]),St=useCallback(D=>{It(D),r.onColumnsChange?.(D);},[r]),br=useCallback(D=>{let ee=nt.map(pe=>pe.id===D?{...pe,visible:false}:pe);St(ee);},[nt,St]),fa=useCallback((D,ee)=>{Ye(D),Xe(ee);},[]),Pr=useCallback((D,ee,pe)=>{C&&(D.preventDefault(),J({isOpen:true,x:D.clientX,y:D.clientY,type:ee?"task":"header",task:ee,columnId:pe}));},[C]),tn=useCallback(()=>{J(D=>({...D,isOpen:false}));},[]),ir=useCallback((D,ee)=>{if(!w)return;D.preventDefault(),D.stopPropagation();let pe=nt.find(Ce=>Ce.id===ee);pe&&(be(ee),$(D.clientX),we(pe.width));},[nt,w]);useEffect(()=>{if(!V)return;let D=nt,ee=Ce=>{let Ne=Ce.clientX-Z,Ke=Math.max(50,te+Ne);D=D.map(oe=>oe.id===V?{...oe,width:Ke}:oe),It(D);},pe=()=>{r.onColumnsChange?.(D),be(null);};return document.addEventListener("mousemove",ee),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",ee),document.removeEventListener("mouseup",pe);}},[V,Z,te,r]);let Ra=useCallback((D,ee)=>{if(ee==="name"){D.preventDefault();return}ue(ee),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",ee),D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="0.5");},[]),Ho=useCallback(D=>{D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="1"),ue(null),ke(null);},[]),Fn=useCallback((D,ee)=>{D.preventDefault(),ee!=="name"&&(D.dataTransfer.dropEffect="move",ke(ee));},[]),_n=useCallback(()=>{ke(null);},[]),Uo=useCallback((D,ee)=>{if(D.preventDefault(),!H||H===ee||ee==="name")return;let pe=[...nt],Ce=pe.findIndex(oe=>oe.id===H),Ne=pe.findIndex(oe=>oe.id===ee);if(Ce===-1||Ne===-1)return;let Ke=pe.splice(Ce,1);Ke[0]&&(pe.splice(Ne,0,Ke[0]),St(pe),ue(null),ke(null));},[H,nt,St]),pi=useCallback(async D=>{if(r.onCreateCustomField){let ee={...D,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(ee);}Q(false);},[r]),Fr=useCallback(D=>D.progress===100||D.status==="completed"?"completed":D.progress&&D.progress>0||D.status==="in-progress"?"in-progress":"todo",[]),Ln=useMemo(()=>{let D=T0(e);if(Be.trim()){let ee=Be.toLowerCase();D=D.filter(pe=>pe.name.toLowerCase().includes(ee));}if(mt!=="all"){let ee=new Set(D.filter(pe=>Fr(pe)===mt).flatMap(pe=>pe.parentPath));D=D.filter(pe=>ee.has(pe.id));}if(ze){let ee=new Set(D.filter(pe=>Fr(pe)!=="completed").flatMap(pe=>pe.parentPath));D=D.filter(pe=>ee.has(pe.id));}return D.sort((ee,pe)=>{let Ce,Ne;switch(Ae){case "name":Ce=ee.name.toLowerCase(),Ne=pe.name.toLowerCase();break;case "startDate":Ce=ee.startDate?.getTime()||0,Ne=pe.startDate?.getTime()||0;break;case "endDate":Ce=ee.endDate?.getTime()||0,Ne=pe.endDate?.getTime()||0;break;case "progress":Ce=ee.progress||0,Ne=pe.progress||0;break;case "status":Ce=ee.status||"todo",Ne=pe.status||"todo";break;case "priority":let Ke={urgent:0,high:1,medium:2,low:3,none:4};Ce=Ke[ee.priority]??4,Ne=Ke[pe.priority]??4;break;case "position":return 0;default:return 0}return Ce<Ne?se==="asc"?-1:1:Ce>Ne?se==="asc"?1:-1:0}),D},[e,Be,mt,ze,Ae,se,Fr]);Vt.current=Ln;let Ba=useCallback((D,ee)=>{let pe=Ke=>{r.onTaskUpdate?.({...D,...Ke});},Ce=Ke=>Ke?D.customFields?.find(Le=>Le.fieldId===Ke)?.value:void 0,Ne=(Ke,oe)=>{if(!Ke)return;let Oe=[...D.customFields||[]],Qe=Oe.findIndex($t=>$t.fieldId===Ke);Qe>=0?Oe[Qe]={fieldId:Ke,value:oe}:Oe.push({fieldId:Ke,value:oe}),pe({customFields:Oe});};switch(ee.type){case "name":return null;case "status":return jsx(ug,{value:D.status||(D.progress===100?"completed":D.progress&&D.progress>0?"in-progress":"todo"),onChange:oe=>{pe({status:oe,progress:oe==="completed"?100:oe==="in-progress"?50:0});},isDark:W,locale:g,translations:j.status});case "priority":return jsx(mg,{value:D.priority,onChange:oe=>pe({priority:oe}),isDark:W,locale:g});case "assignees":{let oe=D.hasChildren,Le=D.assignees||[];if(oe&&D.subtasks?.length){let Oe=new Map,Qe=$t=>{($t||[]).forEach(He=>{(He.assignees||[]).forEach(ut=>{Oe.has(ut.name)||Oe.set(ut.name,ut);}),He.subtasks?.length&&Qe(He.subtasks);});};Qe(D.subtasks),Le=Array.from(Oe.values());}else oe&&(Le=[]);return jsx(xd,{value:Le,availableUsers:c,onChange:Oe=>pe({assignees:Oe}),isDark:W,locale:g,disabled:oe})}case "startDate":return jsx(fl,{value:D.startDate,onChange:oe=>pe({startDate:oe}),isDark:W,locale:g,dateField:"start",startDate:D.startDate,endDate:D.endDate});case "endDate":return jsx(fl,{value:D.endDate,onChange:oe=>pe({endDate:oe}),isDark:W,locale:g,dateField:"end",startDate:D.startDate,endDate:D.endDate});case "progress":{let oe=!!(D.subtasks&&D.subtasks.length>0),Le=oe?k0(Bd(D.subtasks||[])):D.progress||0;return jsx(kg,{value:Le,onChange:oe?void 0:Oe=>{let Qe=Oe===100?"completed":Oe>0?"in-progress":"todo";pe({progress:Oe,status:Qe});},isDark:W,disabled:oe})}case "tags":return jsx(Ig,{value:D.tags||[],isDark:W});case "text":return jsx(Ng,{value:Ce(ee.customFieldId)||"",onChange:oe=>Ne(ee.customFieldId,oe),isDark:W});case "number":return jsx(Eg,{value:Ce(ee.customFieldId)||0,onChange:oe=>Ne(ee.customFieldId,oe),isDark:W});case "date":let Ke=Ce(ee.customFieldId);return jsx(fl,{value:Ke?new Date(Ke):void 0,onChange:oe=>Ne(ee.customFieldId,oe),isDark:W,locale:g});case "dropdown":return jsx(Mg,{value:Ce(ee.customFieldId)||"",options:ee.options||[],onChange:oe=>Ne(ee.customFieldId,oe),isDark:W});case "checkbox":return jsx(Fg,{value:Ce(ee.customFieldId)||false,onChange:oe=>Ne(ee.customFieldId,oe),isDark:W});case "estimatedTime":{let oe=D.status==="completed"||D.progress===100;return jsx(Aa,{value:D.estimatedTime,onChange:Le=>pe({estimatedTime:Le}),isDark:W,locale:g,disabled:oe,lens:N,hourlyRate:B(D)})}case "quotedTime":{let oe=D.status==="completed"||D.progress===100,Le=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsx(Aa,{value:D.quotedTime,onChange:Oe=>pe({quotedTime:Oe}),isDark:W,locale:g,disabled:oe,isBlurred:Le,lens:N,hourlyRate:B(D)})}case "elapsedTime":{let oe=D.status==="completed"||D.progress===100,Le=D.executedDollarsCanonical;return jsx(Aa,{value:D.elapsedTime,onChange:Oe=>pe({elapsedTime:Oe}),isDark:W,locale:g,disabled:oe,lens:N,hourlyRate:B(D),financialOverride:Le})}case "effortMinutes":{if(ae&&D.subtasks&&D.subtasks.length>0){let{allocated:$t}=xs(D);if(N==="financial"){let He=ve(D),ut=Math.round(He.dollarAllocated),pr=Math.round(He.dollarQuoted),hr=pr-ut;return jsxs("div",{className:"flex flex-col",children:[ut>0?jsxs("span",{className:f("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",ut.toLocaleString("es-CO")]}):null,hr!==0&&ut>0&&pr>0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",hr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[hr>0?"+":"",Math.abs(hr)>=1e3?`$${(hr/1e3).toFixed(1)}K`:`$${hr}`]})]})}return jsx(Aa,{value:$t>0?$t:void 0,isDark:W,locale:g,disabled:true,lens:N,hourlyRate:K})}let oe=D.status==="completed"||D.progress===100,Le=D.effortMinutes||0,Oe=D.soldEffortMinutes||0,Qe=B(D);if(N==="financial"&&Qe&&Le>0&&Oe>0){let $t=Math.round(Le/60*Qe),ut=Math.round(Oe/60*Qe)-$t;return jsxs("div",{className:"flex flex-col",children:[jsx(Aa,{value:Le,onChange:pr=>pe({effortMinutes:pr}),isDark:W,locale:g,disabled:oe,lens:N,hourlyRate:B(D)}),ut!==0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ut>0?"+":"",Math.abs(ut)>=1e3?`$${(ut/1e3).toFixed(1)}K`:`$${ut}`]})]})}return jsx(Aa,{value:Le,onChange:$t=>pe({effortMinutes:$t}),isDark:W,locale:g,disabled:oe,lens:N,hourlyRate:B(D)})}case "timeLoggedMinutes":{let oe=D.executedDollarsCanonical;if(ae&&D.subtasks&&D.subtasks.length>0){let{spent:Oe}=xs(D);return jsx(Aa,{value:Oe>0?Oe:void 0,isDark:W,locale:g,disabled:true,lens:N,hourlyRate:B(D),financialOverride:oe})}let Le=D.status==="completed"||D.progress===100;return jsx(Aa,{value:D.timeLoggedMinutes,onChange:r.onLogTime?Oe=>{r.onLogTime?.(D,Oe);}:void 0,isDark:W,locale:g,placeholder:g==="es"?"Agregar":"Add",disabled:Le,lens:N,hourlyRate:B(D),financialOverride:oe})}case "soldEffortMinutes":{if(ae&&D.subtasks&&D.subtasks.length>0){let{quoted:Oe}=xs(D),Qe=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Aa,{value:Oe>0?Oe:void 0,isDark:W,locale:g,disabled:true,isBlurred:Qe,lens:N,hourlyRate:B(D)})}let oe=D.status==="completed"||D.progress===100,Le=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Aa,{value:D.soldEffortMinutes,onChange:Oe=>pe({soldEffortMinutes:Oe}),isDark:W,locale:g,disabled:oe,isBlurred:Le,lens:N,hourlyRate:B(D)})}case "scheduleVariance":{let oe=D.effortMinutes||0,Le=D.soldEffortMinutes||0,Oe=D.timeLoggedMinutes||0,Qe=oe>0||Le>0||Oe>0;return jsx(Og,{startDate:D.startDate,endDate:D.endDate,scheduleVariance:D.scheduleVariance,isDark:W,locale:g,hasTimeAllocated:Qe})}case "hoursBar":{if(ae&&D.hasChildren){let{spent:oe,allocated:Le,quoted:Oe}=xs(D),Qe=oe>Le&&Le>0;return jsxs("span",{className:f("text-[11px] font-mono flex items-center gap-1.5",W?"text-white/50":"text-gray-500"),children:[jsx("span",{className:f("font-bold",Qe?"text-[#FF453A]":W?"text-white/80":"text-gray-800"),children:ys(oe)}),Le>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:W?"text-white/60":"text-gray-600",children:ys(Le)})]}),Oe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:W?"text-amber-400/70":"text-amber-600",children:ys(Oe)})]})]})}return jsx(Ug,{task:D,isDark:W,locale:g,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:N,hourlyRate:B(D)})}case "teamLoad":return D.hasChildren||D.subtasks&&D.subtasks.length>0?jsx(zg,{task:D,isDark:W,locale:g}):jsx(xd,{value:D.assignees||[],availableUsers:c,onChange:Le=>{r.onTaskUpdate?.({...D,assignees:Le});},isDark:W,locale:g});case "blockers":return jsx(Vg,{blockers:D.blockers,isDark:W,locale:g});case "weight":{let oe=me.get(D.id);if(oe!==void 0)return jsx("span",{className:f("text-xs font-mono",oe>0?W?"text-white/50":"text-gray-400":W?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?`${Number(oe.toFixed(2))}%`:"\u2014"});let Le=D.weight||0;return jsx(O1,{value:Le,onChange:Oe=>pe({weight:Oe}),isDark:W})}default:return jsx("span",{className:f("text-sm",W?"text-white/60":"text-gray-500"),children:"-"})}},[r,W,g,c,j,ae,me]),Ga=useCallback(D=>{let pe={name:j.columns.name,status:j.columns.status,priority:j.columns.priority,assignees:j.columns.assignees,startDate:j.columns.startDate,endDate:j.columns.endDate,progress:j.columns.progress,tags:j.columns.tags||(g==="es"?"Etiquetas":"Tags"),estimatedTime:j.columns.estimatedTime||(g==="es"?"Estimado":"Estimated"),quotedTime:j.columns.quotedTime||(g==="es"?"Ofertado":"Quoted"),elapsedTime:j.columns.elapsedTime||(g==="es"?"Ejecutado":"Executed"),soldEffortMinutes:j.columns.soldEffortMinutes||(g==="es"?"Ofertado":"Quoted"),effortMinutes:j.columns.effortMinutes||(g==="es"?"Estimado":"Estimated"),timeLoggedMinutes:j.columns.timeLoggedMinutes||(g==="es"?"Ejecutado":"Executed"),scheduleVariance:j.columns.scheduleVariance||(g==="es"?"Prog / Var":"Sched / Var"),hoursBar:j.columns.hoursBar||(g==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:j.columns.teamLoad||(g==="es"?"Equipo":"Team"),blockers:j.columns.blockers||(g==="es"?"Bloqueantes":"Blockers"),weight:j.columns.weight||(g==="es"?"Peso":"Weight")}[D.type]||D.label;return typeof pe=="string"?pe:String(pe||D.type)},[j,g]),Va=useMemo(()=>{let pe=re.reduce((Ne,Ke)=>Ne+Ke.width,0)+(v?48:0),Ce={};for(let Ne of re)Ce[Ne.id]=`${Ne.width/pe*100}%`;return Ce},[re,v]);return a?jsx("div",{className:f("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:f("text-sm",W?"text-white/60":"text-gray-600"),children:[j.empty.noTasks,"..."]})]})}):n?jsx("div",{className:f("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:f("text-lg font-semibold mb-2",W?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:f("text-sm",W?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:f("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:f("text-lg font-semibold mb-2",W?"text-white":"text-gray-900"),children:j.empty.noTasks}),jsx("p",{className:f("text-sm",W?"text-white/60":"text-gray-600"),children:j.empty.addFirstTask})]})}):jsxs("div",{ref:T,className:f(W?"bg-[#0D0D0D]":"bg-white",V&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",W?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:f("text-sm",W?"text-white/60":"text-gray-600"),children:[Ln.length," ",j.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",W?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Be,onChange:D=>$e(D.target.value),placeholder:j.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",W?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&dt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:le,onClick:()=>wa(!fr),className:f("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",W?fr?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":fr?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),sr==="all"?g==="es"?"Todos":"All":`L${sr}`]}),fr&&jsx("div",{ref:de,className:f("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",W?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:g==="es"?"Todos":"All"},...Array.from({length:Math.min(dt,5)},(D,ee)=>({value:ee+1,label:`L${ee+1}`}))].map(D=>jsxs("button",{onClick:()=>{Zr(D.value),wa(false);},className:f("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",W?sr===D.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":sr===D.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:D.label}),sr===D.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(D.value)))})]}),jsx(g0,{value:mt,hideCompleted:ze,onChange:Nt,onHideCompletedChange:Fe,isDark:W,locale:g}),xe?.enabled&&xe.data&&!he&&jsx("button",{onClick:()=>We(true),className:f("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",W?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:g==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,E&&F&&jsxs(motion.button,{onClick:F,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:j.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",W?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[ur&&jsx("div",{className:"w-5 flex-shrink-0"}),re.map(D=>{let ee=D.id!=="name",pe=q===D.id&&H!==D.id;return jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",W?"text-white/60":"text-gray-500",ee&&"cursor-grab",D.type!=="name"&&"justify-center",H===D.id&&"opacity-50",pe&&(W?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Va[D.id],minWidth:D.minWidth},draggable:ee,onDragStart:ee?Ce=>Ra(Ce,D.id):void 0,onDragEnd:ee?Ho:void 0,onDragOver:ee?Ce=>Fn(Ce,D.id):void 0,onDragLeave:ee?_n:void 0,onDrop:ee?Ce=>Uo(Ce,D.id):void 0,onContextMenu:Ce=>Pr(Ce,void 0,D.id),children:[ee&&jsx(GripVertical,{className:f("w-3 h-3 flex-shrink-0 transition-opacity",W?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:Ce=>{let Ne=Ce.currentTarget.getBoundingClientRect();d(D.id,Ne);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ga(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),Ae===D.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):D.sortable?jsxs("button",{draggable:false,onClick:()=>pt(D.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ga(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:f("w-3 h-3",Ae===D.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ga(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),w&&D.resizable&&jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",V===D.id&&"bg-[#00E5CC]"),onMouseDown:Ce=>ir(Ce,D.id)})]},D.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:D=>{D.stopPropagation(),ot(ee=>!ee);},className:f("p-0.5 rounded transition-colors",W?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ie&&(W?"bg-white/[0.05]":"bg-gray-200")),title:g==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(i0,{isOpen:Ie,onClose:()=>ot(false),columns:nt,customFields:l,onColumnsChange:St,onCreateCustomField:()=>{ot(false),Q(true);},isDark:W,locale:g})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ln.map((D,ee)=>{let pe=st.has(D.id),Ce=Math.min(ee*.01,.2),Ne=D.hasChildren&&D.level===0,Ke=D.subtasks?.length||0;if(Ne){let{spent:He,allocated:ut,quoted:pr}=xs(D),hr=$1(D);return jsxs(motion.div,{"data-task-id":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ce},className:f("flex items-center border-y cursor-pointer transition-colors duration-500",W?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Se===D.id&&(W?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(D),children:[ur&&jsx("div",{className:"w-5 flex-shrink-0"}),re.map(oa=>jsx("div",{className:f("flex items-center px-4 py-3 min-h-[56px]",oa.type!=="name"&&"justify-center"),style:{width:Va[oa.id],minWidth:oa.minWidth},children:oa.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Et=>{Et.stopPropagation(),it(D.id);},className:f("p-0.5 rounded flex-shrink-0 mt-0.5",W?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:f("w-4 h-4",W?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:f("w-4 h-4",W?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Et=>{Et.stopPropagation(),it(D.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:W?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:W?"#FFD60A":"#B45309"}})}),D.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:W?"#FFD60A":"#B45309"},children:D.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:f("text-[13px] font-bold uppercase tracking-wide",W?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:D.name}),jsxs("span",{className:f("text-[10px] font-mono",W?"text-white/30":"text-gray-500"),children:["(",Ke," ",g==="es"?Ke===1?"Tarea":"Tareas":Ke===1?"Item":"Items",")"]}),hr!==null&&jsxs("span",{className:f("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",hr>=1?"text-[#32D74B] bg-[#32D74B]/10":hr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",hr.toFixed(2)]})]})]}):oa.type==="timeLoggedMinutes"?N==="financial"?(()=>{let Et=D.executedDollarsCanonical,jt=Et!=null?Math.round(Et):Math.round(ve(D).dollarSpent);return jt>0?jsxs("span",{className:f("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",jt.toLocaleString("en-US")]}):null})():jsx(Aa,{value:He>0?He:void 0,isDark:W,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):oa.type==="soldEffortMinutes"?N==="financial"?(()=>{let Et=ve(D),jt=Math.round(Et.dollarQuoted);return jt>0?jsxs("span",{className:f("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",jt.toLocaleString("en-US")]}):null})():jsx(Aa,{value:pr>0?pr:void 0,isDark:W,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):oa.type==="effortMinutes"?N==="financial"?(()=>{let Et=ve(D),jt=Math.round(Et.dollarAllocated),ft=Math.round(Et.dollarQuoted),Mt=ft-jt;return jsxs("div",{className:"flex flex-col",children:[jt>0?jsxs("span",{className:f("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",jt.toLocaleString("es-CO")]}):null,Mt!==0&&jt>0&&ft>0&&jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Mt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Mt>0?"+":"",Math.abs(Mt)>=1e3?`$${(Mt/1e3).toFixed(1)}K`:`$${Mt}`]})]})})():jsx(Aa,{value:ut>0?ut:void 0,isDark:W,locale:g,disabled:true,lens:N,hourlyRate:B(D)}):Ba(D,oa)},oa.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)}let oe=O===D.id,Le=Ze===D.id,Oe=Le&&Je==="above",Qe=Le&&Je==="below",$t=Le&&Je==="child";return jsxs(motion.div,{"data-task-id":D.id,"data-listview-row":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ce},className:f("flex items-center border-b transition-colors relative group",W?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Se===D.id&&(W?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:oe?.4:1,backgroundColor:$t?W?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(D),onDoubleClick:()=>r.onTaskDoubleClick?.(D),onContextMenu:He=>Pr(He,D),onMouseEnter:()=>Gt(D.id),onMouseLeave:()=>Gt(He=>He===D.id?null:He),children:[Oe&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Qe&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),ur&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:He=>Jt(D.id,He),style:{color:W?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),re.map(He=>{let ut=!!(D.subtasks&&D.subtasks.length>0),pr=Kr(He.type),oa=!!pr&&!ut&&da===D.id&&!gr,Et=!!gr&&!!pr&&gr.column===pr&&ga(D.id);return jsxs("div",{className:f("flex items-center px-4 py-3 min-h-[56px]",He.type!=="name"&&"justify-center"),style:{width:Va[He.id],minWidth:He.minWidth,position:"relative",backgroundColor:Et?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Et?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[He.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&D.level>0&&jsx("div",{style:{width:`${D.level*24}px`},className:"flex-shrink-0"}),b&&D.hasChildren&&jsx("button",{onClick:jt=>{jt.stopPropagation(),it(D.id);},className:f("p-0.5 rounded flex-shrink-0",W?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:f("w-4 h-4",W?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:f("w-4 h-4",W?"text-white/60":"text-gray-400")})}),b&&!D.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(D.wbsCode||D.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[D.wbsCode&&jsx("span",{className:f("text-[10px] font-mono",W?"text-[#00E5CC]":"text-[#00C4AE]"),children:D.wbsCode}),D.taskCode&&jsx("span",{className:f("text-[10px] font-mono",W?"text-white/40":"text-gray-400"),children:D.taskCode})]}),jsx("span",{className:f("truncate",D.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",D.progress===100?W?"line-through text-white/50":"line-through text-gray-400":D.hasChildren?W?"text-white":"text-gray-900":W?"text-[#D1D5DB]":"text-gray-600"),children:D.name}),D.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${D.tags[0].color}20`,color:D.tags[0].color},children:D.tags[0].name})]})]}):Ba(D,He),oa&&pr&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:jt=>_e(jt,D.id,pr,ee),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},He.id)}),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)})}),I&&Ln.length>0&&(()=>{let{spent:D,allocated:ee,quoted:pe}=Pe,Ce=ee-D,Ne=Ce<0,Ke=Ne?`+${ys(Math.abs(Ce))} ${g==="es"?"EXCEDIDO":"OVER"}`:`+${ys(Ce)} ${g==="es"?"AHORRADO":"SAVED"}`,oe=N==="financial"&&K>0,Le=_?.breakdown,Oe=!!Le&&((Le.equipment??0)>0||(Le.travel??0)>0),Qe=Le?.laborSpent!=null?Le.laborSpent:_?.spent!=null?_.spent:Pe.dollarSpent,$t=Le?.laborAllocated!=null?Le.laborAllocated:_?.allocated!=null?_.allocated:Pe.dollarAllocated,He=_?.quoted!=null?_.quoted:Pe.dollarQuoted,ut=(Et,jt)=>{if(oe){let ft=jt??Et/60*K;return `$${Math.round(ft).toLocaleString("es-CO")}`}return ys(Et)},pr=oe?Math.abs($t-Qe):0,hr=oe?`+$${pr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ne?g==="es"?"EXCEDIDO":"OVER":g==="es"?"AHORRADO":"SAVED"}`:Ke,oa=oe&&Oe?g==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:f("flex items-center sticky bottom-0 z-[5]",W?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:W?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[ur&&jsx("div",{className:"w-5 flex-shrink-0"}),re.map(Et=>jsx("div",{className:f("flex items-center px-4 py-3",Et.type!=="name"&&"justify-center"),style:{width:Va[Et.id],minWidth:Et.minWidth},children:Et.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:f("text-[11px] font-black uppercase tracking-widest",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:g==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),oa&&jsxs("span",{className:f("text-[9px] font-mono mt-0.5 flex items-center gap-1",W?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),oa]})]}):Et.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:f("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(D,oe?Qe:void 0)}),jsx("span",{className:f("text-[11px]",W?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:f("text-[11px]",W?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(ee,oe?$t:void 0)})]}),ee>0&&jsx("span",{className:f("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ne?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe?hr:Ke})]}):Et.type==="soldEffortMinutes"?jsx("span",{className:f("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?ut(pe,oe?He:void 0):"\u2013"}):Et.type==="effortMinutes"?(()=>{if(oe&&pe>0&&ee>0){let jt=Math.round(He),ft=Math.round($t),Mt=jt-ft,Lr=jt>0?Math.round(Mt/jt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:f("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(ee,$t)}),jsxs("span",{className:f("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Mt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Mt>=0?"+":"",Math.abs(Mt)>=1e3?`$${(Mt/1e3).toFixed(1)}K`:`$${Mt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Lr,"%)"]})]})]})}return jsx("span",{className:f("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ee>0?ut(ee,oe?$t:void 0):"\u2013"})})():Et.type==="timeLoggedMinutes"?jsx("span",{className:f("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:D>0?ut(D,oe?Qe:void 0):"\u2013"}):Et.type==="progress"?(()=>{let jt=k0(Bd(e||[]));return jsxs("span",{className:f("text-[12px] font-bold font-mono",W?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[jt,"%"]})})():Et.type==="weight"?(()=>{let jt=e||[],ft=[],Mt=pa=>{for(let qr of pa)ft.push(qr),qr.subtasks?.length&&Mt(qr.subtasks);};Mt(jt);let ba=ft.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),Ar=Math.abs(ba-100)<.1;return jsxs("span",{className:f("text-[12px] font-bold font-mono",Ar?W?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ba.toFixed(1)),"%"]})})():jsx("span",{className:f("text-[11px]",W?"text-white/30":"text-gray-300"),children:"\u2013"})},Et.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ln.length===0&&Be&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:f("w-12 h-12 mx-auto mb-4",W?"text-white/30":"text-gray-400")}),jsx("p",{className:f(W?"text-white/60":"text-gray-600"),children:j.empty.noResults})]})})]})}),xe?.enabled&&xe.data&&he&&jsx(b0,{data:xe.data,isDark:W,locale:g,onClose:()=>We(false),lens:t?.lens,onUnassignedTaskClick:D=>{let ee=document.querySelector(`[data-task-id="${D}"]`);ee&&(ee.scrollIntoView({behavior:"smooth",block:"center"}),Re(D),setTimeout(()=>Re(null),2e3));}})]}),jsx(Jg,{state:R,onClose:tn,isDark:W,locale:g,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:br,onColumnSort:fa,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),Te&&Tt&&O&&createPortal(jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ee=De.flattenTasks(e).find(pe=>pe.id===O);return ee?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:W?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${W?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:W?"#e6edf3":"#111827"},children:ee.name})]}):null})()}),document.body),jsx(d0,{isOpen:L,onClose:()=>Q(false),onSave:pi,isDark:W,locale:g})]})}var D0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],S0=[{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"}],E0=[{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:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Od={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Hd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Cl={dark:$d,light:Od,neutral:Hd};function M0(e){return Cl[e]||Cl.dark}function Tl(e,t,r,a,n=5){let s=[],o=[],c=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,g)=>p.startSerial-g.startSerial||g.endSerial-p.endSerial);for(let p of c){let g=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),y=0;for(;(s[y]||[]).some(([b,h])=>!(x<b||g>h));)y++;(s[y]=s[y]||[]).push([g,x]),o.push({t:p,s:g,e:x,lane:y,contL:p.startSerial<r,contR:p.endSerial>a});}let l={};for(let p=r;p<=a;p++)l[p]=new Set;o.forEach(p=>{for(let g=p.s;g<=p.e;g++)l[g].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let g=+p,x=m[g],y=[];for(let b=0;b<n;b++)l[g].has(b)||y.push(b);if(x.length<=y.length)x.forEach((b,h)=>i.push({it:b,day:g,lane:y[h]}));else {let b=Math.max(y.length-1,0);x.slice(0,b).forEach((h,v)=>i.push({it:h,day:g,lane:y[v]})),d.push({day:g,lane:y[b]!=null?y[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var H1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],U1=["MON","TUE","WED","THU","FRI","SAT","SUN"];function P0(e){return e==="es"?H1:U1}function F0(e){return (e.getDay()+6)%7}function L0(e,t){let r=new Date(e,t,1),a=F0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},c=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function ai(e,t){return F0(e.serialToDate(t))>=5}function W1(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function A0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function I0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Nl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=W1(t),c=42,l=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=A0(d.startDate),g=A0(d.endDate);if(!p||!g)continue;let x=r.dateToSerial(p),y=r.dateToSerial(g);if(y<1||x>c)continue;let b=d.effortMinutes??0,h=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?I0(v):I0(h*n),C=d.assignees?.[0],E=C?.initials||(C?.name?V1(C.name):void 0),F=d.displayId||d.wbsCode||"",k=G1(F||d.id)?"":F||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(y,c),hrs:h,cost:w,critical:!!d.isCriticalPath,who:E,realStart:p,realEnd:g,phaseId:m,phaseName:u});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var z1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function G1(e){return z1.test(e)||/^task-\d+/.test(e)}function V1(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var j1=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],_1=["January","February","March","April","May","June","July","August","September","October","November","December"];function R0(e,t,r){return `${(r==="es"?j1:_1)[t]} ${e}`}var Ud=26,K1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Dl({locale:e}){let t=P0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Sl({bar:e,ws:t,money:r,projColor:a,slotH:n=Ud}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),c>=3?jsx("span",{className:"val",children:i}):null]})}function El({chip:e,ws:t,slotH:r=Ud}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:K1[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Ml({more:e,ws:t,slotH:r=Ud,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function B0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito / Desembolso"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var J1=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function $0({view:e,onViewChange:t,money:r,onMoneyChange:a,projectLabel:n}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[n,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:J1.map(s=>jsxs("button",{type:"button",className:e===s.id?"on":"",onClick:()=>t(s.id),children:[s.lbl,jsx("span",{className:"key",children:s.key})]},s.id))}),jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function O0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,g]=useState(false),x=useRef(null),y=d==="es";useEffect(()=>{if(!p)return;let h=v=>{x.current&&!x.current.contains(v.target)&&g(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[p]);let b=l==="all"?y?"Todas":"All":c?.find(h=>h.id===l)?.name??(y?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:y?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>g(h=>!h),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:y?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),g(false);},children:jsx("span",{className:"nm",children:y?"Todas las fases":"All phases"})}),c.map(h=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(h.id),g(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,m,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",y?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var Q1=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones / Desembolsos",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function H0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:Q1.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var tC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},rC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function W0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:rC[d.type]},children:tC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var U0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones"}};function z0({monthLabel:e,upcomingMilestones:t=[],locale:r="es"}){let a=U0[r]||U0.es,n=r!=="en";return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:a.title}),n?jsxs("p",{children:["Arrastra tareas del ",jsx("b",{children:"backlog"})," o cr\xE9alas en el ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"El plan CPM proyectar\xE1 aqu\xED lo que toque ejecutar en ",jsx("b",{children:e}),"."]}):jsxs("p",{children:["Drag tasks from the ",jsx("b",{children:"backlog"})," or create them in the ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"The CPM plan will project here what needs running in ",jsx("b",{children:e}),"."]}),t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:a.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function V0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function oC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var G0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function sC(e){return G0[e%G0.length]}function iC(e){return e>1?"over":e>=.9?"warn":"ok"}var Wd="\xA0";function Ao(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function j0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(V0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:sC(l),initials:oC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((l.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function _0({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=V0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,m="cal-cap-cell "+(o?"off":iC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:m,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:u,onClick:p=>{!l||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!l||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsx("div",{className:"nums",children:o||!l?jsx("span",{children:o?"\u2014":`0h${Wd}/${Wd}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ao(c.assigned),"h"]}),jsxs("span",{children:["/",Wd,Ao(c.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:l?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function K0({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ao(s),"h asignadas / ",Ao(o),"h"]}),c?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ao(l),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ao(i.hours),"h / ",Ao(i.capacity),"h"]})]},i.name)})})]})}var zd=28,cC=182;function Y0({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=c==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((g,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(dC,{grid:e,ws:g.ws,we:g.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),l&&l[x]?jsx(_0,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:u}):null]},g.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function dC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),m=useMemo(()=>new Set(n.filter(g=>g.type==="deadline").map(g=>g.serial)),[n]),u=[];for(let g=t;g<=r;g++)u.push(g);let p={height:`${cC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:p,children:[jsx("div",{className:"cal-week-bg",children:u.map(g=>{let x=e.serialToDate(g),y=g>=e.monthStartSerial&&g<=e.monthEndSerial,b="cal-day";return ai(e,g)&&(b+=" wknd"),y||(b+=" out"),g===c&&(b+=" today"),m.has(g)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},g)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((g,x)=>jsx("div",{onClick:()=>l?.(g.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsx(Sl,{bar:g,ws:t,money:s,projColor:o,slotH:zd})},`b${x}`)),d.chips.map((g,x)=>jsx(El,{chip:g,ws:t,slotH:zd},`c${x}`)),d.more.map((g,x)=>jsx(Ml,{more:g,ws:t,slotH:zd,onClick:()=>i(g.day,g.items,a.filter(y=>y.startSerial<=g.day&&y.endSerial>=g.day))},`m${x}`))]})]})}var uC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pC(e){return uC.test(e)||/^task-\d+/.test(e)}function mC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function X0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function gC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function J0(e,t){let r=gC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?X0(c):X0(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?mC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=pC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function Q0({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function Z0({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function ws(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function ef({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=useRef(null),i=n==="es";useEffect(()=>{let g=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${ws(r.oldProjectEnd,n)} \u2192 ${ws(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[ws(r.oldStart,n)," \u2013 ",ws(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[ws(r.newStart,n)," \u2013 ",ws(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(g=>g.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var yC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function tf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,g)=>p.serial-g.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxs("button",{type:"button",onClick:()=>c?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),u.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:yC[u.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function xC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Pl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Gd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function rf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Pl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Pl(d).filter(g=>r.has(g)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let g of m){let x=c(g);x>u&&(u=x);}let p=Gd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function af(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Pl(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Gd(p)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Pl(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Fl(e,t,r,a){let n=xC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=rf(n,new Map),i=af(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=rf(d,new Map([[t,r.getTime()]])),u=af(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),g=[];for(let b of n){if(b.id===t)continue;let h=l.start.get(b.id),v=m.start.get(b.id);if(h!=null&&v!=null&&Math.abs(v-h)>=864e5/2){let w=Gd(p.get(b.id))*864e5;g.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-l.projectEnd)/864e5),y=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:g,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:y}}function nf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var kC=132,Ll=26,CC="#5B7FD4";function of({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,canReschedule:d,onReschedule:m,members:u=[],holidayDates:p=[],timesheetSettings:g,onVisibleRangeChange:x}){let[y,b]=useState("mes"),[h,v]=useState(()=>{let O=new Date;return {y:O.getFullYear(),m:O.getMonth()}}),[w,C]=useState(false),[E,F]=useState([]),[k,S]=useState("all"),[P,N]=useState(null),[K,U]=useState(null),[ae,I]=useState(false),[_,j]=useState(null),[W,B]=useState(false),ve=useMemo(()=>L0(h.y,h.m),[h.y,h.m]),je=a||CC,Pe=useMemo(()=>{let O=new Set;for(let Y of p){let Te=new Date(`${Y}T12:00:00`),ge=ve.dateToSerial(Te);ge>=1&&ge<=42&&O.add(ge);}return O},[p,ve]);useEffect(()=>{x?.({start:nf(ve.serialToDate(1)),end:nf(ve.serialToDate(42))});},[h.y,h.m]);let me=u.length,xe=useMemo(()=>{let O=g?.hoursPerDay;if(!O)return 8;let Y=[O.monday,O.tuesday,O.wednesday,O.thursday,O.friday].map(Te=>Te||0).filter(Te=>Te>0);return Y.length?Math.round(Y.reduce((Te,ge)=>Te+ge,0)/Y.length*10)/10:8},[g]),he=useMemo(()=>Nl({tasks:e,grid:ve,projectColor:()=>je,hourlyRate:o,projectId:r}),[e,ve,je,o,r]),We=useMemo(()=>{let O=new Map;for(let Y of he.calTasks)Y.phaseId&&Y.phaseName&&O.set(Y.phaseId,Y.phaseName);return [...O.entries()].map(([Y,Te])=>({id:Y,name:Te})).sort((Y,Te)=>Y.name.localeCompare(Te.name))},[he.calTasks]),Se=!E.includes("tareas"),Re=!E.includes("cpm"),Ae=useMemo(()=>{let O=Se?he.calTasks:[];return k!=="all"&&(O=O.filter(Y=>Y.phaseId===k)),Re||(O=O.map(Y=>Y.critical?{...Y,critical:false}:Y)),O},[he.calTasks,Se,Re,k]),Ye=useMemo(()=>{let O=new Set;return E.includes("hitos")&&(O.add("hito"),O.add("desembolso")),E.includes("ext")&&O.add("ext"),E.includes("aus")&&O.add("aus"),he.dayItems.filter(Y=>!O.has(Y.type))},[he.dayItems,E]),se=!E.includes("festivos"),Xe=new Date,Be=ve.dateToSerial(new Date(Xe.getFullYear(),Xe.getMonth(),Xe.getDate())),$e=O=>F(Y=>Y.includes(O)?Y.filter(Te=>Te!==O):[...Y,O]),mt=()=>v(O=>{let Y=new Date(O.y,O.m-1,1);return {y:Y.getFullYear(),m:Y.getMonth()}}),Nt=()=>v(O=>{let Y=new Date(O.y,O.m+1,1);return {y:Y.getFullYear(),m:Y.getMonth()}}),ze=()=>{let O=new Date;v({y:O.getFullYear(),m:O.getMonth()});},Fe=(O,Y,Te)=>{if(!d||Y===0)return;let ge=he.calTasks.find(Tt=>Tt.uid===O);if(!ge)return;let Ze=Y*864e5,et=new Date(ge.realStart.getTime()+Ze),Je=new Date(ge.realEnd.getTime()+Ze),Bt=Fl(e,O,et,Je);Bt&&j({uid:O,taskId:ge.id,taskName:ge.name,sim:Bt,anchor:Te});},nt=async()=>{if(!_||!m)return;B(true);let O=[{id:_.uid,startDate:_.sim.newStart,endDate:_.sim.newEnd},..._.sim.movedSuccessors.map(Te=>({id:Te.id,startDate:Te.newStart,endDate:Te.newEnd}))],Y=await m(O);B(false),Y&&j(null);},It=R0(h.y,h.m,n),Ie=[{id:"",name:t,color:je}],ot=useMemo(()=>J0(e,o),[e,o]),L=useMemo(()=>{if(y==="lookahead"){let O=ve.weeks.find(Te=>Be>=Te.ws&&Be<=Te.we)??ve.weeks[0],Y=ve.weeks.indexOf(O);return ve.weeks.slice(Y,Y+2)}return y==="semana"?[ve.weeks.find(Y=>Be>=Y.ws&&Be<=Y.we)??ve.weeks[0]]:[]},[y,ve.weeks,Be]),Q=useMemo(()=>{let O={};return L.forEach((Y,Te)=>{let ge=[];for(let et=Y.ws;et<=Y.we;et++)ge.push({serial:et,date:ve.serialToDate(et),isWeekend:ai(ve,et),isHoliday:Pe.has(et)});let Ze=j0(u,ge,xe);O[Te]={days:ge,capByDay:Ze};}),O},[L,ve,Pe,u,xe]),R=y==="semana"||y==="lookahead",J=y==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx($0,{view:y,onViewChange:b,money:c==="$"?"$":"hrs",onMoneyChange:O=>l(O==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx(O0,{monthLabel:It,onPrev:mt,onNext:Nt,onToday:ze,layersOpen:w,onToggleLayers:()=>C(O=>!O),layersOff:E,phases:We,phaseFilter:k,onPhaseChange:S,locale:n,children:w?jsx(H0,{off:E,onToggle:$e}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:J?"hidden":void 0},children:[J?jsx(tf,{grid:ve,tasks:Ae,items:Ye,money:c,projColor:je,todaySerial:Be,locale:n,onTaskOpen:i}):R?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx(Y0,{grid:ve,weeks:L,tasks:Ae,items:Ye,money:c,projColor:je,todaySerial:Be,locale:n,capRows:Q,teamSize:me,onTaskOpen:i,onMore:(O,Y,Te)=>N({day:O,items:Y,tasks:Te}),onCapDay:(O,Y,Te)=>{for(let ge of Object.keys(Q)){let Ze=Q[+ge].capByDay.get(O);if(Ze){U({dayLabel:Y,perPerson:Ze.perPerson,anchor:Te.getBoundingClientRect()});break}}}})]}):he.isEmpty?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:ve.weeks.map(O=>jsx(sf,{grid:ve,ws:O.ws,we:O.we,todaySerial:Be,showFestivos:se,holidaySerials:Pe,locale:n,deadlineDays:new Set},O.ws))}),jsx(z0,{monthLabel:It,locale:n})]}):jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:ve.weeks.map(O=>jsx(TC,{grid:ve,ws:O.ws,we:O.we,tasks:Ae,items:Ye,money:c,projColor:je,todaySerial:Be,showFestivos:se,holidaySerials:Pe,locale:n,onTaskOpen:i,onMore:(Y,Te,ge)=>N({day:Y,items:Te,tasks:ge}),canReschedule:d,onDragReschedule:Fe,pendingGhost:_?{uid:_.uid,days:Math.round((_.sim.newStart.getTime()-_.sim.oldStart.getTime())/864e5)}:null},O.ws))})]}),P?jsx(W0,{dayLabel:`${ve.serialToDate(P.day).getDate()}`,items:P.items,tasks:P.tasks.map(O=>({swatch:je,taskId:O.id,label:O.name,critical:O.critical,value:c==="$"?O.cost:`${O.hrs}h`})),onClose:()=>N(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,K?jsx(K0,{dayLabel:K.dayLabel,perPerson:K.perPerson,onClose:()=>U(null),style:{position:"fixed",top:`${K.anchor.top-8}px`,left:`${K.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,_?jsx(ef,{taskName:_.taskName,taskId:_.sim.taskId,sim:_.sim,busy:W,locale:n,onConfirm:nt,onCancel:()=>j(null),style:{position:"fixed",top:`${_.anchor.top+12}px`,left:`${Math.min(_.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),ae?jsx(Q0,{items:ot,money:c,projColor:je,onItemClick:O=>i?.(O),onCollapse:()=>I(false)}):jsx(Z0,{onExpand:()=>I(true)})]}),jsx(B0,{projects:Ie})]})}function sf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,m=n&&s.has(l),u="cal-day";return ai(e,l)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),l===a&&(u+=" today"),o.has(l)&&(u+=" deadline-day"),jsxs("div",{className:u,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:g,pendingGhost:x}){let y=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(F=>F.type==="deadline").map(F=>F.serial)),[n]),h=Math.max(kC,y.laneCount*Ll+36),v=useRef(null),[w,C]=useState(null),E=(F,k)=>{if(!p||!g){m?.(k);return}F.preventDefault();let S=v.current;if(!S)return;let P=S.getBoundingClientRect().width/7,N=F.clientX,K=0,U=I=>{let _=Math.round((I.clientX-N)/P);K=_,C({id:k,days:_});},ae=I=>{if(window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",ae),C(null),K===0){m?.(k);return}let _=new DOMRect(I.clientX,I.clientY,0,0);g(k,K,_);};window.addEventListener("pointermove",U),window.addEventListener("pointerup",ae);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${h}px`},children:[jsx(sf,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[y.bars.map((F,k)=>{let S=w?.id===F.t.uid?w.days:null,P=x?.uid===F.t.uid?x.days:null,N=S??P??0,K=S==null&&P!=null,U=N!==0?{...F,s:F.s+N,e:F.e+N}:F;return jsx("div",{onPointerDown:ae=>E(ae,F.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:K?.6:1},children:jsx(Sl,{bar:U,ws:t,money:s,projColor:o,slotH:Ll})},`b${k}`)}),y.chips.map((F,k)=>jsx(El,{chip:F,ws:t,slotH:Ll},`c${k}`)),y.more.map((F,k)=>jsx(Ml,{more:F,ws:t,slotH:Ll,onClick:()=>u(F.day,F.items,a.filter(S=>S.startSerial<=F.day&&S.endSerial>=F.day))},`m${k}`))]})]})}function DC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=useState(false),d=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=useMemo(()=>{let p=d.length,g=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),y=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:g,priorities:x,labels:y}},[d]),u=()=>{n?.(e.id);};return jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),l&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:d.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:d.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:g=>{g.stopPropagation(),s?.(e.id,p.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"})]})})]},p.id))})})]})}var cf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function oi(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function si(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function df(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function uf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=useMemo(()=>({...cf,...o}),[o]),[i,d]=useState(new Set),m=useRef(null),u=useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=h.get(w);C?C.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,E)=>E.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:p,uniqueTypes:g}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{d(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),C=Math.floor(w/6e4),E=Math.floor(w/36e5),F=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:E<24?`${E}h ago`:F<7?`${F}d ago`:h.toLocaleDateString()},b=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&m.current){let h=m.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:f("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:f("history-timeline",l.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),g.map(h=>jsxs("option",{value:h,children:[si(h)," ",h.replace("_"," ")]},h))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>r({...t,searchTerm:h.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:u.map(h=>jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((v,w)=>{let C=i.has(v.id),E=s===v.id,F=df(v.type);return jsxs("div",{"data-event-id":v.id,className:f("history-timeline-event",C&&"expanded",E&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:F},children:l.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:si(v.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:F}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[l.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:oi(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,S])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,S])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function mf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],m=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:f("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:f("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&si(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&oi(m)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>c(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,g)=>jsx("div",{className:f("history-replay-progress-marker",g===e.currentIndex&&"active"),style:{left:`${g/(e.totalEvents-1)*100}%`},onClick:()=>c(g),title:oi(p)},p.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:d.map(p=>jsxs("button",{className:f("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>l(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:f("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function jd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function _d(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 gf(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 ff(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function LC(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let g=d.x-p.x,x=d.y-p.y,y=Math.sqrt(g*g+x*x)||1,b=n.chargeStrength*i/(y*y);d.vx+=g/y*b,d.vy+=x/y*b;});}),t.forEach(d=>{let m=c.get(typeof d.source=="string"?d.source:d.source.id),u=c.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,g=u.y-m.y,x=Math.sqrt(p*p+g*g)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*y,m.vy+=g*y,u.vx-=p*y,u.vy-=g*y;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function bf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=useRef(null),[d,m]=useState([]),[u,p]=useState(null),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let U=LC(e,t,r.width,r.height,r,150);m(U);},[e,t,r]);let E=useCallback((U,ae)=>{r.enableDragging&&(ae.stopPropagation(),p(U));},[r.enableDragging]),F=useCallback(U=>{if(!u||!i.current)return;let I=i.current.getBoundingClientRect(),_=(U.clientX-I.left-w.x)/h,j=(U.clientY-I.top-w.y)/h;m(W=>W.map(B=>B.id===u?{...B,x:_,y:j,fx:_,fy:j}:B));},[u,h,w]),k=useCallback(()=>{p(null);},[]),S=useCallback((U,ae)=>{ae.stopPropagation(),c?.({type:"node-click",node:U,position:{x:ae.clientX,y:ae.clientY}});},[c]),P=useCallback((U,ae)=>{ae.stopPropagation(),c?.({type:"edge-click",edge:U,position:{x:ae.clientX,y:ae.clientY}});},[c]),N=useCallback(U=>{let ae=d.find(I=>I.id===U);return ae?{x:ae.x,y:ae.y}:{x:0,y:0}},[d]),K=useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ae=U.card.priority;return ae==="URGENT"?"#ef4444":ae==="HIGH"?"#f59e0b":ae==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:f("relationships-graph-empty",l),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:f("relationships-graph",l),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.min(U+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:jd(U)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[gf(U)," ",_d(U)]})]},U))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:F,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let ae=N(typeof U.source=="string"?U.source:U.source.id),I=N(typeof U.target=="string"?U.target:U.target.id),_=ff(U.type),j=y===U.id,W=U.onCriticalPath;return jsxs("g",{className:f("relationships-graph-edge",j&&"hovered",W&&"critical"),onMouseEnter:()=>b(U.id),onMouseLeave:()=>b(null),onClick:B=>P(U,B),children:[jsx("line",{x1:ae.x,y1:ae.y,x2:I.x,y2:I.y,stroke:jd(U.type),strokeWidth:W?r.edgeWidth*2:r.edgeWidth,strokeOpacity:j?1:.6,markerEnd:_?"url(#arrowhead)":void 0}),r.showEdgeLabels&&j&&jsx("text",{x:(ae.x+I.x)/2,y:(ae.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:_d(U.type)})]},U.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map(U=>{let ae=g===U.id,I=U.onCriticalPath;return jsxs("g",{className:f("relationships-graph-node",ae&&"hovered",I&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:_=>E(U.id,_),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:_=>S(U,_),children:[jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:K(U),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ae?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 xf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[c,l]=useState(false),[i,d]=useState(null),[m,u]=useState(null),p=useRef(null),g=c||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!g&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,g]);let x=()=>{g||(o(""),d(null),u(null),t());},y=async()=>{if(!(!s.trim()||g)){l(true),d(null),u(null);try{let h=await a(s.trim());u(h);}catch(h){d(h instanceof Error?h.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{m&&(r(m),x());};return e?jsxs(ar,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:g,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((h,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((h,v)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:p,value:s,onChange:h=>o(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:g}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,v)=>jsx("button",{onClick:()=>o(h),disabled:g,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:g&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:g,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),m?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||g,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:g?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Kd={"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 IC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},RC={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 BC(e,t,r){let a=Kd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ii(e){return `$${e.toFixed(4)}`}var qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=BC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),c=r.filter(m=>m.success),l=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Ro=new qd;function kf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(Ro.getStats()),[s,o]=useState(Ro.checkLimit(r));if(useEffect(()=>{if(!e)return;let l=setInterval(()=>{n(Ro.getStats()),o(Ro.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=Ro.getRecentOperations(5);return jsxs(ar,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:l=>l.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ii(a.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,m=a.totalOperations>0?i/a.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:l.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(d)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},l)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(l=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(l.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Nf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=useState(""),[l,i]=useState(""),[d,m]=useState(""),[u,p]=useState(false),[g,x]=useState(null),[y,b]=useState(null),[h,v]=useState(null),w=useRef(null),C=u||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=N=>{N.key==="Escape"&&!C&&E();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,C]);let E=()=>{C||(c(""),i(""),m(""),x(null),b(null),v(null),t());},F=async()=>{if(!(!o.trim()||C)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},k=()=>{y&&(r(y),E());};if(!e)return null;let S=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(ar,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:E}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:E,disabled: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:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",S,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,N)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>c(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:l,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:d,onChange:P=>m(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]})]}),g&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:g}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,N)=>jsx("button",{onClick:()=>c(P),disabled: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:P},N))})]})]})}),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-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:E,disabled: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"}),y?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:F,disabled:!o.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Rl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(y=>{t&&yi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{a(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let C=w.columnId,E={...w,columnId:b,position:h},F=v.cards.map(P=>P.id===y?E:P),k=v.columns.map(P=>{if(P.id===C)return {...P,cardIds:P.cardIds.filter(N=>N!==y)};if(P.id===b){let N=F.filter(K=>K.columnId===b).sort((K,U)=>K.position-U.position);return {...P,cardIds:N.map(K=>K.id)}}return P}),S={...v,cards:F,columns:k};return n(S),S});},[n]),o=useCallback(async(y,b)=>{a(h=>{let v=h.cards.map(C=>C.id===y?{...C,...b}:C),w={...h,cards:v};return n(w),w});},[n]),c=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b},w=h.columns.map(E=>E.id===y.columnId?{...E,cardIds:[...E.cardIds,b]}:E),C={...h,cards:[...h.cards,v],columns:w};return n(C),C});},[n]),l=useCallback(async y=>{a(b=>{let h=b.cards.find(E=>E.id===y);if(!h)return b;let v=b.cards.filter(E=>E.id!==y),w=b.columns.map(E=>E.id===h.columnId?{...E,cardIds:E.cardIds.filter(F=>F!==y)}:E),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),d=useCallback(async(y,b)=>{a(h=>{let v=h.columns.map(C=>C.id===y?{...C,...b}:C),w={...h,columns:v};return n(w),w});},[n]),m=useCallback(async y=>{a(b=>{let h=b.cards.filter(C=>C.columnId!==y),v=b.columns.filter(C=>C.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),u=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),b},[c]),p=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),g=useCallback(()=>{a(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:l,deleteColumn:m,clearBoard:g}}}function Sf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Rl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(m=>m.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var li={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Mf={by:"none",order:"asc"};function Pf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...li,...e}),[s,o]=useState({...Mf,...t}),c=useCallback(x=>{n(y=>({...y,...x}));},[]),l=useCallback(x=>{o(y=>({...y,...x}));},[]),i=useCallback(()=>{n(li),o(Mf);},[]),d=useCallback(()=>{r&&n({...li,assignees:[r]});},[r]),m=useCallback(()=>{n({...li,dateFilter:"overdue"});},[]),u=useCallback(()=>{n({...li,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),g=useCallback(x=>{let y=[...x];if(a.search){let b=a.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${h}-${v}-${w}`;y=y.filter(E=>{if(!E.endDate&&!E.dueDate)return false;let F=E.endDate||E.dueDate;if(!F)return false;let k;if(typeof F=="string")k=F.split("T")[0]||F;else {let S=F.getUTCFullYear(),P=String(F.getUTCMonth()+1).padStart(2,"0"),N=String(F.getUTCDate()).padStart(2,"0");k=`${S}-${P}-${N}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let S=new Date(C+"T00:00:00"),P=new Date(k+"T00:00:00"),N=new Date(S);return N.setDate(N.getDate()+7),P>=S&&P<=N;case "custom":if(a.dateRange){let K=typeof F=="string"?new Date(F):F;return K>=a.dateRange.start&&K<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(y=y.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(y=y.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=h.createdAt?new Date(h.createdAt).getTime():0;v=w-C;break;case "priority":let E={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},F=E[b.priority||"LOW"],k=E[h.priority||"LOW"];v=F-k;break;case "dueDate":let S=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!S)return 1;if(!P)return -1;let N=typeof S=="string"?new Date(S).getTime():S.getTime(),K=typeof P=="string"?new Date(P).getTime():P.getTime();v=N-K;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let U=b.estimatedTime||0,ae=h.estimatedTime||0;v=U-ae;break;default:v=0;}return s.order==="asc"?v:-v}),y},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:g,hasActiveFilters:p}}var Lf,Af;if(typeof window<"u")try{let e=fi("ai");Lf=e.generateObject,Af=e.generateText;}catch{}function If(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(Lf&&Af&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",m),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),c=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function Xd(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function Rf(e){let{cards:t}=e,[r,a]=Xd(),n=useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,g=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(g&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),y=t.find(b=>b.id===r.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,S)=>k.position-S.position),h=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===m),[w,C]=h<v?[h,v]:[v,h],E=b.slice(w,C+1).map(k=>k.id),F=Array.from(new Set([...r.selectedCardIds,...E]));a({selectedCardIds:F,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Bf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function $f(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Bf,...r}),[r]),[s,o]=useState([]),c=useCallback((x,y,b,h,v)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),m=useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),u=useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),p=useCallback(async x=>{let y=t.filter(C=>C.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(E=>{h.has(E)||h.set(E,[]),h.get(E).push(C);});}),h.forEach((C,E)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${E}`,cardIds:C.map(F=>F.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${E}"`,confidence:.85});});let v=new Map;y.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(E=>{v.has(E)||v.set(E,[]),v.get(E).push(C);});}),v.forEach((C,E)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${E.slice(-4)}`,cardIds:C.map(F=>F.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,E)=>{if(C.length>=n.minCardsPerStack){let F={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[E.toLowerCase()]||"\u26AA";b.push({stack:{title:`${F} ${E} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:E==="high"||E==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${E} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of y){let F=(await a.findSimilar(C,y)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(F.length>=n.minCardsPerStack-1){let k=[C.id,...F.map(P=>P.card.id)],S=F.reduce((P,N)=>P+N.similarity,0)/F.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${F.length+1} similar tasks`,confidence:S});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,E)=>E.confidence-C.confidence).slice(0,5)},[t,n,a]),g=useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await p(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&g(h);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:g,config:n}}var Of=createContext(null);function Hf({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=fi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=fi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=fi("@libxai/core");c=new l(t.board);}a.current=new BoardStore({board:c,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(Of.Provider,{value:{store:n},children:e})}function Bl(){let e=useContext(Of);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function di(){let e=Bl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=useCallback(h=>{e.updateBoard(h);},[e]),l=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),d=useCallback(h=>{e.deleteColumn(h);},[e]),m=useCallback(h=>e.getColumn(h),[e]),u=useCallback(h=>{e.addCard(h);},[e]),p=useCallback((h,v)=>{e.updateCard(h,v);},[e]),g=useCallback(h=>{e.deleteCard(h);},[e]),x=useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:g,moveCard:x,getCard:y,getCardsByColumn:b}}function Wf(e){let{cards:t}=di();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function zf(e="position",t="asc"){let{cards:r}=di();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var $l=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Fu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},ZC=new $l;function Vf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:n,children:jsx("div",{style:p,children:m.map(g=>{let x=e[g.index];if(!x)return null;let y=l?l(x,g.index):g.index,b={position:"absolute",top:o?0:g.start,left:o?g.start:0,width:o?g.size:"100%",height:o?"100%":g.size};return jsx("div",{style:b,"data-index":g.index,children:a(x,g.index)},y)})})})}function jf(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 Kf({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},g={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:p,className:s,children:jsx("div",{style:g,children:u.map(x=>{let y=e[x.index];if(!y)return null;let b=l?l(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function qf(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 Yf(e,t=10){return e>t}var eu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},tu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ru={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},au={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},nu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},ou={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},su={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},iu={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)"},lu={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)"},cu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},du={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}},uu={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Ol={spacing:eu,borderRadius:tu,fontSize:ru,fontWeight:au,lineHeight:nu,zIndex:ou,duration:su,easing:iu,shadows:lu,opacity:cu,kanban:du,gantt:uu};function Xf(e,t,r){return e[t]??r}function pu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?pu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function r2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function mu(e="asakaa"){let t=pu(Ol),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=r2(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
414
414
|
${r.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function ui(e,t="asakaa"){let r=[],a=
|
|
416
|
+
}`}function ui(e,t="asakaa"){let r=[],a=pu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
|
|
417
417
|
${r.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var Hl={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},
|
|
419
|
+
}`}var Hl={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},gu={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},fu={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function bu(e=Hl,t="asakaa"){let r=mu(t),a=ui(e,t);return `${r}
|
|
420
420
|
|
|
421
|
-
${a}`}function
|
|
421
|
+
${a}`}function Jf(){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
|
+
${bu(Hl)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${ui(
|
|
431
|
+
${ui(gu,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${ui(
|
|
438
|
+
${ui(fu,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var
|
|
443
|
-
export{
|
|
442
|
+
`}var a2=({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 Qf({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=es();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,c])=>{let l=o,i=l===a;return jsxs("button",{onClick:()=>n(l),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(a2,{theme:l})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:c.displayName})]},l)})})}
|
|
443
|
+
export{kf as AIUsageDashboard,RC as AI_FEATURES,Kd as AI_MODELS,kc as AddCardButton,hc as AddColumnButton,Jo as AttachmentUploader,Hf as BoardProvider,zi as BulkOperationsToolbar,Pc as BurnDownChart,E0 as CUSTOM_FIELD_TYPES,of as CalendarBoard,In as Card,mf as CardHistoryReplay,uf as CardHistoryTimeline,bf as CardRelationshipsGraph,DC as CardStack,$c as CardTemplateSelector,Xl as CircuitBreaker,_o as Column,qi as ColumnManager,Nc as CommandPalette,Wc as ConfigMenu,os as ContextMenu,Us as DEFAULT_SHORTCUTS,D0 as DEFAULT_TABLE_COLUMNS,Bc as DEFAULT_TEMPLATES,Ds as DateRangePicker,Es as DependenciesSelector,Ks as DependencyLine,Fc as DistributionCharts,nc as EditableColumnTitle,Xo as ErrorBoundary,km as ExportDropdown,Hc as ExportImportModal,Uc as FilterBar,rg as GANTT_AI_SYSTEM_PROMPT,sl as GanttAIAssistant,Qm as GanttBoard,rs as GanttI18nContext,rl as GanttMilestone,Ki as GanttToolbar,Nf as GenerateGanttTasksDialog,xf as GeneratePlanModal,Ic as GroupBySelector,dc as HealthBar,Zn as KanbanBoard,fc as KanbanToolbar,Os as KanbanViewAdapter,Rc as KeyboardShortcutsHelp,N0 as ListView,er as MenuIcons,$l as PluginManager,vo as PrioritySelector,uc as ProfitabilityReport,Bs as QuickTaskCreate,IC as RATE_LIMITS,S0 as STANDARD_FIELDS,Lc as SwimlaneBoardView,sc as TagBadge,gp as TagList,Ko as TagPicker,Ji as TaskBar,No as TaskDetailModal,tg as TaskFormModal,Xi as TaskGrid,jc as ThemeModal,dm as ThemeProvider,Qf as ThemeSwitcher,wn as TimeInputPopover,ic as TimePill,lc as TimePopover,al as Timeline,ko as UserAssignmentSelector,Mc as VelocityChart,Kf as VirtualGrid,Vf as VirtualList,Ro as aiUsageTracker,tu as borderRadius,Nl as buildCalendar,hi as calculatePosition,cl as cardToGanttTask,cg as cardsToGanttTasks,f as cn,Vp as createKanbanView,kb as createRetryWrapper,zc as darkTheme,Hl as darkTokenTheme,Vi as defaultTheme,Ol as designTokens,su as duration,iu as easing,Jf as exportTokensToCSS,Wn as findTaskByName,ru as fontSize,au as fontWeight,ii as formatCost,_i as ganttEnTranslations,pm as ganttEsTranslations,lg as ganttTaskToCardUpdate,lt as ganttThemes,uu as ganttTokens,_c as ganttTranslations,De as ganttUtils,mu as generateCSSVariables,bu as generateCompleteCSS,yb as generateInitialPositions,ag as generateTasksContext,ui as generateThemeVariables,M0 as getListViewTheme,fd as getListViewTranslations,Xf as getToken,mm as getTranslations,du as kanbanTokens,Gc as lightTheme,gu as lightTokenTheme,nu as lineHeight,$d as listViewDarkTheme,md as listViewEnTranslations,gd as listViewEsTranslations,Od as listViewLightTheme,Hd as listViewNeutralTheme,Cl as listViewThemes,dl as listViewTranslations,ul as mergeListViewTranslations,Kc as mergeTranslations,Vc as neutralTheme,fu as neutralTokenTheme,cu as opacity,sg as parseLocalCommand,dd as parseNaturalDate,ud as parseNaturalDuration,pd as parseProgress,og as parseStatus,ZC as pluginManager,wb as retrySyncOperation,yi as retryWithBackoff,lu as shadows,Yf as shouldVirtualizeGrid,Fl as simulateReschedule,eu as spacing,So as themes,If as useAI,Sf as useBoard,di as useBoardCore,Bl as useBoardStore,$f as useCardStacking,mc as useDragState,Wf as useFilteredCards,Pf as useFilters,qa as useGanttI18n,Rl as useKanbanState,im as useKeyboardShortcuts,Rf as useMultiSelect,Xd as useSelectionState,zf as useSortedCards,es as useTheme,qf as useVirtualGrid,jf as useVirtualList,ig as validateAIResponse,Cc as withErrorBoundary,wi as wouldCreateCircularDependency,ou as zIndex};//# sourceMappingURL=index.js.map
|
|
444
444
|
//# sourceMappingURL=index.js.map
|