@libxai/board 1.5.33 → 1.5.35
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 +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6754 -0
- package/dist/index.d.ts +6754 -0
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=au(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=au(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,y)=>{l[g]=i[y]||"";});let m=l.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function au(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function ru(e,t){switch(t){case "json":return Rf(e);case "csv":return Of(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ou(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var pl=react.createContext(null);function nu(){return react.useContext(pl)}var su=react.createContext(null);function iu({children:e,themeName:t}){return jsxRuntime.jsx(su.Provider,{value:{themeName:t},children:e})}function an(){return react.useContext(su)}function Wt({children:e,container:t}){let[a,r]=react.useState(false),o=nu(),s=an();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var pu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},_f="#BDC3C7",jf=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Po({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let v=y-g.bottom,C=g.top,T;v>=f+b?T=g.bottom+b:C>=f+b?T=g.top-f-b:T=v>=C?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:w}),o(true);};react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?pu[e]:null,p=d?.color||_f;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})})}),r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(pu).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>m(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.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:[jsxRuntime.jsx(jf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Kf=[{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 Bn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),p=(an()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,T=320,D=380,k=4,L=w.left;L+T>C-10&&(L=C-T-10),L<10&&(L=10);let $=v-w.bottom,E=w.top,te;$>=D+k?te=w.bottom+k:E>=D+k?te=w.top-D-k:te=$>=E?w.bottom+k:Math.max(10,w.top-D-k),i({top:te,left:L}),s(true);};react.useEffect(()=>{let w=v=>{c.current&&!c.current.contains(v.target)&&!l.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let v=new Date,C=L=>{let $=L.getFullYear(),E=String(L.getMonth()+1).padStart(2,"0"),te=String(L.getDate()).padStart(2,"0");return `${$}-${E}-${te}`},T=C(v),D=new Date(v);D.setDate(D.getDate()+w);let k=C(D);a(T,k),s(false);},x=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=D.split("-").map(Number);if(k.length!==3||k.some(te=>isNaN(te)))return null;let L=k[0],$=k[1],E=k[2];return L===void 0||$===void 0||E===void 0?null:new Date(L,$-1,E)},v=w(e),C=w(t);if(!v||!C||isNaN(v.getTime())||isNaN(C.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[v.getMonth()]} ${v.getDate()} \u2013 ${T[C.getMonth()]} ${C.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),w<v})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background: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:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Kf.map(w=>jsxRuntime.jsx("button",{onClick:()=>y(w.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:v=>{v.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Lo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[i,c]=react.useState(""),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),g=()=>{if(!p.current)return;let b=p.current.getBoundingClientRect(),w=window.innerHeight,v=window.innerWidth,C=300,T=380,D=4,k=b.right-C;k<10&&(k=b.left),k+C>v-10&&(k=v-C-10);let L=w-b.bottom,$=b.top,E;L>=T+D?E=b.bottom+D:$>=T+D?E=b.top-T-D:E=L>=$?b.bottom+D:Math.max(10,b.top-T-D),m({top:E,left:k}),n(true);};react.useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!p.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(v=>v.id===b.id);a(w?e.filter(v=>v.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(i.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),f>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):jsxRuntime.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:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:b=>c(b.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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.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(b=>{let w=e.some(v=>v.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.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:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Is(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let m of l){if(!s.has(m)&&i(m))return true;if(n.has(m))return true}}return n.delete(c),false};return i(a)}function On({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=react.useState(false),[l,m]=react.useState(""),[d,p]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),f=react.useRef(null),b=react.useRef(null),w=()=>{if(!b.current)return;let k=b.current.getBoundingClientRect(),L=window.innerHeight,$=window.innerWidth,E=300,te=d?380:120,O=4,H=k.right-E;H<10&&(H=k.left),H+E>$-10&&(H=$-E-10);let M=L-k.bottom,J=k.top,ee;M>=te+O?ee=k.bottom+O:J>=te+O?ee=k.top-te-O:ee=M>=J?k.bottom+O:Math.max(10,k.top-te-O),y({top:ee,left:H}),c(true);};react.useEffect(()=>{if(!i||!b.current)return;let k=b.current.getBoundingClientRect(),L=window.innerHeight,$=window.innerWidth,E=300,te=d?380:120,O=4,H=k.right-E;H<10&&(H=k.left),H+E>$-10&&(H=$-E-10);let M=L-k.bottom,J=k.top,ee;M>=te+O?ee=k.bottom+O:J>=te+O?ee=k.top-te-O:ee=M>=J?k.bottom+O:Math.max(10,k.top-te-O),y({top:ee,left:H});},[d,i]),react.useEffect(()=>{let k=L=>{f.current&&!f.current.contains(L.target)&&!b.current?.contains(L.target)&&(c(false),m(""));};if(i)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{let k=L=>{L.key==="Escape"&&(c(false),m(""));};if(i)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]);let v=k=>{let L=t.includes(k),$=a.find(E=>E.id===k);if(h(null),L){let E=t.filter(te=>te!==k);r(E),E.length===0&&p(false);}else {if(s&&Is(a,k,e)){let te=`Cannot add "${$?.title||k}" as dependency - would create circular reference`;h(te),n?.(k,$?.title||k),setTimeout(()=>h(null),3e3);return}r([...t,k]),p(true);}},C=()=>{let k=!d;p(k),k||r([]);},T=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(l.toLowerCase())||k.id.toLowerCase().includes(l.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>i?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:k=>m(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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:T.length===0?jsxRuntime.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"}):T.map(k=>{let L=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>v(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.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&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Jr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Ms.Transform.toString(p),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...l,...m,onClick:()=>a?.(e),children:t(e)});let h=i.filter(v=>e.assignedUserIds?.includes(v.id)),f=e.progress===100,b=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...m,onClick:v=>{v.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:v=>{v.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsxRuntime.jsx("img",{src:b[0].url,alt:b[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:v=>{v.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((v,C)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),C===3&&b.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",b.length-4]})})]},v.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Po,{priority:e.priority,onChange:v=>n?.(e.id,{priority:v})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Bn,{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:(v,C)=>n?.(e.id,{startDate:v,endDate:C})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Lo,{assignedUsers:h,availableUsers:i,onChange:v=>n?.(e.id,{assignedUserIds:v.map(C=>C.id)})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(On,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:c,onChange:v=>n?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsxRuntime.jsx("span",{className:"asakaa-label",children:v},v))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Jr.displayName="Card";var Bs={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"}},ku=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Cu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),m=[...Object.entries(Bs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Bs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Bs[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Bs.todo,id:"todo"}},p=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,v=280,C=4,T=h.right-w;T<10&&(T=h.left),T+w>b-10&&(T=b-w-10);let D=f-h.bottom,k=h.top,L;D>=v+C?L=h.bottom+C:k>=v+C?L=h.top-v-C:L=D>=k?h.bottom+C:Math.max(10,h.top-v-C),i({top:L,left:T}),s(true);};react.useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o?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:y.label,children:jsxRuntime.jsx(ku,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ku,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Tu={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 Nu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Tu[s]||Tu.en,[i,c]=react.useState(false),[l,m]=react.useState(false),[d,p]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(i&&h.current){let C=h.current.getBoundingClientRect();y({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),react.useEffect(()=>{let C=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),react.useEffect(()=>{let C=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),react.useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let b=()=>{m(true),p(e);},w=()=>{let C=d.trim();C&&C!==e&&t(C),m(false),c(false),p(e);},v=C=>{C.key==="Enter"?w():C.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:f,type:"text",value:d,onChange:C=>p(C.target.value),onKeyDown:v,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var nn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:v,isOver:C}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),D=m??Xc(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:v,className:f,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),E=$.state==="exceeded",te=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:u("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",E&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(te()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),$.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),$.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),$.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||x)&&jsxRuntime.jsx(Nu,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!p&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(O=>{let H=t[O.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(Jr,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsxRuntime.jsx(Jr,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});nn.displayName="Column";function hl({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},l=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function mb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Pu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(l===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function gb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function fb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var bb=["\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 Au({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=i==="dark",[f,b]=react.useState(false),[w,v]=react.useState([]),[C,T]=react.useState(0),[D,k]=react.useState(null),[L,$]=react.useState(false),E=react.useRef(null),te=react.useRef(null),O=react.useRef(null),H=react.useRef(null),M=react.useCallback((U,oe)=>{let Z=mb(U,oe);if(k(Z),Z){let Ee=r.filter(ke=>ke.name.toLowerCase().includes(Z.query)||ke.email&&ke.email.toLowerCase().includes(Z.query)).slice(0,5);v(Ee),b(Ee.length>0),T(0);}else b(false),v([]);},[r]),J=U=>{let oe=U.target.value;if(t(oe),M(oe,U.target.selectionStart||0),E.current){E.current.style.height="24px";let Z=E.current.scrollHeight,Ee=280,ke=Math.min(Z,Ee);E.current.style.height=`${ke}px`,E.current.style.overflowY=Z>Ee?"auto":"hidden";}},ee=()=>{E.current&&M(e,E.current.selectionStart||0);},Re=react.useCallback(U=>{if(!D||!E.current)return;let oe=e.slice(0,D.start),Z=e.slice(D.end),Ee=`@${U.name.replace(/\s+/g,"")} `,ke=oe+Ee+Z;t(ke),b(false),k(null),setTimeout(()=>{if(E.current){let Ie=D.start+Ee.length;E.current.selectionStart=Ie,E.current.selectionEnd=Ie,E.current.focus();}},0);},[D,e,t]),B=U=>{if(f&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),T(oe=>oe<w.length-1?oe+1:0);break;case "ArrowUp":U.preventDefault(),T(oe=>oe>0?oe-1:w.length-1);break;case "Enter":{U.preventDefault();let oe=w[C];oe&&Re(oe);break}case "Tab":{U.preventDefault();let oe=w[C];oe&&Re(oe);break}case "Escape":U.preventDefault(),b(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};react.useEffect(()=>{let U=oe=>{te.current&&!te.current.contains(oe.target)&&E.current&&!E.current.contains(oe.target)&&b(false),H.current&&!H.current.contains(oe.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let Y=react.useCallback(U=>{if(!E.current)return;let oe=E.current.selectionStart||e.length,Z=e.slice(0,oe)+U+e.slice(oe);t(Z),$(false),setTimeout(()=>{if(E.current){let Ee=oe+U.length;E.current.selectionStart=Ee,E.current.selectionEnd=Ee,E.current.focus();}},0);},[e,t]),ye=react.useCallback(U=>{if(!g||!U.target.files)return;let oe=Array.from(U.target.files),Z=x*1024*1024,Ee=oe.filter(ke=>ke.size>Z?(console.warn(`File ${ke.name} exceeds max size of ${x}MB`),false):true);Ee.length>0&&g(Ee),U.target.value="";},[g,x]),Ge=react.useCallback(U=>U.type.startsWith("image/")?lucideReact.Image:U.type.includes("pdf")||U.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(f&&te.current){let U=te.current.children[C];U&&U.scrollIntoView({block:"nearest"});}},[C,f]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(U=>{let oe=Ge(U.file),Z=U.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[Z&&U.preview?jsxRuntime.jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(oe,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:U.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:fb(U.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(U.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},U.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!L),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:bb.map(U=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:O,type:"file",multiple:true,onChange:ye,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:E,value:e,onChange:J,onSelect:ee,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:te,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Re(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===C?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:U.color||"#8B5CF6"},children:gb(U.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:U.name}),U.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Lu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var zs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function po({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=react.useState(false),[l,m]=react.useState(""),[d,p]=react.useState(false),[g,y]=react.useState(zs[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),f=react.useRef(null),b=react.useRef(null),w=react.useRef(null),v=react.useRef(null),C=t.filter(E=>E.name.toLowerCase().includes(l.toLowerCase())),T=t.some(E=>E.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&b.current){let E=b.current.getBoundingClientRect();h({top:E.bottom+6,left:E.left});}},[i]),react.useEffect(()=>{let E=te=>{let O=te.target,H=f.current?.contains(O),M=w.current?.contains(O);!H&&!M&&(c(false),m(""),p(false));};if(i)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useEffect(()=>{i&&v.current&&v.current.focus();},[i]);let D=E=>{let te=e.some(O=>O.id===E.id);a(te?e.filter(O=>O.id!==E.id):[...e,E]);},k=async()=>{if(!(!r||!l.trim())){p(true);try{let E=await r(l.trim(),g);E&&(a([...e,E]),m(""),y(zs[Math.floor(Math.random()*zs.length)]||"#2E94FF"));}finally{p(false);}}},L=(E,te)=>{te.stopPropagation(),a(e.filter(O=>O.id!==E));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:f,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${E.color}20`,color:E.color},children:E.name},E.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:v,type:"text",value:l,onChange:E=>m(E.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:E=>{E.key==="Enter"&&l.trim()&&!T&&r&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(E=>jsxRuntime.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:`${E.color}20`,color:E.color},onClick:te=>L(E.id,te),children:[E.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},E.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(E=>{let te=e.some(O=>O.id===E.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(E),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:te?`${E.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{te||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{te||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:E.name}),te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:E.color}})]},E.id)}):l.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!T&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:zs.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(E),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:E,outline:g===E?`2px solid ${E}`:"none",outlineOffset:"2px"}},E))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function xl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Bu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(xl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Bo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Ru(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Nb(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 Db({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function vl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Nb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Ru(e.loggedMinutes),l=e.estimateMinutes?Ru(e.estimateMinutes):null,m=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Db,{className:i[t]}),jsxRuntime.jsx("span",{children:m})]})}function Sb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Ws(e){let t=Sb(e);return t!==null?String(t):e}function $u(e){let a=Ws(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Vs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Mb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Pb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Ab({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Hu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Lb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function wl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:m,className:d}){let[p,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?Vs(t.estimateMinutes):""),[h,f]=react.useState(""),[b,w]=react.useState(false),[v,C]=react.useState(false),T=react.useRef(null);react.useEffect(()=>{T.current?.focus();},[]);let D=async()=>{let $=$u(p);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},k=async()=>{if(!n)return;let $=y.trim()?$u(y):null;await n($),C(false);},L=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&m?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Hu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Mb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Ab,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Hu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Pb,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Lb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:T,type:"text",value:p,onChange:$=>g($.target.value),onKeyDown:L,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:D,disabled:b||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:$=>f($.target.value),onKeyDown:L,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Vs(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),v?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:$=>x($.target.value),onKeyDown:$=>{$.key==="Enter"&&k(),$.key==="Escape"&&C(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Vs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Vs($.durationMinutes)})]},$.id))})]})]})}function $b(e){let a=Ws(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Hb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Wr({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=react.useState(Hb(r)),[l,m]=react.useState(""),[d,p]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let w=$b(i);await o(w&&w>0?w:null,l||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:l,onChange:w=>m(w.target.value),onKeyDown:h,placeholder:b?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:y,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:b?"Quitar":"Clear"})]})]})}function zb(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 Ub(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 Cl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=zb(e.health),s=Ub(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function sn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Vb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Gb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function _b(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function jb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",sn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:sn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:sn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Kb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?sn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:sn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,sn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Gb(e.status,a),Vb(e.status,a)),children:_b(e.status,t)})})]})}function Tl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",m=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(jb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:p,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",l),children:g.map(y=>jsxRuntime.jsx(Kb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function ln(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ih(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function qu(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function lh(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 Zr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:v,timeEntries:C=[],isTimerRunning:T=false,timerElapsedSeconds:D=0,onTimeLog:k,onEstimateUpdate:L,onSoldEffortUpdate:$,onTimerStart:E,onTimerStop:te,onTimerDiscard:O,blurFinancials:H=false}){let M=s==="dark",J={textTertiary:M?"#6B7280":"#9CA3AF",textSecondary:M?"#9CA3AF":"#6B7280",textPrimary:M?"#FFFFFF":"#111827",borderLight:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:M?"#1A1D25":"#FFFFFF",bgSecondary:M?"#0A0A0A":"#F9FAFB",hoverBg:M?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),Re=e,[B,Y]=react.useState(e?qu(e,i):null),[ye,Ge]=react.useState(false),[U,oe]=react.useState(false),[Z,Ee]=react.useState(false),[ke,Ie]=react.useState(null),[He,et]=react.useState(new Date),[ae,Xe]=react.useState(false),[me,at]=react.useState(false),[mt,Pt]=react.useState(""),[Ce,xt]=react.useState(false),[nt,Je]=react.useState(false),[z,se]=react.useState(false),[S,q]=react.useState(false),[ue,Te]=react.useState(""),W=react.useRef(null),re=react.useRef(null),[Ue,Ne]=react.useState(""),ze=react.useRef(null),[Me,Ke]=react.useState(""),[lt,ut]=react.useState(false),[st,Ze]=react.useState([]),[zt,Ct]=react.useState(""),[ht,wt]=react.useState(false),rt=react.useRef(null);react.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 N=qu(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:N?.id,taskName:N?.name,soldEffortMinutes:N?.soldEffortMinutes,quotedMinutes:N?.quotedMinutes,effortMinutes:N?.effortMinutes,timeLoggedMinutes:N?.timeLoggedMinutes}),Y(N),Te(N.description||""),Ne(N.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!ue)return;let N=setTimeout(()=>{let j=re.current;j&&(j.style.height="auto",j.style.height=`${Math.max(100,j.scrollHeight)}px`);},50);return ()=>clearTimeout(N)},[t,ue]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),ze.current&&clearTimeout(ze.current);},[]),react.useEffect(()=>{t&&rt.current&&y.length>0&&setTimeout(()=>{rt.current&&(rt.current.scrollTop=rt.current.scrollHeight);},100);},[t,y.length]);let Lt=react.useCallback(N=>{Y(N),ee&&o&&Re?o(lh(N,Re)):r&&r(N);},[ee,Re,o,r]),We=react.useCallback(()=>{Ge(false),oe(false),Ee(false),Ie(null),at(false),Pt(""),xt(false);},[]),Be=react.useCallback((N,j)=>{if(!B)return;let xe={...B,[N]:j};Lt(xe);},[B,Lt]),pt=react.useCallback(()=>{let N=re.current;N&&(N.style.height="auto",N.style.height=`${Math.max(100,N.scrollHeight)}px`);},[]),le=react.useCallback(N=>{Te(N),setTimeout(pt,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(B){let j={...B,description:N};Lt(j);}},800);},[B,Lt,pt]),be=react.useCallback(N=>{Ne(N),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{if(B&&N.trim()){let j={...B,name:N.trim()};Lt(j);}},800);},[B,Lt]),A=react.useCallback(N=>{let j=N.map(xe=>{let Le={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:xe};return xe.type.startsWith("image/")&&(Le.preview=URL.createObjectURL(xe)),Le});Ze(xe=>[...xe,...j]);},[]),K=react.useCallback(N=>{Ze(j=>{let xe=j.find(Le=>Le.id===N);return xe?.preview&&URL.revokeObjectURL(xe.preview),j.filter(Le=>Le.id!==N)});},[]),X=react.useCallback(async()=>{if(!(!B||!Me.trim()&&st.length===0||!x)){ut(true);try{let N=Pu(Me,f),j=[];if(st.length>0&&b){let xe=st.map(Le=>Le.file);j=await b(xe);}await x(B.id,Me.trim(),N.length>0?N:void 0,j.length>0?j:void 0),Ke(""),st.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),Ze([]);}finally{ut(false);}}},[B,Me,st,x,f,b]),ge=react.useCallback(()=>{if(!B||!zt.trim())return;let N=B.subtasks||[],j={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:zt.trim(),progress:0,startDate:new Date,endDate:new Date,position:N.length},xe=[...N,j],Le={...B,subtasks:xe};Lt(Le),Ct(""),wt(false);},[B,zt,Lt]),Fe=react.useCallback(N=>{if(!B?.subtasks)return;let j=B.subtasks.map(Le=>Le.id===N?{...Le,progress:Le.progress===100?0:100}:Le),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ye=react.useCallback(N=>{if(!B?.subtasks)return;let j=B.subtasks.filter(Le=>Le.id!==N),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ve=react.useCallback(N=>{let j=typeof N=="string"?new Date(N):N,Le=new Date().getTime()-j.getTime(),Qe=Math.floor(Le/6e4),tt=Math.floor(Le/36e5),vt=Math.floor(Le/864e5);return Qe<1?n==="es"?"Ahora":"Just now":Qe<60?n==="es"?`Hace ${Qe} min`:`${Qe}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:vt<7?n==="es"?`Hace ${vt}d`:`${vt}d ago`:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Oe=react.useCallback(N=>{if(!B)return;let j=B.progress||0;N==="completed"?j=100:N==="in-progress"&&j===0?j=10:N==="todo"&&(j=0);let xe={...B,status:N,progress:j};Lt(xe),Ge(false);},[B,Lt]),bt=react.useCallback((N,j)=>{if(!B)return;let xe={...B,startDate:N,endDate:j};Lt(xe);},[B,Lt]),gt=react.useCallback(()=>{let N=He.getFullYear(),j=He.getMonth(),xe=new Date(N,j,1),Qe=new Date(N,j+1,0).getDate(),tt=xe.getDay(),vt=[],Rt=new Date(N,j,0).getDate();for(let Ot=tt-1;Ot>=0;Ot--)vt.push({date:new Date(N,j-1,Rt-Ot),isCurrentMonth:false});for(let Ot=1;Ot<=Qe;Ot++)vt.push({date:new Date(N,j,Ot),isCurrentMonth:true});let na=42-vt.length;for(let Ot=1;Ot<=na;Ot++)vt.push({date:new Date(N,j+1,Ot),isCurrentMonth:false});return vt},[He]),P=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),se(false),!B||!d)return;let j=Array.from(N.dataTransfer.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}}},[B,d]),de=react.useCallback(async N=>{if(!B||!d||!N.target.files)return;let j=Array.from(N.target.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}N.target.value="";}},[B,d]),fe=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),se(true);},[]),I=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),se(false);},[]),G=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),ce=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",M?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",M?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",M?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=B.progress===100?0:100,xe={...B,progress:N,status:N===100?"completed":"todo"};Lt(xe);},className:u("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":M?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:N=>be(N.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":M?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{We(),Ge(!ye);},className:u("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-blue-500/20 text-blue-400":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>Oe(N.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",B.status===N.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:M?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),Ee(!Z);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((N,j)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},j)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(N=>{let j=B.assignees?.some(xe=>xe.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.assignees||[],Le;j?Le=xe.filter(Qe=>Qe.name!==N.name):Le=[...xe,N],Be("assignees",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",j&&(M?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",M?"text-white":"text-gray-900"),children:N.name}),j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(ke?null:"start"),et(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",M?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",M?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,j=new Date(N);j.setDate(N.getDate()+1);let xe=new Date(N);xe.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Le=new Date(N);Le.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let Qe=new Date(N);Qe.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let tt=new Date(N);tt.setDate(N.getDate()+14);let vt=new Date(N);return vt.setDate(N.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Qe,display:Qe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:vt,display:vt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,Ot)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ke==="start"){let _a=B.endDate&&na.date>B.endDate?na.date:B.endDate;bt(na.date,_a),Ie("end");}else {let _a=B.startDate&&na.date<B.startDate?na.date:B.startDate;bt(_a,na.date),Ie(null);}},children:[jsxRuntime.jsx("span",{children:na.label}),jsxRuntime.jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:na.display})]},Ot))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",M?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{bt(void 0,void 0),Ie(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",M?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ke==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",M?"text-white":"text-gray-900"),children:He.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>et(new Date),className:u("p-1 rounded text-sm transition-colors",M?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()-1)),className:u("p-1 rounded",M?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()+1)),className:u("p-1 rounded",M?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",M?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((N,j)=>{let xe=N.date.toDateString()===new Date().toDateString(),Le=B.startDate?.toDateString()===N.date.toDateString(),Qe=B.endDate?.toDateString()===N.date.toDateString(),tt=Le||Qe,vt=B.startDate&&B.endDate&&N.date>=B.startDate&&N.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Rt=new Date(N.date);if(ke==="start"){let na=B.endDate&&Rt>B.endDate?Rt:B.endDate;bt(Rt,na),Ie("end");}else {let na=B.startDate&&Rt<B.startDate?Rt:B.startDate;bt(na,Rt),Ie(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(M?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(M?"text-white":"text-gray-900"),xe&&"ring-2 ring-[#2E94FF]",Le&&"bg-[#2E94FF] text-white",Qe&&!Le&&"bg-[#7C3AED] text-white",vt&&!tt&&(M?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(M?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},j)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{We(),oe(!U);},className:u("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":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{Be("priority",N.id),oe(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",B.priority===N.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:M?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",M?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:N=>{let j=parseInt(N.target.value),xe=B.status;j===100?xe="completed":j>0?xe="in-progress":xe="todo";let Le={...B,progress:j,status:xe};Lt(Le);},onBlur:()=>Xe(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",M?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",M?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",M?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:v?.estimateMinutes?ln(v.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):v?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ln(v.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"estimate",locale:n,isDark:M,currentValue:v?.estimateMinutes||null,onSave:async N=>{await L?.(B.id,N),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",M?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?ln(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ln(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="quoted"&&!H&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"quoted",locale:n,isDark:M,currentValue:B.quotedMinutes||null,onSave:async N=>{$?(await $(B.id,N),Y(j=>j?{...j,quotedMinutes:N}:null)):Be("quotedMinutes",N),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",M?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):T?jsxRuntime.jsxs("button",{type:"button",onClick:()=>te?.(B.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),ih(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>E?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",M?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Je("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",M?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),v&&v.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",v.health==="over-budget"?"text-red-500":v.health==="at-risk"?"text-yellow-500":M?"text-white":"text-gray-900"),children:[ln(v.loggedMinutes),v.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",M?"text-[#6B7280]":"text-gray-400"),children:[" / ",ln(v.estimateMinutes)]})]}),v.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",v.health==="over-budget"?"bg-red-500":v.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,v.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"log",locale:n,isDark:M,currentValue:null,onSave:async(N,j)=>{N&&await k?.(B.id,{durationMinutes:N,note:j,source:"manual"}),Je(false);},onClose:()=>Je(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(po,{selectedTags:B.tags||[],availableTags:c,onChange:N=>{Be("tags",N);},onCreateTag:l,theme:J})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(N=>{let j=g.find(xe=>xe.id===N);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",M?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[j?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let xe=(B.dependencies||[]).filter(Le=>Le!==N);Be("dependencies",xe);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{We(),at(!me);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Pt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",M?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:mt,onChange:N=>Pt(N.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",M?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(N=>N.id!==B.id).filter(N=>mt===""||N.name.toLowerCase().includes(mt.toLowerCase())).map(N=>{let j=B.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.dependencies||[],Le;j?Le=xe.filter(Qe=>Qe!==N.id):Le=[...xe,N.id],Be("dependencies",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",j&&(M?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",j?"bg-blue-500 border-blue-500":M?"border-white/30":"border-gray-300"),children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:u("block truncate",M?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),xt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:Bo.find(N=>N.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Bo.map(N=>{let j=B.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{Be("color",N.value),xt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",j&&"ring-2 ring-offset-2",M?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:j?N.value:void 0},title:N.name,children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:N=>Be("isMilestone",N.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":M?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:re,value:ue,onChange:N=>le(N.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",M?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(N=>N.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((N,j)=>(N.position??0)-(j.position??0)).map(N=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",M?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Fe(N.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",N.progress===100?"bg-green-500 border-green-500":M?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",N.progress===100?"line-through text-[#6B7280]":M?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("button",{onClick:()=>Ye(N.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",M?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},N.id))}),ht?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:zt,onChange:N=>Ct(N.target.value),onKeyDown:N=>{N.key==="Enter"&&zt.trim()?ge():N.key==="Escape"&&(wt(false),Ct(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",M?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:ge,disabled:!zt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",zt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":M?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{wt(false),Ct("");},className:u("p-2 rounded-lg transition-colors",M?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>wt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",M?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:m.map(N=>{let j=ce(N.type),xe=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[xe&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",M?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(j,{className:u("w-5 h-5",M?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",M?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:G(N.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(N.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",M?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:fe,onDragLeave:I,onDrop:P,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?M?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":M?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:de,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||S}),S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",z?"text-blue-500":M?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:z?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",M?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",M?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Bf=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),ty=require('react-markdown'),ay=require('remark-gfm'),ry=require('rehype-sanitize'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Bf__default=/*#__PURE__*/_interopDefault(Bf);var ty__default=/*#__PURE__*/_interopDefault(ty);var ay__default=/*#__PURE__*/_interopDefault(ay);var ry__default=/*#__PURE__*/_interopDefault(ry);var Ms=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Fs=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [Fs.Translate.toString(e),Fs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ps(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 Ff(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ll(e,t){return e.length===0?1e3:t===0?Ps(null,e[0].position):t>=e.length?Ps(e[e.length-1].position,null):Ps(e[t-1].position,e[t].position)}function Jc(e,t=100){return e>t}var Pf=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 Af(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function As(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Pf,onRetry:i}=t,c,l=0;for(let m=1;m<=a;m++){l=m;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(c=d,m===a||!n(c,m))return {error:c,attempts:l,success:false};let g=Af(m,r,o,s);if(i)try{i(c,m,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function Lf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function If(e,t={}){return async(...a)=>As(()=>e(...a),t)}var dl=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Qc=(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))(Qc||{}),Fo=class Fo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(i,o,c?n:"");break;case "INFO":console.info(i,o,c?n:"");break;case "WARN":console.warn(i,o,c?n:"");break;case "ERROR":console.error(i,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Fo.globalOptions};}static configure(t){Fo.globalOptions={...Fo.globalOptions,...t};}child(t){return new Fo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ls((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ls(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Qc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Fo.globalOptions={};var cl=Fo,Ls=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Zc=new cl;function Rf(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Of(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(i=>i.id===s.columnId);return [s.id,ul(s.title),ul(s.description||""),ul(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function $f(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Bf__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,m=n.width/n.height,d=c-20,p=d/m;p>l-20&&(p=l-20,d=p*m);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(i,"PNG",y,20,d,p),g}catch(n){console.error("Error capturing board:",n);}let o=new jspdf.jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(c.description,160);o.text(m,25,s),s+=m.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let m=[];c.startDate&&m.push(`Start: ${c.startDate}`),c.endDate&&m.push(`End: ${c.endDate}`),l.push(m.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ul(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function tu(e,t,a,r){switch(t){case "json":return Rf(e,r);case "csv":return Of(e);case "pdf":return await $f(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function au(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:n[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function Hf(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function zf(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=ru(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=ru(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,y)=>{l[g]=i[y]||"";});let m=l.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ru(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function ou(e,t){switch(t){case "json":return Hf(e);case "csv":return zf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function nu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var pl=react.createContext(null);function su(){return react.useContext(pl)}var iu=react.createContext(null);function lu({children:e,themeName:t}){return jsxRuntime.jsx(iu.Provider,{value:{themeName:t},children:e})}function an(){return react.useContext(iu)}function Wt({children:e,container:t}){let[a,r]=react.useState(false),o=su(),s=an();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):reactDom.createPortal(e,n)}var mu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Yf="#BDC3C7",qf=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Po({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,b=220,f=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let v=y-g.bottom,N=g.top,C;v>=b+f?C=g.bottom+f:N>=b+f?C=g.top-b-f:C=v>=N?g.bottom+f:Math.max(10,g.top-b-f),n({top:C,left:w}),o(true);};react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?mu[e]:null,p=d?.color||Yf;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})})}),r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(mu).map(([g,y])=>jsxRuntime.jsxs("button",{onClick:()=>m(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.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:[jsxRuntime.jsx(qf,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Xf=[{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 Bn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),p=(an()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),v=window.innerHeight,N=window.innerWidth,C=320,D=380,k=4,L=w.left;L+C>N-10&&(L=N-C-10),L<10&&(L=10);let $=v-w.bottom,E=w.top,Z;$>=D+k?Z=w.bottom+k:E>=D+k?Z=w.top-D-k:Z=$>=E?w.bottom+k:Math.max(10,w.top-D-k),i({top:Z,left:L}),s(true);};react.useEffect(()=>{let w=v=>{c.current&&!c.current.contains(v.target)&&!l.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),react.useEffect(()=>{let w=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let v=new Date,N=L=>{let $=L.getFullYear(),E=String(L.getMonth()+1).padStart(2,"0"),Z=String(L.getDate()).padStart(2,"0");return `${$}-${E}-${Z}`},C=N(v),D=new Date(v);D.setDate(D.getDate()+w);let k=N(D);a(C,k),s(false);},x=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=D.split("-").map(Number);if(k.length!==3||k.some(Z=>isNaN(Z)))return null;let L=k[0],$=k[1],E=k[2];return L===void 0||$===void 0||E===void 0?null:new Date(L,$-1,E)},v=w(e),N=w(t);if(!v||!N||isNaN(v.getTime())||isNaN(N.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[v.getMonth()]} ${v.getDate()} \u2013 ${C[N.getMonth()]} ${N.getDate()}`},h=e&&t,f=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),w<v})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${f?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background: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:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.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"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Xf.map(w=>jsxRuntime.jsx("button",{onClick:()=>y(w.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:v=>{v.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Lo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[i,c]=react.useState(""),[l,m]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),g=()=>{if(!p.current)return;let f=p.current.getBoundingClientRect(),w=window.innerHeight,v=window.innerWidth,N=300,C=380,D=4,k=f.right-N;k<10&&(k=f.left),k+N>v-10&&(k=v-N-10);let L=w-f.bottom,$=f.top,E;L>=C+D?E=f.bottom+D:$>=C+D?E=f.top-C-D:E=L>=$?f.bottom+D:Math.max(10,f.top-C-D),m({top:E,left:k}),n(true);};react.useEffect(()=>{let f=w=>{d.current&&!d.current.contains(w.target)&&!p.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s]);let y=f=>{let w=e.some(v=>v.id===f.id);a(w?e.filter(v=>v.id!==f.id):[...e,f]);},x=t.filter(f=>f.name.toLowerCase().includes(i.toLowerCase())),h=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(f=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:f.name,children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"asakaa-avatar-img"}):f.initials},f.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.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:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:f=>c(f.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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.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(f=>{let w=e.some(v=>v.id===f.id);return jsxRuntime.jsxs("button",{onClick:()=>y(f),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.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:f.color,color:"#fff"},children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"w-full h-full rounded-full object-cover"}):f.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:f.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},f.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Is(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let m of l){if(!s.has(m)&&i(m))return true;if(n.has(m))return true}}return n.delete(c),false};return i(a)}function On({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=react.useState(false),[l,m]=react.useState(""),[d,p]=react.useState(t.length>0),[g,y]=react.useState({top:0,left:0}),[x,h]=react.useState(null),b=react.useRef(null),f=react.useRef(null),w=()=>{if(!f.current)return;let k=f.current.getBoundingClientRect(),L=window.innerHeight,$=window.innerWidth,E=300,Z=d?380:120,O=4,H=k.right-E;H<10&&(H=k.left),H+E>$-10&&(H=$-E-10);let F=L-k.bottom,J=k.top,te;F>=Z+O?te=k.bottom+O:J>=Z+O?te=k.top-Z-O:te=F>=J?k.bottom+O:Math.max(10,k.top-Z-O),y({top:te,left:H}),c(true);};react.useEffect(()=>{if(!i||!f.current)return;let k=f.current.getBoundingClientRect(),L=window.innerHeight,$=window.innerWidth,E=300,Z=d?380:120,O=4,H=k.right-E;H<10&&(H=k.left),H+E>$-10&&(H=$-E-10);let F=L-k.bottom,J=k.top,te;F>=Z+O?te=k.bottom+O:J>=Z+O?te=k.top-Z-O:te=F>=J?k.bottom+O:Math.max(10,k.top-Z-O),y({top:te,left:H});},[d,i]),react.useEffect(()=>{let k=L=>{b.current&&!b.current.contains(L.target)&&!f.current?.contains(L.target)&&(c(false),m(""));};if(i)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),react.useEffect(()=>{let k=L=>{L.key==="Escape"&&(c(false),m(""));};if(i)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]);let v=k=>{let L=t.includes(k),$=a.find(E=>E.id===k);if(h(null),L){let E=t.filter(Z=>Z!==k);r(E),E.length===0&&p(false);}else {if(s&&Is(a,k,e)){let Z=`Cannot add "${$?.title||k}" as dependency - would create circular reference`;h(Z),n?.(k,$?.title||k),setTimeout(()=>h(null),3e3);return}r([...t,k]),p(true);}},N=()=>{let k=!d;p(k),k||r([]);},C=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(l.toLowerCase())||k.id.toLowerCase().includes(l.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:f,onClick:()=>i?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:k=>m(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})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.length===0?jsxRuntime.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"}):C.map(k=>{let L=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>v(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:$=>{$.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:$=>{$.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.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&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Jr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Fs.Transform.toString(p),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:x,...l,...m,onClick:()=>a?.(e),children:t(e)});let h=i.filter(v=>e.assignedUserIds?.includes(v.id)),b=e.progress===100,f=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...m,onClick:v=>{v.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:v=>{v.currentTarget.style.display="none";}})}),f.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:f.length===1&&f[0]?jsxRuntime.jsx("img",{src:f[0].url,alt:f[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:v=>{v.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:f.slice(0,4).map((v,N)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),N===3&&f.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",f.length-4]})})]},v.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Po,{priority:e.priority,onChange:v=>n?.(e.id,{priority:v})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Bn,{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:(v,N)=>n?.(e.id,{startDate:v,endDate:N})})}),i.length>0&&jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Lo,{assignedUsers:h,availableUsers:i,onChange:v=>n?.(e.id,{assignedUserIds:v.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(On,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:c,onChange:v=>n?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsxRuntime.jsx("span",{className:"asakaa-label",children:v},v))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#2E94FF"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#2E94FF"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Jr.displayName="Card";var Bs={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"}},Cu=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Tu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),l=react.useRef(null),m=[...Object.entries(Bs).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(Bs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Bs[e];if(h)return {...h,id:e};let b=r.find(f=>f.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Bs.todo,id:"todo"}},p=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),b=window.innerHeight,f=window.innerWidth,w=180,v=280,N=4,C=h.right-w;C<10&&(C=h.left),C+w>f-10&&(C=f-w-10);let D=b-h.bottom,k=h.top,L;D>=v+N?L=h.bottom+N:k>=v+N?L=h.top-v-N:L=D>=k?h.bottom+N:Math.max(10,h.top-v-N),i({top:L,left:C}),s(true);};react.useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!l.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o?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:y.label,children:jsxRuntime.jsx(Cu,{icon:y.icon,color:x})}),o&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.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"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(h=>jsxRuntime.jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Cu,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Nu={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 Du({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Nu[s]||Nu.en,[i,c]=react.useState(false),[l,m]=react.useState(false),[d,p]=react.useState(e),[g,y]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(i&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[i]),react.useEffect(()=>{let N=C=>{x.current&&!x.current.contains(C.target)&&!h.current?.contains(C.target)&&(c(false),m(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),react.useEffect(()=>{let N=C=>{C.key==="Escape"&&(c(false),m(false),p(e));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,e]),react.useEffect(()=>{l&&b.current&&(b.current.focus(),b.current.select());},[l]);let f=()=>{m(true),p(e);},w=()=>{let N=d.trim();N&&N!==e&&t(N),m(false),c(false),p(e);},v=N=>{N.key==="Enter"?w():N.key==="Escape"&&(m(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsxRuntime.jsx("input",{ref:b,type:"text",value:d,onChange:N=>p(N.target.value),onKeyDown:v,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:f,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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:n.rename})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var nn=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:b,renderMetrics:f,locale:w})=>{let{setNodeRef:v,isOver:N}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),C=react.useRef(null),D=m??Jc(t.length),k=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:v,className:b,children:a(e,t)});let $=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),E=$.state==="exceeded",Z=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",E&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u(Z()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&$.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${$.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[$.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),$.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),$.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),$.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||x)&&jsxRuntime.jsx(Du,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsxRuntime.jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),f&&f(e,t),!p&&jsxRuntime.jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(O=>O.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(O=>{let H=t[O.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsxRuntime.jsx(Jr,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsxRuntime.jsx(Jr,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});nn.displayName="Column";function hl({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},l=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:i,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function bb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Au(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(l===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function hb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var xb=["\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 Lu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=i==="dark",[b,f]=react.useState(false),[w,v]=react.useState([]),[N,C]=react.useState(0),[D,k]=react.useState(null),[L,$]=react.useState(false),E=react.useRef(null),Z=react.useRef(null),O=react.useRef(null),H=react.useRef(null),F=react.useCallback((U,oe)=>{let ee=bb(U,oe);if(k(ee),ee){let Ee=r.filter(ke=>ke.name.toLowerCase().includes(ee.query)||ke.email&&ke.email.toLowerCase().includes(ee.query)).slice(0,5);v(Ee),f(Ee.length>0),C(0);}else f(false),v([]);},[r]),J=U=>{let oe=U.target.value;if(t(oe),F(oe,U.target.selectionStart||0),E.current){E.current.style.height="24px";let ee=E.current.scrollHeight,Ee=280,ke=Math.min(ee,Ee);E.current.style.height=`${ke}px`,E.current.style.overflowY=ee>Ee?"auto":"hidden";}},te=()=>{E.current&&F(e,E.current.selectionStart||0);},Re=react.useCallback(U=>{if(!D||!E.current)return;let oe=e.slice(0,D.start),ee=e.slice(D.end),Ee=`@${U.name.replace(/\s+/g,"")} `,ke=oe+Ee+ee;t(ke),f(false),k(null),setTimeout(()=>{if(E.current){let Ie=D.start+Ee.length;E.current.selectionStart=Ie,E.current.selectionEnd=Ie,E.current.focus();}},0);},[D,e,t]),B=U=>{if(b&&w.length>0)switch(U.key){case "ArrowDown":U.preventDefault(),C(oe=>oe<w.length-1?oe+1:0);break;case "ArrowUp":U.preventDefault(),C(oe=>oe>0?oe-1:w.length-1);break;case "Enter":{U.preventDefault();let oe=w[N];oe&&Re(oe);break}case "Tab":{U.preventDefault();let oe=w[N];oe&&Re(oe);break}case "Escape":U.preventDefault(),f(false);break}else U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),a());};react.useEffect(()=>{let U=oe=>{Z.current&&!Z.current.contains(oe.target)&&E.current&&!E.current.contains(oe.target)&&f(false),H.current&&!H.current.contains(oe.target)&&$(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let Y=react.useCallback(U=>{if(!E.current)return;let oe=E.current.selectionStart||e.length,ee=e.slice(0,oe)+U+e.slice(oe);t(ee),$(false),setTimeout(()=>{if(E.current){let Ee=oe+U.length;E.current.selectionStart=Ee,E.current.selectionEnd=Ee,E.current.focus();}},0);},[e,t]),ye=react.useCallback(U=>{if(!g||!U.target.files)return;let oe=Array.from(U.target.files),ee=x*1024*1024,Ee=oe.filter(ke=>ke.size>ee?(console.warn(`File ${ke.name} exceeds max size of ${x}MB`),false):true);Ee.length>0&&g(Ee),U.target.value="";},[g,x]),Ge=react.useCallback(U=>U.type.startsWith("image/")?lucideReact.Image:U.type.includes("pdf")||U.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&Z.current){let U=Z.current.children[N];U&&U.scrollIntoView({block:"nearest"});}},[N,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(U=>{let oe=Ge(U.file),ee=U.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[ee&&U.preview?jsxRuntime.jsx("img",{src:U.preview,alt:U.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(oe,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:U.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:yb(U.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(U.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},U.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[l&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$(!L),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsx(framerMotion.motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:xb.map(U=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Y(U),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:U},U))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:O,type:"file",multiple:true,onChange:ye,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:E,value:e,onChange:J,onSelect:te,onKeyDown:B,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&w.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((U,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Re(U),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",oe===N?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:U.color||"#8B5CF6"},children:hb(U.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:U.name}),U.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:U.email})]})]},U.id))})})]})]})]})}function Iu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsxRuntime.jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsxRuntime.jsx("span",{children:i.value},c))})}var zs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function po({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=react.useState(false),[l,m]=react.useState(""),[d,p]=react.useState(false),[g,y]=react.useState(zs[10]||"#2E94FF"),[x,h]=react.useState({top:0,left:0}),b=react.useRef(null),f=react.useRef(null),w=react.useRef(null),v=react.useRef(null),N=t.filter(E=>E.name.toLowerCase().includes(l.toLowerCase())),C=t.some(E=>E.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(i&&f.current){let E=f.current.getBoundingClientRect();h({top:E.bottom+6,left:E.left});}},[i]),react.useEffect(()=>{let E=Z=>{let O=Z.target,H=b.current?.contains(O),F=w.current?.contains(O);!H&&!F&&(c(false),m(""),p(false));};if(i)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useEffect(()=>{i&&v.current&&v.current.focus();},[i]);let D=E=>{let Z=e.some(O=>O.id===E.id);a(Z?e.filter(O=>O.id!==E.id):[...e,E]);},k=async()=>{if(!(!r||!l.trim())){p(true);try{let E=await r(l.trim(),g);E&&(a([...e,E]),m(""),y(zs[Math.floor(Math.random()*zs.length)]||"#2E94FF"));}finally{p(false);}}},L=(E,Z)=>{Z.stopPropagation(),a(e.filter(O=>O.id!==E));},$={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:f,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:$,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(E=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${E.color}20`,color:E.color},children:E.name},E.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:v,type:"text",value:l,onChange:E=>m(E.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:E=>{E.key==="Enter"&&l.trim()&&!C&&r&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(E=>jsxRuntime.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:`${E.color}20`,color:E.color},onClick:Z=>L(E.id,Z),children:[E.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},E.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(E=>{let Z=e.some(O=>O.id===E.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>D(E),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:Z?`${E.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{Z||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{Z||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:E.name}),Z&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:E.color}})]},E.id)}):l.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!C&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:zs.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(E),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:E,outline:g===E?`2px solid ${E}`:"none",outlineOffset:"2px"}},E))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function xl({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Ru({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsxRuntime.jsx(xl,{tag:s,size:a},s.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Bo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Ou(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Eb(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 Mb({className:e}){return jsxRuntime.jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function vl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Eb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Ou(e.loggedMinutes),l=e.estimateMinutes?Ou(e.estimateMinutes):null,m=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsxRuntime.jsx(Mb,{className:i[t]}),jsxRuntime.jsx("span",{children:m})]})}function Fb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Ws(e){let t=Fb(e);return t!==null?String(t):e}function Hu(e){let a=Ws(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Vs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Lb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Ib({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Bb({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function zu({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Rb({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function wl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:m,className:d}){let[p,g]=react.useState(""),[y,x]=react.useState(t.estimateMinutes?Vs(t.estimateMinutes):""),[h,b]=react.useState(""),[f,w]=react.useState(false),[v,N]=react.useState(false),C=react.useRef(null);react.useEffect(()=>{C.current?.focus();},[]);let D=async()=>{let $=Hu(p);if(!($<=0||!s)){w(true);try{await s({durationMinutes:$,note:h.trim()||void 0,source:"manual"}),g(""),b("");}finally{w(false);}}},k=async()=>{if(!n)return;let $=y.trim()?Hu(y):null;await n($),N(false);},L=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),D()),$.key==="Escape"&&m?.();};return jsxRuntime.jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(zu,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:r?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Lb(o)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Bb,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(zu,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Ib,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Rb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:C,type:"text",value:p,onChange:$=>g($.target.value),onKeyDown:L,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:D,disabled:f||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:$=>b($.target.value),onKeyDown:L,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Vs(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),v?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:y,onChange:$=>x($.target.value),onKeyDown:$=>{$.key==="Enter"&&k(),$.key==="Escape"&&N(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Vs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map($=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:$.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Vs($.durationMinutes)})]},$.id))})]})]})}function Ub(e){let a=Ws(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Wb(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Wr({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=react.useState(Wb(r)),[l,m]=react.useState(""),[d,p]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let w=Ub(i);await o(w&&w>0?w:null,l||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},f=t==="es";return jsxRuntime.jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:l,onChange:w=>m(w.target.value),onKeyDown:h,placeholder:f?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:y,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?f?"Guardando...":"Saving...":f?"Registrar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:d,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:f?"Quitar":"Clear"})]})]})}function Vb(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 Gb(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 Cl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Vb(e.health),s=Gb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsxRuntime.jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsxRuntime.jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxRuntime.jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsxRuntime.jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsxRuntime.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&&jsxRuntime.jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function sn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function jb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Kb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Yb(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 qb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",sn(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsxRuntime.jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:sn(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:sn(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Xb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?sn(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:sn(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,sn(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Kb(e.status,a),jb(e.status,a)),children:Yb(e.status,t)})})]})}function Tl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",m=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(qb,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:p,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsxRuntime.jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:u("divide-y",l),children:g.map(y=>jsxRuntime.jsx(Xb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsxRuntime.jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function ln(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ch(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Xu(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function uh(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 Zr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:f,enableTimeTracking:w=false,timeTrackingSummary:v,timeEntries:N=[],isTimerRunning:C=false,timerElapsedSeconds:D=0,onTimeLog:k,onEstimateUpdate:L,onSoldEffortUpdate:$,onTimerStart:E,onTimerStop:Z,onTimerDiscard:O,blurFinancials:H=false}){let F=s==="dark",J={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},te=e&&"title"in e&&!("name"in e),Re=e,[B,Y]=react.useState(e?Xu(e,i):null),[ye,Ge]=react.useState(false),[U,oe]=react.useState(false),[ee,Ee]=react.useState(false),[ke,Ie]=react.useState(null),[He,et]=react.useState(new Date),[ae,Xe]=react.useState(false),[me,at]=react.useState(false),[mt,Pt]=react.useState(""),[Ce,xt]=react.useState(false),[nt,Je]=react.useState(false),[z,se]=react.useState(false),[S,q]=react.useState(false),[ue,Te]=react.useState(""),W=react.useRef(null),re=react.useRef(null),[Ue,Ne]=react.useState(""),ze=react.useRef(null),[Fe,Ke]=react.useState(""),[lt,ut]=react.useState(false),[st,Ze]=react.useState([]),[zt,Ct]=react.useState(""),[ht,wt]=react.useState(false),rt=react.useRef(null);react.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=Xu(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:T?.id,taskName:T?.name,soldEffortMinutes:T?.soldEffortMinutes,quotedMinutes:T?.quotedMinutes,effortMinutes:T?.effortMinutes,timeLoggedMinutes:T?.timeLoggedMinutes}),Y(T),Te(T.description||""),Ne(T.name||"");}},[e?.id,e?.quotedMinutes,i,t]),react.useEffect(()=>{if(!t||!ue)return;let T=setTimeout(()=>{let j=re.current;j&&(j.style.height="auto",j.style.height=`${Math.max(100,j.scrollHeight)}px`);},50);return ()=>clearTimeout(T)},[t,ue]),react.useEffect(()=>()=>{W.current&&clearTimeout(W.current),ze.current&&clearTimeout(ze.current);},[]),react.useEffect(()=>{t&&rt.current&&y.length>0&&setTimeout(()=>{rt.current&&(rt.current.scrollTop=rt.current.scrollHeight);},100);},[t,y.length]);let Lt=react.useCallback(T=>{Y(T),te&&o&&Re?o(uh(T,Re)):r&&r(T);},[te,Re,o,r]),We=react.useCallback(()=>{Ge(false),oe(false),Ee(false),Ie(null),at(false),Pt(""),xt(false);},[]),Be=react.useCallback((T,j)=>{if(!B)return;let xe={...B,[T]:j};Lt(xe);},[B,Lt]),pt=react.useCallback(()=>{let T=re.current;T&&(T.style.height="auto",T.style.height=`${Math.max(100,T.scrollHeight)}px`);},[]),le=react.useCallback(T=>{Te(T),setTimeout(pt,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(B){let j={...B,description:T};Lt(j);}},800);},[B,Lt,pt]),be=react.useCallback(T=>{Ne(T),ze.current&&clearTimeout(ze.current),ze.current=setTimeout(()=>{if(B&&T.trim()){let j={...B,name:T.trim()};Lt(j);}},800);},[B,Lt]),A=react.useCallback(T=>{let j=T.map(xe=>{let Le={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:xe};return xe.type.startsWith("image/")&&(Le.preview=URL.createObjectURL(xe)),Le});Ze(xe=>[...xe,...j]);},[]),K=react.useCallback(T=>{Ze(j=>{let xe=j.find(Le=>Le.id===T);return xe?.preview&&URL.revokeObjectURL(xe.preview),j.filter(Le=>Le.id!==T)});},[]),X=react.useCallback(async()=>{if(!(!B||!Fe.trim()&&st.length===0||!x)){ut(true);try{let T=Au(Fe,b),j=[];if(st.length>0&&f){let xe=st.map(Le=>Le.file);j=await f(xe);}await x(B.id,Fe.trim(),T.length>0?T:void 0,j.length>0?j:void 0),Ke(""),st.forEach(xe=>{xe.preview&&URL.revokeObjectURL(xe.preview);}),Ze([]);}finally{ut(false);}}},[B,Fe,st,x,b,f]),ge=react.useCallback(()=>{if(!B||!zt.trim())return;let T=B.subtasks||[],j={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:zt.trim(),progress:0,startDate:new Date,endDate:new Date,position:T.length},xe=[...T,j],Le={...B,subtasks:xe};Lt(Le),Ct(""),wt(false);},[B,zt,Lt]),Me=react.useCallback(T=>{if(!B?.subtasks)return;let j=B.subtasks.map(Le=>Le.id===T?{...Le,progress:Le.progress===100?0:100}:Le),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ye=react.useCallback(T=>{if(!B?.subtasks)return;let j=B.subtasks.filter(Le=>Le.id!==T),xe={...B,subtasks:j};Lt(xe);},[B,Lt]),Ve=react.useCallback(T=>{let j=typeof T=="string"?new Date(T):T,Le=new Date().getTime()-j.getTime(),Qe=Math.floor(Le/6e4),tt=Math.floor(Le/36e5),vt=Math.floor(Le/864e5);return Qe<1?n==="es"?"Ahora":"Just now":Qe<60?n==="es"?`Hace ${Qe} min`:`${Qe}m ago`:tt<24?n==="es"?`Hace ${tt}h`:`${tt}h ago`:vt<7?n==="es"?`Hace ${vt}d`:`${vt}d ago`:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Oe=react.useCallback(T=>{if(!B)return;let j=B.progress||0;T==="completed"?j=100:T==="in-progress"&&j===0?j=10:T==="todo"&&(j=0);let xe={...B,status:T,progress:j};Lt(xe),Ge(false);},[B,Lt]),bt=react.useCallback((T,j)=>{if(!B)return;let xe={...B,startDate:T,endDate:j};Lt(xe);},[B,Lt]),gt=react.useCallback(()=>{let T=He.getFullYear(),j=He.getMonth(),xe=new Date(T,j,1),Qe=new Date(T,j+1,0).getDate(),tt=xe.getDay(),vt=[],Rt=new Date(T,j,0).getDate();for(let Ot=tt-1;Ot>=0;Ot--)vt.push({date:new Date(T,j-1,Rt-Ot),isCurrentMonth:false});for(let Ot=1;Ot<=Qe;Ot++)vt.push({date:new Date(T,j,Ot),isCurrentMonth:true});let na=42-vt.length;for(let Ot=1;Ot<=na;Ot++)vt.push({date:new Date(T,j+1,Ot),isCurrentMonth:false});return vt},[He]),P=react.useCallback(async T=>{if(T.preventDefault(),T.stopPropagation(),se(false),!B||!d)return;let j=Array.from(T.dataTransfer.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}}},[B,d]),de=react.useCallback(async T=>{if(!B||!d||!T.target.files)return;let j=Array.from(T.target.files);if(j.length!==0){q(true);try{await d(B.id,j);}finally{q(false);}T.target.value="";}},[B,d]),fe=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),se(true);},[]),I=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),se(false);},[]),G=react.useCallback(T=>T<1024?`${T} B`:T<1024*1024?`${(T/1024).toFixed(1)} KB`:`${(T/(1024*1024)).toFixed(1)} MB`,[]),ce=react.useCallback(T=>T.startsWith("image/")?lucideReact.Image:T.includes("pdf")||T.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",F?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let T=B.progress===100?0:100,xe={...B,progress:T,status:T===100?"completed":"todo"};Lt(xe);},className:u("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":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:T=>be(T.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":F?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{We(),Ge(!ye);},className:u("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-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ge(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(T=>jsxRuntime.jsxs("button",{onClick:()=>Oe(T.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.status===T.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:T.label})]},T.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),Ee(!ee);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((T,j)=>jsxRuntime.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()},j)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(T=>{let j=B.assignees?.some(xe=>xe.name===T.name);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.assignees||[],Le;j?Le=xe.filter(Qe=>Qe.name!==T.name):Le=[...xe,T],Be("assignees",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",j&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.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()}),jsxRuntime.jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:T.name}),j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},T.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(ke?null:"start"),et(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let T=new Date,j=new Date(T);j.setDate(T.getDate()+1);let xe=new Date(T);xe.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Le=new Date(T);Le.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let Qe=new Date(T);Qe.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let tt=new Date(T);tt.setDate(T.getDate()+14);let vt=new Date(T);return vt.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Le,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Qe,display:Qe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:tt,display:tt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:vt,display:vt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,Ot)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ke==="start"){let _a=B.endDate&&na.date>B.endDate?na.date:B.endDate;bt(na.date,_a),Ie("end");}else {let _a=B.startDate&&na.date<B.startDate?na.date:B.startDate;bt(_a,na.date),Ie(null);}},children:[jsxRuntime.jsx("span",{children:na.label}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:na.display})]},Ot))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{bt(void 0,void 0),Ie(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ke==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:He.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>et(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()-1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()+1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((T,j)=>{let xe=T.date.toDateString()===new Date().toDateString(),Le=B.startDate?.toDateString()===T.date.toDateString(),Qe=B.endDate?.toDateString()===T.date.toDateString(),tt=Le||Qe,vt=B.startDate&&B.endDate&&T.date>=B.startDate&&T.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Rt=new Date(T.date);if(ke==="start"){let na=B.endDate&&Rt>B.endDate?Rt:B.endDate;bt(Rt,na),Ie("end");}else {let na=B.startDate&&Rt<B.startDate?Rt:B.startDate;bt(na,Rt),Ie(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(F?"text-white":"text-gray-900"),xe&&"ring-2 ring-[#2E94FF]",Le&&"bg-[#2E94FF] text-white",Qe&&!Le&&"bg-[#7C3AED] text-white",vt&&!tt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!tt&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},j)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{We(),oe(!U);},className:u("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":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>oe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(T=>jsxRuntime.jsxs("button",{onClick:()=>{Be("priority",T.id),oe(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.priority===T.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",T.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:T.label})]},T.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ae?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:T=>{let j=parseInt(T.target.value),xe=B.status;j===100?xe="completed":j>0?xe="in-progress":xe="todo";let Le={...B,progress:j,status:xe};Lt(Le);},onBlur:()=>Xe(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Xe(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:v?.estimateMinutes?ln(v.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):v?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ln(v.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="estimate"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"estimate",locale:n,isDark:F,currentValue:v?.estimateMinutes||null,onSave:async T=>{await L?.(B.id,T),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?ln(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ln(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="quoted"&&!H&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"quoted",locale:n,isDark:F,currentValue:B.quotedMinutes||null,onSave:async T=>{$?(await $(B.id,T),Y(j=>j?{...j,quotedMinutes:T}:null)):Be("quotedMinutes",T),Je(false);},onClose:()=>Je(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxRuntime.jsxs("button",{type:"button",onClick:()=>Z?.(B.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),ch(D||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>E?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>Je("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),v&&v.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",v.health==="over-budget"?"text-red-500":v.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[ln(v.loggedMinutes),v.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",ln(v.estimateMinutes)]})]}),v.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",v.health==="over-budget"?"bg-red-500":v.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,v.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:nt==="log"&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(T,j)=>{T&&await k?.(B.id,{durationMinutes:T,note:j,source:"manual"}),Je(false);},onClose:()=>Je(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(po,{selectedTags:B.tags||[],availableTags:c,onChange:T=>{Be("tags",T);},onCreateTag:l,theme:J})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(T=>{let j=g.find(xe=>xe.id===T);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[j?.name||T.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let xe=(B.dependencies||[]).filter(Le=>Le!==T);Be("dependencies",xe);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},T)})}),jsxRuntime.jsxs("button",{onClick:()=>{We(),at(!me);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{at(false),Pt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:mt,onChange:T=>Pt(T.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(T=>T.id!==B.id).filter(T=>mt===""||T.name.toLowerCase().includes(mt.toLowerCase())).map(T=>{let j=B.dependencies?.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>{let xe=B.dependencies||[],Le;j?Le=xe.filter(Qe=>Qe!==T.id):Le=[...xe,T.id],Be("dependencies",Le);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",j&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",j?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:u("block truncate",F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)})]})]},T.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{We(),xt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Bo.find(T=>T.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xt(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Bo.map(T=>{let j=B.color===T.value;return jsxRuntime.jsx("button",{onClick:()=>{Be("color",T.value),xt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",j&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:T.value,outlineColor:j?T.value:void 0},title:T.name,children:j&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},T.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:T=>Be("isMilestone",T.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:re,value:ue,onChange:T=>le(T.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",F?"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")})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(T=>T.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((T,j)=>(T.position??0)-(j.position??0)).map(T=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Me(T.id),className:u("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":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",T.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("button",{onClick:()=>Ye(T.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},T.id))}),ht?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:zt,onChange:T=>Ct(T.target.value),onKeyDown:T=>{T.key==="Enter"&&zt.trim()?ge():T.key==="Escape"&&(wt(false),Ct(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",F?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsxRuntime.jsx("button",{onClick:ge,disabled:!zt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",zt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{wt(false),Ct("");},className:u("p-2 rounded-lg transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>wt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:m.map(T=>{let j=ce(T.type),xe=T.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[xe&&T.thumbnailUrl?jsxRuntime.jsx("img",{src:T.thumbnailUrl,alt:T.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(j,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:T.name}),jsxRuntime.jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:G(T.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(T.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},T.id)})}),jsxRuntime.jsxs("div",{onDragOver:fe,onDragLeave:I,onDrop:P,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",z?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:de,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||S}),S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:u("w-6 h-6 mx-auto mb-2",z?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:z?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsxRuntime.jsx("p",{className:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
border-radius: 4px !important;
|
|
14
14
|
}
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
|
-
background: ${
|
|
16
|
+
background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:rt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",M?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((N,j)=>{let xe=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,Le=typeof j.createdAt=="string"?new Date(j.createdAt):j.createdAt;return xe.getTime()-Le.getTime()}).map(N=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.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:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",M?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:Ve(N.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Lu,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(j=>{let xe=j.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",M?"text-white":"text-gray-900"),children:j.name})]},j.id)})})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",M?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",M?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Au,{value:Me,onChange:Ke,onSubmit:X,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:st,onFilesSelect:A,onRemoveFile:K})})]})]})]})})}function Dl(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:v,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,timerState:L,onLogTime:$,onUpdateEstimate:E,onUpdateSoldEffort:te,onStartTimer:O,onStopTimer:H,onDiscardTimer:M,blurFinancials:J=false,sidePanel:ee,renderColumnMetrics:Re,suppressDetailModal:B=false}){let[Y,ye]=Dl(),[Ge,U]=react.useState(null),[oe,Z]=react.useState(false),Ee=react.useRef(null),ke=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",He=Ie==="dark"||Ie==="neutral",et=He?"dark":"",ae=react.useCallback((S,q)=>{t.onCardUpdate?.(S,q);},[t]),Xe=react.useCallback((S,q)=>{t.onColumnUpdate?.(S,{title:q});},[t]),me=react.useCallback(S=>{t.onColumnDelete?.(S);},[t]),at=["todo","in-progress","completed"],mt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Pt=react.useMemo(()=>{let S=new Map;return e.columns.forEach(q=>{let ue=q.cardIds.map(Te=>e.cards.find(W=>W.id===Te)).filter(Te=>Te!==void 0).sort((Te,W)=>Te.position-W.position);S.set(q.id,ue);}),S},[e.cards,e.columns]);react.useEffect(()=>{let S=Ee.current;if(!S)return;let q=re=>{let Ue=re.target,Ne=re.button===1,ze=Ue===S||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ne||re.button===0&&ze&&!Y.isDragging)&&(re.preventDefault(),Z(true),ke.current={x:re.clientX,y:re.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},ue=re=>{if(!oe)return;let Ue=re.clientX-ke.current.x,Ne=re.clientY-ke.current.y;S.scrollLeft=ke.current.scrollLeft-Ue,S.scrollTop=ke.current.scrollTop-Ne;},Te=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");},W=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",q),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Te),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Te),S.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let Ce=react.useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),xt=react.useCallback(S=>{let{active:q}=S,ue=e.cards.find(Te=>Te.id===q.id);ue&&ye({isDragging:true,draggedCardId:ue.id,sourceColumnId:ue.columnId,targetColumnId:ue.columnId});},[e.cards,ye]),nt=react.useCallback(S=>{let{active:q,over:ue}=S;if(!ue||!e.cards.find(re=>re.id===q.id))return;let W=null;ue.data.current?.type==="column"?W=ue.id:ue.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===ue.id)?.columnId||null),W&&W!==Y.targetColumnId&&ye({...Y,targetColumnId:W});},[e.cards,Y,ye]),Je=react.useCallback(async S=>{let{active:q,over:ue}=S;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ue)return;let Te=e.cards.find(Ne=>Ne.id===q.id);if(!Te)return;let W,re;if(ue.data.current?.type==="column"){W=ue.id;let Ne=Pt.get(W)||[];re=ll(Ne,0);}else {let Ne=e.cards.find(Ke=>Ke.id===ue.id);if(!Ne)return;W=Ne.columnId;let ze=Pt.get(W)||[],Me=ze.findIndex(Ke=>Ke.id===ue.id);re=ll(ze,Me);}let Ue=e.columns.find(Ne=>Ne.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ne=Pt.get(W)||[];if(Te.columnId!==W&&Ne.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Te);return}}(Te.columnId!==W||Te.position!==re)&&await t.onCardMove?.(Te.id,W,re);},[e.cards,e.columns,Pt,t,ye]),z=react.useCallback(S=>{B||U(S),a?.(S),v?.(S.id);},[a,v,B]),se=react.useCallback(S=>{t.onCardUpdate?.(S.id,S),U(S);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx(vh,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(iu,{themeName:Ie,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:mt,collisionDetection:core$1.closestCorners,onDragStart:xt,onDragOver:nt,onDragEnd:Je,children:[jsxRuntime.jsxs("div",{ref:Ee,className:u("asakaa-board",ee?"flex-1":"",et,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((S,q)=>S.position-q.position).map(S=>{let q=Pt.get(S.id)||[],ue=!at.includes(S.id),Te=r?.renderColumnFooter?.(S);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(nn,{column:S,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Re?(W,re)=>Re(W,re):void 0,onCardClick:z,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?me:void 0,isDeletable:ue,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},S.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Y.draggedCardId?jsxRuntime.jsx(Jr,{card:e.cards.find(S=>S.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!B&&jsxRuntime.jsx(Zr,{task:Ge,isOpen:!!Ge,onClose:()=>U(null),onCardUpdate:se,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:E,onSoldEffortUpdate:te,onTimerStart:O,onTimerStop:H,onTimerDiscard:M,blurFinancials:J})]})}function vh({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Nh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Dh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Sh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Eh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Fh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Mh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ph({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function El({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Nh:Dh,g={...o==="es"?Sh:Eh,...l},y=n||i||c;return jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mh,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Fh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsxRuntime.jsx(Ph,{onClick:()=>t(),label:a||g.newTask}))]})})}function Ml({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ro({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[m,d]=react.useState(void 0),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(false),[b,w]=react.useState(false),[v,C]=react.useState(false),[T,D]=react.useState(s||new Date),k=react.useRef(null),L=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let E=react.useCallback(()=>{f(false),w(false),C(false);},[]),te=react.useCallback(()=>{l(""),d(void 0),g(null),x(null),E(),t();},[t,E]),O=react.useCallback(()=>{let J=c.trim();if(!J)return;let ee=a.find(B=>B.id===p),Re=y||s;e({name:J,priority:m,assignee:ee||void 0,assigneeId:p,startDate:Re,endDate:Re}),l(""),d(void 0),g(null),x(null),E(),k.current?.focus();},[c,m,p,y,s,a,e,E]),H=react.useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),O()),J.key==="Escape"&&te();},[O,te,c]),M=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>E(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),f(!h),w(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{d(J.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),C(!v),f(false),w(false),D(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),M.toLocaleDateString(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,ee=new Date(J);ee.setDate(J.getDate()+1);let Re=new Date(J);Re.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let B=new Date(J);B.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let Y=new Date(J);Y.setDate(J.getDate()+14);let ye=new Date(J);ye.setDate(J.getDate()+28);let Ge=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:J,display:J.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:Re,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:B,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((oe,Z)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),C(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},Z))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:L?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=T.getFullYear(),ee=T.getMonth(),Re=new Date(J,ee,1).getDay(),B=new Date(J,ee+1,0).getDate(),Y=new Date(J,ee,0).getDate(),ye=new Date().toDateString(),Ge=[];for(let oe=Re-1;oe>=0;oe--)Ge.push({dayNum:Y-oe,isCurrent:false,date:new Date(J,ee-1,Y-oe)});for(let oe=1;oe<=B;oe++)Ge.push({dayNum:oe,isCurrent:true,date:new Date(J,ee,oe)});let U=42-Ge.length;for(let oe=1;oe<=U;oe++)Ge.push({dayNum:oe,isCurrent:false,date:new Date(J,ee+1,oe)});return Ge.map((oe,Z)=>{let Ee=oe.date.toDateString()===ye,ke=(y||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),C(false);},children:oe.dayNum},Z)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),w(!b),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===p)?.color||"#007FFF"},children:a.find(J=>J.id===p)?.initials||a.find(J=>J.id===p)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:L?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(J.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:J.color||"#007FFF"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:L?"Guardar":"Save"})]})]})}function Bl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=react.useState(false),m=react.useRef(null),d=react.useRef(null),[p,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!m.current)return;let v=90,C=()=>{let T=m.current.getBoundingClientRect(),k=window.innerHeight-T.bottom<v+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),react.useEffect(()=>{if(!c)return;let v=C=>{let T=C.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);let w=react.useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"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:jsxRuntime.jsx(Ro,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var jn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function up(e={}){return new jn(e)}var dn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Rl(e,t){let a=r=>jsxRuntime.jsx(dn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function $l({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[f,b]=react.useState(""),[w,v]=react.useState("");react.useEffect(()=>{let k=L=>{(L.metaKey||L.ctrlKey)&&L.key===l&&(L.preventDefault(),p($=>!$)),L.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),react.useEffect(()=>{d||(h("home"),y(""),b(""),v(""));},[d]);let C=react.useCallback(()=>{p(false);},[]),T=react.useCallback(k=>{let[L,$]=k.split(":");switch(L){case "create-card":h("create-card");break;case "create-card-in":b($||"");break;case "navigate":$?(a?.($),C()):h("navigate");break;case "search":r?.(g),C();break;case "priority":h("priority");break;case "set-priority":w&&$&&(o?.(w,$),C());break;case "assign":h("assign");break;case "assign-user":w&&$&&(s?.(w,$),C());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,i,c,C]),D=react.useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return d?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&f?"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"&&f&&D();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let L=e.columns.find($=>$.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:T,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function gp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsxRuntime.jsx("div",{ref:rt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((T,j)=>{let xe=typeof T.createdAt=="string"?new Date(T.createdAt):T.createdAt,Le=typeof j.createdAt=="string"?new Date(j.createdAt):j.createdAt;return xe.getTime()-Le.getTime()}).map(T=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:T.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ve(T.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Iu,{content:T.content,theme:s})}),T.attachments&&T.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:T.attachments.map(j=>{let xe=j.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:j.name})]},j.id)})})]})]},T.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Lu,{value:Fe,onChange:Ke,onSubmit:X,users:b,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!f,pendingFiles:st,onFilesSelect:A,onRemoveFile:K})})]})]})]})})}function Dl(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:b,currentUser:f,mentionableUsers:w,onTaskOpen:v,onUploadCommentAttachments:N,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:k,timerState:L,onLogTime:$,onUpdateEstimate:E,onUpdateSoldEffort:Z,onStartTimer:O,onStopTimer:H,onDiscardTimer:F,blurFinancials:J=false,sidePanel:te,renderColumnMetrics:Re,suppressDetailModal:B=false}){let[Y,ye]=Dl(),[Ge,U]=react.useState(null),[oe,ee]=react.useState(false),Ee=react.useRef(null),ke=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",He=Ie==="dark"||Ie==="neutral",et=He?"dark":"",ae=react.useCallback((S,q)=>{t.onCardUpdate?.(S,q);},[t]),Xe=react.useCallback((S,q)=>{t.onColumnUpdate?.(S,{title:q});},[t]),me=react.useCallback(S=>{t.onColumnDelete?.(S);},[t]),at=["todo","in-progress","completed"],mt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Pt=react.useMemo(()=>{let S=new Map;return e.columns.forEach(q=>{let ue=q.cardIds.map(Te=>e.cards.find(W=>W.id===Te)).filter(Te=>Te!==void 0).sort((Te,W)=>Te.position-W.position);S.set(q.id,ue);}),S},[e.cards,e.columns]);react.useEffect(()=>{let S=Ee.current;if(!S)return;let q=re=>{let Ue=re.target,Ne=re.button===1,ze=Ue===S||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ne||re.button===0&&ze&&!Y.isDragging)&&(re.preventDefault(),ee(true),ke.current={x:re.clientX,y:re.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},ue=re=>{if(!oe)return;let Ue=re.clientX-ke.current.x,Ne=re.clientY-ke.current.y;S.scrollLeft=ke.current.scrollLeft-Ue,S.scrollTop=ke.current.scrollTop-Ne;},Te=()=>{oe&&(ee(false),S.style.cursor="",S.style.userSelect="");},W=()=>{oe&&(ee(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",q),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Te),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Te),S.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let Ce=react.useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),xt=react.useCallback(S=>{let{active:q}=S,ue=e.cards.find(Te=>Te.id===q.id);ue&&ye({isDragging:true,draggedCardId:ue.id,sourceColumnId:ue.columnId,targetColumnId:ue.columnId});},[e.cards,ye]),nt=react.useCallback(S=>{let{active:q,over:ue}=S;if(!ue||!e.cards.find(re=>re.id===q.id))return;let W=null;ue.data.current?.type==="column"?W=ue.id:ue.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===ue.id)?.columnId||null),W&&W!==Y.targetColumnId&&ye({...Y,targetColumnId:W});},[e.cards,Y,ye]),Je=react.useCallback(async S=>{let{active:q,over:ue}=S;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ue)return;let Te=e.cards.find(Ne=>Ne.id===q.id);if(!Te)return;let W,re;if(ue.data.current?.type==="column"){W=ue.id;let Ne=Pt.get(W)||[];re=ll(Ne,0);}else {let Ne=e.cards.find(Ke=>Ke.id===ue.id);if(!Ne)return;W=Ne.columnId;let ze=Pt.get(W)||[],Fe=ze.findIndex(Ke=>Ke.id===ue.id);re=ll(ze,Fe);}let Ue=e.columns.find(Ne=>Ne.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ne=Pt.get(W)||[];if(Te.columnId!==W&&Ne.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Te);return}}(Te.columnId!==W||Te.position!==re)&&await t.onCardMove?.(Te.id,W,re);},[e.cards,e.columns,Pt,t,ye]),z=react.useCallback(S=>{B||U(S),a?.(S),v?.(S.id);},[a,v,B]),se=react.useCallback(S=>{t.onCardUpdate?.(S.id,S),U(S);},[t]);return c?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx(Ch,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(lu,{themeName:Ie,children:[jsxRuntime.jsxs("div",{className:u("flex h-full overflow-hidden",te?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:mt,collisionDetection:core$1.closestCorners,onDragStart:xt,onDragOver:nt,onDragEnd:Je,children:[jsxRuntime.jsxs("div",{ref:Ee,className:u("asakaa-board",te?"flex-1":"",et,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((S,q)=>S.position-q.position).map(S=>{let q=Pt.get(S.id)||[],ue=!at.includes(S.id),Te=r?.renderColumnFooter?.(S);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(nn,{column:S,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Re?(W,re)=>Re(W,re):void 0,onCardClick:z,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?me:void 0,isDeletable:ue,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},S.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:Y.draggedCardId?jsxRuntime.jsx(Jr,{card:e.cards.find(S=>S.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),te]}),!B&&jsxRuntime.jsx(Zr,{task:Ge,isOpen:!!Ge,onClose:()=>U(null),onCardUpdate:se,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:b,currentUser:f,mentionableUsers:w,onUploadCommentAttachments:N,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:k,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:E,onSoldEffortUpdate:Z,onTimerStart:O,onTimerStop:H,onTimerDiscard:F,blurFinancials:J})]})}function Ch({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Eh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Mh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Fh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ph={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ah({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Lh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[i,c]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx("div",{className:"py-1",children:d.map((g,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ih({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function El({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Eh:Mh,g={...o==="es"?Fh:Ph,...l},y=n||i||c;return jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[m,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lh,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsxRuntime.jsx(Ah,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsxRuntime.jsx(Ih,{onClick:()=>t(),label:a||g.newTask}))]})})}function Fl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(""),l=react.useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=react.useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsxRuntime.jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:u("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ro({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=react.useState(""),[m,d]=react.useState(void 0),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,b]=react.useState(false),[f,w]=react.useState(false),[v,N]=react.useState(false),[C,D]=react.useState(s||new Date),k=react.useRef(null),L=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{k.current?.focus();},[]);let E=react.useCallback(()=>{b(false),w(false),N(false);},[]),Z=react.useCallback(()=>{l(""),d(void 0),g(null),x(null),E(),t();},[t,E]),O=react.useCallback(()=>{let J=c.trim();if(!J)return;let te=a.find(B=>B.id===p),Re=y||s;e({name:J,priority:m,assignee:te||void 0,assigneeId:p,startDate:Re,endDate:Re}),l(""),d(void 0),g(null),x(null),E(),k.current?.focus();},[c,m,p,y,s,a,e,E]),H=react.useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),O()),J.key==="Escape"&&Z();},[O,Z,c]),F=y||s||new Date;return jsxRuntime.jsxs("div",{className:u("quick-task-create",n),onClick:()=>E(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:k,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),b(!h),w(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{d(J.id),b(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),N(!v),b(false),w(false),D(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),F.toLocaleDateString(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,te=new Date(J);te.setDate(J.getDate()+1);let Re=new Date(J);Re.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let B=new Date(J);B.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let Y=new Date(J);Y.setDate(J.getDate()+14);let ye=new Date(J);ye.setDate(J.getDate()+28);let Ge=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:J,display:J.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:te,display:te.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:Re,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:B,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((oe,ee)=>jsxRuntime.jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),N(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},ee))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:L?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=C.getFullYear(),te=C.getMonth(),Re=new Date(J,te,1).getDay(),B=new Date(J,te+1,0).getDate(),Y=new Date(J,te,0).getDate(),ye=new Date().toDateString(),Ge=[];for(let oe=Re-1;oe>=0;oe--)Ge.push({dayNum:Y-oe,isCurrent:false,date:new Date(J,te-1,Y-oe)});for(let oe=1;oe<=B;oe++)Ge.push({dayNum:oe,isCurrent:true,date:new Date(J,te,oe)});let U=42-Ge.length;for(let oe=1;oe<=U;oe++)Ge.push({dayNum:oe,isCurrent:false,date:new Date(J,te+1,oe)});return Ge.map((oe,ee)=>{let Ee=oe.date.toDateString()===ye,ke=(y||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),N(false);},children:oe.dayNum},ee)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),w(!f),b(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===p)?.color||"#007FFF"},children:a.find(J=>J.id===p)?.initials||a.find(J=>J.id===p)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:r?"text-white/40":"text-gray-500",children:L?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{g(J.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:J.color||"#007FFF"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:L?"Guardar":"Save"})]})]})}function Bl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=react.useState(false),m=react.useRef(null),d=react.useRef(null),[p,g]=react.useState({}),[y,x]=react.useState(false),h=n==="dark",f={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!m.current)return;let v=90,N=()=>{let C=m.current.getBoundingClientRect(),k=window.innerHeight-C.bottom<v+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),react.useEffect(()=>{if(!c)return;let v=N=>{let C=N.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);let w=react.useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxRuntime.jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),f.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"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:jsxRuntime.jsx(Ro,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var jn=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function pp(e={}){return new jn(e)}var dn=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Rl(e,t){let a=r=>jsxRuntime.jsx(dn,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function $l({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=react.useState(false),[g,y]=react.useState(""),[x,h]=react.useState("home"),[b,f]=react.useState(""),[w,v]=react.useState("");react.useEffect(()=>{let k=L=>{(L.metaKey||L.ctrlKey)&&L.key===l&&(L.preventDefault(),p($=>!$)),L.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),react.useEffect(()=>{d||(h("home"),y(""),f(""),v(""));},[d]);let N=react.useCallback(()=>{p(false);},[]),C=react.useCallback(k=>{let[L,$]=k.split(":");switch(L){case "create-card":h("create-card");break;case "create-card-in":f($||"");break;case "navigate":$?(a?.($),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":w&&$&&(o?.(w,$),N());break;case "assign":h("assign");break;case "assign-user":w&&$&&(s?.(w,$),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":i?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,i,c,N]),D=react.useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return d?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.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&&D();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},k.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let L=e.columns.find($=>$.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:C,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map($=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:$},$))})]},k.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function fp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,h.onclick=
|
|
59
|
+
`,h.onclick=b=>{b.stopPropagation(),l(),o(x);},d.appendChild(h);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.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>',p.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;l(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function jh(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Kh(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 zl(e){return e.startsWith("image/")}function _r({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=react.useState(false),[c,l]=react.useState(false),[m,d]=react.useState(null),p=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((k,L)=>{L.preventDefault(),L.stopPropagation();let $=g.current.filter(O=>zl(O.type)),E=$.findIndex(O=>O.id===k.id),te=O=>{let H=g.current.filter(J=>zl(J.type)),M=H[O];M&&gp(M.url,M.name,H,O,te);};gp(k.url,k.name,$,E,te);},[]),x=react.useCallback(k=>{let L=[],$=[];return e.length+k.length>s?($.push(`Maximum ${s} files allowed`),{valid:L,errors:$}):(k.forEach(E=>{if(E.size/1048576>r){$.push(`${E.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>E.type.match(O))){$.push(`${E.name} has invalid file type`);return}L.push(E);}),{valid:L,errors:$})},[e.length,s,r,o]),h=react.useCallback(async k=>{let{valid:L,errors:$}=x(k);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(L.length!==0){l(true),d(null);try{await t?.(L);}catch(E){d(E instanceof Error?E.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[x,t]),f=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(true);},[]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(false);},[]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(false);let L=Array.from(k.dataTransfer.files);h(L);},[h]),C=react.useCallback(k=>{let L=k.target.files?Array.from(k.target.files):[];h(L),p.current&&(p.current.value="");},[h]),T=react.useCallback(()=>{p.current?.click();},[]),D=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:v,onClick:T,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:zl(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(k,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Kh(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:jh(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ul({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=react.useState("details"),[v,C]=react.useState(false),[T,D]=react.useState({}),[k,L]=react.useState(""),[$,E]=react.useState(false),[te,O]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{C(false),D({}),w("details"),L(""),O({}),a();},[a]),M=react.useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),D({}),C(false));},[e.id,T,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ee=react.useCallback(()=>{m&&k.trim()&&(m(e.id,k.trim()),L(""));},[e.id,k,m]),Re=react.useCallback(async()=>{if(y){E(true);try{let U=await y(e);O(oe=>({...oe,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{E(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){E(true);try{let U=await x(e);O(oe=>({...oe,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{E(false);}}},[e,x]),Y=react.useCallback(async()=>{if(h){E(true);try{let U=await h(e);O(oe=>({...oe,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{E(false);}}},[e,h]),ye={...e,...T},Ge=s.filter(U=>ye.assignedUserIds?.includes(U.id));return jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),v?jsxRuntime.jsx("input",{type:"text",value:T.title??ye.title,onChange:U=>D({...T,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ye.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:M,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:J,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),v?jsxRuntime.jsx("textarea",{value:T.description??ye.description??"",onChange:U=>D({...T,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ye.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),v?jsxRuntime.jsx("select",{multiple:true,value:T.assignedUserIds??ye.assignedUserIds??[],onChange:U=>{let oe=Array.from(U.target.selectedOptions,Z=>Z.value);D({...T,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsxRuntime.jsx("option",{value:U.id,children:U.name},U.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ge.length>0?Ge.map(U=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsx("span",{children:U.name})]},U.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),v?jsxRuntime.jsxs("select",{value:T.priority??ye.priority??"",onChange:U=>D({...T,priority:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ye.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:ye.labels&&ye.labels.length>0?ye.labels.map(U=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:U},U)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),v?jsxRuntime.jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:ye.startDate?new Date(ye.startDate).toISOString().split("T")[0]:"",onChange:U=>D({...T,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.startDate?new Date(ye.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),v?jsxRuntime.jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:ye.endDate?new Date(ye.endDate).toISOString().split("T")[0]:"",onChange:U=>D({...T,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),v?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??ye.estimatedTime??"",onChange:U=>D({...T,estimatedTime:U.target.value?parseFloat(U.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:ye.dependencies&&ye.dependencies.length>0?ye.dependencies.map(U=>{let oe=typeof U=="string"?U:U.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.createdAt?new Date(ye.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:U=>L(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ee,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(U=>{let oe=s.find(Z=>Z.id===U.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(U.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:U.content})]},U.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:i.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let oe=s.find(Z=>Z.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:oe?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(_r,{cardId:e.id,attachments:l,onUpload:p?U=>p(e.id,U):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Re,disabled:$||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:$||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Y,disabled:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),te.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),te.assignees.map((U,oe)=>{let Z=s.find(Ee=>Ee.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Z?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),te.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),te.subtasks.map((U,oe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},oe))]}),te.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[te.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(te.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(U=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!te.assignees&&!te.subtasks&&!te.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Yn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;l.current&&!l.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var ty=["LOW","MEDIUM","HIGH","URGENT"],ay=["todo","in-progress","review","done"];function Gl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:v,onSubtasksChange:C,attachments:T=[],onUploadAttachments:D,onDeleteAttachment:k}){let L=an(),$=v||L?.themeName||"dark",[E,te]=react.useState(e),[O,H]=react.useState(false),[M,J]=react.useState(()=>[...e?.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0))),[ee,Re]=react.useState(false),[B,Y]=react.useState(""),[ye,Ge]=react.useState(""),[U,oe]=react.useState("all"),[Z,Ee]=react.useState(false),[ke,Ie]=react.useState(false),[He,et]=react.useState(false),[ae,Xe]=react.useState(false),[me,at]=react.useState(false),[mt,Pt]=react.useState(false),Ce=react.useRef(null),xt=react.useRef(null),nt=react.useRef(null),Je=react.useRef(null),z=react.useRef(null),se=react.useRef(null),S=react.useRef(null),q=react.useRef(null),ue=react.useRef(null),Te=react.useRef(null),W=react.useRef(null),re=react.useRef(null);react.useEffect(()=>{if(e&&!E){te({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}else if(e&&E&&e.id!==E.id){te({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}},[e,E]),react.useEffect(()=>{let A=K=>{let X=K.target;Je.current&&!Je.current.contains(X)&&Ee(false),z.current&&!z.current.contains(X)&&Ie(false),se.current&&!se.current.contains(X)&&et(false),S.current&&!S.current.contains(X)&&Xe(false);};if(Z||ke||He||ae)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[Z,ke,He,ae]),react.useEffect(()=>{if(!t)return;let A=K=>{let X=K.target,ge=X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.isContentEditable;if(K.key==="Escape"){K.preventDefault(),Z||ke||He||ae||me||mt?(Ee(false),Ie(false),et(false),Xe(false),at(false),Pt(false)):ge||a();return}if(ge&&K.key!=="Escape")return;let Fe=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Ee(true);break;case "a":K.preventDefault(),et(true);break;case "p":K.preventDefault(),Ie(true);break;case "l":K.preventDefault(),Xe(true);break;case "d":Fe||(K.preventDefault(),at(true),setTimeout(()=>q.current?.focus(),0));break;case "e":Fe||(K.preventDefault(),Pt(true));break;case "i":K.preventDefault(),H(true),setTimeout(()=>xt.current?.focus(),0);break;case "t":K.preventDefault(),Re(true);break;case "c":K.preventDefault(),nt.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,Z,ke,He,ae,me,mt]);let Ue=react.useCallback(A=>{let K=A.currentTarget.textContent?.trim()||"";if(E&&K!==E.title){let X={...E,title:K};te(X),r?.(E.id,{title:K});}},[E,r]),Ne=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=E?.title||"",A.currentTarget.blur());},[E]),ze=react.useCallback(()=>{E&&e&&E.description!==e.description&&r?.(E.id,{description:E.description}),H(false);},[E,e,r]),Me=react.useCallback(A=>{if(E){let K={...E,columnId:A};te(K),r?.(E.id,{columnId:A}),Ee(false);}},[E,r]),Ke=react.useCallback(A=>{if(E){let K={...E,priority:A};te(K),r?.(E.id,{priority:A}),Ie(false);}},[E,r]),lt=react.useCallback(A=>{if(E){let K=E.assignedUserIds||[],X=K.includes(A)?K.filter(Fe=>Fe!==A):[...K,A],ge={...E,assignedUserIds:X};te(ge),r?.(E.id,{assignedUserIds:X});}},[E,r]),ut=react.useCallback(A=>{if(E){let K=E.labels||[],X=K.includes(A)?K.filter(Fe=>Fe!==A):[...K,A],ge={...E,labels:X};te(ge),r?.(E.id,{labels:X});}},[E,r]),st=react.useCallback(A=>{if(E){let K={...E,tags:A};te(K),r?.(E.id,{tags:A});}},[E,r]),Ze=react.useCallback(A=>{if(E){let K=A.target.value,X={...E,endDate:K};te(X),r?.(E.id,{endDate:K}),at(false);}},[E,r]),zt=react.useCallback(A=>{if(E){let K={...E,estimatedTime:parseFloat(A)||0};te(K),r?.(E.id,{estimatedTime:parseFloat(A)||0});}},[E,r]),Ct=react.useCallback(()=>{if(B.trim()&&E){let A={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:M.length,createdAt:new Date},K=[...M,A];J(K),Y(""),Re(false),C?.(E.id,K);}},[B,M,E,C]),ht=react.useCallback(A=>{let K=M.map(X=>X.id===A?{...X,completed:!X.completed,updatedAt:new Date}:X);J(K),E&&C?.(E.id,K);},[M,E,C]),wt=react.useCallback(A=>{let K=M.filter(X=>X.id!==A);J(K),E&&C?.(E.id,K);},[M,E,C]),rt=react.useCallback(()=>{ye.trim()&&E&&c&&(c(E.id,ye.trim()),Ge(""));},[ye,E,c]),Lt=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),rt());},[rt]),We=A=>jsxRuntime.jsx(Qh__default.default,{remarkPlugins:[Zh__default.default],rehypePlugins:[ey__default.default],components:{a:({node:K,...X})=>jsxRuntime.jsx("a",{...X,target:"_blank",rel:"noopener noreferrer"})},children:A}),Be=i.filter(A=>U==="comments"?A.type.includes("COMMENT"):U==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let pt=E||e,le=s.filter(A=>pt.assignedUserIds?.includes(A.id)),be=M.filter(A=>A.completed).length;return jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Ne,children:pt.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxRuntime.jsxs("button",{ref:ue,className:"modal-v2-field",onClick:()=>Ee(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.columnId||"No status"})]}),jsxRuntime.jsx(Yn,{triggerRef:ue,isOpen:Z,onClose:()=>Ee(false),width:250,estimatedHeight:200,children:(y.length>0?y:ay.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${pt.columnId===A.id?"active":""}`,onClick:()=>Me(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxRuntime.jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>et(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:le.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:Te,isOpen:He,onClose:()=>et(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>lt(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,pt.assignedUserIds?.includes(A.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:z,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ie(!ke),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.priority||"None"})]}),jsxRuntime.jsxs(Yn,{triggerRef:W,isOpen:ke,onClose:()=>Ie(false),width:180,estimatedHeight:220,children:[ty.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${pt.priority===A?"active":""}`,onClick:()=>Ke(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),h.length>0||f?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(po,{selectedTags:pt.tags||[],availableTags:h,onChange:st,onCreateTag:f,theme:dt[$]||dt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxRuntime.jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>Xe(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.labels&&pt.labels.length>0?jsxRuntime.jsx("span",{children:pt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:re,isOpen:ae,onClose:()=>Xe(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.labels?.includes(A)?"active":""}`,onClick:()=>ut(A),children:[A,pt.labels?.includes(A)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!me),setTimeout(()=>q.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.endDate?new Date(pt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof pt.endDate=="string"?pt.endDate.split("T")[0]:pt.endDate?(()=>{let A=new Date(pt.endDate),K=A.getUTCFullYear(),X=String(A.getUTCMonth()+1).padStart(2,"0"),ge=String(A.getUTCDate()).padStart(2,"0");return `${K}-${X}-${ge}`})():"",onChange:Ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Pt(!mt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.estimatedTime?`${pt.estimatedTime}h`:"Not set"})]}),mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pt.estimatedTime||"",onChange:A=>zt(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Pt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:pt.description||"",onChange:A=>{if(E){let K={...E,description:A.target.value};te(K);}},onBlur:ze,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:pt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:We(pt.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),M.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[be,"/",M.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Re(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[M.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ht(A.id),children:A.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>wt(A.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),ee&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:A=>Y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Ct(),A.key==="Escape"&&(Re(false),Y(""));},onBlur:Ct,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||T.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.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"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),T.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:T.length})]}),jsxRuntime.jsx(_r,{cardId:pt.id,attachments:T,onUpload:D?A=>D(pt.id,A):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>oe("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:nt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ye,onChange:A=>Ge(A.target.value),onKeyDown:Lt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.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"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:rt,disabled:!ye.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Be.map(A=>{let K=s.find(ge=>ge.id===A.userId);if(A.type.includes("COMMENT")){let ge=n.find(Fe=>Fe.id===A.metadata?.commentId);return ge?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ge.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),Be.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function uy({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function jl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(uy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,i)=>n+i.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,i)=>n+i.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,i)=>n+(i.planned||0),0)})]})]})]})}function vy({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Kl({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Fy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Cp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function My({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Tp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Yl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Fy[c.name]||Cp[e.indexOf(c)%Cp.length]})),i=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?My:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Tp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let m=l.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Tp,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var ti=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=react.useState(false),[c,l]=react.useState(false),[m,d]=react.useState(false),[p,g]=react.useState(false);if(e.length===0)return null;let y=e.map(v=>v.id),x=v=>{r.onBulkUpdate?.(y,{priority:v}),i(false);},h=v=>{r.onBulkMove?.(y,v),l(false),a();},f=v=>{r.onBulkUpdate?.(y,{assignedUserIds:v}),d(false);},b=v=>{let C=new Set;e.forEach(D=>{D.labels?.forEach(k=>C.add(k));});let T=Array.from(new Set([...C,...v]));r.onBulkUpdate?.(y,{labels:T}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(v),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(v.id),children:v.title},v.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([v.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([v]),children:v},v))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});ti.displayName="BulkOperationsToolbar";function By(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,i=y?.name||`User ${g}`,c=y?.color,l=y?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let 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];i=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ql({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),i=react.useMemo(()=>By(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(l=>{n(m=>{let d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsxRuntime.jsx(fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let m=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),p={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(fo,{board:p,callbacks:r,availableUsers:a})})]},l.id)}),i.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Xl=[{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 Jl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),i=Xl.find(l=>l.value===e)||Xl[0];react.useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Xl.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var qn=[{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 $y(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Fp(e={}){let{shortcuts:t=qn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),i=react.useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let m=l.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if($y(l,d)){r&&l.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function zy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Uy(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Wy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Uy(e),r=t?zy(t):"";return a?`${a} + ${r}`:r}function Vy(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Ql({shortcuts:e=qn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=Vy(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsxRuntime.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:Wy(l)})]},l.action))})]},i))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.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 Zl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;l(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function qh(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Xh(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 zl(e){return e.startsWith("image/")}function _r({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=react.useState(false),[c,l]=react.useState(false),[m,d]=react.useState(null),p=react.useRef(null),g=react.useRef(e);g.current=e;let y=react.useCallback((k,L)=>{L.preventDefault(),L.stopPropagation();let $=g.current.filter(O=>zl(O.type)),E=$.findIndex(O=>O.id===k.id),Z=O=>{let H=g.current.filter(J=>zl(J.type)),F=H[O];F&&fp(F.url,F.name,H,O,Z);};fp(k.url,k.name,$,E,Z);},[]),x=react.useCallback(k=>{let L=[],$=[];return e.length+k.length>s?($.push(`Maximum ${s} files allowed`),{valid:L,errors:$}):(k.forEach(E=>{if(E.size/1048576>r){$.push(`${E.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>E.type.match(O))){$.push(`${E.name} has invalid file type`);return}L.push(E);}),{valid:L,errors:$})},[e.length,s,r,o]),h=react.useCallback(async k=>{let{valid:L,errors:$}=x(k);if($.length>0){d($.join(", ")),setTimeout(()=>d(null),5e3);return}if(L.length!==0){l(true),d(null);try{await t?.(L);}catch(E){d(E instanceof Error?E.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[x,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(true);},[]),f=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(false);},[]),w=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),i(false);let L=Array.from(k.dataTransfer.files);h(L);},[h]),N=react.useCallback(k=>{let L=k.target.files?Array.from(k.target.files):[];h(L),p.current&&(p.current.value="");},[h]),C=react.useCallback(()=>{p.current?.click();},[]),D=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:f,onDragOver:w,onDrop:v,onClick:C,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.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"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:zl(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>y(k,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Xh(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:qh(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>D(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ul({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:b="user-1"}){let[f,w]=react.useState("details"),[v,N]=react.useState(false),[C,D]=react.useState({}),[k,L]=react.useState(""),[$,E]=react.useState(false),[Z,O]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{N(false),D({}),w("details"),L(""),O({}),a();},[a]),F=react.useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),D({}),N(false));},[e.id,C,r]),J=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),te=react.useCallback(()=>{m&&k.trim()&&(m(e.id,k.trim()),L(""));},[e.id,k,m]),Re=react.useCallback(async()=>{if(y){E(true);try{let U=await y(e);O(oe=>({...oe,assignees:U}));}catch(U){console.error("Failed to suggest assignee:",U);}finally{E(false);}}},[e,y]),B=react.useCallback(async()=>{if(x){E(true);try{let U=await x(e);O(oe=>({...oe,subtasks:U}));}catch(U){console.error("Failed to generate subtasks:",U);}finally{E(false);}}},[e,x]),Y=react.useCallback(async()=>{if(h){E(true);try{let U=await h(e);O(oe=>({...oe,effort:U}));}catch(U){console.error("Failed to estimate effort:",U);}finally{E(false);}}},[e,h]),ye={...e,...C},Ge=s.filter(U=>ye.assignedUserIds?.includes(U.id));return jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),v?jsxRuntime.jsx("input",{type:"text",value:C.title??ye.title,onChange:U=>D({...C,title:U.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:ye.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:J,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${f==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${f==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${f==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${f==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${f==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[f==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),v?jsxRuntime.jsx("textarea",{value:C.description??ye.description??"",onChange:U=>D({...C,description:U.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:ye.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),v?jsxRuntime.jsx("select",{multiple:true,value:C.assignedUserIds??ye.assignedUserIds??[],onChange:U=>{let oe=Array.from(U.target.selectedOptions,ee=>ee.value);D({...C,assignedUserIds:oe});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(U=>jsxRuntime.jsx("option",{value:U.id,children:U.name},U.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:Ge.length>0?Ge.map(U=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:U.color},children:U.initials}),jsxRuntime.jsx("span",{children:U.name})]},U.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),v?jsxRuntime.jsxs("select",{value:C.priority??ye.priority??"",onChange:U=>D({...C,priority:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxRuntime.jsx("span",{children:ye.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:ye.labels&&ye.labels.length>0?ye.labels.map(U=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:U},U)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),v?jsxRuntime.jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:ye.startDate?new Date(ye.startDate).toISOString().split("T")[0]:"",onChange:U=>D({...C,startDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.startDate?new Date(ye.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),v?jsxRuntime.jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:ye.endDate?new Date(ye.endDate).toISOString().split("T")[0]:"",onChange:U=>D({...C,endDate:U.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),v?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??ye.estimatedTime??"",onChange:U=>D({...C,estimatedTime:U.target.value?parseFloat(U.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:ye.dependencies&&ye.dependencies.length>0?ye.dependencies.map(U=>{let oe=typeof U=="string"?U:U.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",oe.slice(-4)]},oe)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:ye.createdAt?new Date(ye.createdAt).toLocaleString():"Unknown"})]})]}),f==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:U=>L(U.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:te,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(U=>{let oe=s.find(ee=>ee.id===U.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[oe&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:oe.color},children:oe.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:oe?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(U.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(U.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:U.content})]},U.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),f==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:i.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:i.map(U=>{let oe=s.find(ee=>ee.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("COMMENT")&&"\u{1F4AC}",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",U.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:oe?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),f==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(_r,{cardId:e.id,attachments:l,onUpload:p?U=>p(e.id,U):void 0,onDelete:g,currentUserId:b,maxSizeMB:10,maxFiles:20})}),f==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Re,disabled:$||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:B,disabled:$||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:Y,disabled:$||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),Z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),Z.assignees.map((U,oe)=>{let ee=s.find(Ee=>Ee.id===U.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:U.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(U.confidence*100).toFixed(0),"%"]})]})]},oe)})]}),Z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),Z.subtasks.map((U,oe)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:U.title}),U.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:U.description}),U.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",U.estimatedTime,"h"]})]},oe))]}),Z.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[Z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(Z.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(U=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${U.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:U.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:U.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:U.description}),U.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",U.suggestedAction]})]},U.id))]}),!Z.assignees&&!Z.subtasks&&!Z.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Yn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,b=d.top,f;return h>=s+y?f=d.bottom+y:b>=s+y?f=d.top-s-y:h>=b?f=d.bottom+y:f=Math.max(10,d.top-s-y),{top:f,left:x}},[e,o,s]);return react.useEffect(()=>{t&&c(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;l.current&&!l.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var oy=["LOW","MEDIUM","HIGH","URGENT"],ny=["todo","in-progress","review","done"];function Gl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:b,onUploadCoverImage:f,unsplashAccessKey:w,theme:v,onSubtasksChange:N,attachments:C=[],onUploadAttachments:D,onDeleteAttachment:k}){let L=an(),$=v||L?.themeName||"dark",[E,Z]=react.useState(e),[O,H]=react.useState(false),[F,J]=react.useState(()=>[...e?.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0))),[te,Re]=react.useState(false),[B,Y]=react.useState(""),[ye,Ge]=react.useState(""),[U,oe]=react.useState("all"),[ee,Ee]=react.useState(false),[ke,Ie]=react.useState(false),[He,et]=react.useState(false),[ae,Xe]=react.useState(false),[me,at]=react.useState(false),[mt,Pt]=react.useState(false),Ce=react.useRef(null),xt=react.useRef(null),nt=react.useRef(null),Je=react.useRef(null),z=react.useRef(null),se=react.useRef(null),S=react.useRef(null),q=react.useRef(null),ue=react.useRef(null),Te=react.useRef(null),W=react.useRef(null),re=react.useRef(null);react.useEffect(()=>{if(e&&!E){Z({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}else if(e&&E&&e.id!==E.id){Z({...e});let A=[...e.subtasks||[]].sort((K,X)=>(K.position??0)-(X.position??0));J(A);}},[e,E]),react.useEffect(()=>{let A=K=>{let X=K.target;Je.current&&!Je.current.contains(X)&&Ee(false),z.current&&!z.current.contains(X)&&Ie(false),se.current&&!se.current.contains(X)&&et(false),S.current&&!S.current.contains(X)&&Xe(false);};if(ee||ke||He||ae)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[ee,ke,He,ae]),react.useEffect(()=>{if(!t)return;let A=K=>{let X=K.target,ge=X.tagName==="INPUT"||X.tagName==="TEXTAREA"||X.isContentEditable;if(K.key==="Escape"){K.preventDefault(),ee||ke||He||ae||me||mt?(Ee(false),Ie(false),et(false),Xe(false),at(false),Pt(false)):ge||a();return}if(ge&&K.key!=="Escape")return;let Me=K.metaKey||K.ctrlKey;switch(K.key.toLowerCase()){case "s":K.preventDefault(),Ee(true);break;case "a":K.preventDefault(),et(true);break;case "p":K.preventDefault(),Ie(true);break;case "l":K.preventDefault(),Xe(true);break;case "d":Me||(K.preventDefault(),at(true),setTimeout(()=>q.current?.focus(),0));break;case "e":Me||(K.preventDefault(),Pt(true));break;case "i":K.preventDefault(),H(true),setTimeout(()=>xt.current?.focus(),0);break;case "t":K.preventDefault(),Re(true);break;case "c":K.preventDefault(),nt.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,ee,ke,He,ae,me,mt]);let Ue=react.useCallback(A=>{let K=A.currentTarget.textContent?.trim()||"";if(E&&K!==E.title){let X={...E,title:K};Z(X),r?.(E.id,{title:K});}},[E,r]),Ne=react.useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=E?.title||"",A.currentTarget.blur());},[E]),ze=react.useCallback(()=>{E&&e&&E.description!==e.description&&r?.(E.id,{description:E.description}),H(false);},[E,e,r]),Fe=react.useCallback(A=>{if(E){let K={...E,columnId:A};Z(K),r?.(E.id,{columnId:A}),Ee(false);}},[E,r]),Ke=react.useCallback(A=>{if(E){let K={...E,priority:A};Z(K),r?.(E.id,{priority:A}),Ie(false);}},[E,r]),lt=react.useCallback(A=>{if(E){let K=E.assignedUserIds||[],X=K.includes(A)?K.filter(Me=>Me!==A):[...K,A],ge={...E,assignedUserIds:X};Z(ge),r?.(E.id,{assignedUserIds:X});}},[E,r]),ut=react.useCallback(A=>{if(E){let K=E.labels||[],X=K.includes(A)?K.filter(Me=>Me!==A):[...K,A],ge={...E,labels:X};Z(ge),r?.(E.id,{labels:X});}},[E,r]),st=react.useCallback(A=>{if(E){let K={...E,tags:A};Z(K),r?.(E.id,{tags:A});}},[E,r]),Ze=react.useCallback(A=>{if(E){let K=A.target.value,X={...E,endDate:K};Z(X),r?.(E.id,{endDate:K}),at(false);}},[E,r]),zt=react.useCallback(A=>{if(E){let K={...E,estimatedTime:parseFloat(A)||0};Z(K),r?.(E.id,{estimatedTime:parseFloat(A)||0});}},[E,r]),Ct=react.useCallback(()=>{if(B.trim()&&E){let A={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:F.length,createdAt:new Date},K=[...F,A];J(K),Y(""),Re(false),N?.(E.id,K);}},[B,F,E,N]),ht=react.useCallback(A=>{let K=F.map(X=>X.id===A?{...X,completed:!X.completed,updatedAt:new Date}:X);J(K),E&&N?.(E.id,K);},[F,E,N]),wt=react.useCallback(A=>{let K=F.filter(X=>X.id!==A);J(K),E&&N?.(E.id,K);},[F,E,N]),rt=react.useCallback(()=>{ye.trim()&&E&&c&&(c(E.id,ye.trim()),Ge(""));},[ye,E,c]),Lt=react.useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),rt());},[rt]),We=A=>jsxRuntime.jsx(ty__default.default,{remarkPlugins:[ay__default.default],rehypePlugins:[ry__default.default],components:{a:({node:K,...X})=>jsxRuntime.jsx("a",{...X,target:"_blank",rel:"noopener noreferrer"})},children:A}),Be=i.filter(A=>U==="comments"?A.type.includes("COMMENT"):U==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let pt=E||e,le=s.filter(A=>pt.assignedUserIds?.includes(A.id)),be=F.filter(A=>A.completed).length;return jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":$,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Ne,children:pt.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxRuntime.jsxs("button",{ref:ue,className:"modal-v2-field",onClick:()=>Ee(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.columnId||"No status"})]}),jsxRuntime.jsx(Yn,{triggerRef:ue,isOpen:ee,onClose:()=>Ee(false),width:250,estimatedHeight:200,children:(y.length>0?y:ny.map(A=>({id:A,title:A}))).map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${pt.columnId===A.id?"active":""}`,onClick:()=>Fe(A.id),children:A.title},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxRuntime.jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>et(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:le.map(A=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:Te,isOpen:He,onClose:()=>et(false),width:280,estimatedHeight:300,children:s.map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>lt(A.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,pt.assignedUserIds?.includes(A.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:z,children:[jsxRuntime.jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ie(!ke),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.priority||"None"})]}),jsxRuntime.jsxs(Yn,{triggerRef:W,isOpen:ke,onClose:()=>Ie(false),width:180,estimatedHeight:220,children:[oy.map(A=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${pt.priority===A?"active":""}`,onClick:()=>Ke(A),children:A},A)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),children:"None"})]})]}),h.length>0||b?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(po,{selectedTags:pt.tags||[],availableTags:h,onChange:st,onCreateTag:b,theme:dt[$]||dt.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxRuntime.jsxs("button",{ref:re,className:"modal-v2-field",onClick:()=>Xe(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.labels&&pt.labels.length>0?jsxRuntime.jsx("span",{children:pt.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Yn,{triggerRef:re,isOpen:ae,onClose:()=>Xe(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${pt.labels?.includes(A)?"active":""}`,onClick:()=>ut(A),children:[A,pt.labels?.includes(A)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{at(!me),setTimeout(()=>q.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.endDate?new Date(pt.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:q,type:"date",value:typeof pt.endDate=="string"?pt.endDate.split("T")[0]:pt.endDate?(()=>{let A=new Date(pt.endDate),K=A.getUTCFullYear(),X=String(A.getUTCMonth()+1).padStart(2,"0"),ge=String(A.getUTCDate()).padStart(2,"0");return `${K}-${X}-${ge}`})():"",onChange:Ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Pt(!mt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:pt.estimatedTime?`${pt.estimatedTime}h`:"Not set"})]}),mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:pt.estimatedTime||"",onChange:A=>zt(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Pt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),O?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:pt.description||"",onChange:A=>{if(E){let K={...E,description:A.target.value};Z(K);}},onBlur:ze,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:pt.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:We(pt.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),F.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[be,"/",F.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Re(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[F.map(A=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ht(A.id),children:A.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>wt(A.id),children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),te&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:A=>Y(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Ct(),A.key==="Escape"&&(Re(false),Y(""));},onBlur:Ct,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||C.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.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"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),C.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:C.length})]}),jsxRuntime.jsx(_r,{cardId:pt.id,attachments:C,onUpload:D?A=>D(pt.id,A):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="all"?"active":""}`,onClick:()=>oe("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>oe("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>oe("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:nt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ye,onChange:A=>Ge(A.target.value),onKeyDown:Lt,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.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"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:rt,disabled:!ye.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Be.map(A=>{let K=s.find(ge=>ge.id===A.userId);if(A.type.includes("COMMENT")){let ge=n.find(Me=>Me.id===A.metadata?.commentId);return ge?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[K&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ge.content})]})]},A.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:K?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:A.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),Be.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function gy({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function jl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(gy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,i)=>n+i.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,i)=>n+i.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,i)=>n+(i.planned||0),0)})]})]})]})}function Cy({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function Kl({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Cy,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ay={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Tp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ly({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Np({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Yl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ay[c.name]||Tp[e.indexOf(c)%Tp.length]})),i=n.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Ly:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Np,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let m=l.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Np,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsxRuntime.jsx(recharts.Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var ti=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=react.useState(false),[c,l]=react.useState(false),[m,d]=react.useState(false),[p,g]=react.useState(false);if(e.length===0)return null;let y=e.map(v=>v.id),x=v=>{r.onBulkUpdate?.(y,{priority:v}),i(false);},h=v=>{r.onBulkMove?.(y,v),l(false),a();},b=v=>{r.onBulkUpdate?.(y,{assignedUserIds:v}),d(false);},f=v=>{let N=new Set;e.forEach(D=>{D.labels?.forEach(k=>N.add(k));});let C=Array.from(new Set([...N,...v]));r.onBulkUpdate?.(y,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(v),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(v.id),children:v.title},v.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([v.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([v]),children:v},v))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});ti.displayName="BulkOperationsToolbar";function $y(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,i=y?.name||`User ${g}`,c=y?.color,l=y?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let 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];i=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ql({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),i=react.useMemo(()=>$y(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(l=>{n(m=>{let d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsxRuntime.jsx(fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let m=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),p={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(fo,{board:p,callbacks:r,availableUsers:a})})]},l.id)}),i.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Xl=[{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 Jl({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),i=Xl.find(l=>l.value===e)||Xl[0];react.useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:i.icon}),jsxRuntime.jsx("span",{children:i.label}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Xl.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var qn=[{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 Uy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Fp(e={}){let{shortcuts:t=qn,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),s=react.useRef(a);react.useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=react.useCallback(c=>{o.current=[...o.current,c];},[]),i=react.useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return react.useEffect(()=>{function c(l){if(!s.current)return;let m=l.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Uy(l,d)){r&&l.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Vy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Gy(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function _y(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Gy(e),r=t?Vy(t):"";return a?`${a} + ${r}`:r}function jy(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Ql({shortcuts:e=qn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=jy(e);return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(l=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsxRuntime.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:_y(l)})]},l.action))})]},i))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.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 Zl=[{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,15 +122,15 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ed({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.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:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ad({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=react.useState("export"),[c,l]=react.useState("json"),[m,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await eu(e,c,x);tu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await ou(h),b=h.name.endsWith(".json")?"json":"csv",w=ru(f,b);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.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:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Yy=["URGENT","HIGH","MEDIUM","LOW"],qy=[{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"}],Xy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function rd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),f=react.useCallback(T=>{a({search:T.target.value});},[a]),b=react.useCallback(T=>{a({dateFilter:T.target.value});},[a]),w=react.useCallback(T=>{r({by:T.target.value});},[r]),v=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!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:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:T=>{let D=T.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Yy.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let D=T.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsxRuntime.jsx("option",{value:T.id,children:T.name},T.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let D=T.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:qy.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Xy.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function od({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.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"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var nd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},sd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},id={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"}},Ho={dark:nd,light:sd,neutral:id},ri="dark";var oi=react.createContext(void 0),sx="asakaa-theme";function Ap({children:e,defaultTheme:t=ri,storageKey:a=sx}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Ho[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${ix(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ho};return jsxRuntime.jsx(oi.Provider,{value:n,children:e})}function mn(){let e=react.useContext(oi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ix(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ld({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=mn();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.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"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ho).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Lp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ni={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"}},Ip={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"}},dd={en:ni,es:Ip};function Bp(e){return dd[e]||dd.en}function cd(e,t){let a=Bp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var fn=react.createContext(ni);function vr(){return react.useContext(fn)}function Qn(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Gp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=react.useState(false),[l,m]=react.useState(null),d=react.useRef(null),p=react.useRef(null),g=vr(),y=Qn(d,i,"right",176);if(react.useEffect(()=>{if(!i)return;let b=w=>{let v=w.target;d.current&&!d.current.contains(v)&&p.current&&!p.current.contains(v)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){m(b);try{await w();}catch(v){console.error(`Export ${b} failed:`,v);}finally{m(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.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:y.top,left:y.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:jsxRuntime.jsx("div",{className:"py-1",children:h.map((b,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.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:w*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Op({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=react.useState(false),[c,l]=react.useState(null),[m,d]=react.useState(false),p=react.useRef(null),g=react.useRef(null),y=vr(),x=Qn(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let C=T=>{let D=T.target;p.current&&!p.current.contains(D)&&g.current&&!g.current.contains(D)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),w=async(C,T)=>{if(T){l(C);try{await T();}catch(D){console.error(`Export ${C} failed:`,D);}finally{l(null),i(false);}}},v=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.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:[b.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:b.map((C,T)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===C.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),b.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v,className:"w-full flex items-center gap-2.5 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:b.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Mx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Px({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function $p({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),i=react.useRef(null),c=vr(),l=Qn(n,o,"left");react.useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,g)=>{let y=t===p.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function Hp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=vr(),m=Qn(i,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;i.current&&!i.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:l.toolbar.filter||"Filters"}),p&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Ax({value:e,onChange:t,theme:a}){let r=vr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Lx({theme:e,forecast:t}){let a=vr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Ix({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=vr(),f=Qn(y,p,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!p)return;let T=D=>{let k=D.target;y.current&&!y.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]);let w=h.toolbar.visibility==="Visibilidad",v=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:i,onChange:c}],C=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!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:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.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:f.top,left:f.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"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:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:v.map((T,D)=>{let k=T.icon,L=T.disabled,$=T.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!L&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:L?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:L?"not-allowed":"pointer"},whileHover:L?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsxRuntime.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:L?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!L&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((T,D)=>{let k=l===T.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(T.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(v.length+D)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function si({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:v=4,viewMode:C="execution",onViewModeChange:T,projectForecast:D,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportCSV:E,onExportJSON:te,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:M,showDependencies:J=true,onShowDependenciesChange:ee,highlightWeekends:Re=true,onHighlightWeekendsChange:B,showBaseline:Y=false,onShowBaselineChange:ye,onCopySnapshotLink:Ge,hasDependencies:U=true}){let oe=vr(),Z=k||L||$||E||te||O,Ee=!!e.glassToolbar,[ke,Ie]=react.useState(false),He=react.useRef(null);react.useEffect(()=>{ke&&He.current&&He.current.focus();},[ke]);let et=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],ae=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Xe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ee){let me=Xe?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Xe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ke?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!ke),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),ke&&jsxRuntime.jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ie(false),onKeyDown:at=>{at.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),T&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Xe?"#000000":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?Xe?"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:oe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?Xe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ax,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),w&&jsxRuntime.jsx($p,{theme:e,value:b??"all",onChange:w,maxDepth:v}),y&&jsxRuntime.jsx(Hp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),f]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),jsxRuntime.jsx(Ix,{theme:e,showCriticalPath:H,onShowCriticalPathChange:M,showBaseline:Y,onShowBaselineChange:ye,highlightWeekends:Re,onHighlightWeekendsChange:B,showDependencies:J,onShowDependenciesChange:ee,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsxRuntime.jsx(Op,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),m&&p&&jsxRuntime.jsxs(framerMotion.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 ${Xe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Xe?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]})]})]}),D&&jsxRuntime.jsx(Lx,{theme:e,forecast:D})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Px,{options:et,value:t,onChange:me=>a(me),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx($p,{theme:e,value:b??"all",onChange:w,maxDepth:v}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Hp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[f,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]}),(Z||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(Op,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsxRuntime.jsx(Mx,{options:ae,value:s,onChange:me=>n(me),theme:e})]})]})}function ii({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),i=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function hn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var Qt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Jp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=react.useRef(false),y=react.useCallback(w=>{g.current=w;},[]),x=react.useCallback(w=>{let v=[],C=T=>{for(let D of T)v.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&C(D.subtasks);};return C(w),v},[]),h=react.useCallback(()=>{let w=x(e);for(let v of w)if(t.has(v.id))return v;return null},[e,t,x]),f=react.useCallback((w,v)=>{let C=x(e);if(C.length===0)return;let T=h();if(!T){a(C[0].id,false);return}let D=C.findIndex($=>$.id===T.id);if(D===-1)return;let k=w==="up"?D-1:D+1;if(k<0||k>=C.length)return;let L=C[k];a(L.id,v);},[e,h,x,a]),b=react.useCallback(w=>{if(!p)return;let v=w.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){w.key==="Escape"&&(v.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,k=Array.from(t),L=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&m(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){k.length>0&&(w.preventDefault(),n(k,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){k.length>0&&(w.preventDefault(),i(k));return}if(w.key==="Tab"&&w.shiftKey){k.length>0&&(w.preventDefault(),c(k));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),d(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),l(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){k.length>0&&(w.preventDefault(),o(k));return}if(w.key==="d"&&D&&!w.shiftKey){k.length>0&&(w.preventDefault(),s(k));return}},[p,t,h,f,r,o,s,n,i,c,l,m,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function Zp(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=p.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),i=react.useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function fd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?fd(t.subtasks):t.subtasks}))}function yn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function li(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=li(a.subtasks,t);if(r)return r}}return null}function gd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=gd(a.subtasks,t);if(r)return r}return null}function bd(e,t){if(t.length===0)return e;let a=yn(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return fd(d)}function hd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=gd(a,r);if(!o)continue;let s=gd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return fd(a)}function yd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function xd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function es(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function em(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function vd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:vd(r.subtasks,t,a)}:r)}function wd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:wd(a.subtasks,t)}:a)}function kd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function tm(e,t,a,r){if(t===a)return e;let o=li(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function wr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=wr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ci({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:v,onCreateSubtask:C,onOpenTaskModal:T,onDeleteRequest:D,onTaskReparent:k,scrollContainerRef:L,showCriticalPath:$=false}){let E=react.useContext(fn),[te,O]=react.useState(null),[H,M]=react.useState(null),[J,ee]=react.useState(""),Re=react.useRef(null),[B,Y]=react.useState(null),[ye,Ge]=react.useState(0),[U,oe]=react.useState(0),[Z,Ee]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ke,Ie]=react.useState(null),[He,et]=react.useState(null),[ae,Xe]=react.useState(null),me=react.useRef(0),at=5,mt=react.useRef(false),[Pt,Ce]=react.useState(null),[xt,nt]=react.useState(false),Je=react.useRef(null),[z,se]=react.useState(null),[S,q]=react.useState(false),ue=react.useRef(null);react.useEffect(()=>{function le(be){ue.current&&!ue.current.contains(be.target)&&q(false);}if(S)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[S]),react.useEffect(()=>{H&&Re.current&&(Re.current.focus(),Re.current.select());},[H]),react.useEffect(()=>{if(!B)return;let le=A=>{let K=A.clientX-ye,X=U+K;p?.(B,X);},be=()=>{Y(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",be),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",be),document.body.style.cursor="",document.body.style.userSelect="";}},[B,ye,U,p]);let{selectedTaskIds:Te,handleTaskClick:W,isTaskSelected:re}=Zp(),{setIsEditing:Ue}=Jp({tasks:e,selectedTaskIds:Te,onTaskSelect:(le,be)=>{let K=yn(e).map(X=>X.id);W(le,K,be||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:le=>{let be=yn(e).find(A=>A.id===le);be&&ut(be);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:le=>{let be=yn(e).find(A=>A.id===le);be&&T&&T(be);},enableKeyboard:true}),Ne=(le,be=0,A="")=>{let K=[],X=[...le].sort((ge,Fe)=>(ge.position??0)-(Fe.position??0));for(let ge=0;ge<X.length;ge++){let Fe=X[ge],Ye=ge+1,Ve=A?`${A}.${Ye}`:`${Ye}.0`;if(Fe.wbsCode=Ve,K.push({task:Fe,level:be}),Fe.subtasks&&Fe.subtasks.length>0&&Fe.isExpanded){let Oe=A?`${A}.${Ye}`:`${Ye}`;K.push(...Ne(Fe.subtasks,be+1,Oe));}}return K},ze=Ne(e),Me=48,Ke=Math.max(ze.length*a,600-Me),lt=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,ut=le=>{M(le.id),ee(le.name),Ue(true);},st=le=>{J.trim()&&J!==e.find(be=>be.id===le)?.name&&v?.(le,J.trim()),M(null),ee(""),Ue(false);},Ze=()=>{M(null),ee(""),Ue(false);},zt=(le,be)=>{be.stopPropagation(),C?.(le.id);},Ct=(le,be)=>{be.preventDefault(),me.current=be.clientY,Ie(le),mt.current=false,nt(false),Ce({x:be.clientX,y:be.clientY});},ht=le=>{if(!ke||(Math.abs(le.clientY-me.current)>at&&!mt.current&&(mt.current=true,nt(true)),Ce({x:le.clientX,y:le.clientY}),!mt.current))return;if(L?.current){let ge=L.current,Fe=ge.getBoundingClientRect(),Ye=60,Ve=12;Je.current&&(cancelAnimationFrame(Je.current),Je.current=null);let Oe=le.clientY-Fe.top,bt=Fe.bottom-le.clientY;if(Oe<Ye&&ge.scrollTop>0){let gt=Math.round(Ve*(1-Oe/Ye)),P=()=>{ge.scrollTop-=gt,mt.current&&ge.scrollTop>0&&(Je.current=requestAnimationFrame(P));};Je.current=requestAnimationFrame(P);}else if(bt<Ye&&ge.scrollTop<ge.scrollHeight-ge.clientHeight){let gt=Math.round(Ve*(1-bt/Ye)),P=()=>{ge.scrollTop+=gt,mt.current&&ge.scrollTop<ge.scrollHeight-ge.clientHeight&&(Je.current=requestAnimationFrame(P));};Je.current=requestAnimationFrame(P);}}let A=document.querySelectorAll("[data-task-row]"),K=null,X=null;A.forEach(ge=>{let Fe=ge.getBoundingClientRect(),Ye=ge.getAttribute("data-task-row");if(Ye&&Ye!==ke&&le.clientY>=Fe.top&&le.clientY<=Fe.bottom){K=Ye;let Ve=le.clientY-Fe.top,Oe=Fe.height;Ve<Oe*.25?X="above":Ve>Oe*.75?X="below":X="child";}}),et(K),Xe(X);},wt=()=>{if(mt.current&&ke&&He&&ae){if(ae==="child")k?.(ke,He);else if(ae==="above"||ae==="below"){let le=(X,ge,Fe=null)=>{for(let Ye of X){if(Ye.id===ge)return Fe;if(Ye.subtasks){let Ve=le(Ye.subtasks,ge,Ye.id);if(Ve!==void 0)return Ve}}},be=le(e,ke,null),A=le(e,He,null),K=(X,ge,Fe,Ye)=>{let Ve=X.findIndex(gt=>gt.id===ge),Oe=Ye?X.findIndex(gt=>gt.id===Fe):-1,bt=ae==="below"?Ve+1:Ve;return Ye&&Oe!==-1&&Oe<Ve&&(bt-=1),Math.max(0,bt)};if(A===null){let ge=K(e,He,ke,be===null);k?.(ke,null,ge);}else {let X=ze.find(ge=>ge.task.id===A)?.task;if(X?.subtasks){let ge=be===A,Fe=K(X.subtasks,He,ke,ge);k?.(ke,A,Fe);}}}}Je.current&&(cancelAnimationFrame(Je.current),Je.current=null),Ie(null),et(null),Xe(null),Ce(null),mt.current=false,nt(false);};react.useEffect(()=>{if(ke)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",wt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",wt),document.body.style.cursor="",document.body.style.userSelect="";}},[ke,He,ae]);let rt=(le,be,A)=>{let K=be.subtasks&&be.subtasks.length>0;switch(le.id){case "name":let X=H===be.id,ge=te===be.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[k&&jsxRuntime.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:ge?1:.3},onMouseDown:I=>Ct(be.id,I),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),be.subtasks&&be.subtasks.length>0?jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),c?.(be.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:be.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),X?jsxRuntime.jsx("input",{ref:Re,type:"text",value:J,onChange:I=>ee(I.target.value),onKeyDown:I=>{I.key==="Enter"?st(be.id):I.key==="Escape"&&Ze();},onBlur:()=>st(be.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:I=>I.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:be.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:be.parentId?"13px":"14px",fontWeight:be.isMilestone?600:be.parentId?400:600,letterSpacing:be.parentId?"0":"-0.01em"},title:be.name,children:[be.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:be.wbsCode}),be.isHighlighted&&be.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:be.name}),be.subtasks&&be.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(be.progress||0),"%"]}),$&&be.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&be.cpmData&&jsxRuntime.jsxs("span",{style:{color:be.cpmData.totalFloat<=0?"#EF4444":be.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(be.cpmData.totalFloat),"d"]})]}),ge&&!X&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>zt(be,I),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),ut(be);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Ye=le.id==="startDate"?"startDate":"endDate",Ve=be[Ye],Oe=z?.taskId===be.id&&z?.field===Ye,bt=I=>I?(typeof I=="string"?new Date(I):I).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!K)if(Oe)se(null);else {let G=I.currentTarget.getBoundingClientRect();se({taskId:be.id,field:Ye,month:Ve?typeof Ve=="string"?new Date(Ve):Ve:new Date,position:{top:G.bottom+4,left:G.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:bt(Ve)}),K&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(null)}),jsxRuntime.jsxs(framerMotion.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:z?.position.top,left:z?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,G=new Date(I);G.setDate(I.getDate()+1);let ce=new Date(I);ce.setDate(I.getDate()+7);let N=new Date(I);return N.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:G},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:N}].map((xe,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Qe=>Qe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Qe=>Qe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:xe.date}),se(null);},children:xe.label},Le))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:void 0}),se(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>se(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:z?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>se(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((I,G)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=z?.month||new Date,G=I.getFullYear(),ce=I.getMonth(),N=new Date(G,ce,1).getDay(),j=new Date(G,ce+1,0).getDate(),xe=new Date,Le=[];for(let tt=N-1;tt>=0;tt--)Le.push({day:new Date(G,ce,-tt).getDate(),date:new Date(G,ce-1,new Date(G,ce,-tt).getDate()),isCurrentMonth:false});for(let tt=1;tt<=j;tt++)Le.push({day:tt,date:new Date(G,ce,tt),isCurrentMonth:true});let Qe=42-Le.length;for(let tt=1;tt<=Qe;tt++)Le.push({day:tt,date:new Date(G,ce+1,tt),isCurrentMonth:false});return Le.map((tt,vt)=>{let Rt=tt.date.toDateString()===xe.toDateString(),Ot=(Ve?typeof Ve=="string"?new Date(Ve):Ve:null)?.toDateString()===tt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:tt.isCurrentMonth?Ot?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ot?"#2E94FF":"transparent",boxShadow:Rt&&!Ot?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(be.id,{[Ye]:tt.date}),se(null);},children:tt.day},vt)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:lt(be)})});case "assignees":if(K)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let gt=r.filter(I=>be.assignees?.some(G=>G.name===I.name||G.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Lo,{assignedUsers:gt,availableUsers:r,onChange:I=>{let G=I.map(ce=>({id:ce.id,name:ce.name,initials:ce.initials,color:ce.color}));g?.(be.id,{assignees:G.length>0?G:void 0});}})});case "status":if(K){let I=be.progress===100?"\u2713":be.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Cu,{status:be.status||"todo",onChange:I=>{g?.(be.id,{status:I,progress:I==="completed"?100:be.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.progress}%`,backgroundColor:be.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[be.progress,"%"]})]});case "priority":let P={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},de={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=P[be.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Po,{priority:fe,onChange:I=>{I&&g?.(be.id,{priority:de[I]||"medium"});}})});default:return null}},Lt=le=>[{id:"hide",label:"Hide Column",icon:Qt.Hide,onClick:()=>d(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Qt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Qt.SortDesc,onClick:()=>{}}],We=le=>le.subtasks&&le.subtasks.length>0?[{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{b?.([le.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}]:[{id:"edit",label:E?.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{n?.(le);}},{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:E?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{g?.(le.id,{status:"todo",progress:0});},disabled:le.status==="todo"},{id:"setInProgress",label:E?.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{g?.(le.id,{status:"in-progress"});},disabled:le.status==="in-progress"},{id:"markComplete",label:E?.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{g?.(le.id,{status:"completed",progress:100});},disabled:le.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{b?.([le.id]);}},{id:"split",label:E?.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{D?D(le.id,le.name):f?.([le.id]);}}],Be=m.filter(le=>le.visible),pt=Be.reduce((le,be)=>le+be.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:pt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Me}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((le,be)=>{let A=be===Be.length-1,K=le.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(K?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:X=>{X.preventDefault(),Ee({isOpen:true,x:X.clientX,y:X.clientY,type:"header",columnId:le.id});},onMouseEnter:X=>{X.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:X=>{X.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:X=>{X.preventDefault(),X.stopPropagation(),Y(le.id),Ge(X.clientX),oe(le.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},le.id)})}),jsxRuntime.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:[jsxRuntime.jsx(ii,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>q(!S),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),S&&jsxRuntime.jsxs("div",{ref:ue,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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>q(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ke},children:ze.map(({task:le,level:be},A)=>{let K=re(le.id),X=He===le.id,ge=X&&ae==="above",Fe=X&&ae==="below",Ye=X&&ae==="child",Ve={};return Ye&&(Ve.backgroundColor=`${t.accent}15`,Ve.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${ke===le.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Ye?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:$?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Ve},onMouseEnter:()=>O(le.id),onMouseLeave:()=>O(null),onClick:Oe=>{let gt=yn(e).map(fe=>fe.id),de=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;W(le.id,gt,de,Oe.shiftKey),s?.(le);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(le);},onContextMenu:Oe=>{Oe.preventDefault(),Ee({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:le}),i?.(le,Oe);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[ge&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Oe,bt)=>{let gt=bt===Be.length-1,P=Oe.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(P?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${te===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:rt(Oe,le,P?be:0)},`${le.id}-${Oe.id}`)})]},le.id)})}),jsxRuntime.jsx(hn,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Lt(Z.columnId):Z.type==="task"&&Z.task?We(Z.task):[],onClose:()=>Ee({...Z,isOpen:false}),theme:t}),xt&&Pt&&ke&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Pt.x+12,top:Pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=ze.find(be=>be.task.id===ke)?.task;return le?jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:le.name})}):null})()}),document.body)]})}function sm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,i]=react.useState(e),[c,l]=react.useState(t),[m,d]=react.useState(null),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(0),[v,C]=react.useState(0),[T,D]=react.useState(null),[k,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:v,setSegmentDragOffsetX:C,hoveredSegmentIndex:T,setHoveredSegmentIndex:D,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,M)=>{r("none"),d(null),g(null),i(H),l(M),C(0),f(null),w(0);}}}function mi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false}){let v=sm(t,r),C=react.useRef(null),T=react.useRef(false),D=react.useRef(null),k=react.useRef(null),{dragMode:L,setDragMode:$,dragOffset:E,setDragOffset:te,ghostX:O,setGhostX:H,ghostWidth:M,setGhostWidth:J,connectionLine:ee,setConnectionLine:Re,hoveredTaskId:B,setHoveredTaskId:Y,activeZone:ye,setActiveZone:Ge,draggedSegmentIndex:U,setDraggedSegmentIndex:oe,draggedSegmentStartX:Z,setDraggedSegmentStartX:Ee,segmentDragOffsetX:ke,setSegmentDragOffsetX:Ie,hoveredSegmentIndex:He,setHoveredSegmentIndex:et,isHovered:ae,setIsHovered:Xe,isDragging:me,isResizing:at,isConnecting:mt,resetDragState:Pt}=v,Ce=18,xt=!!o.executionBarBg,nt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Je=xt?3:6,z=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<A})()&&e.progress<100,S=b&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",ue=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},re=b&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,Ue=w?"default":me?mt?"crosshair":at?"ew-resize":"grabbing":"grab",Ne=w?"default":"ew-resize",Me=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),Ke=r<50,lt=r<40;react.useEffect(()=>{x&&(!ae||me||e.segments)&&x(null);},[ae,me,e.segments,x]);let ut=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),st=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},Ze=A=>Math.round(A/s)*s,zt=A=>{let K=Math.round(A/s),X=new Date(n);return X.setDate(X.getDate()+K),X},Ct=(A,K)=>{for(let X of g){if(X.id===e.id)continue;let ge=5;if(A>=X.x-ge&&A<=X.x+X.width+ge&&K>=X.y-ge&&K<=X.y+X.height+ge)return X.id}return null},ht=react.useCallback((A,K,X)=>{if(w)return;A.preventDefault(),A.stopPropagation();let ge=C.current?.ownerSVGElement;if(!ge)return;let Fe=ge.createSVGPoint();Fe.x=A.clientX,Fe.y=A.clientY;let Ye=Fe.matrixTransform(ge.getScreenCTM()?.inverse()),Ve=X!==void 0?X:t,Oe=K;if(!Oe){let bt=Ye.x-Ve;A.shiftKey?(Oe="connect",Re({x:t+r,y:a+Ce/2})):A.ctrlKey||A.metaKey?Oe="move":A.altKey?Oe=bt<r/2?"resize-start":"resize-end":lt?bt<r/2?Oe="move":Oe="resize-end":Ke?bt<=Me/2?Oe="resize-start":bt>=r-Me/2?Oe="resize-end":Oe="move":bt<=Me?Oe="resize-start":bt>=r-Me?Oe="resize-end":Oe="move";}T.current=false,$(Oe),Xe(false),Ge(null),Oe==="move"?te(Ye.x-Ve):Oe==="connect"?Re({x:t+r,y:a+Ce/2}):te(0),H(Ve),J(r);},[t,r,a,Ce,w]),wt=react.useCallback(A=>{let K=C.current?.ownerSVGElement;if(!K)return;let X=K.closest(".gantt-timeline-scroll");if(!X)return;let ge=X.getBoundingClientRect(),Fe=60,Ye=15,Ve=0;if(A.clientX<ge.left+Fe){let Oe=ge.left+Fe-A.clientX;Ve=-Math.min(Ye,Oe/2);}else if(A.clientX>ge.right-Fe){let Oe=A.clientX-(ge.right-Fe);Ve=Math.min(Ye,Oe/2);}return Ve!==0&&(X.scrollLeft+=Ve),Ve!==0},[]),rt=react.useCallback(A=>{if(L==="none")return;T.current=true,k.current=A;let K=C.current?.ownerSVGElement;if(!K)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Fe=wt(A);Fe&&!D.current?D.current=window.setInterval(()=>{k.current&&(wt(k.current),rt(k.current));},16):!Fe&&D.current&&(window.clearInterval(D.current),D.current=null);}let X=K.createSVGPoint();X.x=A.clientX,X.y=A.clientY;let ge=X.matrixTransform(K.getScreenCTM()?.inverse());if(L==="connect"){Re({x:ge.x,y:ge.y});let Fe=Ct(ge.x,ge.y);Y(Fe);}else if(L==="move"){let Fe=ge.x-E,Ye=Ze(Fe);H(Ye),J(r);let Ve=Math.round((Ye-t)/s);if(y?.(e.id,Ve,true),e.segments&&e.segments.length>0&&U!==null){let Oe=Ye-Z;Ie(Oe);}}else if(L==="resize-start"){let Fe=ge.x,Ye=Ze(Fe),Ve=t+r-Ye;Ve>=s&&(H(Ye),J(Ve));}else if(L==="resize-end"){let Fe=ge.x,Ve=Ze(Fe)-t;Ve>=s&&J(Ve);}},[L,t,r,s,E,e,Ze,U,Z,Ct,Y,Re,H,J,Ie,y,wt]),Lt=react.useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),k.current=null,L!=="none"){if(L==="connect")B&&p&&p(e,B),Re(null),Y(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),K,X,ge=true;if(L==="move"){if(K=zt(O),X=new Date(K.getTime()+A),e.segments&&e.segments.length>0&&U!==null){let Fe=Math.round(ke/s),Ye=e.segments.map((gt,P)=>{if(P===U){let de=new Date(gt.startDate),fe=new Date(gt.endDate);return de.setDate(de.getDate()+Fe),fe.setDate(fe.getDate()+Fe),{startDate:de,endDate:fe}}return gt}),Ve=Ye.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ve.map(gt=>gt.getTime()))),bt=new Date(Math.max(...Ve.map(gt=>gt.getTime())));d?.({...e,segments:Ye},Oe,bt),Pt(t,r);return}}else L==="resize-start"?(K=zt(O),X=e.endDate,K>X&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):L==="resize-end"?(K=e.startDate,X=zt(O+M),X.setDate(X.getDate()-1),X<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&K&&X&&(X.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,X));}y?.(e.id,0,false),Pt(t,r);}},[L,O,M,e,d,B,p,t,r,s,zt,ke,U,Pt,y]);react.useEffect(()=>{if(L==="none")return;let A=X=>{rt(X);},K=()=>{Lt();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",K),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,rt,Lt]);let We=me&&!mt?O:t,Be=me&&!mt?M:r,pt=i.taskClass(e),le=24,be=b?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:C,"data-task-bar":"true",style:{opacity:be,transition:"opacity 300ms ease"},onClick:()=>{!me&&!T.current&&c?.(e),T.current=false;},onDoubleClick:A=>{!me&&!T.current&&(A.stopPropagation(),l?.(e));},onContextMenu:A=>{A.preventDefault(),m?.(e,A);},onMouseEnter:()=>!me&&Xe(true),onMouseMove:A=>{x&&ae&&!me&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{me||(Xe(false),Ge(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+le,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!me&&!Ke&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Me,height:Ce,fill:ye==="resize-start"?o.accent:"transparent",opacity:ye==="resize-start"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-start"),onMouseDown:A=>ht(A,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Me,y:a,width:r-Me*2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r-Me,y:a,width:Me,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")})]}),ae&&!me&<&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.2:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),me&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:M,height:Ce,rx:Je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!me&&(()=>{let A=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),X=n.getTime(),ge=864e5,Fe=(A-X)/ge,Ye=(K-A)/ge,Ve=Fe*s,Oe=Math.max(Ye*s,s),bt=We+Be,gt=Ve+Oe,P=e.endDate?.getTime()??0,de=Math.ceil((P-K)/ge),fe=de>0,I=de<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ve,y:a,width:Oe,height:Ce,rx:Je,fill:"none",stroke:nt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),fe&&bt>gt&&jsxRuntime.jsx("rect",{x:gt,y:a,width:bt-gt,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),fe&&jsxRuntime.jsxs("text",{x:Math.max(bt,gt)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",de,"d"]}),I&&jsxRuntime.jsxs("text",{x:bt+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[de,"d"]})]})})(),!e.segments&&xt&&z&&(()=>{let K=a+(Ce-8)/2,X=4,ge=e.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ye=e.startDate&&Fe>=e.startDate,Ve=e.endDate&&(()=>{let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),Fe>fe})(),Oe=e.startDate&&Fe<e.startDate,bt=1;if(Ye&&e.startDate&&e.endDate&&!Oe){let fe=new Date(e.startDate);fe.setHours(0,0,0,0);let I=new Date(e.endDate);I.setHours(0,0,0,0);let G=Math.max(1,(I.getTime()-fe.getTime())/(1e3*60*60*24)),N=Math.min((Fe.getTime()-fe.getTime())/(1e3*60*60*24),G)/G*100;bt=N>0?ge/N:1;}let gt;ge>=100?gt="#00E5CC":Oe?gt="#4B5563":Ve&&ge<100?gt="#EF4444":bt>=.95?gt="#22C55E":bt>=.8?gt="#F59E0B":gt="#EF4444";let P=Math.max(ge/100*Be,ge>0?X*2:0),de=Be>100&&ge>0;return jsxRuntime.jsxs("g",{"data-task-class":pt,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:We,y:K,width:Be,height:8,rx:X,fill:"rgba(255,255,255,0.10)"}),ge>0&&jsxRuntime.jsx("rect",{x:We,y:K,width:P,height:8,rx:X,fill:gt}),de&&jsxRuntime.jsxs("text",{x:We+P+6,y:K+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ge),"%"]})]})})(),!e.segments&&xt&&!z&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:me&&!mt?.15:e.parentId?.6:1,scale:ae&&!me?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>ht(A),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!xt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:re,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:me&&!mt?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:z?void 0:A=>ht(A),style:{cursor:z?"default":Ue,pointerEvents:"all"}}),xt&&(se||S)&&!e.segments&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!z&&jsxRuntime.jsx("rect",{x:We,y:a,width:Math.max(Be*(e.progress/100),Je*2),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!z&&e.progress<100&&(()=>{let A=e.progress>0?Be*(e.progress/100):0,K=We+A,X=Be-A,ge=e.progress===0?Je:0,Fe=e.progress===0?We:K,Ye=e.progress===0?Be:X;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Fe,y:a,width:Ye,height:Ce,rx:ge,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Fe,y:a,width:Ye,height:Ce,rx:ge,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),xt&&!e.segments&&e.progress>0&&e.progress<100&&!z&&!me&&(()=>{let A=We+Be*(e.progress/100),K=8,X=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:A,cy:a+Ce/2,r:K,fill:X?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:A,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:X?.initials||X?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,K)=>{let X=(A.startDate.getTime()-n.getTime())/864e5*s,Fe=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-X+s,Ye=me&&L==="move"&&U===K,Ve=He===K,Oe=Ye?X+ke:X;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!me&&et(K),onMouseLeave:()=>!me&&et(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:Fe,height:Ce,rx:Je,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:Ye||e.parentId?.6:Ve?.9:.8,scale:Ve&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:bt=>{bt.stopPropagation(),oe(K),Ee(X),ht(bt,void 0,X);},style:{cursor:Ue,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:Fe*(e.progress/100),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),q&&(se||S)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&!se&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Be>60&&!e.segments&&!(xt&&z)&&(()=>{let A=i.taskLabel(e),K=typeof A=="string"?A:e.name,X=K.length>Math.floor(Be/8)?`${K.substring(0,Math.floor(Be/8))}...`:K;return jsxRuntime.jsx("text",{x:We+8,y:a+Ce/2,dominantBaseline:"middle",fill:ue?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ue?"line-through":"none"},children:X})})(),!me&&!e.segments&&!z&&e.progress>0&&e.progress<100&&(xt?jsxRuntime.jsxs("text",{x:We+Be+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxRuntime.jsxs("text",{x:We+Be-12,y:a+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Be>80&&!me&&!e.segments&&!(xt&&z)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||at)&&!mt&&!e.segments&&!z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-start"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-start"||L==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We+Be-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-end"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+Be-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!me&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ge("connect"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ye==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:ee.x,y2:ee.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:ee.x,cy:ee.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||me)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We-1,y:a-1,width:Be+2,height:Ce+2,rx:Je+1,fill:"none",stroke:me?o.accent:xt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:xt?1:2,opacity:me||xt?.6:.4,initial:{opacity:0},animate:{opacity:me||xt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+M,y1:0,x2:O+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!me&&!e.segments&&!x&&(()=>{let X=a<100,ge=X?a+Ce+13:a-82-13,Fe=X?`M ${We+Be/2-6} ${a+Ce+3} L ${We+Be/2} ${a+Ce+13} L ${We+Be/2+6} ${a+Ce+3}`:`M ${We+Be/2-6} ${a-13} L ${We+Be/2} ${a-3} L ${We+Be/2+6} ${a-13}`,Ye=ge+22,Ve=ge+40,Oe=ge+55,bt=ge+70,gt=X?ge+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:X?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:X?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Fe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:We+Be/2-120,y:ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:We+Be/2,y:Ye,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.startDate)}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.endDate)}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:We+Be/2+65,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st()}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:We+Be/2+65,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:We+Be/2-110,y:bt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:We+Be/2-50,y:bt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(P=>P.name).join(", ").substring(0,30),e.assignees.map(P=>P.name).join(", ").length>30?"...":""]})]}),!X&&jsxRuntime.jsx("text",{x:We+Be/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":Ke?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Cd=260,xn=8,dm=16,wv=-12;function cm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:v}=e,T=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null?155:105,D=w+dm,k=v+wv-T;D+Cd>window.innerWidth-xn&&(D=w-Cd-dm),D<xn&&(D=xn);let L=k<xn;L&&(k=v+20),k+T>window.innerHeight-xn&&(k=window.innerHeight-xn-T),o({left:D,top:k,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},m=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),v=b%60;return w===0?`${v}m`:v===0?`${w}h`:`${w}h ${v}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Cd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(gi,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ed({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxRuntime.jsxs("div",{className:u("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.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:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ad({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=react.useState("export"),[c,l]=react.useState("json"),[m,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await tu(e,c,x);au(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let b=await nu(h),f=h.name.endsWith(".json")?"json":"csv",w=ou(b,f);d(w),w.success&&r&&r(w,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.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:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Jy=["URGENT","HIGH","MEDIUM","LOW"],Qy=[{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"}],Zy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function rd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=react.useState(true),b=react.useCallback(C=>{a({search:C.target.value});},[a]),f=react.useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=react.useCallback(C=>{r({by:C.target.value});},[r]),v=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!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:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Jy.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let D=C.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsxRuntime.jsx("option",{value:C.id,children:C.name},C.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(C=>jsxRuntime.jsx("option",{value:C,children:C},C))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:Qy.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:C=>y(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Zy.map(C=>jsxRuntime.jsx("option",{value:C.value,children:C.label},C.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function od({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),l&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>p(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>p(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.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"]}),jsxRuntime.jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var nd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#2E94FF",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},sd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},id={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"}},Ho={dark:nd,light:sd,neutral:id},ri="dark";var oi=react.createContext(void 0),dx="asakaa-theme";function Lp({children:e,defaultTheme:t=ri,storageKey:a=dx}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=react.useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Ho[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${cx(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Ho};return jsxRuntime.jsx(oi.Provider,{value:n,children:e})}function mn(){let e=react.useContext(oi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function cx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ld({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=mn();return e?jsxRuntime.jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.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"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ho).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ip(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var ni={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"}},Bp={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"}},dd={en:ni,es:Bp};function Rp(e){return dd[e]||dd.en}function cd(e,t){let a=Rp(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var fn=react.createContext(ni);function vr(){return react.useContext(fn)}function Qn(e,t,a="left",r=208){let[o,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function _p({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=react.useState(false),[l,m]=react.useState(null),d=react.useRef(null),p=react.useRef(null),g=vr(),y=Qn(d,i,"right",176);if(react.useEffect(()=>{if(!i)return;let f=w=>{let v=w.target;d.current&&!d.current.contains(v)&&p.current&&!p.current.contains(v)&&c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(f=>f.handler),b=async(f,w)=>{if(w){m(f);try{await w();}catch(v){console.error(`Export ${f} failed:`,v);}finally{m(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.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:y.top,left:y.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:jsxRuntime.jsx("div",{className:"py-1",children:h.map((f,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.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:w*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):f.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})}),document.body)]})}function $p({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=react.useState(false),[c,l]=react.useState(null),[m,d]=react.useState(false),p=react.useRef(null),g=react.useRef(null),y=vr(),x=Qn(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=y.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!n)return;let N=C=>{let D=C.target;p.current&&!p.current.contains(D)&&g.current&&!g.current.contains(D)&&i(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let f=[{id:"png",label:y.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),w=async(N,C)=>{if(C){l(N);try{await C();}catch(D){console.error(`Export ${N} failed:`,D);}finally{l(null),i(false);}}},v=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.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:[f.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:f.map((N,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(N.id,N.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 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:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===N.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),f.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v,className:"w-full flex items-center gap-2.5 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:f.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Lx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Ix({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Hp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=react.useState(false),n=react.useRef(null),i=react.useRef(null),c=vr(),l=Qn(n,o,"left");react.useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,g)=>{let y=t===p.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function zp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),i=react.useRef(null),c=react.useRef(null),l=vr(),m=Qn(i,s,"left");react.useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=b=>{let f=b.target;i.current&&!i.current.contains(f)&&c.current&&!c.current.contains(f)&&n(false);},h=b=>{b.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:l.toolbar.filter||"Filters"}),p&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Bx({value:e,onChange:t,theme:a}){let r=vr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Rx({theme:e,forecast:t}){let a=vr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&i&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsxRuntime.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:h})]})]})]})}function Ox({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=react.useState(false),y=react.useRef(null),x=react.useRef(null),h=vr(),b=Qn(y,p,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!p)return;let C=D=>{let k=D.target;y.current&&!y.current.contains(k)&&x.current&&!x.current.contains(k)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);let w=h.toolbar.visibility==="Visibilidad",v=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:i,onChange:c}],N=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:y,onClick:()=>g(!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:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.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:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"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:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:v.map((C,D)=>{let k=C.icon,L=C.disabled,$=C.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!L&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:L?f?"rgba(255,255,255,0.3)":"#9CA3AF":f?"rgba(255,255,255,0.85)":"#111827",cursor:L?"not-allowed":"pointer"},whileHover:L?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},title:$,children:[jsxRuntime.jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:L?f?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!L&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((C,D)=>{let k=l===C.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(C.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(v.length+D)*.03},children:[jsxRuntime.jsx("span",{style:{color:k?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),k&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function si({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:f,onWbsLevelChange:w,maxWbsDepth:v=4,viewMode:N="execution",onViewModeChange:C,projectForecast:D,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportCSV:E,onExportJSON:Z,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:F,showDependencies:J=true,onShowDependenciesChange:te,highlightWeekends:Re=true,onHighlightWeekendsChange:B,showBaseline:Y=false,onShowBaselineChange:ye,onCopySnapshotLink:Ge,hasDependencies:U=true}){let oe=vr(),ee=k||L||$||E||Z||O,Ee=!!e.glassToolbar,[ke,Ie]=react.useState(false),He=react.useRef(null);react.useEffect(()=>{ke&&He.current&&He.current.focus();},[ke]);let et=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],ae=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Xe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ee){let me=Xe?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs(framerMotion.motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Xe?"#1A1A1A":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ke?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>Ie(!ke),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsxRuntime.jsx(lucideReact.Search,{className:"w-4 h-4"})}),ke&&jsxRuntime.jsx("input",{ref:He,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ie(false),onKeyDown:at=>{at.key==="Escape"&&Ie(false);}})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),C&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Xe?"#000000":e.bgSecondary,border:`1px solid ${Xe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Xe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Xe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Bx,{value:t,onChange:a,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),w&&jsxRuntime.jsx(Hp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsxRuntime.jsx(zp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:me}}),jsxRuntime.jsx(Ox,{theme:e,showCriticalPath:H,onShowCriticalPathChange:F,showBaseline:Y,onShowBaselineChange:ye,highlightWeekends:Re,onHighlightWeekendsChange:B,showDependencies:J,onShowDependenciesChange:te,rowDensity:i,onRowDensityChange:c,hasDependencies:U}),jsxRuntime.jsx($p,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),m&&p&&jsxRuntime.jsxs(framerMotion.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 ${Xe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Xe?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]})]})]}),D&&jsxRuntime.jsx(Rx,{theme:e,forecast:D})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ix,{options:et,value:t,onChange:me=>a(me),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsxRuntime.jsx(Hp,{theme:e,value:f??"all",onChange:w,maxDepth:v}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(zp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||oe.toolbar.createTask})]}),(ee||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx($p,{theme:e,onExportPNG:k,onExportPDF:L,onExportExcel:$,onExportMSProject:O,onCopySnapshotLink:Ge}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsxRuntime.jsx(Lx,{options:ae,value:s,onChange:me=>n(me),theme:e})]})]})}function ii({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),i=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Wt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function hn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[i,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var Zt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Qp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=react.useRef(false),y=react.useCallback(w=>{g.current=w;},[]),x=react.useCallback(w=>{let v=[],N=C=>{for(let D of C)v.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&N(D.subtasks);};return N(w),v},[]),h=react.useCallback(()=>{let w=x(e);for(let v of w)if(t.has(v.id))return v;return null},[e,t,x]),b=react.useCallback((w,v)=>{let N=x(e);if(N.length===0)return;let C=h();if(!C){a(N[0].id,false);return}let D=N.findIndex($=>$.id===C.id);if(D===-1)return;let k=w==="up"?D-1:D+1;if(k<0||k>=N.length)return;let L=N[k];a(L.id,v);},[e,h,x,a]),f=react.useCallback(w=>{if(!p)return;let v=w.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){w.key==="Escape"&&(v.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,k=Array.from(t),L=h();if(w.key==="ArrowUp"){w.preventDefault(),b("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),b("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&m(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){k.length>0&&(w.preventDefault(),n(k,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){k.length>0&&(w.preventDefault(),i(k));return}if(w.key==="Tab"&&w.shiftKey){k.length>0&&(w.preventDefault(),c(k));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),d(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),l(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){k.length>0&&(w.preventDefault(),o(k));return}if(w.key==="d"&&D&&!w.shiftKey){k.length>0&&(w.preventDefault(),s(k));return}},[p,t,h,b,r,o,s,n,i,c,l,m,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[p,f]),{setIsEditing:y}}function em(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=react.useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),b=p.slice(x,h+1);t(new Set(b)),r(d);},[a,o]),i=react.useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=react.useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function fd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?fd(t.subtasks):t.subtasks}))}function yn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function li(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=li(a.subtasks,t);if(r)return r}}return null}function gd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=gd(a.subtasks,t);if(r)return r}return null}function bd(e,t){if(t.length===0)return e;let a=yn(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let b=n(h.subtasks,g);h.subtasks=b.tasks,y.push(...b.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return fd(d)}function hd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=gd(a,r);if(!o)continue;let s=gd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return fd(a)}function yd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function xd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function es(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function tm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function vd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:vd(r.subtasks,t,a)}:r)}function wd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:wd(a.subtasks,t)}:a)}function kd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function am(e,t,a,r){if(t===a)return e;let o=li(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function wr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=wr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ci({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:b,onTaskDuplicate:f,onTaskCreate:w,onTaskRename:v,onCreateSubtask:N,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:k,scrollContainerRef:L,showCriticalPath:$=false}){let E=react.useContext(fn),[Z,O]=react.useState(null),[H,F]=react.useState(null),[J,te]=react.useState(""),Re=react.useRef(null),[B,Y]=react.useState(null),[ye,Ge]=react.useState(0),[U,oe]=react.useState(0),[ee,Ee]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ke,Ie]=react.useState(null),[He,et]=react.useState(null),[ae,Xe]=react.useState(null),me=react.useRef(0),at=5,mt=react.useRef(false),[Pt,Ce]=react.useState(null),[xt,nt]=react.useState(false),Je=react.useRef(null),[z,se]=react.useState(null),[S,q]=react.useState(false),ue=react.useRef(null);react.useEffect(()=>{function le(be){ue.current&&!ue.current.contains(be.target)&&q(false);}if(S)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[S]),react.useEffect(()=>{H&&Re.current&&(Re.current.focus(),Re.current.select());},[H]),react.useEffect(()=>{if(!B)return;let le=A=>{let K=A.clientX-ye,X=U+K;p?.(B,X);},be=()=>{Y(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",be),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",be),document.body.style.cursor="",document.body.style.userSelect="";}},[B,ye,U,p]);let{selectedTaskIds:Te,handleTaskClick:W,isTaskSelected:re}=em(),{setIsEditing:Ue}=Qp({tasks:e,selectedTaskIds:Te,onTaskSelect:(le,be)=>{let K=yn(e).map(X=>X.id);W(le,K,be||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:le=>{let be=yn(e).find(A=>A.id===le);be&&ut(be);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:le=>{let be=yn(e).find(A=>A.id===le);be&&C&&C(be);},enableKeyboard:true}),Ne=(le,be=0,A="")=>{let K=[],X=[...le].sort((ge,Me)=>(ge.position??0)-(Me.position??0));for(let ge=0;ge<X.length;ge++){let Me=X[ge],Ye=ge+1,Ve=A?`${A}.${Ye}`:`${Ye}.0`;if(Me.wbsCode=Ve,K.push({task:Me,level:be}),Me.subtasks&&Me.subtasks.length>0&&Me.isExpanded){let Oe=A?`${A}.${Ye}`:`${Ye}`;K.push(...Ne(Me.subtasks,be+1,Oe));}}return K},ze=Ne(e),Fe=48,Ke=Math.max(ze.length*a,600-Fe),lt=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,ut=le=>{F(le.id),te(le.name),Ue(true);},st=le=>{J.trim()&&J!==e.find(be=>be.id===le)?.name&&v?.(le,J.trim()),F(null),te(""),Ue(false);},Ze=()=>{F(null),te(""),Ue(false);},zt=(le,be)=>{be.stopPropagation(),N?.(le.id);},Ct=(le,be)=>{be.preventDefault(),me.current=be.clientY,Ie(le),mt.current=false,nt(false),Ce({x:be.clientX,y:be.clientY});},ht=le=>{if(!ke||(Math.abs(le.clientY-me.current)>at&&!mt.current&&(mt.current=true,nt(true)),Ce({x:le.clientX,y:le.clientY}),!mt.current))return;if(L?.current){let ge=L.current,Me=ge.getBoundingClientRect(),Ye=60,Ve=12;Je.current&&(cancelAnimationFrame(Je.current),Je.current=null);let Oe=le.clientY-Me.top,bt=Me.bottom-le.clientY;if(Oe<Ye&&ge.scrollTop>0){let gt=Math.round(Ve*(1-Oe/Ye)),P=()=>{ge.scrollTop-=gt,mt.current&&ge.scrollTop>0&&(Je.current=requestAnimationFrame(P));};Je.current=requestAnimationFrame(P);}else if(bt<Ye&&ge.scrollTop<ge.scrollHeight-ge.clientHeight){let gt=Math.round(Ve*(1-bt/Ye)),P=()=>{ge.scrollTop+=gt,mt.current&&ge.scrollTop<ge.scrollHeight-ge.clientHeight&&(Je.current=requestAnimationFrame(P));};Je.current=requestAnimationFrame(P);}}let A=document.querySelectorAll("[data-task-row]"),K=null,X=null;A.forEach(ge=>{let Me=ge.getBoundingClientRect(),Ye=ge.getAttribute("data-task-row");if(Ye&&Ye!==ke&&le.clientY>=Me.top&&le.clientY<=Me.bottom){K=Ye;let Ve=le.clientY-Me.top,Oe=Me.height;Ve<Oe*.25?X="above":Ve>Oe*.75?X="below":X="child";}}),et(K),Xe(X);},wt=()=>{if(mt.current&&ke&&He&&ae){if(ae==="child")k?.(ke,He);else if(ae==="above"||ae==="below"){let le=(X,ge,Me=null)=>{for(let Ye of X){if(Ye.id===ge)return Me;if(Ye.subtasks){let Ve=le(Ye.subtasks,ge,Ye.id);if(Ve!==void 0)return Ve}}},be=le(e,ke,null),A=le(e,He,null),K=(X,ge,Me,Ye)=>{let Ve=X.findIndex(gt=>gt.id===ge),Oe=Ye?X.findIndex(gt=>gt.id===Me):-1,bt=ae==="below"?Ve+1:Ve;return Ye&&Oe!==-1&&Oe<Ve&&(bt-=1),Math.max(0,bt)};if(A===null){let ge=K(e,He,ke,be===null);k?.(ke,null,ge);}else {let X=ze.find(ge=>ge.task.id===A)?.task;if(X?.subtasks){let ge=be===A,Me=K(X.subtasks,He,ke,ge);k?.(ke,A,Me);}}}}Je.current&&(cancelAnimationFrame(Je.current),Je.current=null),Ie(null),et(null),Xe(null),Ce(null),mt.current=false,nt(false);};react.useEffect(()=>{if(ke)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",wt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",wt),document.body.style.cursor="",document.body.style.userSelect="";}},[ke,He,ae]);let rt=(le,be,A)=>{let K=be.subtasks&&be.subtasks.length>0;switch(le.id){case "name":let X=H===be.id,ge=Z===be.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${A*20}px`},children:[k&&jsxRuntime.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:ge?1:.3},onMouseDown:I=>Ct(be.id,I),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),be.subtasks&&be.subtasks.length>0?jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),c?.(be.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:be.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),X?jsxRuntime.jsx("input",{ref:Re,type:"text",value:J,onChange:I=>te(I.target.value),onKeyDown:I=>{I.key==="Enter"?st(be.id):I.key==="Escape"&&Ze();},onBlur:()=>st(be.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:I=>I.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:be.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:be.parentId?"13px":"14px",fontWeight:be.isMilestone?600:be.parentId?400:600,letterSpacing:be.parentId?"0":"-0.01em"},title:be.name,children:[be.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:be.wbsCode}),be.isHighlighted&&be.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:be.name}),be.subtasks&&be.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(be.progress||0),"%"]}),$&&be.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),$&&be.cpmData&&jsxRuntime.jsxs("span",{style:{color:be.cpmData.totalFloat<=0?"#EF4444":be.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(be.cpmData.totalFloat),"d"]})]}),ge&&!X&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:I=>zt(be,I),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),ut(be);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Ye=le.id==="startDate"?"startDate":"endDate",Ve=be[Ye],Oe=z?.taskId===be.id&&z?.field===Ye,bt=I=>I?(typeof I=="string"?new Date(I):I).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:K?.5:1,cursor:K?"default":"pointer"},title:K?"Auto-calculated from subtasks":void 0,onClick:I=>{if(!K)if(Oe)se(null);else {let G=I.currentTarget.getBoundingClientRect();se({taskId:be.id,field:Ye,month:Ve?typeof Ve=="string"?new Date(Ve):Ve:new Date,position:{top:G.bottom+4,left:G.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:bt(Ve)}),K&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(null)}),jsxRuntime.jsxs(framerMotion.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:z?.position.top,left:z?.position.left},onClick:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let I=new Date,G=new Date(I);G.setDate(I.getDate()+1);let ce=new Date(I);ce.setDate(I.getDate()+7);let T=new Date(I);return T.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:G},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:T}].map((xe,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Qe=>Qe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Qe=>Qe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:xe.date}),se(null);},children:xe.label},Le))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:I=>I.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(be.id,{[Ye]:void 0}),se(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>se(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:z?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>se(I=>I?{...I,month:new Date(I.month.getFullYear(),I.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((I,G)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:I},G))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let I=z?.month||new Date,G=I.getFullYear(),ce=I.getMonth(),T=new Date(G,ce,1).getDay(),j=new Date(G,ce+1,0).getDate(),xe=new Date,Le=[];for(let tt=T-1;tt>=0;tt--)Le.push({day:new Date(G,ce,-tt).getDate(),date:new Date(G,ce-1,new Date(G,ce,-tt).getDate()),isCurrentMonth:false});for(let tt=1;tt<=j;tt++)Le.push({day:tt,date:new Date(G,ce,tt),isCurrentMonth:true});let Qe=42-Le.length;for(let tt=1;tt<=Qe;tt++)Le.push({day:tt,date:new Date(G,ce+1,tt),isCurrentMonth:false});return Le.map((tt,vt)=>{let Rt=tt.date.toDateString()===xe.toDateString(),Ot=(Ve?typeof Ve=="string"?new Date(Ve):Ve:null)?.toDateString()===tt.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:tt.isCurrentMonth?Ot?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ot?"#2E94FF":"transparent",boxShadow:Rt&&!Ot?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(be.id,{[Ye]:tt.date}),se(null);},children:tt.day},vt)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:lt(be)})});case "assignees":if(K)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let gt=r.filter(I=>be.assignees?.some(G=>G.name===I.name||G.initials===I.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Lo,{assignedUsers:gt,availableUsers:r,onChange:I=>{let G=I.map(ce=>({id:ce.id,name:ce.name,initials:ce.initials,color:ce.color}));g?.(be.id,{assignees:G.length>0?G:void 0});}})});case "status":if(K){let I=be.progress===100?"\u2713":be.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:I})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Tu,{status:be.status||"todo",onChange:I=>{g?.(be.id,{status:I,progress:I==="completed"?100:be.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:K?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.progress}%`,backgroundColor:be.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[be.progress,"%"]})]});case "priority":let P={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},de={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=P[be.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:I=>I.stopPropagation(),children:jsxRuntime.jsx(Po,{priority:fe,onChange:I=>{I&&g?.(be.id,{priority:de[I]||"medium"});}})});default:return null}},Lt=le=>[{id:"hide",label:"Hide Column",icon:Zt.Hide,onClick:()=>d(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Zt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Zt.SortDesc,onClick:()=>{}}],We=le=>le.subtasks&&le.subtasks.length>0?[{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Zt.Add,onClick:()=>{N?.(le.id);}},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Zt.Duplicate,onClick:()=>{f?.([le.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Zt.Delete,onClick:()=>{D?D(le.id,le.name):b?.([le.id]);}}]:[{id:"edit",label:E?.contextMenu?.editTask||"Edit Task",icon:Zt.Pencil,onClick:()=>{n?.(le);}},{id:"addSubtask",label:E?.contextMenu?.addSubtask||"Add Subtask",icon:Zt.Add,onClick:()=>{N?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:E?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Zt.MarkIncomplete,onClick:()=>{g?.(le.id,{status:"todo",progress:0});},disabled:le.status==="todo"},{id:"setInProgress",label:E?.contextMenu?.setInProgress||"Set In Progress",icon:Zt.SetInProgress,onClick:()=>{g?.(le.id,{status:"in-progress"});},disabled:le.status==="in-progress"},{id:"markComplete",label:E?.contextMenu?.markComplete||"Mark Complete",icon:Zt.MarkComplete,onClick:()=>{g?.(le.id,{status:"completed",progress:100});},disabled:le.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:E?.contextMenu?.duplicateTask||"Duplicate Task",icon:Zt.Duplicate,onClick:()=>{f?.([le.id]);}},{id:"split",label:E?.contextMenu?.splitTask||"Split Task",icon:Zt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:E?.contextMenu?.deleteTask||"Delete Task",icon:Zt.Delete,onClick:()=>{D?D(le.id,le.name):b?.([le.id]);}}],Be=m.filter(le=>le.visible),pt=Be.reduce((le,be)=>le+be.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:pt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((le,be)=>{let A=be===Be.length-1,K=le.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${K?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(K?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:A?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:X=>{X.preventDefault(),Ee({isOpen:true,x:X.clientX,y:X.clientY,type:"header",columnId:le.id});},onMouseEnter:X=>{X.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:X=>{X.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:X=>{X.preventDefault(),X.stopPropagation(),Y(le.id),Ge(X.clientX),oe(le.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},le.id)})}),jsxRuntime.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:[jsxRuntime.jsx(ii,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>q(!S),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),S&&jsxRuntime.jsxs("div",{ref:ue,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:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>q(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ke},children:ze.map(({task:le,level:be},A)=>{let K=re(le.id),X=He===le.id,ge=X&&ae==="above",Me=X&&ae==="below",Ye=X&&ae==="child",Ve={};return Ye&&(Ve.backgroundColor=`${t.accent}15`,Ve.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${ke===le.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:K?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:K?t.accentLight:Ye?`${t.accent}15`:A%2===0?t.bgPrimary:t.bgGrid,opacity:$?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Ve},onMouseEnter:()=>O(le.id),onMouseLeave:()=>O(null),onClick:Oe=>{let gt=yn(e).map(fe=>fe.id),de=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;W(le.id,gt,de,Oe.shiftKey),s?.(le);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(le);},onContextMenu:Oe=>{Oe.preventDefault(),Ee({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:le}),i?.(le,Oe);},whileHover:{backgroundColor:K?t.accentLight:t.hoverBg},children:[ge&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Me&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Oe,bt)=>{let gt=bt===Be.length-1,P=Oe.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(P?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${Z===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:rt(Oe,le,P?be:0)},`${le.id}-${Oe.id}`)})]},le.id)})}),jsxRuntime.jsx(hn,{isOpen:ee.isOpen,x:ee.x,y:ee.y,items:ee.type==="header"&&ee.columnId?Lt(ee.columnId):ee.type==="task"&&ee.task?We(ee.task):[],onClose:()=>Ee({...ee,isOpen:false}),theme:t}),xt&&Pt&&ke&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Pt.x+12,top:Pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=ze.find(be=>be.task.id===ke)?.task;return le?jsxRuntime.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:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:le.name})}):null})()}),document.body)]})}function im(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,i]=react.useState(e),[c,l]=react.useState(t),[m,d]=react.useState(null),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,b]=react.useState(null),[f,w]=react.useState(0),[v,N]=react.useState(0),[C,D]=react.useState(null),[k,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:f,setDraggedSegmentStartX:w,segmentDragOffsetX:v,setSegmentDragOffsetX:N,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,F)=>{r("none"),d(null),g(null),i(H),l(F),N(0),b(null),w(0);}}}function mi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:f=true,readOnly:w=false}){let v=im(t,r),N=react.useRef(null),C=react.useRef(false),D=react.useRef(null),k=react.useRef(null),{dragMode:L,setDragMode:$,dragOffset:E,setDragOffset:Z,ghostX:O,setGhostX:H,ghostWidth:F,setGhostWidth:J,connectionLine:te,setConnectionLine:Re,hoveredTaskId:B,setHoveredTaskId:Y,activeZone:ye,setActiveZone:Ge,draggedSegmentIndex:U,setDraggedSegmentIndex:oe,draggedSegmentStartX:ee,setDraggedSegmentStartX:Ee,segmentDragOffsetX:ke,setSegmentDragOffsetX:Ie,hoveredSegmentIndex:He,setHoveredSegmentIndex:et,isHovered:ae,setIsHovered:Xe,isDragging:me,isResizing:at,isConnecting:mt,resetDragState:Pt}=v,Ce=18,xt=!!o.executionBarBg,nt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Je=xt?3:6,z=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let A=new Date;A.setHours(0,0,0,0);let K=new Date(e.endDate);return K.setHours(0,0,0,0),K<A})()&&e.progress<100,S=f&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",ue=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},re=f&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,Ue=w?"default":me?mt?"crosshair":at?"ew-resize":"grabbing":"grab",Ne=w?"default":"ew-resize",Fe=(A=>A>=80?20:A>=60?15:A>=50?12:10)(r),Ke=r<50,lt=r<40;react.useEffect(()=>{x&&(!ae||me||e.segments)&&x(null);},[ae,me,e.segments,x]);let ut=A=>A.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),st=()=>{let A=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${A} day${A!==1?"s":""}`},Ze=A=>Math.round(A/s)*s,zt=A=>{let K=Math.round(A/s),X=new Date(n);return X.setDate(X.getDate()+K),X},Ct=(A,K)=>{for(let X of g){if(X.id===e.id)continue;let ge=5;if(A>=X.x-ge&&A<=X.x+X.width+ge&&K>=X.y-ge&&K<=X.y+X.height+ge)return X.id}return null},ht=react.useCallback((A,K,X)=>{if(w)return;A.preventDefault(),A.stopPropagation();let ge=N.current?.ownerSVGElement;if(!ge)return;let Me=ge.createSVGPoint();Me.x=A.clientX,Me.y=A.clientY;let Ye=Me.matrixTransform(ge.getScreenCTM()?.inverse()),Ve=X!==void 0?X:t,Oe=K;if(!Oe){let bt=Ye.x-Ve;A.shiftKey?(Oe="connect",Re({x:t+r,y:a+Ce/2})):A.ctrlKey||A.metaKey?Oe="move":A.altKey?Oe=bt<r/2?"resize-start":"resize-end":lt?bt<r/2?Oe="move":Oe="resize-end":Ke?bt<=Fe/2?Oe="resize-start":bt>=r-Fe/2?Oe="resize-end":Oe="move":bt<=Fe?Oe="resize-start":bt>=r-Fe?Oe="resize-end":Oe="move";}C.current=false,$(Oe),Xe(false),Ge(null),Oe==="move"?Z(Ye.x-Ve):Oe==="connect"?Re({x:t+r,y:a+Ce/2}):Z(0),H(Ve),J(r);},[t,r,a,Ce,w]),wt=react.useCallback(A=>{let K=N.current?.ownerSVGElement;if(!K)return;let X=K.closest(".gantt-timeline-scroll");if(!X)return;let ge=X.getBoundingClientRect(),Me=60,Ye=15,Ve=0;if(A.clientX<ge.left+Me){let Oe=ge.left+Me-A.clientX;Ve=-Math.min(Ye,Oe/2);}else if(A.clientX>ge.right-Me){let Oe=A.clientX-(ge.right-Me);Ve=Math.min(Ye,Oe/2);}return Ve!==0&&(X.scrollLeft+=Ve),Ve!==0},[]),rt=react.useCallback(A=>{if(L==="none")return;C.current=true,k.current=A;let K=N.current?.ownerSVGElement;if(!K)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Me=wt(A);Me&&!D.current?D.current=window.setInterval(()=>{k.current&&(wt(k.current),rt(k.current));},16):!Me&&D.current&&(window.clearInterval(D.current),D.current=null);}let X=K.createSVGPoint();X.x=A.clientX,X.y=A.clientY;let ge=X.matrixTransform(K.getScreenCTM()?.inverse());if(L==="connect"){Re({x:ge.x,y:ge.y});let Me=Ct(ge.x,ge.y);Y(Me);}else if(L==="move"){let Me=ge.x-E,Ye=Ze(Me);H(Ye),J(r);let Ve=Math.round((Ye-t)/s);if(y?.(e.id,Ve,true),e.segments&&e.segments.length>0&&U!==null){let Oe=Ye-ee;Ie(Oe);}}else if(L==="resize-start"){let Me=ge.x,Ye=Ze(Me),Ve=t+r-Ye;Ve>=s&&(H(Ye),J(Ve));}else if(L==="resize-end"){let Me=ge.x,Ve=Ze(Me)-t;Ve>=s&&J(Ve);}},[L,t,r,s,E,e,Ze,U,ee,Ct,Y,Re,H,J,Ie,y,wt]),Lt=react.useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),k.current=null,L!=="none"){if(L==="connect")B&&p&&p(e,B),Re(null),Y(null);else {let A=e.endDate.getTime()-e.startDate.getTime(),K,X,ge=true;if(L==="move"){if(K=zt(O),X=new Date(K.getTime()+A),e.segments&&e.segments.length>0&&U!==null){let Me=Math.round(ke/s),Ye=e.segments.map((gt,P)=>{if(P===U){let de=new Date(gt.startDate),fe=new Date(gt.endDate);return de.setDate(de.getDate()+Me),fe.setDate(fe.getDate()+Me),{startDate:de,endDate:fe}}return gt}),Ve=Ye.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ve.map(gt=>gt.getTime()))),bt=new Date(Math.max(...Ve.map(gt=>gt.getTime())));d?.({...e,segments:Ye},Oe,bt),Pt(t,r);return}}else L==="resize-start"?(K=zt(O),X=e.endDate,K>X&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):L==="resize-end"?(K=e.startDate,X=zt(O+F),X.setDate(X.getDate()-1),X<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&K&&X&&(X.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,K,X));}y?.(e.id,0,false),Pt(t,r);}},[L,O,F,e,d,B,p,t,r,s,zt,ke,U,Pt,y]);react.useEffect(()=>{if(L==="none")return;let A=X=>{rt(X);},K=()=>{Lt();};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",K),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,rt,Lt]);let We=me&&!mt?O:t,Be=me&&!mt?F:r,pt=i.taskClass(e),le=24,be=f?e.isCriticalPath?1:.25:1;return jsxRuntime.jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:be,transition:"opacity 300ms ease"},onClick:()=>{!me&&!C.current&&c?.(e),C.current=false;},onDoubleClick:A=>{!me&&!C.current&&(A.stopPropagation(),l?.(e));},onContextMenu:A=>{A.preventDefault(),m?.(e,A);},onMouseEnter:()=>!me&&Xe(true),onMouseMove:A=>{x&&ae&&!me&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:A.clientX,mouseY:A.clientY});},onMouseLeave:()=>{me||(Xe(false),Ge(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+le,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ae&&!me&&!Ke&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Fe,height:Ce,fill:ye==="resize-start"?o.accent:"transparent",opacity:ye==="resize-start"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-start"),onMouseDown:A=>ht(A,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")})]}),ae&&!me&<&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ge("move"),onMouseDown:A=>ht(A,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.2:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ge("resize-end"),onMouseDown:A=>ht(A,"resize-end")}),ae&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),me&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:O,y:a,width:F,height:Ce,rx:Je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!me&&(()=>{let A=e.baselineStartDate.getTime(),K=e.baselineEndDate.getTime(),X=n.getTime(),ge=864e5,Me=(A-X)/ge,Ye=(K-A)/ge,Ve=Me*s,Oe=Math.max(Ye*s,s),bt=We+Be,gt=Ve+Oe,P=e.endDate?.getTime()??0,de=Math.ceil((P-K)/ge),fe=de>0,I=de<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:Ve,y:a,width:Oe,height:Ce,rx:Je,fill:"none",stroke:nt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),fe&&bt>gt&&jsxRuntime.jsx("rect",{x:gt,y:a,width:bt-gt,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),fe&&jsxRuntime.jsxs("text",{x:Math.max(bt,gt)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",de,"d"]}),I&&jsxRuntime.jsxs("text",{x:bt+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[de,"d"]})]})})(),!e.segments&&xt&&z&&(()=>{let K=a+(Ce-8)/2,X=4,ge=e.progress||0,Me=new Date;Me.setHours(0,0,0,0);let Ye=e.startDate&&Me>=e.startDate,Ve=e.endDate&&(()=>{let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),Me>fe})(),Oe=e.startDate&&Me<e.startDate,bt=1;if(Ye&&e.startDate&&e.endDate&&!Oe){let fe=new Date(e.startDate);fe.setHours(0,0,0,0);let I=new Date(e.endDate);I.setHours(0,0,0,0);let G=Math.max(1,(I.getTime()-fe.getTime())/(1e3*60*60*24)),T=Math.min((Me.getTime()-fe.getTime())/(1e3*60*60*24),G)/G*100;bt=T>0?ge/T:1;}let gt;ge>=100?gt="#00E5CC":Oe?gt="#4B5563":Ve&&ge<100?gt="#EF4444":bt>=.95?gt="#22C55E":bt>=.8?gt="#F59E0B":gt="#EF4444";let P=Math.max(ge/100*Be,ge>0?X*2:0),de=Be>100&&ge>0;return jsxRuntime.jsxs("g",{"data-task-class":pt,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:We,y:K,width:Be,height:8,rx:X,fill:"rgba(255,255,255,0.10)"}),ge>0&&jsxRuntime.jsx("rect",{x:We,y:K,width:P,height:8,rx:X,fill:gt}),de&&jsxRuntime.jsxs("text",{x:We+P+6,y:K+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ge),"%"]})]})})(),!e.segments&&xt&&!z&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:me&&!mt?.15:e.parentId?.6:1,scale:ae&&!me?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>ht(A),style:{cursor:Ue,pointerEvents:"all"}}),!e.segments&&!xt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We,y:a,width:Be,height:Ce,rx:Je,fill:re,"data-task-class":pt,initial:{opacity:0,scale:.95},animate:{opacity:me&&!mt?.15:e.parentId?.6:ae?.9:.8,scale:ae&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:z?void 0:A=>ht(A),style:{cursor:z?"default":Ue,pointerEvents:"all"}}),xt&&(se||S)&&!e.segments&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!z&&jsxRuntime.jsx("rect",{x:We,y:a,width:Math.max(Be*(e.progress/100),Je*2),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!z&&e.progress<100&&(()=>{let A=e.progress>0?Be*(e.progress/100):0,K=We+A,X=Be-A,ge=e.progress===0?Je:0,Me=e.progress===0?We:K,Ye=e.progress===0?Be:X;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:Me,y:a,width:Ye,height:Ce,rx:ge,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:Me,y:a,width:Ye,height:Ce,rx:ge,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),xt&&!e.segments&&e.progress>0&&e.progress<100&&!z&&!me&&(()=>{let A=We+Be*(e.progress/100),K=8,X=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:A,cy:a+Ce/2,r:K,fill:X?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:A,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:X?.initials||X?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((A,K)=>{let X=(A.startDate.getTime()-n.getTime())/864e5*s,Me=(A.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-X+s,Ye=me&&L==="move"&&U===K,Ve=He===K,Oe=Ye?X+ke:X;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!me&&et(K),onMouseLeave:()=>!me&&et(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:Me,height:Ce,rx:Je,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:Ye||e.parentId?.6:Ve?.9:.8,scale:Ve&&!me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:bt=>{bt.stopPropagation(),oe(K),Ee(X),ht(bt,void 0,X);},style:{cursor:Ue,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:Me*(e.progress/100),height:Ce,rx:Je,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),q&&(se||S)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&!se&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsxRuntime.jsx("rect",{x:We,y:a,width:Be,height:Ce,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Be>60&&!e.segments&&!(xt&&z)&&(()=>{let A=i.taskLabel(e),K=typeof A=="string"?A:e.name,X=K.length>Math.floor(Be/8)?`${K.substring(0,Math.floor(Be/8))}...`:K;return jsxRuntime.jsx("text",{x:We+8,y:a+Ce/2,dominantBaseline:"middle",fill:ue?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ue?"line-through":"none"},children:X})})(),!me&&!e.segments&&!z&&e.progress>0&&e.progress<100&&(xt?jsxRuntime.jsxs("text",{x:We+Be+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxRuntime.jsxs("text",{x:We+Be-12,y:a+Ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Be>80&&!me&&!e.segments&&!(xt&&z)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:We+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ae||at)&&!mt&&!e.segments&&!z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-start"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-start"||L==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:We+Be-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ge("resize-end"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:We+Be-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:ye==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!me&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ge("connect"),onMouseLeave:()=>Ge(null),onMouseDown:A=>{A.stopPropagation(),ht(A,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ye==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&te&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Ce/2,x2:te.x,y2:te.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:te.x,cy:te.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:te.x+15,y:te.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:te.x+10},animate:{opacity:1,x:te.x+15},transition:{duration:.2},children:"Connect"})]}),(ae||me)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:We-1,y:a-1,width:Be+2,height:Ce+2,rx:Je+1,fill:"none",stroke:me?o.accent:xt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:xt?1:2,opacity:me||xt?.6:.4,initial:{opacity:0},animate:{opacity:me||xt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&!me&&!e.segments&&!x&&(()=>{let X=a<100,ge=X?a+Ce+13:a-82-13,Me=X?`M ${We+Be/2-6} ${a+Ce+3} L ${We+Be/2} ${a+Ce+13} L ${We+Be/2+6} ${a+Ce+3}`:`M ${We+Be/2-6} ${a-13} L ${We+Be/2} ${a-3} L ${We+Be/2+6} ${a-13}`,Ye=ge+22,Ve=ge+40,Oe=ge+55,bt=ge+70,gt=X?ge+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:X?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:X?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:We+Be/2-120,y:ge,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:We+Be/2,y:Ye,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.startDate)}),jsxRuntime.jsx("text",{x:We+Be/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:We+Be/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut(e.endDate)}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:We+Be/2+65,y:Ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st()}),jsxRuntime.jsx("text",{x:We+Be/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:We+Be/2+65,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:We+Be/2-110,y:bt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:We+Be/2-50,y:bt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(P=>P.name).join(", ").substring(0,30),e.assignees.map(P=>P.name).join(", ").length>30?"...":""]})]}),!X&&jsxRuntime.jsx("text",{x:We+Be/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":Ke?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Cd=260,xn=8,cm=16,Tv=-12;function um({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){o(null);return}let{task:f,mouseX:w,mouseY:v}=e,C=f.effortMinutes!=null||f.timeLoggedMinutes!=null||f.soldEffortMinutes!=null?155:105,D=w+cm,k=v+Tv-C;D+Cd>window.innerWidth-xn&&(D=w-Cd-cm),D<xn&&(D=xn);let L=k<xn;L&&(k=v+20),k+C>window.innerHeight-xn&&(k=window.innerHeight-xn-C),o({left:D,top:k,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=f=>f.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let f=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${f} d\xEDa${f!==1?"s":""}`:`${f} day${f!==1?"s":""}`},m=f=>{if(f==null||f===0)return "N/A";let w=Math.floor(f/60),v=f%60;return w===0?`${v}m`:v===0?`${w}h`:`${w}h ${v}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",b=jsxRuntime.jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Cd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(gi,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsxRuntime.jsx(gi,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(f=>f.name).join(", ")})]}),n&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsxRuntime.jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return reactDom.createPortal(f,document.body)}function gi({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function as({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:m,strokeWidthOverride:d,glowFilter:p}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,w=20,v=!b&&a<=e,C,T,D=a-e,k=e+D/2;T=k;let L=8;if(n==="squared")if(b)C=`M ${e} ${t} L ${a} ${r}`;else if(v){let ke=e+15,Ie=a-w,He=f?t+20:t-20;T=Ie;let et=f?1:-1;C=`M ${e} ${t} L ${ke-L} ${t} Q ${ke} ${t} ${ke} ${t+et*L} L ${ke} ${He-et*L} Q ${ke} ${He} ${ke-L} ${He} L ${Ie+L} ${He} Q ${Ie} ${He} ${Ie} ${He+et*L} L ${Ie} ${r-et*L} Q ${Ie} ${r} ${Ie+L} ${r} L ${a} ${r}`;}else {T=a-w;let Ee=f?1:-1;C=`M ${e} ${t} L ${T-L} ${t} Q ${T} ${t} ${T} ${t+Ee*L} L ${T} ${r-Ee*L} Q ${T} ${r} ${T+L} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let $=6,E=5,te=`M ${a} ${r} L ${a-$} ${r-E/2} L ${a-$} ${r+E/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),H=m||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),M=d||1,J=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),ee="#f87171",Re="rgba(248, 113, 113, 0.15)",B=T,Y=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),Y=t;else if(v){let Ee=e+15,ke=a-w,Ie=f?t+20:t-20,He=[[e,t,Ee,t],[Ee,t,Ee,Ie],[Ee,Ie,ke,Ie],[ke,Ie,ke,r],[ke,r,a,r]],et=1/0,ae={x:B,y:Y};for(let Xe of He){let me=ye(y.x,y.y,Xe[0],Xe[1],Xe[2],Xe[3]),at=Math.hypot(y.x-me.x,y.y-me.y);at<et&&(et=at,ae=me);}B=ae.x,Y=ae.y;}else {let Ee=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],ke=1/0,Ie={x:B,y:Y};for(let He of Ee){let et=ye(y.x,y.y,He[0],He[1],He[2],He[3]),ae=Math.hypot(y.x-et.x,y.y-et.y);ae<ke&&(ke=ae,Ie=et);}B=Ie.x,Y=Ie.y;}else {let Ee=k,ke=t,Ie=k,He=r,et=1/0,ae=B,Xe=Y;for(let me=0;me<=1;me+=.02){let at=1-me,mt=at*at*at*e+3*at*at*me*Ee+3*at*me*me*Ie+me*me*me*a,Pt=at*at*at*t+3*at*at*me*ke+3*at*me*me*He+me*me*me*r,Ce=Math.hypot(y.x-mt,y.y-Pt);Ce<et&&(et=Ce,ae=mt,Xe=Pt);}B=ae,Y=Xe;}function ye(Ee,ke,Ie,He,et,ae){let Xe=et-Ie,me=ae-He,at=Xe*Xe+me*me;if(at===0)return {x:Ie,y:He};let mt=((Ee-Ie)*Xe+(ke-He)*me)/at;return mt=Math.max(0,Math.min(1,mt)),{x:Ie+mt*Xe,y:He+mt*me}}let Ge=Ee=>{let ke=Ee.currentTarget.ownerSVGElement;if(!ke)return;let Ie=ke.getScreenCTM();if(!Ie)return;let He=Ie.inverse();x({x:He.a*Ee.clientX+He.c*Ee.clientY+He.e,y:He.b*Ee.clientX+He.d*Ee.clientY+He.f});},U=()=>{g(false),x(null),c?.(false);},oe=()=>{g(true),c?.(true);},Z=Ee=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ee,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:Y,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:Y,r:9,fill:Re,stroke:ee,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:Y-3,x2:B+3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:Y-3,x2:B-3,y2:Y+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,onMouseMove:Ge,children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:J,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:J,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:te,fill:J,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:J,opacity:.9,style:{pointerEvents:"none"}}),Z({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:Ge,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:J,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:C,fill:"none",stroke:J,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:te,fill:J,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:J,style:{pointerEvents:"none"}}),Z({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:Ge,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:C,fill:"none",stroke:H,strokeWidth:M,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:p||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:te,fill:H,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:H,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function yi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let m=r.get(l)||[];for(let d of m){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Se.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,i=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let
|
|
130
|
+
`})]});return reactDom.createPortal(b,document.body)}function gi({label:e,value:t,labelColor:a,valueColor:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:a},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function as({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:m,strokeWidthOverride:d,glowFilter:p}){let[,g]=react.useState(false),[y,x]=react.useState(null),h=r-t,b=h>0,f=Math.abs(h)<5,w=20,v=!f&&a<=e,N,C,D=a-e,k=e+D/2;C=k;let L=8;if(n==="squared")if(f)N=`M ${e} ${t} L ${a} ${r}`;else if(v){let ke=e+15,Ie=a-w,He=b?t+20:t-20;C=Ie;let et=b?1:-1;N=`M ${e} ${t} L ${ke-L} ${t} Q ${ke} ${t} ${ke} ${t+et*L} L ${ke} ${He-et*L} Q ${ke} ${He} ${ke-L} ${He} L ${Ie+L} ${He} Q ${Ie} ${He} ${Ie} ${He+et*L} L ${Ie} ${r-et*L} Q ${Ie} ${r} ${Ie+L} ${r} L ${a} ${r}`;}else {C=a-w;let Ee=b?1:-1;N=`M ${e} ${t} L ${C-L} ${t} Q ${C} ${t} ${C} ${t+Ee*L} L ${C} ${r-Ee*L} Q ${C} ${r} ${C+L} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let $=6,E=5,Z=`M ${a} ${r} L ${a-$} ${r-E/2} L ${a-$} ${r+E/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),H=m||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=d||1,J=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),te="#f87171",Re="rgba(248, 113, 113, 0.15)",B=C,Y=(t+r)/2;if(y)if(n==="squared")if(f)B=Math.max(e+10,Math.min(a-10,y.x)),Y=t;else if(v){let Ee=e+15,ke=a-w,Ie=b?t+20:t-20,He=[[e,t,Ee,t],[Ee,t,Ee,Ie],[Ee,Ie,ke,Ie],[ke,Ie,ke,r],[ke,r,a,r]],et=1/0,ae={x:B,y:Y};for(let Xe of He){let me=ye(y.x,y.y,Xe[0],Xe[1],Xe[2],Xe[3]),at=Math.hypot(y.x-me.x,y.y-me.y);at<et&&(et=at,ae=me);}B=ae.x,Y=ae.y;}else {let Ee=[[e,t,C,t],[C,t,C,r],[C,r,a,r]],ke=1/0,Ie={x:B,y:Y};for(let He of Ee){let et=ye(y.x,y.y,He[0],He[1],He[2],He[3]),ae=Math.hypot(y.x-et.x,y.y-et.y);ae<ke&&(ke=ae,Ie=et);}B=Ie.x,Y=Ie.y;}else {let Ee=k,ke=t,Ie=k,He=r,et=1/0,ae=B,Xe=Y;for(let me=0;me<=1;me+=.02){let at=1-me,mt=at*at*at*e+3*at*at*me*Ee+3*at*me*me*Ie+me*me*me*a,Pt=at*at*at*t+3*at*at*me*ke+3*at*me*me*He+me*me*me*r,Ce=Math.hypot(y.x-mt,y.y-Pt);Ce<et&&(et=Ce,ae=mt,Xe=Pt);}B=ae,Y=Xe;}function ye(Ee,ke,Ie,He,et,ae){let Xe=et-Ie,me=ae-He,at=Xe*Xe+me*me;if(at===0)return {x:Ie,y:He};let mt=((Ee-Ie)*Xe+(ke-He)*me)/at;return mt=Math.max(0,Math.min(1,mt)),{x:Ie+mt*Xe,y:He+mt*me}}let Ge=Ee=>{let ke=Ee.currentTarget.ownerSVGElement;if(!ke)return;let Ie=ke.getScreenCTM();if(!Ie)return;let He=Ie.inverse();x({x:He.a*Ee.clientX+He.c*Ee.clientY+He.e,y:He.b*Ee.clientX+He.d*Ee.clientY+He.f});},U=()=>{g(false),x(null),c?.(false);},oe=()=>{g(true),c?.(true);},ee=Ee=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Ee,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:Y,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:Y,r:9,fill:Re,stroke:te,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:Y-3,x2:B+3,y2:Y+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:Y-3,x2:B-3,y2:Y+3,stroke:te,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:U,onMouseMove:Ge,children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:Z,fill:J,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:J,opacity:.9,style:{pointerEvents:"none"}}),ee({opacity:0,scale:.8})]}):l?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:Ge,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:J,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:Z,fill:J,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:3.5,fill:J,style:{pointerEvents:"none"}}),ee({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:oe,onMouseLeave:U,onMouseMove:Ge,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:H,strokeWidth:F,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:p||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:Z,fill:H,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:H,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function yi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let m=r.get(l)||[];for(let d of m){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Se.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Se.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,i=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let b=h.assignees.map(f=>f.id?s[f.id]:void 0).filter(f=>f!=null&&f>0);return b.length===0?n:b.reduce((f,w)=>f+w,0)/b.length},c=new Map,l=(h,b="")=>{[...h].sort((w,v)=>(w.position??0)-(v.position??0)).forEach((w,v)=>{let N=b?`${b}.${v+1}`:`${v+1}`;c.set(w.id,N),w.subtasks?.length&&l(w.subtasks,N);});};l(e);let m=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let b=h.startDate&&h.endDate?Se.calculateDuration(h.startDate,h.endDate):0,f=h.effortMinutes,w=h.timeLoggedMinutes,v=h.soldEffortMinutes,N=typeof f=="number"?+(f/60).toFixed(1):0,C=typeof w=="number"?+(w/60).toFixed(1):0,D=typeof v=="number"?+(v/60).toFixed(1):0,k=h._costRate>0?h._costRate:i(h),L={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Se.formatDate(h.startDate):"","End Date":h.endDate?Se.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map($=>$.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":C||"","Quoted (h)":D||""};return m&&(L["$ Estimated"]=N>0&&k>0?Math.round(N*k):"",L["$ Executed"]=C>0&&k>0?Math.round(C*k):"",L["$ Quoted"]=D>0&&k>0?Math.round(D*k):"",L["Rate ($/h)"]=k>0?k:""),L["Is Milestone"]=h.isMilestone?"Yes":"No",L}),p=a?.projectName||"";if(p||d.length>0){let h=0,b=0,f=0,w=0,v=0,N=0,C=0,D=0,k=o.filter(E=>E.startDate).map(E=>E.startDate.getTime()),L=o.filter(E=>E.endDate).map(E=>E.endDate.getTime());for(let E of d)typeof E["Estimated (h)"]=="number"&&(h+=E["Estimated (h)"]),typeof E["Logged (h)"]=="number"&&(b+=E["Logged (h)"]),typeof E["Quoted (h)"]=="number"&&(f+=E["Quoted (h)"]),m&&(typeof E["$ Estimated"]=="number"&&(w+=E["$ Estimated"]),typeof E["$ Executed"]=="number"&&(v+=E["$ Executed"]),typeof E["$ Quoted"]=="number"&&(N+=E["$ Quoted"])),typeof E["Progress (%)"]=="number"&&(C+=E["Progress (%)"],D++);let $={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":k.length>0?Se.formatDate(new Date(Math.min(...k))):"","End Date":L.length>0?Se.formatDate(new Date(Math.max(...L))):"","Duration (days)":k.length>0&&L.length>0?Se.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...L))):"","Progress (%)":D>0?Math.round(C/D):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+f.toFixed(1)||""};m&&($["$ Estimated"]=w||"",$["$ Executed"]=v||"",$["$ Quoted"]=N||"",$["Rate ($/h)"]=""),$["Is Milestone"]="No",d.unshift($);}let g=r.utils.json_to_sheet(d),y=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...m?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,b=w=>String(w).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Se.flattenTasks(e),o=new Map;r.forEach((p,g)=>{o.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),n=Se.getEarliestStartDate(e)||new Date,i=Se.getLatestEndDate(e)||new Date,c=r.map((p,g)=>{let y=o.get(p.id),x=p.startDate&&p.endDate?Se.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(b=>o.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
|
-
<PredecessorUID>${o.get(
|
|
133
|
+
<PredecessorUID>${o.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
135
135
|
<CrossProject>0</CrossProject>
|
|
136
136
|
<LinkLag>0</LinkLag>
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
<Task>
|
|
140
140
|
<UID>${y}</UID>
|
|
141
141
|
<ID>${g+1}</ID>
|
|
142
|
-
<Name>${p.name.replace(/[<>&'"]/g,
|
|
142
|
+
<Name>${p.name.replace(/[<>&'"]/g,b=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[b]||b)}</Name>
|
|
143
143
|
<Type>0</Type>
|
|
144
144
|
<IsNull>0</IsNull>
|
|
145
145
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
@@ -358,14 +358,14 @@
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,m=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let m=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(l.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let m=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(l.id)),p=s;if(d.length>0)for(let y of d){i(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(l.id,{ls:g,lf:p});};a.forEach(i);let c=[];for(let l of a){let m=r.get(l.id),d=n.get(l.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let i=new Map,c=[],l=[];for(let p of r)(n.get(p.id)||0)===0&&l.push(p.id);for(;l.length>0;){let p=l.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=i.get(f);b&&(x=Math.max(x,b.ef));}i.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&l.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(i.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=m;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let p of c){let g=i.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],f;h.length>0?f=Math.min(...h.map(b=>i.get(b).es))-g.ef:f=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let i=Se.getLatestEndDate(e);if(!i)return null;let c=Se.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Se.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=Se.calculateEndDate(m,l),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);i=p(i),i=Se.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),m=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(E=>E.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),C=(f.endDate.getTime()-w)/m,D=(w-l)/m*s,k=D+y*s,L=Math.max(C*s,s),$=i+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:k,width:L,y:$,rowIndex:b,daysDelta:y,color:f.color}),p(f.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=m=>m.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function vi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:v=true,canEditTask:C}){let D=vr(),k=react.useRef(null),[L,$]=react.useState([]),[E,te]=react.useState(null),[O,H]=react.useState(null),[M,J]=react.useState(null),ee=react.useRef(false),[Re,B]=react.useState(new Set),[Y,ye]=react.useState(null),Ge=react.useCallback(z=>{if(M&&!ee.current){let se=z.target,S=false;for(;se&&se!==z.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}se=se.parentElement;}S||J(null);}},[M]),U=react.useCallback(z=>{H(z);},[]),oe=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),Z=r==="day"?60:r==="week"?20:8,Ee=oe*Z*n,ke=z=>{let se=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),S=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-S);let q=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-q.getTime())/864e5+1)/7)},Ie=z=>{let se=z.getDay();return se===0||se===6},He=react.useCallback(z=>{let se=Math.round(z/(Z*n)),S=new Date(o);return S.setDate(S.getDate()+se),S},[o,Z,n]),et=react.useCallback((z,se)=>{if(se.startDate&&se.endDate)return;let S=z.currentTarget.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=z.clientX,q.y=z.clientY;let ue=q.matrixTransform(S.getScreenCTM()?.inverse()),Te=He(ue.x),W=new Date(Te);W.setDate(W.getDate()+1),ye(null),y?.(se,Te,W);},[He,y]),ae=react.useCallback((z,se,S)=>{let q=z.currentTarget.ownerSVGElement;if(!q)return;let ue=q.createSVGPoint();ue.x=z.clientX,ue.y=z.clientY;let Te=ue.matrixTransform(q.getScreenCTM()?.inverse()),W=He(Te.x),Ue=Math.round(Te.x/(Z*n))*Z*n;ye({taskId:se.id,x:Ue,y:S*a+a/2,date:W});},[He,Z,n,a]),Xe=react.useCallback(()=>{ye(null);},[]),me=react.useMemo(()=>{let z=ue=>ue.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let W=z(Te.subtasks),re=W.filter(Ue=>Ue.startDate&&Ue.endDate);if(re.length>0){let Ue=re.map(Ke=>Ke.startDate.getTime()),Ne=re.map(Ke=>Ke.endDate.getTime()),ze=new Date(Math.min(...Ue)),Me=new Date(Math.max(...Ne));return {...Te,subtasks:W,startDate:ze,endDate:Me}}return {...Te,subtasks:W}}return Te}),se=(ue,Te=[])=>{let W=[...ue].sort((re,Ue)=>(re.position??0)-(Ue.position??0));for(let re of W)Te.push(re),re.subtasks&&re.subtasks.length>0&&(re.isExpanded===void 0||re.isExpanded)&&se(re.subtasks,Te);return Te},S=z(e);return se(S)},[e]),at=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let se=z.startDate.getTime(),S=z.endDate.getTime(),q=o.getTime(),ue=(se-q)/(1e3*60*60*24),Te=(S-se)/(1e3*60*60*24)+1,W=ue*Z*n,re=Math.max(Z*n,40),Ue=Math.max(Te*Z*n,re);return {x:W,width:Ue}},[o,Z,n]),mt=react.useMemo(()=>me.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:se,width:S}=at(z),ue=me.findIndex(Te=>Te.id===z.id)*a+(a-18)/2;return {id:z.id,x:se,y:ue,width:S,height:18}}),[me,at]),Pt=react.useCallback((z,se,S)=>{if(!S){$([]),te(null);return}if(te({taskId:z,daysDelta:se}),se===0){$([]);return}let q=Se.calculateCascadePreview(e,z,se,me,o,Z*n,a,48);$(q);},[e,me,o,Z,n,a,48]),Ce=react.useCallback((z,se)=>{if(!E)return se;let S=Z*n,q=E.daysDelta*S;if(z===E.taskId)return {x:se.x+q,width:se.width};let ue=L.find(Te=>Te.taskId===z);return ue?{x:ue.previewX,width:ue.width}:se},[E,L,Z,n]),xt=react.useMemo(()=>{let z=[],se=new Date(o);for(;se<=s;){let ue=(se.getTime()-o.getTime())/864e5*Z*n;if(r==="day")z.push({date:new Date(se),label:se.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ue}),se.setDate(se.getDate()+1);else if(r==="week"){let Te=ke(se);z.push({date:new Date(se),label:`${D.labels.week} ${Te}`,x:ue}),se.setDate(se.getDate()+7);}else z.push({date:new Date(se),label:se.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ue}),se.setMonth(se.getMonth()+1);}return z},[o,s,r,Z,n,i,D.labels.week]),nt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*Z*n,[o,Z,n]),Je=Math.max(me.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.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:jsxRuntime.jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),xt.map((z,se)=>jsxRuntime.jsxs("g",{children:[se>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${se}`)),nt>=0&&nt<=Ee&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:nt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:nt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${nt-18}, 2)`,children:[jsxRuntime.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}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:D.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:k,width:Math.max(Ee,1e3),height:Je,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ge,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.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"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:Je,fill:t.bgPrimary}),me.map((z,se)=>jsxRuntime.jsx("rect",{x:0,y:se*a,width:Math.max(Ee,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${z.id}`)),xt.map((z,se)=>se>0?jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:me.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),v&&xt.map((z,se)=>{let S=xt[se+1]?.x||Ee;return Ie(z.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:z.x,y:0,width:S-z.x,height:me.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:z.x,y:0,width:S-z.x,height:me.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),me.map((z,se)=>{let S=z.startDate&&z.endDate;return jsxRuntime.jsx("g",{children:!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:se*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>et(q,z),onMouseMove:q=>ae(q,z,se),onMouseLeave:()=>{Xe();}},`clickable-${z.id}`),Y&&Y.taskId===z.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:Y.x,y1:se*a+4,x2:Y.x,y2:se*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${Y.x}, ${se*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Y.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Y||Y.taskId!==z.id)&&jsxRuntime.jsx("text",{x:nt>0?nt:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${z.id}`)]})},`row-group-${z.id}`)}),me.map((z,se)=>{if(!z.startDate||!z.endDate)return null;let{x:S,width:q}=at(z),ue=se*a+(a-18)/2,Te=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;if(z.isMilestone)return jsxRuntime.jsx(yi,{task:z,x:S+q/2,y:ue+12,theme:t,onClick:d},z.id);if(Te){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),re=8,Ue=ue+(a-18)/2+(18-re)/2,Ne=4,ze=z.progress||0,Me=new Date;Me.setHours(0,0,0,0);let Ke=z.startDate&&Me>=z.startDate,lt=z.endDate&&(()=>{let rt=new Date(z.endDate);return rt.setHours(0,0,0,0),Me>rt})(),ut=z.startDate&&Me<z.startDate,st=1;if(Ke&&z.startDate&&z.endDate&&!ut){let rt=new Date(z.startDate);rt.setHours(0,0,0,0);let Lt=new Date(z.endDate);Lt.setHours(0,0,0,0);let We=Math.max(1,(Lt.getTime()-rt.getTime())/(1e3*60*60*24)),pt=Math.min((Me.getTime()-rt.getTime())/(1e3*60*60*24),We)/We*100;st=pt>0?ze/pt:1;}let Ze;ze>=100?Ze="#00E5CC":ut?Ze="#4B5563":lt&&ze<100?Ze="#EF4444":st>=.95?Ze="#22C55E":st>=.8?Ze="#F59E0B":Ze="#EF4444";let zt=Math.max(ze/100*q,ze>0?Ne*2:0),Ct=q>100&&ze>0,ht=z.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(z),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(z,rt);},onMouseMove:rt=>{U({task:z,x:S,y:Ue,width:q,height:re,showBelow:Ue<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:b?ht?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:S,y:ue,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:Ue,width:q,height:re,rx:Ne,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),ze>0&&jsxRuntime.jsx("rect",{x:S,y:Ue,width:zt,height:re,rx:Ne,fill:Ze}),b&&ht&&jsxRuntime.jsx("rect",{x:S,y:Ue,width:q,height:re,rx:Ne,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ct&&jsxRuntime.jsxs("text",{x:S+zt+6,y:Ue+re/2,dominantBaseline:"central",fill:W?"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(ze),"%"]})]},z.id)}return jsxRuntime.jsx(mi,{task:z,x:S,y:ue,width:q,theme:t,dayWidth:Z*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:mt,onDragMove:Pt,onHoverChange:U,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:C?!C(z):false},z.id)}),w&&me.map((z,se)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(S=>{let q=me.find(Ze=>Ze.id===S);if(!q||!q.startDate||!q.endDate)return null;let ue=me.findIndex(Ze=>Ze.id===S),Te=Ce(q.id,at(q)),W=Ce(z.id,at(z)),re=Te.x+Te.width,Ue=ue*a+26,Ne=W.x,ze=se*a+26,Me=`dep-${S}-${z.id}`;if(Re.has(Me))return null;let Ke=b&&z.isCriticalPath&&q.isCriticalPath;return jsxRuntime.jsx(as,{x1:re,y1:Ue,x2:Ne,y2:ze,theme:t,lineStyle:l,colorOverride:b?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(z.id,S),onHoverChange:Ze=>{ee.current=Ze,Ze&&J({key:Me,fromId:S,toId:z.id,exitX:re,exitY:Ue,enterX:Ne,enterY:ze});}},Me)})),L.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:18,rx:6,fill:z.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),w&&M&&jsxRuntime.jsx(as,{x1:M.exitX,y1:M.exitY,x2:M.enterX,y2:M.enterY,theme:t,lineStyle:l,onDelete:()=>{let z=M.key;J(null),ee.current=false,B(se=>new Set(se).add(z)),h?.(M.toId,M.fromId);},hoverOverlayOnly:true,onHoverChange:z=>{ee.current=z,z||J(null);}},`${M.key}-hover-overlay`),nt>=0&&nt<=Ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsxRuntime.jsx(cm,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var Nv=['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"'],mm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Dv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Sv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Ev=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),Fv=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.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 Ci({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,m]=react.useState(false),[d,p]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[f,b]=react.useState(false),[w,v]=react.useState(true),[C,T]=react.useState(""),[D,k]=react.useState(-1),[L,$]=react.useState(false),[E,te]=react.useState(0),O=react.useRef(null),H=react.useRef(null),M=react.useRef(null),J=react.useRef(null),{enabled:ee=true,placeholder:Re='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:Y,suggestions:ye=Nv,maxHistory:Ge=50,persistHistory:U,mentionableUsers:oe=[]}=a,Z=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ee=Z?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ke=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ie=Z?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",He=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",et=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=Z?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",me=Z?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=Z?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Pt=Z?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=Z?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",xt=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",nt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Je=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",z=Z?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",se=Z?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=Z?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=Z?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ue=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",W=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",re=Z?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=Z?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ne=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ze=Z?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Me=Z?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=Z?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=Z?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ut="rgba(46, 148, 255, 0.06)",st=Z?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ze=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",zt=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ct=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ht=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",wt=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",rt=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Lt=Z?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",We=Z?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=Z?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pt=Z?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",le=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",be=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=Z?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=Z?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",X=U?.storageKey||"gantt-ai-history",ge=U?.maxMessages??5,Fe=oe.filter(I=>{if(!C)return true;let G=C.toLowerCase();return I.name.toLowerCase().includes(G)||I.email&&I.email.toLowerCase().includes(G)}).slice(0,5),Ye=react.useCallback(I=>{if(h(I),oe.length===0)return;let G=O.current;if(!G)return;let ce=G.selectionStart||I.length,N=I.slice(0,ce),j=N.lastIndexOf("@");if(j>=0&&((j>0?N[j-1]:" ")===" "||j===0)){let Le=N.slice(j+1);if(Le.length<=40){T(Le),k(j),$(true),te(0);return}}$(false),T(""),k(-1);},[oe.length]),Ve=react.useCallback(I=>{let G=x.slice(0,D),ce=x.slice(D+1+C.length),N=`${G}@${I.name} ${ce}`;h(N),$(false),T(""),k(-1),setTimeout(()=>O.current?.focus(),0);},[x,D,C]),Oe=react.useCallback(I=>{if(!L||Fe.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),te(G=>G<Fe.length-1?G+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),te(G=>G>0?G-1:Fe.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let G=Fe[E];return G&&Ve(G),true}return I.key==="Escape"?($(false),true):false},[L,Fe,E,Ve]);react.useEffect(()=>{if(U?.enabled)try{let I=localStorage.getItem(X);if(I){let ce=JSON.parse(I).map(N=>({...N,timestamp:new Date(N.timestamp)}));y(ce.slice(-ge));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[U?.enabled,X,ge]),react.useEffect(()=>{if(U?.enabled&&g.length>0)try{let I=g.filter(G=>!G.isLoading).slice(-ge);localStorage.setItem(X,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,U?.enabled,X,ge]),react.useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let bt=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&i?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&c?.(I.taskId,I.dependencyFrom);break}},[o,s,n,i,c]),gt=react.useCallback(async I=>{if(!I.trim()||f)return;let G={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(N=>[...N.slice(-(Ge-1)),G]),h(""),v(false),b(true);let ce={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(N=>[...N,ce]);try{if(Y){let N=await Y(I,e);y(j=>{let xe=j.filter(Qe=>!Qe.isLoading),Le={id:`assistant-${Date.now()}`,role:"assistant",content:N.message,timestamp:new Date,command:N};return [...xe,Le]}),bt(N);}else y(N=>[...N.filter(xe=>!xe.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(N){y(j=>[...j.filter(Le=>!Le.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${N instanceof Error?N.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Ge,Y,e,bt]),P=I=>{I.preventDefault(),gt(x);},de=I=>{h(I),O.current?.focus();};if(react.useEffect(()=>{let I=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),m(ce=>!ce),l||p(false)),G.key==="Escape"&&l&&m(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[l]),react.useEffect(()=>{if(!l)return;let I=ce=>{let N=ce.target;M.current&&!M.current.contains(N)&&m(false);},G=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(G),document.removeEventListener("mousedown",I);}},[l]),!ee)return null;let fe={"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 jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.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 ${fe[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ee,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ke}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ie,overflow:"visible"},onClick:()=>m(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${et}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(mm,{size:18}),jsxRuntime.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:me,background:ae,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Xe}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
|
|
361
|
+
</Project>`,m=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let m=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(l.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let m=l.startDate&&l.endDate?Se.calculateDuration(l.startDate,l.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(l.id)),p=s;if(d.length>0)for(let y of d){i(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(l.id,{ls:g,lf:p});};a.forEach(i);let c=[];for(let l of a){let m=r.get(l.id),d=n.get(l.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let i=new Map,c=[],l=[];for(let p of r)(n.get(p.id)||0)===0&&l.push(p.id);for(;l.length>0;){let p=l.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let b of g.dependencies){let f=i.get(b);f&&(x=Math.max(x,f.ef));}i.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let b of h){let f=(n.get(b)||1)-1;n.set(b,f),f===0&&l.push(b);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(i.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],b=m;if(h.length>0)for(let f of h){let w=d.get(f);w&&(b=Math.min(b,w.ls));}d.set(g,{ls:b-x,lf:b});}for(let p of c){let g=i.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],b;h.length>0?b=Math.min(...h.map(f=>i.get(f).es))-g.ef:b=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.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 a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let i=Se.getLatestEndDate(e);if(!i)return null;let c=Se.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=Se.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=Se.calculateEndDate(m,l),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);i=p(i),i=Se.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),m=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let b of h){if(!b.startDate||!b.endDate)continue;let f=r.findIndex(E=>E.id===b.id);if(f===-1)continue;let w=b.startDate.getTime(),N=(b.endDate.getTime()-w)/m,D=(w-l)/m*s,k=D+y*s,L=Math.max(N*s,s),$=i+f*n+(n-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:D,previewX:k,width:L,y:$,rowIndex:f,daysDelta:y,color:b.color}),p(b.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=m=>m.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function vi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:b,showCriticalPath:f=true,showDependencies:w=true,highlightWeekends:v=true,canEditTask:N}){let D=vr(),k=react.useRef(null),[L,$]=react.useState([]),[E,Z]=react.useState(null),[O,H]=react.useState(null),[F,J]=react.useState(null),te=react.useRef(false),[Re,B]=react.useState(new Set),[Y,ye]=react.useState(null),Ge=react.useCallback(z=>{if(F&&!te.current){let se=z.target,S=false;for(;se&&se!==z.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}se=se.parentElement;}S||J(null);}},[F]),U=react.useCallback(z=>{H(z);},[]),oe=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),ee=r==="day"?60:r==="week"?20:8,Ee=oe*ee*n,ke=z=>{let se=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),S=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-S);let q=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-q.getTime())/864e5+1)/7)},Ie=z=>{let se=z.getDay();return se===0||se===6},He=react.useCallback(z=>{let se=Math.round(z/(ee*n)),S=new Date(o);return S.setDate(S.getDate()+se),S},[o,ee,n]),et=react.useCallback((z,se)=>{if(se.startDate&&se.endDate)return;let S=z.currentTarget.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=z.clientX,q.y=z.clientY;let ue=q.matrixTransform(S.getScreenCTM()?.inverse()),Te=He(ue.x),W=new Date(Te);W.setDate(W.getDate()+1),ye(null),y?.(se,Te,W);},[He,y]),ae=react.useCallback((z,se,S)=>{let q=z.currentTarget.ownerSVGElement;if(!q)return;let ue=q.createSVGPoint();ue.x=z.clientX,ue.y=z.clientY;let Te=ue.matrixTransform(q.getScreenCTM()?.inverse()),W=He(Te.x),Ue=Math.round(Te.x/(ee*n))*ee*n;ye({taskId:se.id,x:Ue,y:S*a+a/2,date:W});},[He,ee,n,a]),Xe=react.useCallback(()=>{ye(null);},[]),me=react.useMemo(()=>{let z=ue=>ue.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let W=z(Te.subtasks),re=W.filter(Ue=>Ue.startDate&&Ue.endDate);if(re.length>0){let Ue=re.map(Ke=>Ke.startDate.getTime()),Ne=re.map(Ke=>Ke.endDate.getTime()),ze=new Date(Math.min(...Ue)),Fe=new Date(Math.max(...Ne));return {...Te,subtasks:W,startDate:ze,endDate:Fe}}return {...Te,subtasks:W}}return Te}),se=(ue,Te=[])=>{let W=[...ue].sort((re,Ue)=>(re.position??0)-(Ue.position??0));for(let re of W)Te.push(re),re.subtasks&&re.subtasks.length>0&&(re.isExpanded===void 0||re.isExpanded)&&se(re.subtasks,Te);return Te},S=z(e);return se(S)},[e]),at=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let se=z.startDate.getTime(),S=z.endDate.getTime(),q=o.getTime(),ue=(se-q)/(1e3*60*60*24),Te=(S-se)/(1e3*60*60*24)+1,W=ue*ee*n,re=Math.max(ee*n,40),Ue=Math.max(Te*ee*n,re);return {x:W,width:Ue}},[o,ee,n]),mt=react.useMemo(()=>me.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:se,width:S}=at(z),ue=me.findIndex(Te=>Te.id===z.id)*a+(a-18)/2;return {id:z.id,x:se,y:ue,width:S,height:18}}),[me,at]),Pt=react.useCallback((z,se,S)=>{if(!S){$([]),Z(null);return}if(Z({taskId:z,daysDelta:se}),se===0){$([]);return}let q=Se.calculateCascadePreview(e,z,se,me,o,ee*n,a,48);$(q);},[e,me,o,ee,n,a,48]),Ce=react.useCallback((z,se)=>{if(!E)return se;let S=ee*n,q=E.daysDelta*S;if(z===E.taskId)return {x:se.x+q,width:se.width};let ue=L.find(Te=>Te.taskId===z);return ue?{x:ue.previewX,width:ue.width}:se},[E,L,ee,n]),xt=react.useMemo(()=>{let z=[],se=new Date(o);for(;se<=s;){let ue=(se.getTime()-o.getTime())/864e5*ee*n;if(r==="day")z.push({date:new Date(se),label:se.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ue}),se.setDate(se.getDate()+1);else if(r==="week"){let Te=ke(se);z.push({date:new Date(se),label:`${D.labels.week} ${Te}`,x:ue}),se.setDate(se.getDate()+7);}else z.push({date:new Date(se),label:se.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ue}),se.setMonth(se.getMonth()+1);}return z},[o,s,r,ee,n,i,D.labels.week]),nt=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*ee*n,[o,ee,n]),Je=Math.max(me.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.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:jsxRuntime.jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),xt.map((z,se)=>jsxRuntime.jsxs("g",{children:[se>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${se}`)),nt>=0&&nt<=Ee&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:nt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:nt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${nt-18}, 2)`,children:[jsxRuntime.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}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:D.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:k,width:Math.max(Ee,1e3),height:Je,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ge,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.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"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:Je,fill:t.bgPrimary}),me.map((z,se)=>jsxRuntime.jsx("rect",{x:0,y:se*a,width:Math.max(Ee,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${z.id}`)),xt.map((z,se)=>se>0?jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:me.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),v&&xt.map((z,se)=>{let S=xt[se+1]?.x||Ee;return Ie(z.date)?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:z.x,y:0,width:S-z.x,height:me.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:z.x,y:0,width:S-z.x,height:me.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),me.map((z,se)=>{let S=z.startDate&&z.endDate;return jsxRuntime.jsx("g",{children:!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:se*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>et(q,z),onMouseMove:q=>ae(q,z,se),onMouseLeave:()=>{Xe();}},`clickable-${z.id}`),Y&&Y.taskId===z.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:Y.x,y1:se*a+4,x2:Y.x,y2:se*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:Y.x,cy:Y.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${Y.x}, ${se*a-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Y.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Y||Y.taskId!==z.id)&&jsxRuntime.jsx("text",{x:nt>0?nt:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${z.id}`)]})},`row-group-${z.id}`)}),me.map((z,se)=>{if(!z.startDate||!z.endDate)return null;let{x:S,width:q}=at(z),ue=se*a+(a-18)/2,Te=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;if(z.isMilestone)return jsxRuntime.jsx(yi,{task:z,x:S+q/2,y:ue+12,theme:t,onClick:d},z.id);if(Te){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),re=8,Ue=ue+(a-18)/2+(18-re)/2,Ne=4,ze=z.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ke=z.startDate&&Fe>=z.startDate,lt=z.endDate&&(()=>{let rt=new Date(z.endDate);return rt.setHours(0,0,0,0),Fe>rt})(),ut=z.startDate&&Fe<z.startDate,st=1;if(Ke&&z.startDate&&z.endDate&&!ut){let rt=new Date(z.startDate);rt.setHours(0,0,0,0);let Lt=new Date(z.endDate);Lt.setHours(0,0,0,0);let We=Math.max(1,(Lt.getTime()-rt.getTime())/(1e3*60*60*24)),pt=Math.min((Fe.getTime()-rt.getTime())/(1e3*60*60*24),We)/We*100;st=pt>0?ze/pt:1;}let Ze;ze>=100?Ze="#00E5CC":ut?Ze="#4B5563":lt&&ze<100?Ze="#EF4444":st>=.95?Ze="#22C55E":st>=.8?Ze="#F59E0B":Ze="#EF4444";let zt=Math.max(ze/100*q,ze>0?Ne*2:0),Ct=q>100&&ze>0,ht=z.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>d?.(z),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(z,rt);},onMouseMove:rt=>{U({task:z,x:S,y:Ue,width:q,height:re,showBelow:Ue<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>U(null),style:{cursor:"default",opacity:f?ht?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:S,y:ue,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:S,y:Ue,width:q,height:re,rx:Ne,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),ze>0&&jsxRuntime.jsx("rect",{x:S,y:Ue,width:zt,height:re,rx:Ne,fill:Ze}),f&&ht&&jsxRuntime.jsx("rect",{x:S,y:Ue,width:q,height:re,rx:Ne,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ct&&jsxRuntime.jsxs("text",{x:S+zt+6,y:Ue+re/2,dominantBaseline:"central",fill:W?"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(ze),"%"]})]},z.id)}return jsxRuntime.jsx(mi,{task:z,x:S,y:ue,width:q,theme:t,dayWidth:ee*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:mt,onDragMove:Pt,onHoverChange:U,showBaseline:b,showTaskBarLabels:m,showCriticalPath:f,readOnly:N?!N(z):false},z.id)}),w&&me.map((z,se)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map(S=>{let q=me.find(Ze=>Ze.id===S);if(!q||!q.startDate||!q.endDate)return null;let ue=me.findIndex(Ze=>Ze.id===S),Te=Ce(q.id,at(q)),W=Ce(z.id,at(z)),re=Te.x+Te.width,Ue=ue*a+26,Ne=W.x,ze=se*a+26,Fe=`dep-${S}-${z.id}`;if(Re.has(Fe))return null;let Ke=f&&z.isCriticalPath&&q.isCriticalPath;return jsxRuntime.jsx(as,{x1:re,y1:Ue,x2:Ne,y2:ze,theme:t,lineStyle:l,colorOverride:f?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:f?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(z.id,S),onHoverChange:Ze=>{te.current=Ze,Ze&&J({key:Fe,fromId:S,toId:z.id,exitX:re,exitY:Ue,enterX:Ne,enterY:ze});}},Fe)})),L.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:18,rx:6,fill:z.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),w&&F&&jsxRuntime.jsx(as,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:l,onDelete:()=>{let z=F.key;J(null),te.current=false,B(se=>new Set(se).add(z)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:z=>{te.current=z,z||J(null);}},`${F.key}-hover-overlay`),nt>=0&&nt<=Ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:nt,y1:0,x2:nt,y2:Je,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsxRuntime.jsx(um,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var Ev=['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"'],gm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Mv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Fv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Pv=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),Av=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.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 Ci({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,m]=react.useState(false),[d,p]=react.useState(false),[g,y]=react.useState([]),[x,h]=react.useState(""),[b,f]=react.useState(false),[w,v]=react.useState(true),[N,C]=react.useState(""),[D,k]=react.useState(-1),[L,$]=react.useState(false),[E,Z]=react.useState(0),O=react.useRef(null),H=react.useRef(null),F=react.useRef(null),J=react.useRef(null),{enabled:te=true,placeholder:Re='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:Y,suggestions:ye=Ev,maxHistory:Ge=50,persistHistory:U,mentionableUsers:oe=[]}=a,ee=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ee=ee?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ke=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ie=ee?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",He=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",et=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=ee?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Xe=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",me=ee?"rgba(46, 148, 255, 0.9)":"#2E94FF",at=ee?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Pt=ee?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(46, 148, 255, 0.04)",Ce=ee?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",xt=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",nt=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Je=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",z=ee?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",se=ee?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=ee?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",q=ee?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ue=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",W=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",re=ee?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=ee?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ne=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ze=ee?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Fe=ee?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=ee?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=ee?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ut="rgba(46, 148, 255, 0.06)",st=ee?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ze=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",zt=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ct=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",ht=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",wt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",rt=ee?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Lt=ee?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",We=ee?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=ee?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pt=ee?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",le=ee?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",be=ee?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=ee?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",K=ee?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",X=U?.storageKey||"gantt-ai-history",ge=U?.maxMessages??5,Me=oe.filter(I=>{if(!N)return true;let G=N.toLowerCase();return I.name.toLowerCase().includes(G)||I.email&&I.email.toLowerCase().includes(G)}).slice(0,5),Ye=react.useCallback(I=>{if(h(I),oe.length===0)return;let G=O.current;if(!G)return;let ce=G.selectionStart||I.length,T=I.slice(0,ce),j=T.lastIndexOf("@");if(j>=0&&((j>0?T[j-1]:" ")===" "||j===0)){let Le=T.slice(j+1);if(Le.length<=40){C(Le),k(j),$(true),Z(0);return}}$(false),C(""),k(-1);},[oe.length]),Ve=react.useCallback(I=>{let G=x.slice(0,D),ce=x.slice(D+1+N.length),T=`${G}@${I.name} ${ce}`;h(T),$(false),C(""),k(-1),setTimeout(()=>O.current?.focus(),0);},[x,D,N]),Oe=react.useCallback(I=>{if(!L||Me.length===0)return false;if(I.key==="ArrowDown")return I.preventDefault(),Z(G=>G<Me.length-1?G+1:0),true;if(I.key==="ArrowUp")return I.preventDefault(),Z(G=>G>0?G-1:Me.length-1),true;if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();let G=Me[E];return G&&Ve(G),true}return I.key==="Escape"?($(false),true):false},[L,Me,E,Ve]);react.useEffect(()=>{if(U?.enabled)try{let I=localStorage.getItem(X);if(I){let ce=JSON.parse(I).map(T=>({...T,timestamp:new Date(T.timestamp)}));y(ce.slice(-ge));}}catch(I){console.warn("[GanttAIAssistant] Failed to load persisted history:",I);}},[U?.enabled,X,ge]),react.useEffect(()=>{if(U?.enabled&&g.length>0)try{let I=g.filter(G=>!G.isLoading).slice(-ge);localStorage.setItem(X,JSON.stringify(I));}catch(I){console.warn("[GanttAIAssistant] Failed to persist history:",I);}},[g,U?.enabled,X,ge]),react.useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let bt=react.useCallback(I=>{if(I.success)switch(I.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":I.taskId&&I.updates&&o?.(I.taskId,I.updates);break;case "create_task":I.newTask&&s?.(I.newTask);break;case "delete_task":I.taskId&&n?.(I.taskId);break;case "link_tasks":I.dependencyFrom&&I.dependencyTo&&i?.(I.dependencyFrom,I.dependencyTo);break;case "unlink_tasks":I.taskId&&I.dependencyFrom&&c?.(I.taskId,I.dependencyFrom);break}},[o,s,n,i,c]),gt=react.useCallback(async I=>{if(!I.trim()||b)return;let G={id:`user-${Date.now()}`,role:"user",content:I,timestamp:new Date};y(T=>[...T.slice(-(Ge-1)),G]),h(""),v(false),f(true);let ce={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(T=>[...T,ce]);try{if(Y){let T=await Y(I,e);y(j=>{let xe=j.filter(Qe=>!Qe.isLoading),Le={id:`assistant-${Date.now()}`,role:"assistant",content:T.message,timestamp:new Date,command:T};return [...xe,Le]}),bt(T);}else y(T=>[...T.filter(xe=>!xe.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){y(j=>[...j.filter(Le=>!Le.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${T instanceof Error?T.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[b,Ge,Y,e,bt]),P=I=>{I.preventDefault(),gt(x);},de=I=>{h(I),O.current?.focus();};if(react.useEffect(()=>{let I=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),m(ce=>!ce),l||p(false)),G.key==="Escape"&&l&&m(false);};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[l]),react.useEffect(()=>{if(!l)return;let I=ce=>{let T=ce.target;F.current&&!F.current.contains(T)&&m(false);},G=setTimeout(()=>{document.addEventListener("mousedown",I);},100);return ()=>{clearTimeout(G),document.removeEventListener("mousedown",I);}},[l]),!te)return null;let fe={"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 jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.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 ${fe[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ee,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ke}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ie,overflow:"visible"},onClick:()=>m(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${et}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(gm,{size:18}),jsxRuntime.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:me,background:ae,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Xe}`},children:"AI \xB7 \u2318K"}),jsxRuntime.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
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${xt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:nt,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsxRuntime.jsx(mm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:z},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>p(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:I=>{I.currentTarget.style.background=q,I.currentTarget.style.color=S;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=se;},children:jsxRuntime.jsx(Ev,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:I=>{I.currentTarget.style.background=q,I.currentTarget.style.color=S;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=se;},children:jsxRuntime.jsx(Sv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ue,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((I,G)=>jsxRuntime.jsx("button",{onClick:()=>de(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:re,border:`1px solid ${W}`},onMouseEnter:ce=>{ce.currentTarget.style.borderColor=Ue,ce.currentTarget.style.color="#2E94FF";},onMouseLeave:ce=>{ce.currentTarget.style.borderColor=W,ce.currentTarget.style.color=re;},children:I.length>30?I.slice(0,30)+"...":I},G))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?Ne:Me,color:I.role==="user"?"#2E94FF":lt,border:I.role==="user"?`1px solid ${ze}`:`1px solid ${Ke}`},children:[I.isLoading?jsxRuntime.jsx(Fv,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(L&&Fe.length>0){I.preventDefault();return}P(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&Fe.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,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:Lt,border:`1px solid ${We}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:Fe.map((I,G)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ve(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===E?pt:"transparent",color:le},onMouseEnter:()=>te(G),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:A,border:`1px solid ${K}`,color:"#2E94FF"},children:I.name.split(" ").map(ce=>ce[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:be},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${Ze}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:I=>Ye(I.target.value),onKeyDown:I=>{Oe(I);},placeholder:Re,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:zt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Ct:"transparent",color:x.trim()?"#2E94FF":wt,border:x.trim()?`1px solid ${ht}`:"1px solid transparent"},children:jsxRuntime.jsx(Dv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function gm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function fm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Lv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function bm(e){return {...Lv,...e}}var Uv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},xm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:v=false,createTaskLabel:C,onCreateTask:T,taskFilter:D,onTaskFilterChange:k,toolbarRightContent:L,showBaseline:$,viewMode:E,onViewModeChange:te,projectForecast:O,onThemeChange:H,onTaskClick:M,onTaskDblClick:J,onTaskContextMenu:ee,onTaskUpdate:Re,onDependentTasksScheduled:B,onProgressChange:Y,onTaskEdit:ye,onTaskAddSubtask:Ge,onTaskMarkIncomplete:U,onTaskSetInProgress:oe,onDependencyCreate:Z,onDependencyDelete:Ee,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:He,onAfterTaskUpdate:et,onBeforeTaskDelete:ae,onAfterTaskDelete:Xe,permissions:me,onCopySnapshotLink:at}=a,Pt=react.useContext(oi)?.theme,[Ce,xt]=react.useState(Pt||s||"dark"),[nt,Je]=react.useState(n),[z,se]=react.useState(i),[S,q]=react.useState(1),[ue,Te]=react.useState("all"),[W,re]=react.useState(E||"execution"),Ue=E??W,Ne=react.useCallback(F=>{re(F),te?.(F);},[te]),ze=$??Ue==="oracle",[Me,Ke]=react.useState(a.showCriticalPath!==false),[lt,ut]=react.useState(a.showDependencies!==false),[st,Ze]=react.useState(a.highlightWeekends!==false),zt=react.useCallback(F=>{Ke(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Ct=react.useCallback(F=>{ut(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),ht=react.useCallback(F=>{Ze(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(nt);},[nt]),react.useEffect(()=>{a.onZoomChange?.(S);},[S]);let wt=react.useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let rt=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Lt,We]=react.useState(()=>{if(!x)return "all";try{let F=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Be=D??Lt,pt=k??We,[le,be]=react.useState(()=>{if(!x)return false;try{let F=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});react.useEffect(()=>{let F=rt();if(F)try{let R={taskFilter:Be,hideCompleted:le};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,le,rt]);let A=react.useRef(h);react.useEffect(()=>{if(A.current!==h&&h!==void 0){We("all"),be(false);let F=rt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}A.current=h;},[h,rt]);let[K,X]=react.useState(0),[ge,Fe]=react.useState(false),[Ye,Ve]=react.useState(null),[Oe,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,P]=react.useState(null),[de,fe]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==Ce&&xt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==Ce&&xt(s);},[s]);let I=react.useCallback(F=>{xt(F),H?.(F);},[H]),{state:G,setState:ce,undo:N,redo:j,canUndo:xe,canRedo:Le,clearHistory:Qe}=gm(t,50),tt=react.useMemo(()=>{let F=(R,_=0)=>{let Q=_;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,F(ve.subtasks,_+1)));return Q};return F(G)+1},[G]),vt=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Rt=react.useRef(new Map),na=react.useRef(false);if(!na.current&&y){na.current=true;let F=typeof y=="string"?y:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Rt.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ot=react.useCallback(()=>{let F=vt();if(F)try{let R=Array.from(Rt.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[vt]),_a=react.useRef(0),cr=react.useRef(G);react.useEffect(()=>{cr.current=G;},[G]);let Ka=react.useRef(false),Pn=react.useCallback(F=>{Te(F),_a.current+=1,ce(R=>{let _=(ve,Pe=0)=>ve.map(kt=>{let ot=F==="all"||Pe<F-1;return kt.subtasks?.length&&Rt.current.set(kt.id,ot),{...kt,isExpanded:ot,subtasks:kt.subtasks?_(kt.subtasks,Pe+1):void 0}}),Q=_(R);return Ot(),Q});},[ce,Ot]);react.useEffect(()=>{if(_a.current>0){_a.current-=1;return}let F=_=>{let Q=new Map;for(let ve of _){let Pe=ve.id;Q.get(Pe)||Q.set(Pe,ve);}return Array.from(Q.values())},R=_=>_.map(Q=>{let ve=Rt.current.get(Q.id),Pe=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Pe.subtasks?.length){let kt=F(Pe.subtasks);return {...Pe,subtasks:R(kt)}}return Pe});if(Rt.current.size>0)ce(wr(R(t)));else {let _=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:F(_(ve.subtasks))}:ve);ce(wr(_(t)));}},[t,ce]);let Cs=react.useRef(t),Ic=react.useRef(true);react.useEffect(()=>{if(Ic.current){Ic.current=false,Cs.current=G;return}if(Ka.current){Ka.current=false,Cs.current=G;return}if(!r)return;let F=JSON.stringify(Cs.current),R=JSON.stringify(G);F!==R&&(Cs.current=G,r(G));},[G,r]);let Ya=react.useMemo(()=>cd(b,w),[b,w]),J0=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Xo,Qi]=react.useState(()=>J0(Ya));react.useEffect(()=>{Qi(F=>F.map(R=>({...R,label:Ya.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ya]);let Ts=react.useMemo(()=>Xo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[Xo]),Bc=react.useRef(Xo.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Xo.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),_=Bc.current;if(R!==_){let Q=F.some(Pe=>Pe.id!=="name"),ve=_.includes(",");Q?!ve&&Q&&Ve(null):Ve(null),Bc.current=R;}},[Xo]);let Rc=60,Oc=.6,Q0=react.useMemo(()=>{let R=Ts+Rc,_=typeof window<"u"?window.innerWidth*Oc:800,Q=Math.max(R,_);return Ye!==null?Math.max(200,Math.min(Ye,Q)):Math.max(200,R)},[Ye,Ts]),so=react.useRef(null),Ns=react.useRef(null),Hr=react.useRef(null),An=react.useRef(null),ra=react.useMemo(()=>Lp(Ce),[Ce]),Z0=react.useMemo(()=>({theme:ra,themeName:Ce}),[ra,Ce]),$c=react.useMemo(()=>bm(p),[p]),Zi=react.useMemo(()=>{if(!g)return G;let F=Se.calculateCriticalPathFull(G),R=_=>_.map(Q=>{let ve=F.get(Q.id),Pe=Q.subtasks?R(Q.subtasks):void 0,kt=Pe?.some(ma=>ma.isCriticalPath||ma.subtasks&&ma.subtasks.some(Ut=>Ut.isCriticalPath))||false,ot=ve?ve.isCritical:kt;return {...Q,isCriticalPath:ot,cpmData:ve||void 0,subtasks:Pe}});return R(G)},[G,g]),ef=react.useMemo(()=>Se.flattenTasks(G).some(R=>R.dependencies&&R.dependencies.length>0),[G]),Hc=react.useMemo(()=>{if(Be==="all"&&!le)return Zi;let F=R=>{let _=[];for(let Q of R){let ve=Q.subtasks?.length?F(Q.subtasks):void 0,Pe=false;if(le)Pe=Q.progress<100;else switch(Be){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||ve&&ve.length>0)&&_.push({...Q,subtasks:ve});}return _};return F(Zi)},[Zi,Be,le]),Ds=Uv(z);fm({undo:N,redo:j,canUndo:xe,canRedo:Le,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>Se.findTaskById(G,F),addTask:(F,R)=>{ce(_=>{if(!R)return [..._,{...F,level:0}];let Q=ve=>ve.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...F,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},updateTask:(F,R)=>{ce(_=>{let Q=ve=>ve.map(Pe=>Pe.id===F?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},deleteTask:F=>{ce(R=>{let _=Q=>Q.filter(ve=>ve.id===F?false:(ve.subtasks&&(ve.subtasks=_(ve.subtasks)),true));return _(R)});},deleteTasks:F=>{ce(R=>xd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Se.findTaskById(G,F);R&&a.onTaskDuplicate(R);}else ce(R=>es(R,[F]).tasks);},splitTask:(F,R,_=3)=>{ce(Q=>Se.splitTask(Q,F,R,_));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(F,R)=>!Se.validateDependencies(G,F,R),getAllTasks:()=>Se.flattenTasks(G),getTasksByStatus:F=>Se.flattenTasks(G).filter(R=>R.status===F),getTasksByParent:F=>F?Se.findTaskById(G,F)?.subtasks||[]:G.filter(_=>!_.parentId),getCriticalPath:()=>Se.flattenTasks(G).filter(F=>F.isCriticalPath),indentTask:F=>{ce(R=>wr(bd(R,[F])));},outdentTask:F=>{ce(R=>wr(hd(R,[F])));},moveTask:(F,R)=>{ce(_=>yd(_,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:_}=kd(G,F);if(ke){let Q=ke({..._,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}ce(wr(R)),Ie&&Ie({..._,parentId:F});},scrollToTask:F=>{let _=Se.flattenTasks(G).findIndex(Q=>Q.id===F);if(_!==-1&&so.current){let Q=_*Ds;so.current.scrollTo({top:Q,behavior:"smooth"}),Hr.current&&Hr.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{ce(R=>{let _=Q=>Q.map(ve=>ve.id===F?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},collapseTask:F=>{ce(R=>{let _=Q=>Q.map(ve=>ve.id===F?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},expandAll:()=>{ce(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{ce(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Pn(F);},undo:N,redo:j,canUndo:()=>xe,canRedo:()=>Le,clearHistory:Qe,exportToPNG:async()=>{if(!An.current||!so.current||!Hr.current)throw new Error("Gantt container not found");let F=An.current,R=so.current,_=Ns.current||R.querySelector(".gantt-grid-scroll"),Q=Hr.current,ve=_?.scrollTop||0,Pe=Q.scrollTop,kt=F.style.overflow,ot=F.style.height,ma=R.style.overflow;try{let Ut=_?.querySelector(".gantt-taskgrid-content"),ea=Q.querySelector("svg"),ja=Ut?.scrollHeight||_?.scrollHeight||600,ur=ea?.getBoundingClientRect().height||Q.scrollHeight,Fo=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ja,ur)+20;_&&(_.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${Fo}px`,R.style.overflow="visible",await new Promise(tn=>setTimeout(tn,100));let zr=await htmlToImage.toPng(F,{backgroundColor:ra.bgPrimary,pixelRatio:2,filter:tn=>{if(!(tn instanceof Element))return !0;let Ss=window.getComputedStyle(tn),In=parseInt(Ss.zIndex,10);return (isNaN(In)||In<50)&&Ss.position!=="fixed"}});return await(await fetch(zr)).blob()}finally{F.style.overflow=kt,F.style.height=ot,R.style.overflow=ma,_&&(_.scrollTop=ve),Q.scrollTop=Pe;}},exportToPDF:async F=>{await Se.exportToPDF(G,F);},exportToExcel:async F=>{await Se.exportToExcel(G,F,rl.current);},exportToJSON:()=>Se.exportToJSON(G),exportToCSV:()=>Se.exportToCSV(G),importFromJSON:F=>{let R=Se.importFromJSON(F);ce(R);},getTasks:()=>G,refresh:()=>{ce(F=>[...F]);},clearAll:()=>{ce([]);}}),[G,N,j,xe,Le,Qe,ra,Ds]);let tf=react.useCallback(F=>{Qi(R=>R.map(_=>_.id===F?{..._,visible:!_.visible}:_));},[]),af=react.useCallback((F,R)=>{Qi(_=>_.map(Q=>{if(Q.id!==F)return Q;let ve=Q.minWidth??100,Pe=Q.maxWidth??800,kt=Math.max(ve,Math.min(Pe,R));return {...Q,width:kt}}));},[]),rf=react.useCallback(F=>{ce(R=>{let _=wd(R,F),Q=ve=>{for(let Pe of ve){if(Pe.id===F){Rt.current.set(F,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(_),Ot(),_}),a.onTaskToggleExpand?.(F);},[a,Ot]),Jo=react.useCallback((F,R)=>{if(He&&He(F,R)===false)return;let Q=Se.findTaskById(G,F)?.progress,ve=kt=>kt.map(ot=>ot.id===F?{...ot,...R}:ot.subtasks?{...ot,subtasks:ve(ot.subtasks)}:ot);ce(ve(G));let Pe=Se.findTaskById(ve(G),F);Pe&&(Re?.(Pe),et?.(Pe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&Y?.(F,Q,R.progress));},[G,Re,He,et,Y]),of=react.useCallback(F=>{F.length!==0&&(_a.current+=1,Ka.current=true,ce(R=>wr(bd(R,F))),a.onTaskIndent?.(F[0]));},[a]),nf=react.useCallback(F=>{F.length!==0&&(_a.current+=1,Ka.current=true,ce(R=>wr(hd(R,F))),a.onTaskOutdent?.(F[0]));},[a]),sf=react.useCallback((F,R,_)=>{_a.current+=1,Ka.current=true,ce(Q=>wr(tm(Q,F,R,_))),a.onTaskReparent?.(F,R,_);},[a]),lf=react.useCallback((F,R)=>{F.length!==0&&(_a.current+=1,Ka.current=true,ce(_=>yd(_,F,R)),a.onTaskMove?.(F[0],R));},[a]),el=react.useCallback(async F=>{let R=[];for(let _ of F)ae&&await Promise.resolve(ae(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ce(_=>wr(xd(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),Xe&&R.forEach(_=>Xe(_)));},[a,ae,Xe]),df=react.useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let _=Se.findTaskById(G,R);_&&a.onTaskDuplicate(_);}):ce(R=>es(R,F).tasks);},[a,G]),cf=react.useCallback((F,R)=>{ce(_=>{let{tasks:Q,newTask:ve}=em(_,F,R);return ke&&ke(ve)===false?_:(a.onTaskCreate?.(ve.parentId,ve.position||0),Ie?.(ve),Q)});},[a,ke,Ie]),uf=react.useCallback((F,R)=>{ce(_=>vd(_,F,R)),a.onTaskRename?.(F,R);},[a]),tl=react.useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let _=li(G,F);if(_){R(_);return}}ce(_=>{let{tasks:Q}=kd(_,F);return a.onTaskCreate?.(F,0),Q});},[a,G]),pf=react.useCallback((F,R,_)=>{let Q=!F.startDate&&!F.endDate,ve=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Pe=Ut=>Ut.map(ea=>ea.id===F.id?{...ea,startDate:R,endDate:_,...F.segments&&{segments:F.segments}}:ea.subtasks?{...ea,subtasks:Pe(ea.subtasks)}:ea),kt=Pe(G),ot=kt;kt=Se.autoScheduleDependents(kt,F.id,ve),kt=wr(kt),ce(kt);let ma={...F,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,_):Re?.(ma),B&&ve!==0){let Ut=Se.flattenTasks(ot),ea=Se.flattenTasks(kt),ja=[];for(let ur of ea){if(ur.id===F.id)continue;let io=Ut.find(zr=>zr.id===ur.id);if(!io)continue;let en=ur.startDate?.getTime()!==io.startDate?.getTime(),Fo=ur.endDate?.getTime()!==io.endDate?.getTime();(en||Fo)&&ja.push(ur);}ja.length>0&&B(ja);}},[G,Re,B,a]),mf=react.useCallback((F,R)=>{ee?.(F,R),bt({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[ee]),gf=react.useCallback((F,R)=>{let _=Se.splitTask(G,F.id,R);ce(_),bt({isOpen:false,x:0,y:0,task:null});},[G]),zc=react.useCallback(F=>{let R=Se.findTaskById(G,F.id)||F;J?.(R),ye||P(R);},[G,J,ye]),Uc=react.useCallback((F,R,_)=>{let Q=new Map,ve=Ut=>{Ut.forEach(ea=>{ea.dependencies&&Q.set(ea.id,ea.dependencies),ea.subtasks&&ve(ea.subtasks);});};ve(_);let Pe=Q.get(R)||[];Q.set(R,[...Pe,F]);let kt=new Set,ot=new Set,ma=Ut=>{if(!kt.has(Ut)){kt.add(Ut),ot.add(Ut);let ea=Q.get(Ut)||[];for(let ja of ea){if(!kt.has(ja)&&ma(ja))return true;if(ot.has(ja))return true}}return ot.delete(Ut),false};return ma(R)},[]),Wc=react.useCallback((F,R)=>{if(Uc(F.id,R,cr.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${fe[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:at,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${xt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:nt,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsxRuntime.jsx(gm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:z},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>p(I=>!I),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:I=>{I.currentTarget.style.background=q,I.currentTarget.style.color=S;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=se;},children:jsxRuntime.jsx(Pv,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:I=>{I.currentTarget.style.background=q,I.currentTarget.style.color=S;},onMouseLeave:I=>{I.currentTarget.style.background="transparent",I.currentTarget.style.color=se;},children:jsxRuntime.jsx(Fv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ue,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((I,G)=>jsxRuntime.jsx("button",{onClick:()=>de(I),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:re,border:`1px solid ${W}`},onMouseEnter:ce=>{ce.currentTarget.style.borderColor=Ue,ce.currentTarget.style.color="#2E94FF";},onMouseLeave:ce=>{ce.currentTarget.style.borderColor=W,ce.currentTarget.style.color=re;},children:I.length>30?I.slice(0,30)+"...":I},G))})]}),g.map(I=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${I.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${I.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:I.role==="user"?Ne:Fe,color:I.role==="user"?"#2E94FF":lt,border:I.role==="user"?`1px solid ${ze}`:`1px solid ${Ke}`},children:[I.isLoading?jsxRuntime.jsx(Av,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content}),I.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:I.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:I.command.success?"#10B981":"#EF4444",border:`1px solid ${I.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[I.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:I.command.type.replace(/_/g," ")})]})]})},I.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:I=>{if(L&&Me.length>0){I.preventDefault();return}P(I);},className:"p-3 relative",style:{borderTop:`1px solid ${ut}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&Me.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:J,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:Lt,border:`1px solid ${We}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:Me.map((I,G)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ve(I),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===E?pt:"transparent",color:le},onMouseEnter:()=>Z(G),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:A,border:`1px solid ${K}`,color:"#2E94FF"},children:I.name.split(" ").map(ce=>ce[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:I.name}),I.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:be},children:I.email})]})]},I.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${Ze}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:I=>Ye(I.target.value),onKeyDown:I=>{Oe(I);},placeholder:Re,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:zt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Ct:"transparent",color:x.trim()?"#2E94FF":wt,border:x.trim()?`1px solid ${ht}`:"1px solid transparent"},children:jsxRuntime.jsx(Mv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function fm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function bm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Rv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hm(e){return {...Rv,...e}}var Gv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},vm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:b,locale:f="en",customTranslations:w,showCreateTaskButton:v=false,createTaskLabel:N,onCreateTask:C,taskFilter:D,onTaskFilterChange:k,toolbarRightContent:L,showBaseline:$,viewMode:E,onViewModeChange:Z,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:J,onTaskContextMenu:te,onTaskUpdate:Re,onDependentTasksScheduled:B,onProgressChange:Y,onTaskEdit:ye,onTaskAddSubtask:Ge,onTaskMarkIncomplete:U,onTaskSetInProgress:oe,onDependencyCreate:ee,onDependencyDelete:Ee,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:He,onAfterTaskUpdate:et,onBeforeTaskDelete:ae,onAfterTaskDelete:Xe,permissions:me,onCopySnapshotLink:at}=a,Pt=react.useContext(oi)?.theme,[Ce,xt]=react.useState(Pt||s||"dark"),[nt,Je]=react.useState(n),[z,se]=react.useState(i),[S,q]=react.useState(1),[ue,Te]=react.useState("all"),[W,re]=react.useState(E||"execution"),Ue=E??W,Ne=react.useCallback(M=>{re(M),Z?.(M);},[Z]),ze=$??Ue==="oracle",[Fe,Ke]=react.useState(a.showCriticalPath!==false),[lt,ut]=react.useState(a.showDependencies!==false),[st,Ze]=react.useState(a.highlightWeekends!==false),zt=react.useCallback(M=>{Ke(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),Ct=react.useCallback(M=>{ut(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),ht=react.useCallback(M=>{Ze(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(nt);},[nt]),react.useEffect(()=>{a.onZoomChange?.(S);},[S]);let wt=react.useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let rt=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Lt,We]=react.useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(M);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Be=D??Lt,pt=k??We,[le,be]=react.useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(M);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=rt();if(M)try{let R={taskFilter:Be,hideCompleted:le};localStorage.setItem(M,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,le,rt]);let A=react.useRef(h);react.useEffect(()=>{if(A.current!==h&&h!==void 0){We("all"),be(false);let M=rt();if(M)try{localStorage.removeItem(M);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}A.current=h;},[h,rt]);let[K,X]=react.useState(0),[ge,Me]=react.useState(false),[Ye,Ve]=react.useState(null),[Oe,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,P]=react.useState(null),[de,fe]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==Ce&&xt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==Ce&&xt(s);},[s]);let I=react.useCallback(M=>{xt(M),H?.(M);},[H]),{state:G,setState:ce,undo:T,redo:j,canUndo:xe,canRedo:Le,clearHistory:Qe}=fm(t,50),tt=react.useMemo(()=>{let M=(R,_=0)=>{let Q=_;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,M(ve.subtasks,_+1)));return Q};return M(G)+1},[G]),vt=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Rt=react.useRef(new Map),na=react.useRef(false);if(!na.current&&y){na.current=true;let M=typeof y=="string"?y:"gantt-expanded-tasks";try{let R=localStorage.getItem(M);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Rt.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ot=react.useCallback(()=>{let M=vt();if(M)try{let R=Array.from(Rt.current.entries());localStorage.setItem(M,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[vt]),_a=react.useRef(0),cr=react.useRef(G);react.useEffect(()=>{cr.current=G;},[G]);let Ka=react.useRef(false),Pn=react.useCallback(M=>{Te(M),_a.current+=1,ce(R=>{let _=(ve,Pe=0)=>ve.map(kt=>{let ot=M==="all"||Pe<M-1;return kt.subtasks?.length&&Rt.current.set(kt.id,ot),{...kt,isExpanded:ot,subtasks:kt.subtasks?_(kt.subtasks,Pe+1):void 0}}),Q=_(R);return Ot(),Q});},[ce,Ot]);react.useEffect(()=>{if(_a.current>0){_a.current-=1;return}let M=_=>{let Q=new Map;for(let ve of _){let Pe=ve.id;Q.get(Pe)||Q.set(Pe,ve);}return Array.from(Q.values())},R=_=>_.map(Q=>{let ve=Rt.current.get(Q.id),Pe=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Pe.subtasks?.length){let kt=M(Pe.subtasks);return {...Pe,subtasks:R(kt)}}return Pe});if(Rt.current.size>0)ce(wr(R(t)));else {let _=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:M(_(ve.subtasks))}:ve);ce(wr(_(t)));}},[t,ce]);let Cs=react.useRef(t),Bc=react.useRef(true);react.useEffect(()=>{if(Bc.current){Bc.current=false,Cs.current=G;return}if(Ka.current){Ka.current=false,Cs.current=G;return}if(!r)return;let M=JSON.stringify(Cs.current),R=JSON.stringify(G);M!==R&&(Cs.current=G,r(G));},[G,r]);let Ya=react.useMemo(()=>cd(f,w),[f,w]),ef=react.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}],[]),[Xo,Qi]=react.useState(()=>ef(Ya));react.useEffect(()=>{Qi(M=>M.map(R=>({...R,label:Ya.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ya]);let Ts=react.useMemo(()=>Xo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[Xo]),Rc=react.useRef(Xo.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=Xo.filter(Q=>Q.visible),R=M.map(Q=>Q.id).join(","),_=Rc.current;if(R!==_){let Q=M.some(Pe=>Pe.id!=="name"),ve=_.includes(",");Q?!ve&&Q&&Ve(null):Ve(null),Rc.current=R;}},[Xo]);let Oc=60,$c=.6,tf=react.useMemo(()=>{let R=Ts+Oc,_=typeof window<"u"?window.innerWidth*$c:800,Q=Math.max(R,_);return Ye!==null?Math.max(200,Math.min(Ye,Q)):Math.max(200,R)},[Ye,Ts]),so=react.useRef(null),Ns=react.useRef(null),Hr=react.useRef(null),An=react.useRef(null),ra=react.useMemo(()=>Ip(Ce),[Ce]),af=react.useMemo(()=>({theme:ra,themeName:Ce}),[ra,Ce]),Hc=react.useMemo(()=>hm(p),[p]),Zi=react.useMemo(()=>{if(!g)return G;let M=Se.calculateCriticalPathFull(G),R=_=>_.map(Q=>{let ve=M.get(Q.id),Pe=Q.subtasks?R(Q.subtasks):void 0,kt=Pe?.some(ma=>ma.isCriticalPath||ma.subtasks&&ma.subtasks.some(Ut=>Ut.isCriticalPath))||false,ot=ve?ve.isCritical:kt;return {...Q,isCriticalPath:ot,cpmData:ve||void 0,subtasks:Pe}});return R(G)},[G,g]),rf=react.useMemo(()=>Se.flattenTasks(G).some(R=>R.dependencies&&R.dependencies.length>0),[G]),zc=react.useMemo(()=>{if(Be==="all"&&!le)return Zi;let M=R=>{let _=[];for(let Q of R){let ve=Q.subtasks?.length?M(Q.subtasks):void 0,Pe=false;if(le)Pe=Q.progress<100;else switch(Be){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||ve&&ve.length>0)&&_.push({...Q,subtasks:ve});}return _};return M(Zi)},[Zi,Be,le]),Ds=Gv(z);bm({undo:T,redo:j,canUndo:xe,canRedo:Le,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>Se.findTaskById(G,M),addTask:(M,R)=>{ce(_=>{if(!R)return [..._,{...M,level:0}];let Q=ve=>ve.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...M,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},updateTask:(M,R)=>{ce(_=>{let Q=ve=>ve.map(Pe=>Pe.id===M?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},deleteTask:M=>{ce(R=>{let _=Q=>Q.filter(ve=>ve.id===M?false:(ve.subtasks&&(ve.subtasks=_(ve.subtasks)),true));return _(R)});},deleteTasks:M=>{ce(R=>xd(R,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let R=Se.findTaskById(G,M);R&&a.onTaskDuplicate(R);}else ce(R=>es(R,[M]).tasks);},splitTask:(M,R,_=3)=>{ce(Q=>Se.splitTask(Q,M,R,_));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(M,R)=>!Se.validateDependencies(G,M,R),getAllTasks:()=>Se.flattenTasks(G),getTasksByStatus:M=>Se.flattenTasks(G).filter(R=>R.status===M),getTasksByParent:M=>M?Se.findTaskById(G,M)?.subtasks||[]:G.filter(_=>!_.parentId),getCriticalPath:()=>Se.flattenTasks(G).filter(M=>M.isCriticalPath),indentTask:M=>{ce(R=>wr(bd(R,[M])));},outdentTask:M=>{ce(R=>wr(hd(R,[M])));},moveTask:(M,R)=>{ce(_=>yd(_,[M],R));},createSubtask:async M=>{let{tasks:R,newTask:_}=kd(G,M);if(ke){let Q=ke({..._,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}ce(wr(R)),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=Se.flattenTasks(G).findIndex(Q=>Q.id===M);if(_!==-1&&so.current){let Q=_*Ds;so.current.scrollTo({top:Q,behavior:"smooth"}),Hr.current&&Hr.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,R=2e3)=>{},expandTask:M=>{ce(R=>{let _=Q=>Q.map(ve=>ve.id===M?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},collapseTask:M=>{ce(R=>{let _=Q=>Q.map(ve=>ve.id===M?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve);return _(R)});},expandAll:()=>{ce(M=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(M)});},collapseAll:()=>{ce(M=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(M)});},collapseToLevel:M=>{Pn(M);},undo:T,redo:j,canUndo:()=>xe,canRedo:()=>Le,clearHistory:Qe,exportToPNG:async()=>{if(!An.current||!so.current||!Hr.current)throw new Error("Gantt container not found");let M=An.current,R=so.current,_=Ns.current||R.querySelector(".gantt-grid-scroll"),Q=Hr.current,ve=_?.scrollTop||0,Pe=Q.scrollTop,kt=M.style.overflow,ot=M.style.height,ma=R.style.overflow;try{let Ut=_?.querySelector(".gantt-taskgrid-content"),ea=Q.querySelector("svg"),ja=Ut?.scrollHeight||_?.scrollHeight||600,ur=ea?.getBoundingClientRect().height||Q.scrollHeight,Mo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ja,ur)+20;_&&(_.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${Mo}px`,R.style.overflow="visible",await new Promise(tn=>setTimeout(tn,100));let zr=await htmlToImage.toPng(M,{backgroundColor:ra.bgPrimary,pixelRatio:2,filter:tn=>{if(!(tn instanceof Element))return !0;let Ss=window.getComputedStyle(tn),In=parseInt(Ss.zIndex,10);return (isNaN(In)||In<50)&&Ss.position!=="fixed"}});return await(await fetch(zr)).blob()}finally{M.style.overflow=kt,M.style.height=ot,R.style.overflow=ma,_&&(_.scrollTop=ve),Q.scrollTop=Pe;}},exportToPDF:async M=>{await Se.exportToPDF(G,M);},exportToExcel:async M=>{await Se.exportToExcel(G,M,rl.current);},exportToJSON:()=>Se.exportToJSON(G),exportToCSV:()=>Se.exportToCSV(G),importFromJSON:M=>{let R=Se.importFromJSON(M);ce(R);},getTasks:()=>G,refresh:()=>{ce(M=>[...M]);},clearAll:()=>{ce([]);}}),[G,T,j,xe,Le,Qe,ra,Ds]);let of=react.useCallback(M=>{Qi(R=>R.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),nf=react.useCallback((M,R)=>{Qi(_=>_.map(Q=>{if(Q.id!==M)return Q;let ve=Q.minWidth??100,Pe=Q.maxWidth??800,kt=Math.max(ve,Math.min(Pe,R));return {...Q,width:kt}}));},[]),sf=react.useCallback(M=>{ce(R=>{let _=wd(R,M),Q=ve=>{for(let Pe of ve){if(Pe.id===M){Rt.current.set(M,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(_),Ot(),_}),a.onTaskToggleExpand?.(M);},[a,Ot]),Jo=react.useCallback((M,R)=>{if(He&&He(M,R)===false)return;let Q=Se.findTaskById(G,M)?.progress,ve=kt=>kt.map(ot=>ot.id===M?{...ot,...R}:ot.subtasks?{...ot,subtasks:ve(ot.subtasks)}:ot);ce(ve(G));let Pe=Se.findTaskById(ve(G),M);Pe&&(Re?.(Pe),et?.(Pe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&Y?.(M,Q,R.progress));},[G,Re,He,et,Y]),lf=react.useCallback(M=>{M.length!==0&&(_a.current+=1,Ka.current=true,ce(R=>wr(bd(R,M))),a.onTaskIndent?.(M[0]));},[a]),df=react.useCallback(M=>{M.length!==0&&(_a.current+=1,Ka.current=true,ce(R=>wr(hd(R,M))),a.onTaskOutdent?.(M[0]));},[a]),cf=react.useCallback((M,R,_)=>{_a.current+=1,Ka.current=true,ce(Q=>wr(am(Q,M,R,_))),a.onTaskReparent?.(M,R,_);},[a]),uf=react.useCallback((M,R)=>{M.length!==0&&(_a.current+=1,Ka.current=true,ce(_=>yd(_,M,R)),a.onTaskMove?.(M[0],R));},[a]),el=react.useCallback(async M=>{let R=[];for(let _ of M)ae&&await Promise.resolve(ae(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(ce(_=>wr(xd(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),Xe&&R.forEach(_=>Xe(_)));},[a,ae,Xe]),pf=react.useCallback(M=>{a.onTaskDuplicate?M.forEach(R=>{let _=Se.findTaskById(G,R);_&&a.onTaskDuplicate(_);}):ce(R=>es(R,M).tasks);},[a,G]),mf=react.useCallback((M,R)=>{ce(_=>{let{tasks:Q,newTask:ve}=tm(_,M,R);return ke&&ke(ve)===false?_:(a.onTaskCreate?.(ve.parentId,ve.position||0),Ie?.(ve),Q)});},[a,ke,Ie]),gf=react.useCallback((M,R)=>{ce(_=>vd(_,M,R)),a.onTaskRename?.(M,R);},[a]),tl=react.useCallback(M=>{let{onTaskAddSubtask:R}=a;if(R){let _=li(G,M);if(_){R(_);return}}ce(_=>{let{tasks:Q}=kd(_,M);return a.onTaskCreate?.(M,0),Q});},[a,G]),ff=react.useCallback((M,R,_)=>{let Q=!M.startDate&&!M.endDate,ve=M.startDate?Math.round((R.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Pe=Ut=>Ut.map(ea=>ea.id===M.id?{...ea,startDate:R,endDate:_,...M.segments&&{segments:M.segments}}:ea.subtasks?{...ea,subtasks:Pe(ea.subtasks)}:ea),kt=Pe(G),ot=kt;kt=Se.autoScheduleDependents(kt,M.id,ve),kt=wr(kt),ce(kt);let ma={...M,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,R,_):Re?.(ma),B&&ve!==0){let Ut=Se.flattenTasks(ot),ea=Se.flattenTasks(kt),ja=[];for(let ur of ea){if(ur.id===M.id)continue;let io=Ut.find(zr=>zr.id===ur.id);if(!io)continue;let en=ur.startDate?.getTime()!==io.startDate?.getTime(),Mo=ur.endDate?.getTime()!==io.endDate?.getTime();(en||Mo)&&ja.push(ur);}ja.length>0&&B(ja);}},[G,Re,B,a]),bf=react.useCallback((M,R)=>{te?.(M,R),bt({isOpen:true,x:R.clientX,y:R.clientY,task:M});},[te]),hf=react.useCallback((M,R)=>{let _=Se.splitTask(G,M.id,R);ce(_),bt({isOpen:false,x:0,y:0,task:null});},[G]),Uc=react.useCallback(M=>{let R=Se.findTaskById(G,M.id)||M;J?.(R),ye||P(R);},[G,J,ye]),Wc=react.useCallback((M,R,_)=>{let Q=new Map,ve=Ut=>{Ut.forEach(ea=>{ea.dependencies&&Q.set(ea.id,ea.dependencies),ea.subtasks&&ve(ea.subtasks);});};ve(_);let Pe=Q.get(R)||[];Q.set(R,[...Pe,M]);let kt=new Set,ot=new Set,ma=Ut=>{if(!kt.has(Ut)){kt.add(Ut),ot.add(Ut);let ea=Q.get(Ut)||[];for(let ja of ea){if(!kt.has(ja)&&ma(ja))return true;if(ot.has(ja))return true}}return ot.delete(Ut),false};return ma(R)},[]),Vc=react.useCallback((M,R)=>{if(Wc(M.id,R,cr.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 _=Q=>Q.map(ve=>{if(ve.id===R){let Pe=ve.dependencies||[];if(!Pe.includes(F.id))return {...ve,dependencies:[...Pe,F.id]}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,ce(Q=>_(Q)),Z?.(F.id,R);},[Z,Uc]),Vc=react.useCallback((F,R)=>{let _=Q=>Q.map(ve=>{if(ve.id===F&&ve.dependencies){let Pe=ve.dependencies.filter(kt=>kt!==R);return {...ve,dependencies:Pe}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,ce(Q=>_(Q)),Ee?.(F,R);},[Ee]),{startDate:Qo,endDate:al}=react.useMemo(()=>{let F=G.filter(Pe=>Pe.startDate&&Pe.endDate);if(F.length===0){let Pe=new Date,kt=new Date(Pe);kt.setDate(kt.getDate()-30);let ot=new Date(Pe);return ot.setDate(ot.getDate()+60),{startDate:kt,endDate:ot}}let R=F.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),_=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),ve=nt==="day"?7:nt==="week"?14:30;return _.setDate(_.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:_,endDate:Q}},[G,nt]);react.useEffect(()=>{wt.current?.(Qo,al);},[Qo,al]);let ff=react.useCallback(async()=>{if(!An.current||!so.current||!Hr.current)return;await new Promise(Fo=>setTimeout(Fo,200));let F=An.current,R=so.current,_=Ns.current||R.querySelector(".gantt-grid-scroll"),Q=Hr.current,ve=_?.scrollTop||0,Pe=_?.scrollLeft||0,kt=Q.scrollTop,ot=Q.scrollLeft,ma=F.style.overflow,Ut=F.style.height,ea=_?.style.overflow||"",ja=Q.style.overflow,ur=R.style.overflow,io=F.style.width,en=Q.style.width;try{let Fo=_?.querySelector(".gantt-taskgrid-content"),zr=Q.querySelector("svg"),nl=zr?.getAttribute("height")?parseInt(zr.getAttribute("height"),10):zr?.getBoundingClientRect().height||0,tn=Fo?.scrollHeight||_?.scrollHeight||600,Ss=Math.max(nl,Q.scrollHeight),In=zr?.getAttribute("width")?parseInt(zr.getAttribute("width"),10):zr?.getBoundingClientRect().width||Q.scrollWidth,Cf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,sl=Math.max(tn,Ss,nl),jc=Cf+sl+50,Kc=(_?.offsetWidth||R.offsetWidth||300)+In+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${jc}px`,F.style.width=`${Kc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${sl+50}px`),Q.style.overflow="visible",Q.style.height=`${sl+50}px`,Q.style.width=`${In+10}px`,await new Promise(Es=>setTimeout(Es,150));let Tf=await htmlToImage.toPng(F,{backgroundColor:ra.bgPrimary,pixelRatio:2,width:Kc,height:jc,skipFonts:!1,filter:Es=>{if(!(Es instanceof Element))return !0;let Yc=window.getComputedStyle(Es),qc=parseInt(Yc.zIndex,10);return !(!isNaN(qc)&&qc>=50||Yc.position==="fixed")}}),il=document.createElement("a");il.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,il.href=Tf,il.click();}finally{F.style.overflow=ma,F.style.height=Ut,F.style.width=io,R.style.overflow=ur,_&&(_.style.overflow=ea,_.style.height="",_.scrollTop=ve,_.scrollLeft=Pe),Q.style.overflow=ja,Q.style.height="",Q.style.width=en,Q.scrollTop=kt,Q.scrollLeft=ot;}},[ra]),bf=react.useCallback(async()=>{await Se.exportToPDF(G);},[G]),rl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});rl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let hf=react.useCallback(async()=>{let F=new Date,R=ve=>String(ve).padStart(2,"0"),_=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(G,`${Q}_${_}.xlsx`,rl.current);},[G,m]),yf=react.useCallback(()=>{let F=Se.exportToCSV(G),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[G]),xf=react.useCallback(()=>{let F=Se.exportToJSON(G),R=new Blob([F],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[G]),vf=react.useCallback(()=>{Se.exportToMSProject(G,"Gantt Project","project.xml");},[G]),wf=F=>{F.preventDefault(),Fe(true);},Zo=react.useRef(false),[ol,Gc]=react.useState(false),Ln=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let F=Hr.current,R=so.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let _=()=>{if(Zo.current)return;Zo.current=true;let ot=F.scrollTop;X(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Zo.current=false;});},Q=()=>{if(Zo.current)return;Zo.current=true;let ot=R.scrollTop;X(ot),F.scrollTop=ot,requestAnimationFrame(()=>{Zo.current=false;});},ve=ot=>{if(ge&&R){let Ut=R.parentElement?.getBoundingClientRect()?.left||0,ea=ot.clientX-Ut,ja=200,ur=Ts+Rc,io=window.innerWidth*Oc,en=Math.max(ur,io);ea>=ja&&ea<=en&&Ve(ea);}if(ol&&F){let ma=ot.clientX-Ln.current.x,Ut=ot.clientY-Ln.current.y;F.scrollLeft=Ln.current.scrollLeft-ma,F.scrollTop=Ln.current.scrollTop-Ut;}},Pe=()=>{Fe(false),Gc(false);},kt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(Gc(true),Ln.current={x:ot.clientX,y:ot.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},ot.preventDefault());};return F.addEventListener("scroll",_),R.addEventListener("scroll",Q),F.addEventListener("mousedown",kt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Pe),()=>{F.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Pe);}},[ge,ol,Ts]);let _c=react.useRef(false),kf=react.useRef(null);return react.useLayoutEffect(()=>{if(_c.current||G.length===0||!Hr.current)return;_c.current=true,kf.current=Qo;let F=Hr.current,R=new Date,_=nt==="day"?60:nt==="week"?20:8,Q=(R.getTime()-Qo.getTime())/(1e3*60*60*24),ve=F.clientWidth,kt=Q*_*S-ve/2;Q>=0&&ve>0&&(F.scrollLeft=Math.max(0,kt));},[G.length,Qo,nt,S]),jsxRuntime.jsx(fn.Provider,{value:Ya,children:jsxRuntime.jsx(pl.Provider,{value:Z0,children:jsxRuntime.jsxs("div",{ref:An,className:"flex flex-col h-full w-full",style:{backgroundColor:ra.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ra.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ra.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(si,{theme:ra,timeScale:nt,onTimeScaleChange:Je,zoom:S,onZoomChange:q,currentTheme:Ce,onThemeChange:I,rowDensity:z,onRowDensityChange:se,showThemeSelector:c,showCreateTaskButton:v&&me?.canCreateTask!==false&&!me?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:T,taskFilter:Be,onTaskFilterChange:pt,hideCompleted:le,onHideCompletedChange:be,toolbarRightContent:L,wbsLevel:ue,onWbsLevelChange:Pn,maxWbsDepth:tt,viewMode:Ue,onViewModeChange:Ne,projectForecast:O,onExportPNG:l?ff:void 0,onExportPDF:l?bf:void 0,onExportExcel:l?hf:void 0,onExportCSV:l?yf:void 0,onExportJSON:l?xf:void 0,onExportMSProject:l?vf:void 0,showCriticalPath:Me,onShowCriticalPathChange:zt,showDependencies:lt,onShowDependenciesChange:Ct,highlightWeekends:st,onHighlightWeekendsChange:ht,showBaseline:ze,onShowBaselineChange:F=>{F&&Ue!=="oracle"&&Ne("oracle"),!F&&Ue==="oracle"&&Ne("execution");},onCopySnapshotLink:at,hasDependencies:ef})}),jsxRuntime.jsxs("div",{ref:so,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Ns,className:"gantt-grid-scroll flex-shrink-0",style:{width:Q0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ci,{tasks:Hc,theme:ra,rowHeight:Ds,availableUsers:d,templates:$c,showCriticalPath:Me,onTaskClick:M,onTaskDblClick:zc,onTaskContextMenu:ee,onTaskToggle:rf,scrollTop:K,columns:Xo,onToggleColumn:tf,onColumnResize:af,onTaskUpdate:Jo,onTaskIndent:of,onTaskOutdent:nf,onTaskMove:lf,onMultiTaskDelete:el,onTaskDuplicate:df,onTaskCreate:cf,onTaskRename:uf,onCreateSubtask:tl,onOpenTaskModal:M?F=>M(F):void 0,onDeleteRequest:(F,R)=>fe({taskId:F,taskName:R}),onTaskReparent:sf,scrollContainerRef:Ns})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ra.border,zIndex:15},onMouseDown:wf}),jsxRuntime.jsx("div",{ref:Hr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ol?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(vi,{tasks:Hc,theme:ra,rowHeight:Ds,timeScale:nt,startDate:Qo,endDate:al,zoom:S,locale:b,templates:$c,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:M,onTaskDblClick:zc,onTaskContextMenu:mf,onTaskDateChange:pf,onDependencyCreate:Wc,onDependencyDelete:Vc,showBaseline:ze,showCriticalPath:Me,showDependencies:lt,highlightWeekends:st,canEditTask:me?.canEditTask})})]}),Oe.task&&jsxRuntime.jsx(hn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:ra,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Oe.task;if(!F)return [];let R=Se.findTaskById(G,F.id)||F,_=R.subtasks&&R.subtasks.length>0,Q=me?.canCreateTask!==false,ve=me?.canDeleteTask!==false;if(_){let Ut=[],ea=me?.canDuplicateTask!==false;return Q&&Ut.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ea&&Ut.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ce(ja=>es(ja,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),ve&&(Ut.length>0&&Ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ut.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),Ut}let Pe=me?.canUpdateTask!==false,kt=me?.canDuplicateTask!==false,ot=[];return Pe&&ot.push({id:"edit",label:Ya.contextMenu?.editTask||"Edit Task",icon:Qt.Pencil,onClick:()=>{ye?ye(R):P(R);}}),Q&&ot.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Qt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ot.length>0&&Pe&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ot.push({id:"markIncomplete",label:Ya.contextMenu?.markIncomplete||"Mark Incomplete",icon:Qt.MarkIncomplete,onClick:()=>{U?U(R):Jo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ya.contextMenu?.setInProgress||"Set In Progress",icon:Qt.SetInProgress,onClick:()=>{oe?oe(R):Jo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ya.contextMenu?.markComplete||"Mark Complete",icon:Qt.MarkComplete,onClick:()=>{Jo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Pe&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&ot.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Qt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ce(Ut=>es(Ut,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ya.contextMenu?.splitTask||"Split Task",icon:Qt.Split,onClick:()=>{let Ut=R.startDate.getTime(),ea=R.endDate.getTime(),ja=Ut+(ea-Ut)/2,ur=new Date(ja);gf(R,ur);}}),ve&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Qt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(Zr,{task:gt,isOpen:!!gt,onClose:()=>P(null),onTaskUpdate:F=>{gt&&(Jo(gt.id,F),P(null));},theme:Ce==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsx(framerMotion.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:()=>fe(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ra.bgSecondary,border:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ra.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:ra.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ya.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ra.textPrimary},children:['"',de.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ra.bgPrimary,borderTop:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=ra.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{el([de.taskId]),fe(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ci,{tasks:G,theme:ra,config:f,onTasksUpdate:ce,onTaskUpdate:Jo,onTaskCreate:F=>{ce(R=>[...R,F]);},onTaskDelete:F=>{el([F]);},onDependencyCreate:(F,R)=>{let _=Se.findTaskById(G,F);_&&Wc(_,R);},onDependencyDelete:Vc})]})})})});function Qv(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Nd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Dd=[{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 Cm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Nd,...l.filter(S=>!Nd.some(q=>q.id===S.id))],f=dt[c]||dt.dark,[b,w]=react.useState(false),[v,C]=react.useState(false),[T,D]=react.useState(false),[k,L]=react.useState(false),[$,E]=react.useState({top:0,left:0}),[te,O]=react.useState(null),[H,M]=react.useState(new Date),[J,ee]=react.useState({top:0,left:0}),[Re,B]=react.useState(false),[Y,ye]=react.useState([]),[Ge,U]=react.useState(false),[oe,Z]=react.useState(""),Ee=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[ae,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[me,at]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),B(false),ye([]));},[a,e,x]),react.useEffect(()=>{let S=q=>{Ee.current&&!Ee.current.contains(q.target)&&w(false),ke.current&&!ke.current.contains(q.target)&&C(false),Ie.current&&!Ie.current.contains(q.target)&&D(false),He.current&&!He.current.contains(q.target)&&L(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let mt=()=>{let S={};return ae.name.trim()||(S.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),at(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!mt())try{let q=i==="create"&&Y.length>0?{...ae,pendingFiles:Y}:ae;await s(q),ye([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{Xe(ue=>{let Te={...ue,[S]:q};if(S==="status"){let W=q;W==="todo"?Te.progress=0:W==="in-progress"?(ue.progress===0||ue.progress===100)&&(Te.progress=50):W==="completed"||W==="closed"?Te.progress=100:(W==="in-review"||W==="review")&&(Te.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ue.status!=="completed"?Te.status="completed":W>0&&W<100&&ue.status==="todo"?Te.status="in-progress":W===0&&ue.status!=="todo"&&(Te.status="todo");}return Te}),me[S]&&at(ue=>{let Te={...ue};return delete Te[S],Te});},xt=h.find(S=>S.id===ae.status)??Nd[0],nt=Dd.find(S=>S.id===ae.priority)??Dd[1],Je=Bo.find(S=>S.value===ae.color)??Bo[0],z=c==="dark",se={backgroundColor:z?"#141414":f.bgSecondary,border:`1px solid ${z?"#262626":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:z?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,WebkitBackdropFilter:z?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:xt.color||f.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),me.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ae.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&C(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsxRuntime.jsx("span",{children:nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Dd.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",S.id),C(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ae.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ae.assignees?.some(ue=>ue.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ue=>ue.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ue=q?(ae.assignees||[]).filter(Te=>Te.name!==S.name):[...ae.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ue);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)L(false);else {if(He.current){let S=He.current.getBoundingClientRect(),q=window.innerHeight,ue=120,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;E({top:W,left:S.left});}L(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Je.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Bo.slice(0,18).map(S=>{let q=ae.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),Ce("color",S.value),L(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(po,{selectedTags:ae.tags||[],availableTags:m,onChange:S=>Ce("tags",S),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="start")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ue=320,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;ee({top:W,left:S.left});}O("start"),M(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(te==="end")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ue=320,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;ee({top:W,left:S.left});}O("end"),M(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.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:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":f.bgPrimary,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${z?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ue=new Date(S);ue.setDate(S.getDate()+7);let Te=new Date(S);return Te.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ue},{label:"2 semanas",date:Te}].map((re,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{te==="start"?(Ce("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Ce("endDate",re.date),O("end")):(Ce("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Ce("startDate",re.date),O(null));},children:re.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>M(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>M(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ue=new Date(S,q,1).getDay(),Te=new Date(S,q+1,0).getDate(),W=new Date,re=[];for(let Ne=ue-1;Ne>=0;Ne--)re.push({day:new Date(S,q,-Ne).getDate(),date:new Date(S,q-1,new Date(S,q,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)re.push({day:Ne,date:new Date(S,q,Ne),isCurrentMonth:true});let Ue=42-re.length;for(let Ne=1;Ne<=Ue;Ne++)re.push({day:Ne,date:new Date(S,q+1,Ne),isCurrentMonth:false});return re.map((Ne,ze)=>{let Me=Ne.date.toDateString()===W.toDateString(),Ke=ae.startDate?.toDateString()===Ne.date.toDateString(),lt=ae.endDate?.toDateString()===Ne.date.toDateString(),ut=ae.startDate&&ae.endDate&&Ne.date>=ae.startDate&&Ne.date<=ae.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ke||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:lt?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Me&&!Ke&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{te==="start"?(Ce("startDate",Ne.date),ae.endDate&&Ne.date>ae.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ae.startDate&&Ne.date<ae.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},ze)})})()})]})]})]})})]}),me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?Qv(ae.effortMinutes):"",onChange:S=>{let q=Zv(S.target.value);Ce("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.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"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?Y.length>0&&`(${Y.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(_r,{cardId:"pending",attachments:Y.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ye(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ye(ue=>ue.filter((Te,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(_r,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[Y.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(S=>{let q=r.find(ue=>ue.id===S);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ue=(ae.dependencies||[]).filter(Te=>Te!==S);Ce("dependencies",ue);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!Ge),Z("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),Z("");}}),jsxRuntime.jsxs(framerMotion.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:z?"#0a0a0a":f.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":f.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:S=>Z(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>oe===""||S.name.toLowerCase().includes(oe.toLowerCase())).map(S=>{let q=ae.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ue=ae.dependencies||[],Te;q?Te=ue.filter(W=>W!==S.id):Te=[...ue,S.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ue=>{q||(ue.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ue=>{ue.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Tm=`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 _=Q=>Q.map(ve=>{if(ve.id===R){let Pe=ve.dependencies||[];if(!Pe.includes(M.id))return {...ve,dependencies:[...Pe,M.id]}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,ce(Q=>_(Q)),ee?.(M.id,R);},[ee,Wc]),Gc=react.useCallback((M,R)=>{let _=Q=>Q.map(ve=>{if(ve.id===M&&ve.dependencies){let Pe=ve.dependencies.filter(kt=>kt!==R);return {...ve,dependencies:Pe}}return ve.subtasks?{...ve,subtasks:_(ve.subtasks)}:ve});_a.current+=1,ce(Q=>_(Q)),Ee?.(M,R);},[Ee]),{startDate:Qo,endDate:al}=react.useMemo(()=>{let M=G.filter(Pe=>Pe.startDate&&Pe.endDate);if(M.length===0){let Pe=new Date,kt=new Date(Pe);kt.setDate(kt.getDate()-30);let ot=new Date(Pe);return ot.setDate(ot.getDate()+60),{startDate:kt,endDate:ot}}let R=M.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),_=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),ve=nt==="day"?7:nt==="week"?14:30;return _.setDate(_.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:_,endDate:Q}},[G,nt]);react.useEffect(()=>{wt.current?.(Qo,al);},[Qo,al]);let yf=react.useCallback(async()=>{if(!An.current||!so.current||!Hr.current)return;await new Promise(Mo=>setTimeout(Mo,200));let M=An.current,R=so.current,_=Ns.current||R.querySelector(".gantt-grid-scroll"),Q=Hr.current,ve=_?.scrollTop||0,Pe=_?.scrollLeft||0,kt=Q.scrollTop,ot=Q.scrollLeft,ma=M.style.overflow,Ut=M.style.height,ea=_?.style.overflow||"",ja=Q.style.overflow,ur=R.style.overflow,io=M.style.width,en=Q.style.width;try{let Mo=_?.querySelector(".gantt-taskgrid-content"),zr=Q.querySelector("svg"),nl=zr?.getAttribute("height")?parseInt(zr.getAttribute("height"),10):zr?.getBoundingClientRect().height||0,tn=Mo?.scrollHeight||_?.scrollHeight||600,Ss=Math.max(nl,Q.scrollHeight),In=zr?.getAttribute("width")?parseInt(zr.getAttribute("width"),10):zr?.getBoundingClientRect().width||Q.scrollWidth,Df=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,sl=Math.max(tn,Ss,nl),Kc=Df+sl+50,Yc=(_?.offsetWidth||R.offsetWidth||300)+In+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Kc}px`,M.style.width=`${Yc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${sl+50}px`),Q.style.overflow="visible",Q.style.height=`${sl+50}px`,Q.style.width=`${In+10}px`,await new Promise(Es=>setTimeout(Es,150));let Sf=await htmlToImage.toPng(M,{backgroundColor:ra.bgPrimary,pixelRatio:2,width:Yc,height:Kc,skipFonts:!1,filter:Es=>{if(!(Es instanceof Element))return !0;let qc=window.getComputedStyle(Es),Xc=parseInt(qc.zIndex,10);return !(!isNaN(Xc)&&Xc>=50||qc.position==="fixed")}}),il=document.createElement("a");il.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,il.href=Sf,il.click();}finally{M.style.overflow=ma,M.style.height=Ut,M.style.width=io,R.style.overflow=ur,_&&(_.style.overflow=ea,_.style.height="",_.scrollTop=ve,_.scrollLeft=Pe),Q.style.overflow=ja,Q.style.height="",Q.style.width=en,Q.scrollTop=kt,Q.scrollLeft=ot;}},[ra]),xf=react.useCallback(async()=>{await Se.exportToPDF(G);},[G]),rl=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});rl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let vf=react.useCallback(async()=>{let M=new Date,R=ve=>String(ve).padStart(2,"0"),_=`${M.getFullYear()}-${R(M.getMonth()+1)}-${R(M.getDate())}_${R(M.getHours())}${R(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(G,`${Q}_${_}.xlsx`,rl.current);},[G,m]),wf=react.useCallback(()=>{let M=Se.exportToCSV(G),R=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[G]),kf=react.useCallback(()=>{let M=Se.exportToJSON(G),R=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[G]),Cf=react.useCallback(()=>{Se.exportToMSProject(G,"Gantt Project","project.xml");},[G]),Tf=M=>{M.preventDefault(),Me(true);},Zo=react.useRef(false),[ol,_c]=react.useState(false),Ln=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=Hr.current,R=so.current?.querySelector(".gantt-grid-scroll");if(!M||!R)return;let _=()=>{if(Zo.current)return;Zo.current=true;let ot=M.scrollTop;X(ot),R.scrollTop=ot,requestAnimationFrame(()=>{Zo.current=false;});},Q=()=>{if(Zo.current)return;Zo.current=true;let ot=R.scrollTop;X(ot),M.scrollTop=ot,requestAnimationFrame(()=>{Zo.current=false;});},ve=ot=>{if(ge&&R){let Ut=R.parentElement?.getBoundingClientRect()?.left||0,ea=ot.clientX-Ut,ja=200,ur=Ts+Oc,io=window.innerWidth*$c,en=Math.max(ur,io);ea>=ja&&ea<=en&&Ve(ea);}if(ol&&M){let ma=ot.clientX-Ln.current.x,Ut=ot.clientY-Ln.current.y;M.scrollLeft=Ln.current.scrollLeft-ma,M.scrollTop=Ln.current.scrollTop-Ut;}},Pe=()=>{Me(false),_c(false);},kt=ot=>{if(ot.button!==0)return;let ma=ot.target;ma.closest("[data-task-bar]")||ma.closest("[data-dependency-line]")||ma.closest("button")||ma.closest('[role="button"]')||ma.tagName==="rect"&&ma.getAttribute("data-clickable")==="true"||(_c(true),Ln.current={x:ot.clientX,y:ot.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},ot.preventDefault());};return M.addEventListener("scroll",_),R.addEventListener("scroll",Q),M.addEventListener("mousedown",kt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Pe),()=>{M.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),M.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Pe);}},[ge,ol,Ts]);let jc=react.useRef(false),Nf=react.useRef(null);return react.useLayoutEffect(()=>{if(jc.current||G.length===0||!Hr.current)return;jc.current=true,Nf.current=Qo;let M=Hr.current,R=new Date,_=nt==="day"?60:nt==="week"?20:8,Q=(R.getTime()-Qo.getTime())/(1e3*60*60*24),ve=M.clientWidth,kt=Q*_*S-ve/2;Q>=0&&ve>0&&(M.scrollLeft=Math.max(0,kt));},[G.length,Qo,nt,S]),jsxRuntime.jsx(fn.Provider,{value:Ya,children:jsxRuntime.jsx(pl.Provider,{value:af,children:jsxRuntime.jsxs("div",{ref:An,className:"flex flex-col h-full w-full",style:{backgroundColor:ra.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ra.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ra.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(si,{theme:ra,timeScale:nt,onTimeScaleChange:Je,zoom:S,onZoomChange:q,currentTheme:Ce,onThemeChange:I,rowDensity:z,onRowDensityChange:se,showThemeSelector:c,showCreateTaskButton:v&&me?.canCreateTask!==false&&!me?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:C,taskFilter:Be,onTaskFilterChange:pt,hideCompleted:le,onHideCompletedChange:be,toolbarRightContent:L,wbsLevel:ue,onWbsLevelChange:Pn,maxWbsDepth:tt,viewMode:Ue,onViewModeChange:Ne,projectForecast:O,onExportPNG:l?yf:void 0,onExportPDF:l?xf:void 0,onExportExcel:l?vf:void 0,onExportCSV:l?wf:void 0,onExportJSON:l?kf:void 0,onExportMSProject:l?Cf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:zt,showDependencies:lt,onShowDependenciesChange:Ct,highlightWeekends:st,onHighlightWeekendsChange:ht,showBaseline:ze,onShowBaselineChange:M=>{M&&Ue!=="oracle"&&Ne("oracle"),!M&&Ue==="oracle"&&Ne("execution");},onCopySnapshotLink:at,hasDependencies:rf})}),jsxRuntime.jsxs("div",{ref:so,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Ns,className:"gantt-grid-scroll flex-shrink-0",style:{width:tf,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(ci,{tasks:zc,theme:ra,rowHeight:Ds,availableUsers:d,templates:Hc,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:Uc,onTaskContextMenu:te,onTaskToggle:sf,scrollTop:K,columns:Xo,onToggleColumn:of,onColumnResize:nf,onTaskUpdate:Jo,onTaskIndent:lf,onTaskOutdent:df,onTaskMove:uf,onMultiTaskDelete:el,onTaskDuplicate:pf,onTaskCreate:mf,onTaskRename:gf,onCreateSubtask:tl,onOpenTaskModal:F?M=>F(M):void 0,onDeleteRequest:(M,R)=>fe({taskId:M,taskName:R}),onTaskReparent:cf,scrollContainerRef:Ns})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ra.border,zIndex:15},onMouseDown:Tf}),jsxRuntime.jsx("div",{ref:Hr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ol?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(vi,{tasks:zc,theme:ra,rowHeight:Ds,timeScale:nt,startDate:Qo,endDate:al,zoom:S,locale:f,templates:Hc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Uc,onTaskContextMenu:bf,onTaskDateChange:ff,onDependencyCreate:Vc,onDependencyDelete:Gc,showBaseline:ze,showCriticalPath:Fe,showDependencies:lt,highlightWeekends:st,canEditTask:me?.canEditTask})})]}),Oe.task&&jsxRuntime.jsx(hn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:ra,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Oe.task;if(!M)return [];let R=Se.findTaskById(G,M.id)||M,_=R.subtasks&&R.subtasks.length>0,Q=me?.canCreateTask!==false,ve=me?.canDeleteTask!==false;if(_){let Ut=[],ea=me?.canDuplicateTask!==false;return Q&&Ut.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Zt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ea&&Ut.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Zt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ce(ja=>es(ja,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),ve&&(Ut.length>0&&Ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ut.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Zt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),Ut}let Pe=me?.canUpdateTask!==false,kt=me?.canDuplicateTask!==false,ot=[];return Pe&&ot.push({id:"edit",label:Ya.contextMenu?.editTask||"Edit Task",icon:Zt.Pencil,onClick:()=>{ye?ye(R):P(R);}}),Q&&ot.push({id:"addSubtask",label:Ya.contextMenu?.addSubtask||"Add Subtask",icon:Zt.Add,onClick:()=>{Ge?Ge(R):tl(R.id);}}),ot.length>0&&Pe&&ot.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ot.push({id:"markIncomplete",label:Ya.contextMenu?.markIncomplete||"Mark Incomplete",icon:Zt.MarkIncomplete,onClick:()=>{U?U(R):Jo(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ot.push({id:"setInProgress",label:Ya.contextMenu?.setInProgress||"Set In Progress",icon:Zt.SetInProgress,onClick:()=>{oe?oe(R):Jo(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ot.push({id:"markComplete",label:Ya.contextMenu?.markComplete||"Mark Complete",icon:Zt.MarkComplete,onClick:()=>{Jo(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(kt||Pe&&R.startDate&&R.endDate)&&ot.length>0&&ot.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),kt&&ot.push({id:"duplicate",label:Ya.contextMenu?.duplicateTask||"Duplicate Task",icon:Zt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):ce(Ut=>es(Ut,[R.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&ot.push({id:"split",label:Ya.contextMenu?.splitTask||"Split Task",icon:Zt.Split,onClick:()=>{let Ut=R.startDate.getTime(),ea=R.endDate.getTime(),ja=Ut+(ea-Ut)/2,ur=new Date(ja);hf(R,ur);}}),ve&&(ot.length>0&&ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ot.push({id:"delete",label:Ya.contextMenu?.deleteTask||"Delete Task",icon:Zt.Delete,onClick:()=>{fe({taskId:R.id,taskName:R.name});}})),ot})()}),jsxRuntime.jsx(Zr,{task:gt,isOpen:!!gt,onClose:()=>P(null),onTaskUpdate:M=>{gt&&(Jo(gt.id,M),P(null));},theme:Ce==="light"?"light":"dark",locale:f==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsx(framerMotion.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:()=>fe(null),children:jsxRuntime.jsxs(framerMotion.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:ra.bgSecondary,border:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ra.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:ra.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ya.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:f==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},children:[f==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ra.textPrimary},children:['"',de.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ra.bgPrimary,borderTop:`1px solid ${ra.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ra.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=ra.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{el([de.taskId]),fe(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:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),f==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsxRuntime.jsx(Ci,{tasks:G,theme:ra,config:b,onTasksUpdate:ce,onTaskUpdate:Jo,onTaskCreate:M=>{ce(R=>[...R,M]);},onTaskDelete:M=>{el([M]);},onDependencyCreate:(M,R)=>{let _=Se.findTaskById(G,M);_&&Vc(_,R);},onDependencyDelete:Gc})]})})})});function t2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function a2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Nd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Dd=[{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 Tm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Nd,...l.filter(S=>!Nd.some(q=>q.id===S.id))],b=dt[c]||dt.dark,[f,w]=react.useState(false),[v,N]=react.useState(false),[C,D]=react.useState(false),[k,L]=react.useState(false),[$,E]=react.useState({top:0,left:0}),[Z,O]=react.useState(null),[H,F]=react.useState(new Date),[J,te]=react.useState({top:0,left:0}),[Re,B]=react.useState(false),[Y,ye]=react.useState([]),[Ge,U]=react.useState(false),[oe,ee]=react.useState(""),Ee=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[ae,Xe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[me,at]=react.useState({});react.useEffect(()=>{a?(Xe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(Xe({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),B(false),ye([]));},[a,e,x]),react.useEffect(()=>{let S=q=>{Ee.current&&!Ee.current.contains(q.target)&&w(false),ke.current&&!ke.current.contains(q.target)&&N(false),Ie.current&&!Ie.current.contains(q.target)&&D(false),He.current&&!He.current.contains(q.target)&&L(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let mt=()=>{let S={};return ae.name.trim()||(S.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),at(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!mt())try{let q=i==="create"&&Y.length>0?{...ae,pendingFiles:Y}:ae;await s(q),ye([]),t();}catch(q){console.error("Error submitting task:",q);}},Ce=(S,q)=>{Xe(ue=>{let Te={...ue,[S]:q};if(S==="status"){let W=q;W==="todo"?Te.progress=0:W==="in-progress"?(ue.progress===0||ue.progress===100)&&(Te.progress=50):W==="completed"||W==="closed"?Te.progress=100:(W==="in-review"||W==="review")&&(Te.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ue.status!=="completed"?Te.status="completed":W>0&&W<100&&ue.status==="todo"?Te.status="in-progress":W===0&&ue.status!=="todo"&&(Te.status="todo");}return Te}),me[S]&&at(ue=>{let Te={...ue};return delete Te[S],Te});},xt=h.find(S=>S.id===ae.status)??Nd[0],nt=Dd.find(S=>S.id===ae.priority)??Dd[1],Je=Bo.find(S=>S.value===ae.color)??Bo[0],z=c==="dark",se={backgroundColor:z?"#141414":b.bgSecondary,border:`1px solid ${z?"#262626":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:z?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,WebkitBackdropFilter:z?"blur(16px)":void 0,border:`1px solid ${b.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${b.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:xt.color||b.accent}}),jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:b.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:b.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=b.hoverBg,S.currentTarget.style.color=b.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=b.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:ae.name,onChange:S=>Ce("name",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ae.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),me.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ae.description||"",onChange:S=>Ce("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:b.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Ee,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(S=>jsxRuntime.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:()=>{Ce("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ae.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ke,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:nt.color}}),jsxRuntime.jsx("span",{children:nt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Dd.map(S=>jsxRuntime.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:()=>{Ce("priority",S.id),N(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ae.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||b.accent,borderColor:b.bgSecondary},children:S.initials},q))}),ae.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.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:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ae.assignees?.some(ue=>ue.name===S.name);return jsxRuntime.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:ue=>ue.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ue=q?(ae.assignees||[]).filter(Te=>Te.name!==S.name):[...ae.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ce("assignees",ue);},children:[jsxRuntime.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:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)L(false);else {if(He.current){let S=He.current.getBoundingClientRect(),q=window.innerHeight,ue=120,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;E({top:W,left:S.left});}L(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsxRuntime.jsx("span",{children:Je.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>L(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${$.top}px`,left:`${$.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Bo.slice(0,18).map(S=>{let q=ae.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),Ce("color",S.value),L(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(po,{selectedTags:ae.tags||[],availableTags:m,onChange:S=>Ce("tags",S),onCreateTag:d,theme:b,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:b.textTertiary}}),jsxRuntime.jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(Z==="start")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ue=320,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;te({top:W,left:S.left});}O("start"),F(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(Z==="end")O(null);else {if(et.current){let S=et.current.getBoundingClientRect(),q=window.innerHeight,ue=320,W=q-S.bottom<ue?S.top-ue-8:S.bottom+8;te({top:W,left:S.left});}O("end"),F(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.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:`${J.top}px`,left:`${J.left}px`,zIndex:99999,backgroundColor:z?"#0a0a0a":b.bgPrimary,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${z?"#262626":b.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ue=new Date(S);ue.setDate(S.getDate()+7);let Te=new Date(S);return Te.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ue},{label:"2 semanas",date:Te}].map((re,Ue)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{Z==="start"?(Ce("startDate",re.date),(!ae.endDate||re.date>ae.endDate)&&Ce("endDate",re.date),O("end")):(Ce("endDate",re.date),(!ae.startDate||re.date<ae.startDate)&&Ce("startDate",re.date),O(null));},children:re.label},Ue))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ue=new Date(S,q,1).getDay(),Te=new Date(S,q+1,0).getDate(),W=new Date,re=[];for(let Ne=ue-1;Ne>=0;Ne--)re.push({day:new Date(S,q,-Ne).getDate(),date:new Date(S,q-1,new Date(S,q,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)re.push({day:Ne,date:new Date(S,q,Ne),isCurrentMonth:true});let Ue=42-re.length;for(let Ne=1;Ne<=Ue;Ne++)re.push({day:Ne,date:new Date(S,q+1,Ne),isCurrentMonth:false});return re.map((Ne,ze)=>{let Fe=Ne.date.toDateString()===W.toDateString(),Ke=ae.startDate?.toDateString()===Ne.date.toDateString(),lt=ae.endDate?.toDateString()===Ne.date.toDateString(),ut=ae.startDate&&ae.endDate&&Ne.date>=ae.startDate&&Ne.date<=ae.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ke||lt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ke?b.accent:lt?"#7C3AED":ut?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ke&&!lt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{Z==="start"?(Ce("startDate",Ne.date),ae.endDate&&Ne.date>ae.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ae.startDate&&Ne.date<ae.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},ze)})})()})]})]})]})})]}),me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:b.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:S=>Ce("progress",parseInt(S.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ae.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${Re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?t2(ae.effortMinutes):"",onChange:S=>{let q=a2(S.target.value);Ce("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}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.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"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",i==="create"?Y.length>0&&`(${Y.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(_r,{cardId:"pending",attachments:Y.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>ye(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);ye(ue=>ue.filter((Te,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(_r,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&Y.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[Y.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:S=>Ce("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(S=>{let q=r.find(ue=>ue.id===S);return jsxRuntime.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||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ue=(ae.dependencies||[]).filter(Te=>Te!==S);Ce("dependencies",ue);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!Ge),ee("");},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:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),ee("");}}),jsxRuntime.jsxs(framerMotion.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:z?"#0a0a0a":b.bgPrimary,backdropFilter:z?"blur(16px)":void 0,border:`1px solid ${z?"#262626":b.border}`,boxShadow:z?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:oe,onChange:S=>ee(S.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})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>oe===""||S.name.toLowerCase().includes(oe.toLowerCase())).map(S=>{let q=ae.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ue=ae.dependencies||[],Te;q?Te=ue.filter(W=>W!==S.id):Te=[...ue,S.id],Ce("dependencies",Te);},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:ue=>{q||(ue.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:ue=>{ue.currentTarget.style.backgroundColor=q?`${b.accent}10`:"transparent";},children:[jsxRuntime.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&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${b.border}`,fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:b.textSecondary,fontSize:13},onMouseEnter:S=>S.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:b.accent,color:"#FFF",fontSize:13},onMouseEnter:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Nm=`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 Dm(e){return `CURRENT TASKS:
|
|
410
|
+
${Sm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Dm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function oo(e,t){let a=Dm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Sd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Ed(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Fd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Sm(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 Em(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=oo(t,l),p=Sd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=oo(t,l),p=Ed(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=oo(t,l),p=Fd(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=oo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=oo(t,l),p=oo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=oo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Fm(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 e2(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 t2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Di(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Di(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:e2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Mm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:t2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Pm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Di(r,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"}},Pd={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"}},Si={en:Md,es:Pd};function Ad(e){return Si[e]||Si.en}function Ei(e,t){let a=Ad(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Ld=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function Am(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 Lm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Am(e),l=Ld[0],m=Ld.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Am(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ld.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Id=[{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 Bm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Id.find(m=>m.value===e)??Id[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Id.map(m=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function ss(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Hm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ss(x.name),color:x.color||Bd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.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:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ss(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Wm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=react.useState(false),[d,p]=react.useState(o),[g,y]=react.useState(()=>{let D=o==="start"?e:t;if(D){let k=D instanceof Date?D:new Date(D);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=k=>{x.current&&!x.current.contains(k.target)&&m(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let D=g.getFullYear(),k=g.getMonth(),L=new Date(D,k,1),E=new Date(D,k+1,0).getDate(),te=L.getDay(),O=[],M=new Date(D,k,0).getDate();for(let ee=te-1;ee>=0;ee--)O.push({date:new Date(D,k-1,M-ee),isCurrentMonth:false});for(let ee=1;ee<=E;ee++)O.push({date:new Date(D,k,ee),isCurrentMonth:true});let J=42-O.length;for(let ee=1;ee<=J;ee++)O.push({date:new Date(D,k+1,ee),isCurrentMonth:false});return O},[g]),v=D=>{if(r)o==="start"?a(D,f||void 0):a(h||void 0,D),m(false);else if(d==="start"){let k=f&&D>f?D:f;a(D,k||void 0),p("end");}else {let k=h&&D<h?D:h;a(k||void 0,D),m(false);}},C=()=>{let D=new Date,k=new Date(D);k.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let E=new Date(D);E.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let te=new Date(D);te.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:te,display:te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let D=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(D)})]})}let T=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),m(!l);let k=o==="start"?h:f;k&&y(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,k)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>v(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},k)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,k)=>{let L=D.date.toDateString()===new Date().toDateString(),$=h?.toDateString()===D.date.toDateString(),E=f?.toDateString()===D.date.toDateString(),te=$||E,O=!r&&h&&f&&D.date>=h&&D.date<=f;return jsxRuntime.jsx("button",{onClick:()=>v(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",E&&!$&&"bg-[#7C3AED] text-white",O&&!te&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!te&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},k)})})]})]})]})]})}function Pi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Wm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Tn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ai(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),m=react.useRef([]);return react.useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Vm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),m=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function _m({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),{isFlashing:d,triggerFlash:p}=Tn(),{displayValue:g,isAnimating:y}=Ai(e,{enabled:o,duration:300,steps:6}),x=v=>{if(r||!t)return;v.stopPropagation();let C=v.currentTarget.getBoundingClientRect(),T=v.clientX-C.left,D=Math.round(T/C.width*100),k=Math.max(0,Math.min(100,D));k!==e&&(t(k),s&&p());},h=react.useCallback(v=>{r||!t||(v.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=react.useCallback(()=>{i(false);let v=parseInt(c,10);if(!isNaN(v)&&t){let C=Math.max(0,Math.min(100,v));C!==e&&(t(C),s&&p());}},[c,t,e,s,p]),b=react.useCallback(v=>{v.key==="Enter"&&f(),v.key==="Escape"&&i(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:m,value:c,onChange:v=>l(v.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Ym({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Jm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=react.useState(false),[d,p]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=Tn(),{displayValue:h,isAnimating:f}=Ai(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let v=parseFloat(d);if(!isNaN(v)){let C=v;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&x());}m(false);},w=v=>{v.key==="Enter"?b():v.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:v=>p(v.target.value),onBlur:b,onKeyDown:w,onClick:v=>v.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:v=>{v.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function Qm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function eg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=Vm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function rg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function H2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function z2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function ar({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=react.useState(false),[p,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=Tn(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:H2(e,r);react.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?g(`${T}h ${D}m`):T>0?g(`${T}h`):g(`${D}m`);}else g("");},[e,m]);let w=()=>{let T=z2(p);T!==e&&(t?.(T),n&&h()),d(false);},v=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:b})]}):m?jsxRuntime.jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:v,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:b})]})}function ig({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function dg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=ee=>m?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[p,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),w=e.timeLoggedMinutes||0,v=e.effortMinutes||0,C=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,D=Math.round(v/60*10)/10,k=v>0?w/v*100:0,L=k>100?Math.round((w-v)/60*10)/10:0,$=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let ee=Re=>{b.current&&!b.current.contains(Re.target)&&(x(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[y,h]);let E=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Re=>!Re),f(null);return}n&&n(e);},te=ee=>{x(false),f(ee);},O=async(ee,Re)=>{h==="log"&&r&&ee?r(e,ee,Re):h==="estimate"&&o?o(e,ee):h==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,M=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),J=h==="estimate"?v:h==="quoted"?C:void 0;return v===0&&w===0&&C===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsxRuntime.jsx("button",{onClick:E,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.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:M.map(ee=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),v>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),L>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(L)," Over"]})]}),v>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsxRuntime.jsx("button",{onClick:E,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.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:M.map(ee=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function K2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function Y2(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 cg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function ug({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=K2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(cg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?Y2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(cg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var q2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function mg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function hg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g}){let y=react.useRef(null),x=r==="es"?fg.es:fg.en;if(react.useEffect(()=>{let v=T=>{y.current&&!y.current.contains(T.target)&&t();},C=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let h=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:x.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),i&&(v.push({id:"status",label:x.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:x.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:x.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:x.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:x.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:x.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:x.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:x.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:x.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&v.push({id:"assign",label:x.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],k=T.some(L=>L.name===C.name)?T.filter(L=>L.name!==C.name):[...T,{name:C.name,initials:m1(C.name),color:C.color||g1(C.name),avatar:C.avatarUrl}];i({...e.task,assignees:k}),t();}}))})),d&&v.push({id:"log-time",label:x.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&v.push({id:"report-blocker",label:x.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&v.push({id:"copy-link",label:x.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:x.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:x.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},f=()=>{if(!e.columnId)return [];let v=[];return l&&(v.push({id:"sort-asc",label:x.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:x.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:x.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),v},b=e.type==="task"?h():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:y,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:b.map(v=>v.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(f1,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(v.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function f1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var fg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Dg={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},P1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Eg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=react.useState(""),[m,d]=react.useState(null),p=react.useRef(null),g=i==="es"?Sg.es:Sg.en;if(react.useLayoutEffect(()=>{if(!e||!p.current)return;let v=()=>{if(!p.current)return;let C=p.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let C=D=>{p.current&&!p.current.contains(D.target)&&t();},T=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",T),p._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(v),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let y=v=>g.columns[v]||v,x=v=>{if(v==="name")return;let C=a.map(T=>T.id===v?{...T,visible:!T.visible}:T);o(C);},h=(v,C)=>{let T=a.find(k=>k.type===v&&(!C||k.customFieldId===C));if(T){x(T.id);return}let D={id:C||v,type:v,label:C?r.find(k=>k.id===C)?.name||v:y(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=P1.filter(v=>y(v).toLowerCase().includes(c.toLowerCase())),b=r.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:p,style:{...m?{maxHeight:`${m}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",w);},onFocus:v=>{v.currentTarget.style.borderColor=w,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(k=>k.type===v&&!k.customFieldId),T=C?.visible??false,D=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(C?x(C.id):h(v));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:k=>{D||(k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(v)})]},v)})})]}),b.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:b.map(v=>{let T=a.find(D=>D.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>h(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:v.name})]},v.id)})})]})]})]})}var Sg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var z1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function Pg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,m]=react.useState([""]),d=o==="es"?Mg.es:Mg.en;react.useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:z1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Mg={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 Ig={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 Bg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),m=s==="es"?Ig.es:Ig.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),m.filters,p&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Rg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function cs(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Og({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxRuntime.jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#FF2D20":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:cs(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:cs(c)})]}),l>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:cs(l)})]}),i>0&&jsxRuntime.jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${cs(m)} ${s?"Disp.":"Avail."}`:`${cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Rg(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Rg(c)})]}),c>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var aw=[{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 Vg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Vg(r.subtasks,t+1));return a}function rw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function ow(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function En(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=En(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Sn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function nw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Gg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:v,persistFilter:C=false,financialBlur:T,healthSidebar:D,lens:k="hours",hourlyRate:L=0,rateMap:$,aggregateParentHours:E=false,showProjectTotals:te=false}=t,O=Ei(d,p),H=m==="dark",M=P=>{if(!$||!P.assignees||P.assignees.length===0)return L;let de=P.assignees.map(fe=>fe.id?$[fe.id]:void 0).filter(fe=>fe!=null&&fe>0);return de.length===0?L:de.reduce((fe,I)=>fe+I,0)/de.length},J=react.useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(C);if(P){let de=JSON.parse(P);return {statusFilter:de.statusFilter||"all",hideCompleted:de.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[C]),ee=react.useMemo(()=>{function P(de){let fe=0,I=0,G=0;for(let ce of de)if(ce.subtasks&&ce.subtasks.length>0){let N=P(ce.subtasks);fe+=N.spent,I+=N.allocated,G+=N.quoted;}else fe+=ce.timeLoggedMinutes??0,I+=ce.effortMinutes??0,G+=ce.soldEffortMinutes??0;return {spent:fe,allocated:I,quoted:G}}return P(e)},[e]),Re=react.useMemo(()=>{let P=new Map;function de(fe){let I=0;for(let G of fe)if(G.subtasks&&G.subtasks.length>0){let ce=de(G.subtasks);P.set(G.id,ce),I+=ce;}else I+=G.weight||0;return I}return de(e),P},[e]),B=react.useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:ee.spent,totalHoursAllocatedMinutes:ee.allocated}},[D,ee]),[Y,ye]=react.useState(true),[Ge,U]=react.useState("position"),[oe,Z]=react.useState("asc"),[Ee,ke]=react.useState(""),[Ie,He]=react.useState(()=>J().statusFilter),[et,ae]=react.useState(()=>J().hideCompleted),[Xe,me]=react.useState(x||aw),[at,mt]=react.useState(false),[Pt,Ce]=react.useState(false),[xt,nt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Je,z]=react.useState("all"),[se,S]=react.useState(false),q=react.useRef(null),ue=react.useRef(null),Te=react.useMemo(()=>{let P=0;function de(fe,I){for(let G of fe)I>P&&(P=I),G.subtasks?.length&&de(G.subtasks,I+1);}return de(e,1),P},[e]);react.useEffect(()=>{if(!se)return;let P=de=>{q.current?.contains(de.target)||ue.current?.contains(de.target)||S(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[se]),react.useEffect(()=>{if(Je==="all"){let fe=function(I){for(let G of I)G.subtasks?.length&&(G.isExpanded===false&&a.onTaskToggleExpand?.(G.id),fe(G.subtasks));};fe(e);}else {let fe=function(I,G){for(let ce of I)if(ce.subtasks?.length){let N=G<Je,j=ce.isExpanded!==false;N!==j&&a.onTaskToggleExpand?.(ce.id),fe(ce.subtasks,G+1);}};fe(e,1);}},[Je]);let[W,re]=react.useState(null),[Ue,Ne]=react.useState(0),[ze,Me]=react.useState(0),Ke=react.useRef(null),[lt,ut]=react.useState(null),[st,Ze]=react.useState(null);react.useEffect(()=>{x&&me(x);},[x]),react.useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:Ie,hideCompleted:et}));}catch(P){console.error("Error persisting filter state:",P);}},[C,Ie,et]);let zt=react.useMemo(()=>{let P=new Set;function de(fe){for(let I of fe)I.subtasks?.length&&(I.isExpanded!==false&&P.add(I.id),de(I.subtasks));}return de(e),P},[e]),Ct=react.useMemo(()=>Xe.filter(P=>P.visible),[Xe]),ht=react.useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),wt=react.useCallback(P=>{Ge===P?Z(de=>de==="asc"?"desc":"asc"):(U(P),Z("asc")),a.onSortChange?.({column:P,direction:oe==="asc"?"desc":"asc"});},[Ge,oe,a]),rt=react.useCallback(P=>{me(P),a.onColumnsChange?.(P);},[a]),Lt=react.useCallback(P=>{let de=Xe.map(fe=>fe.id===P?{...fe,visible:false}:fe);rt(de);},[Xe,rt]),We=react.useCallback((P,de)=>{U(P),Z(de);},[]),Be=react.useCallback((P,de,fe)=>{b&&(P.preventDefault(),nt({isOpen:true,x:P.clientX,y:P.clientY,type:de?"task":"header",task:de,columnId:fe}));},[b]),pt=react.useCallback(()=>{nt(P=>({...P,isOpen:false}));},[]),le=react.useCallback((P,de)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let fe=Xe.find(I=>I.id===de);fe&&(re(de),Ne(P.clientX),Me(fe.width));},[Xe,f]);react.useEffect(()=>{if(!W)return;let P=fe=>{let I=fe.clientX-Ue,G=Math.max(50,ze+I),ce=Xe.map(N=>N.id===W?{...N,width:G}:N);me(ce);},de=()=>{W&&a.onColumnsChange?.(Xe),re(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",de),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",de);}},[W,Ue,ze,Xe,a]);let be=react.useCallback((P,de)=>{if(de==="name"){P.preventDefault();return}ut(de),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",de),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),A=react.useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ut(null),Ze(null);},[]),K=react.useCallback((P,de)=>{P.preventDefault(),de!=="name"&&(P.dataTransfer.dropEffect="move",Ze(de));},[]),X=react.useCallback(()=>{Ze(null);},[]),ge=react.useCallback((P,de)=>{if(P.preventDefault(),!lt||lt===de||de==="name")return;let fe=[...Xe],I=fe.findIndex(N=>N.id===lt),G=fe.findIndex(N=>N.id===de);if(I===-1||G===-1)return;let ce=fe.splice(I,1);ce[0]&&(fe.splice(G,0,ce[0]),rt(fe),ut(null),Ze(null));},[lt,Xe,rt]),Fe=react.useCallback(async P=>{if(a.onCreateCustomField){let de={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(de);}Ce(false);},[a]),Ye=react.useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ve=react.useMemo(()=>{let P=Vg(e);if(Ee.trim()){let de=Ee.toLowerCase();P=P.filter(fe=>fe.name.toLowerCase().includes(de));}return Ie!=="all"&&(P=P.filter(de=>Ye(de)===Ie)),et&&(P=P.filter(de=>Ye(de)!=="completed")),P.sort((de,fe)=>{let I,G;switch(Ge){case "name":I=de.name.toLowerCase(),G=fe.name.toLowerCase();break;case "startDate":I=de.startDate?.getTime()||0,G=fe.startDate?.getTime()||0;break;case "endDate":I=de.endDate?.getTime()||0,G=fe.endDate?.getTime()||0;break;case "progress":I=de.progress||0,G=fe.progress||0;break;case "status":I=de.status||"todo",G=fe.status||"todo";break;case "priority":let ce={urgent:0,high:1,medium:2,low:3,none:4};I=ce[de.priority]??4,G=ce[fe.priority]??4;break;case "position":return 0;default:return 0}return I<G?oe==="asc"?-1:1:I>G?oe==="asc"?1:-1:0}),P},[e,Ee,Ie,et,Ge,oe,Ye]),Oe=react.useCallback((P,de)=>{let fe=ce=>{a.onTaskUpdate?.({...P,...ce});},I=ce=>ce?P.customFields?.find(j=>j.fieldId===ce)?.value:void 0,G=(ce,N)=>{if(!ce)return;let xe=[...P.customFields||[]],Le=xe.findIndex(Qe=>Qe.fieldId===ce);Le>=0?xe[Le]={fieldId:ce,value:N}:xe.push({fieldId:ce,value:N}),fe({customFields:xe});};switch(de.type){case "name":return null;case "status":return jsxRuntime.jsx(Lm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:N=>{fe({status:N,progress:N==="completed"?100:N==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Bm,{value:P.priority,onChange:N=>fe({priority:N}),isDark:H,locale:d});case "assignees":{let N=P.hasChildren,j=P.assignees||[];if(N&&P.subtasks?.length){let xe=new Map;(P.assignees||[]).forEach(Qe=>xe.set(Qe.name,Qe));let Le=Qe=>{(Qe||[]).forEach(tt=>{(tt.assignees||[]).forEach(vt=>{xe.has(vt.name)||xe.set(vt.name,vt);}),tt.subtasks?.length&&Le(tt.subtasks);});};Le(P.subtasks),j=Array.from(xe.values());}return jsxRuntime.jsx(Hm,{value:j,availableUsers:i,onChange:xe=>fe({assignees:xe}),isDark:H,locale:d,disabled:N})}case "startDate":return jsxRuntime.jsx(Pi,{value:P.startDate,onChange:N=>fe({startDate:N}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsxRuntime.jsx(Pi,{value:P.endDate,onChange:N=>fe({endDate:N}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":return jsxRuntime.jsx(_m,{value:P.progress||0,onChange:N=>{let j=N===100?"completed":N>0?"in-progress":"todo";fe({progress:N,status:j});},isDark:H});case "tags":return jsxRuntime.jsx(rg,{value:P.tags||[],isDark:H});case "text":return jsxRuntime.jsx(Ym,{value:I(de.customFieldId)||"",onChange:N=>G(de.customFieldId,N),isDark:H});case "number":return jsxRuntime.jsx(Jm,{value:I(de.customFieldId)||0,onChange:N=>G(de.customFieldId,N),isDark:H});case "date":let ce=I(de.customFieldId);return jsxRuntime.jsx(Pi,{value:ce?new Date(ce):void 0,onChange:N=>G(de.customFieldId,N),isDark:H,locale:d});case "dropdown":return jsxRuntime.jsx(Qm,{value:I(de.customFieldId)||"",options:de.options||[],onChange:N=>G(de.customFieldId,N),isDark:H});case "checkbox":return jsxRuntime.jsx(eg,{value:I(de.customFieldId)||false,onChange:N=>G(de.customFieldId,N),isDark:H});case "estimatedTime":{let N=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.estimatedTime,onChange:j=>fe({estimatedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "quotedTime":{let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(ar,{value:P.quotedTime,onChange:xe=>fe({quotedTime:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "elapsedTime":{let N=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.elapsedTime,onChange:j=>fe({elapsedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "effortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{allocated:Qe,quoted:tt}=En(P),vt=M(P);if(k==="financial"&&vt&&Qe>0&&tt>0){let Rt=Math.round(Qe/60*vt),Ot=Math.round(tt/60*vt)-Rt;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}),Ot!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Ot>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})}return jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=P.effortMinutes||0,xe=P.soldEffortMinutes||0,Le=M(P);if(k==="financial"&&Le&&j>0&&xe>0){let Qe=Math.round(j/60*Le),vt=Math.round(xe/60*Le)-Qe;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:j,onChange:Rt=>fe({effortMinutes:Rt}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)}),vt!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[vt>0?"+":"",Math.abs(vt)>=1e3?`$${(vt/1e3).toFixed(1)}K`:`$${vt}`]})]})}return jsxRuntime.jsx(ar,{value:j,onChange:Qe=>fe({effortMinutes:Qe}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "timeLoggedMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{spent:j}=En(P);return jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(P,j);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:N,lens:k,hourlyRate:M(P)})}case "soldEffortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{quoted:xe}=En(P),Le=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,isBlurred:Le,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:P.soldEffortMinutes,onChange:xe=>fe({soldEffortMinutes:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "scheduleVariance":{let N=P.effortMinutes||0,j=P.soldEffortMinutes||0,xe=P.timeLoggedMinutes||0,Le=N>0||j>0||xe>0;return jsxRuntime.jsx(ig,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Le})}case "hoursBar":{if(E&&P.hasChildren){let{spent:N,allocated:j,quoted:xe}=En(P),Le=N>j&&j>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",Le?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Sn(N)}),j>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-white/60":"text-gray-600",children:Sn(j)})]}),xe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Sn(xe)})]})]})}return jsxRuntime.jsx(dg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:M(P)})}case "teamLoad":return jsxRuntime.jsx(ug,{task:P,isDark:H,locale:d});case "blockers":return jsxRuntime.jsx(mg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let N=Re.get(P.id);if(N!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",N>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:N>0?`${Number(N.toFixed(2))}%`:"\u2014"});let j=P.weight||0;return jsxRuntime.jsx(nw,{value:j,onChange:xe=>fe({weight:xe}),isDark:H})}default:return jsxRuntime.jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,E,Re]),bt=react.useCallback(P=>{let fe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[P.type]||P.label;return typeof fe=="string"?fe:String(fe||P.type)},[O,d]),gt=react.useMemo(()=>{let fe=Ct.reduce((G,ce)=>G+ce.width,0)+(h?48:0),I={};for(let G of Ct)I[G.id]=`${G.width/fe*100}%`;return I},[Ct,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Ke,className:u(H?"bg-[#0D0D0D]":"bg-white",W&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ve.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:P=>ke(P.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),y&&Te>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:q,onClick:()=>S(!se),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?se?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":se?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),Je==="all"?d==="es"?"Todos":"All":`L${Je}`]}),se&&jsxRuntime.jsx("div",{ref:ue,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Te,5)},(P,de)=>({value:de+1,label:`L${de+1}`}))].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{z(P.value),S(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?Je===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Je===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:P.label}),Je===P.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsxRuntime.jsx(Bg,{value:Ie,hideCompleted:et,onChange:He,onHideCompletedChange:ae,isDark:H,locale:d}),B?.enabled&&B.data&&!Y&&jsxRuntime.jsx("button",{onClick:()=>ye(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&v&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ct.map(P=>{let de=P.id!=="name",fe=st===P.id&<!==P.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",de&&"cursor-grab",lt===P.id&&"opacity-50",fe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:gt[P.id],minWidth:P.minWidth},draggable:de,onDragStart:de?I=>be(I,P.id):void 0,onDragEnd:de?A:void 0,onDragOver:de?I=>K(I,P.id):void 0,onDragLeave:de?X:void 0,onDrop:de?I=>ge(I,P.id):void 0,onContextMenu:I=>Be(I,void 0,P.id),children:[de&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),P.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>wt(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[bt(P),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",Ge===P.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:bt(P)}),f&&P.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",W===P.id&&"bg-[#007BFF]"),onMouseDown:I=>le(I,P.id)})]},P.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),mt(de=>!de);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",at&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Eg,{isOpen:at,onClose:()=>mt(false),columns:Xe,customFields:c,onColumnsChange:rt,onCreateCustomField:()=>{mt(false),Ce(true);},isDark:H,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ve.map((P,de)=>{let fe=zt.has(P.id),I=Math.min(de*.01,.2),G=P.hasChildren&&P.level===0,ce=P.subtasks?.length||0;if(G){let{spent:N,allocated:j,quoted:xe}=En(P),Le=rw(P),Qe=ow(P);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Ct.map(tt=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:gt[tt.id],minWidth:tt.minWidth},children:tt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:"flex-shrink-0 cursor-pointer",children:fe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsxRuntime.jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ce," ",d==="es"?ce===1?"Tarea":"Tareas":ce===1?"Item":"Items",")"]}),Le!==null&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Le>=1?"text-[#32D74B]":Le>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Le.toFixed(2)]}),Qe>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Qe]})]}):tt.type==="timeLoggedMinutes"?jsxRuntime.jsx(ar,{value:N>0?N:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="soldEffortMinutes"?jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="effortMinutes"?jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):Oe(P,tt)},tt.id))},P.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-b transition-colors",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:N=>Be(N,P),children:[Ct.map(N=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:gt[N.id],minWidth:N.minWidth},children:N.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsxRuntime.jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Oe(P,N)},N.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),te&&Ve.length>0&&(()=>{let{spent:P,allocated:de,quoted:fe}=ee,I=de-P,G=I<0,ce=G?`+${Sn(Math.abs(I))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Sn(I)} ${d==="es"?"AHORRADO":"SAVED"}`,N=k==="financial"&&L>0,j=Qe=>N?`$${(Qe/60*L).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Sn(Qe),xe=N?Math.abs(I/60*L):0,Le=N?`${G?"+":"-"}$${xe.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${G?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:ce;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ct.map(Qe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:gt[Qe.id],minWidth:Qe.minWidth},children:Qe.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Qe.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(P)}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),de>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold ml-1",G?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:N?Le:ce})]}):Qe.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?j(fe):"\u2013"}):Qe.type==="effortMinutes"?(()=>{if(N&&fe>0&&de>0){let tt=Math.round(fe/60*(L||25)),vt=Math.round(de/60*(L||25)),Rt=tt-vt,na=tt>0?Math.round(Rt/tt*100):0;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de>0?j(de):"\u2013"})})():Qe.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?j(P):"\u2013"}):Qe.type==="progress"?(()=>{let tt=e||[],vt=0,Rt=0,na=0,Ot=0;for(let cr of tt){let Ka=cr.weight||Re.get(cr.id)||0,Pn=cr.progress||0;Ka>0&&(vt+=Pn*Ka,Rt+=Ka),na+=Pn,Ot++;}let _a=Rt>0?Math.round(vt/Rt*10)/10:Ot>0?Math.round(na/Ot):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_a,"%"]})})():Qe.type==="weight"?(()=>{let tt=e||[],vt=[],Rt=cr=>{for(let Ka of cr)vt.push(Ka),Ka.subtasks?.length&&Rt(Ka.subtasks);};Rt(tt);let Ot=vt.filter(cr=>!cr.subtasks?.length||cr.subtasks.length===0).reduce((cr,Ka)=>cr+(Ka.weight||0),0),_a=Math.abs(Ot-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",_a?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ot.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Qe.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ve.length===0&&Ee&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),B?.enabled&&B.data&&Y&&jsxRuntime.jsx(Og,{data:B.data,isDark:H,locale:d,onClose:()=>ye(false),lens:t?.lens})]}),jsxRuntime.jsx(hg,{state:xt,onClose:pt,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Lt,onColumnSort:We,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsxRuntime.jsx(Pg,{isOpen:Pt,onClose:()=>Ce(false),onSave:Fe,isDark:H,locale:d})]})}var _g=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],jg=[{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"}],Kg=[{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 Xd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Jd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Qd={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"},Hi={dark:Xd,light:Jd,neutral:Qd};function Yg(e){return Hi[e]||Hi.dark}var Zd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ec={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},zi={en:Zd,es:ec};function ps(e){return zi[e]||zi.en}function Ui(e,t){let a=ps(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function qg(e){let t=ps(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Xg(e,t=0,a=true){let r=ps(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function gs(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function ac(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Zg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var a0=26,mw=22,gw=10;function e0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function rc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function r0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function t0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?rc(c.effortMinutes,n,i):null,f=p?r0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*a0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function o0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:v,onLogTime:C,onUpdateEstimate:T,onUpdateSoldEffort:D,onStartTimer:k,onStopTimer:L,onDiscardTimer:$,blurFinancials:E=false,suppressDetailModal:te=false,lens:O="hours",hourlyRate:H=0}){let{theme:M="dark",locale:J="en",customTranslations:ee,showBacklog:Re=true}=t,B=Ui(J,ee),Y=M==="dark"||M==="neutral",[ye,Ge]=react.useState(r||new Date),[U,oe]=react.useState(null),[Z,Ee]=react.useState(null),[ke,Ie]=react.useState(null),[He,et]=react.useState({}),ae=3,Xe=3,me=react.useCallback(W=>{Ee(W.id),te||oe(W),h?.(W.id);},[te,h]),[at,mt]=react.useState(null),Pt=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),Ce=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),xt=react.useCallback(()=>{Ge(new Date);},[]),nt=react.useMemo(()=>{let W=ye.getFullYear(),re=ye.getMonth(),Ue=new Date(W,re,1),Ne=new Date(W,re+1,0),ze=Ue.getDay(),Me=Ne.getDate(),Ke=gs(e),lt=new Date;lt.setHours(0,0,0,0);let ut=[],st=ze,Ze=new Date(W,re,0).getDate();for(let Ct=st-1;Ct>=0;Ct--){let ht=new Date(W,re-1,Ze-Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ct=1;Ct<=Me;Ct++){let ht=new Date(W,re,Ct),wt=ht.getTime()===lt.getTime();ut.push({date:ht,isCurrentMonth:true,isToday:wt,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(rt=>ac(ht,rt)).map(rt=>({id:rt.id,title:rt.name,start:rt.startDate,end:rt.endDate,task:rt}))});}let zt=42-ut.length;for(let Ct=1;Ct<=zt;Ct++){let ht=new Date(W,re+1,Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ut},[ye,e]),Je=react.useMemo(()=>gs(e).filter(W=>!W.startDate||!W.endDate),[e]),z=react.useMemo(()=>{let W=gs(e),re=0,Ue=0,Ne=0,ze=0,Me=0;W.forEach(Ze=>{Ze.effortMinutes&&(re+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Ue+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Ne+=Ze.scheduleVariance,ze++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Me+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ke=Ue>0?Math.min(100,Math.round(re/Ue*100)):0,lt=ze>0?Math.round(Ne/ze):0,st=`${Me<0?"-":"+"}${t0(Me,O,H)}`;return {budgetUtil:Ke,avgVariance:lt,costDisplay:st,hasCostData:Ue>0}},[e,O,H]),se=react.useMemo(()=>{let W=[0,0,0,0,0,0];return nt.forEach((re,Ue)=>{let Ne=Math.floor(Ue/7);re.events.forEach(ze=>{if(ze.task.startDate&&ze.task.soldEffortMinutes){let Me=new Date(ze.task.startDate),Ke=re.date;Me.getFullYear()===Ke.getFullYear()&&Me.getMonth()===Ke.getMonth()&&Me.getDate()===Ke.getDate()&&Ne<W.length&&(W[Ne]-=ze.task.soldEffortMinutes);}});}),W},[nt]),S=react.useMemo(()=>{let W=gs(e),re=new Map,Ue=new Set,Ne=[0,0,0,0,0,0];if(nt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne};let ze=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Me=ze(nt[0].date),Ke=ze(nt[nt.length-1].date),lt=[];for(let st of W){if(!st.startDate||!st.endDate)continue;let Ze=ze(st.startDate),zt=ze(st.endDate);if(Ze.getTime()===zt.getTime()||zt<Me||Ze>Ke)continue;let Ct=Ze<Me?Me:Ze,ht=zt>Ke?Ke:zt,wt=e0(Ct,Me),rt=e0(ht,Me);wt<0||wt>41||rt<0||rt>41||wt!==rt&&(Ue.add(st.id),lt.push({task:st,startIdx:wt,endIdx:rt}));}lt.sort((st,Ze)=>st.startIdx!==Ze.startIdx?st.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(st.endIdx-st.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:st,startIdx:Ze,endIdx:zt}of lt){let Ct=Math.floor(Ze/7),ht=Math.floor(zt/7),wt=ze(st.startDate),rt=ze(st.endDate),Lt=false;for(let We=Ct;We<=ht;We++){let Be=We===Ct?Ze%7:0,pt=We===ht?zt%7:6,le=pt-Be+1,be=0,A=ut[We]??[];for(ut[We]||(ut[We]=A);be<A.length&&(A[be]??-1)>=Be;)be++;if(be>=gw){Lt=true;break}be>=A.length?A.push(pt):A[be]=pt,Ne[We]=Math.max(Ne[We]??0,be+1);let K=We===Ct&&wt>=Me,X=We===ht&&rt<=Ke,ge=We*7+Be,Fe={taskId:st.id,task:st,rowIndex:We,startCol:Be,endCol:pt,spanCols:le,lane:be,isStart:K,isEnd:X};re.has(ge)||re.set(ge,[]),re.get(ge).push(Fe);}Lt&&(Ue.delete(st.id),re.forEach((We,Be)=>{let pt=We.filter(le=>le.taskId!==st.id);pt.length===0?re.delete(Be):re.set(Be,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne}},[nt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ue=ye.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ue.charAt(0).toUpperCase()+ue.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",Y?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:nt.map((W,re)=>{let Ue=re%7===6,Ne=re>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let ze=Math.floor(re/7),Me=(S.maxLanesPerRow[ze]??0)*a0,Ke=S.segmentsByCell.get(re);return Me===0&&!Ke?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:Ke?.map(lt=>jsxRuntime.jsx(fw,{segment:lt,isDark:Y,blurFinancials:E,isSelected:Z===lt.taskId,t:B,lens:O,hourlyRate:H,onClick:()=>{me(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let ze=W.events.filter(Me=>Me.task.isMilestone&&!S.multiDayTaskIds.has(Me.id));return ze.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[ze.slice(0,4).map(Me=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:Ke=>{Ke.stopPropagation(),me(Me.task);}},Me.id)),ze.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",ze.length-4]})]})})(),(()=>{let ze=[];W.events.forEach(Ke=>{Ke.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&ze.push({taskId:Ke.id,type:lt.type,severity:lt.severity,variance:Ke.task.scheduleVariance});});});let Me=ze[0];return Me?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let ze=W.events.filter(ut=>!S.multiDayTaskIds.has(ut.id)),Me=He[re]||ae,Ke=ze.slice(0,Me),lt=ze.length-Me;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ut=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{me(ut.task),a.onEventClick?.(ut);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ut.task.progress===100||ut.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?ut.task.progress===100||ut.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ut.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",ut.task.isMilestone?Y?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),lt>0&&jsxRuntime.jsxs("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:Me+Xe}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",J==="es"?"m\xE1s":"more"]}),Me>ae&&ze.length>ae&&jsxRuntime.jsx("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let ze=re>=28,Me=re%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at===re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:ze?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ze?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",ze?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",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:jsxRuntime.jsx(Ro,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||W.date,endDate:Ke.endDate||W.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:Y,locale:J==="es"?"es":"en",defaultDate:W.date,dropdownDirection:ze?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let ze=Math.floor(re/7),Me=se[ze];if(!Me||Me===0)return null;let Ke=t0(Me,O,H);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Me<0?"-":"+",Ke]})})()]},re)})})})]}),Re&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(re=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",E&&"blur-sm select-none"),children:[rc(W.effortMinutes,O,H)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",rc(W.effortMinutes,O,H)]}),(()=>{let re=r0(W,O,H);return re?jsxRuntime.jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(Zg,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((re,Ue)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",Y?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),z.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",E&&"blur-sm select-none"),children:[z.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.budgetUtil}%`,background:z.budgetUtil>90?"#EF4444":z.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.avgVariance>0?"text-emerald-400":z.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[z.avgVariance>0?"+":"",z.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:z.costDisplay})]})]})]})]})]}),!te&&jsxRuntime.jsx(Zr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:M==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?m?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:gs(e).filter(W=>W.id!==U?.id),comments:d?.filter(W=>W.taskId===U?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:T,onSoldEffortUpdate:D,onTimerStart:k,onTimerStop:L,onTimerDiscard:$,blurFinancials:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:ke.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",Y?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ke.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(null),me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(Zg,{task:W.task,isDark:Y}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var oc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},nc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},sc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Gi={dark:oc,light:nc,neutral:sc};function n0(e){return Gi[e]||Gi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),m=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var i0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function bs(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 hs(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 l0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function d0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...i0,...n}),[n]),[l,m]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let v=w.timestamp.toISOString().split("T")[0],C=b.get(v);C?C.push(w):b.set(v,[w]);}),Array.from(b.entries()).sort((w,v)=>v[0].localeCompare(w[0])).map(([w,v])=>({date:new Date(w),events:v.sort((C,T)=>T.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,w=new Set;return e.forEach(v=>{b.add(v.userId),w.add(v.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let v=new Set(w);return v.has(b)?v.delete(b):v.add(b),v});},h=b=>{let v=new Date().getTime()-b.getTime(),C=Math.floor(v/6e4),T=Math.floor(v/36e5),D=Math.floor(v/864e5);return C<1?"just now":C<60?`${C}m ago`:T<24?`${T}h ago`:D<7?`${D}d ago`:b.toLocaleDateString()},f=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[hs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((w,v)=>{let C=l.has(w.id),T=s===w.id,D=l0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",C&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:hs(w.type)})}),v<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:bs(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},k)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function u0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&hs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&bs(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:bs(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ic(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function lc(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 p0(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 m0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function g0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[m,d]=react.useState([]),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(1),[v,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=react.useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),D=react.useCallback(O=>{if(!p||!l.current)return;let M=l.current.getBoundingClientRect(),J=(O.clientX-M.left-v.x)/b,ee=(O.clientY-M.top-v.y)/b;d(Re=>Re.map(B=>B.id===p?{...B,x:J,y:ee,fx:J,fy:ee}:B));},[p,b,v]),k=react.useCallback(()=>{g(null);},[]),L=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),$=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),E=react.useCallback(O=>{let H=m.find(M=>M.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),te=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:ic(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[p0(O)," ",lc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=E(typeof O.source=="string"?O.source:O.source.id),M=E(typeof O.target=="string"?O.target:O.target.id),J=m0(O.type),ee=h===O.id,Re=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Re&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>$(O,B),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:M.x,y2:M.y,stroke:ic(O.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsxRuntime.jsx("text",{x:(H.x+M.x)/2,y:(H.y+M.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:lc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,M=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",H&&"hovered",M&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:J=>T(O.id,J),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:J=>L(O,J),children:[jsxRuntime.jsx("circle",{r:M?a.nodeSize*1.2:a.nodeSize,fill:te(O),stroke:M?"#fbbf24":"#ffffff",strokeWidth:M?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function h0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,m]=react.useState(null),[d,p]=react.useState(null),g=react.useRef(null),y=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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((b,w)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,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:b},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var dc={"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 Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=dc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ys(e){return `$${e.toFixed(4)}`}var cc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},jo=new cc;function v0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(jo.getStats()),[s,n]=react.useState(jo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(jo.getStats()),n(jo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=jo.getRecentOperations(5);return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ys(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:i.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.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 C0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[m,d]=react.useState(""),[p,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(null),v=react.useRef(null),C=p||o;react.useEffect(()=>{e&&v.current&&v.current.focus();},[e]),react.useEffect(()=>{let $=E=>{E.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let T=()=>{C||(i(""),l(""),d(""),x(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),x(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){x($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{h&&(a(h),T());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.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"}),jsxRuntime.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:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.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:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map(($,E)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:v,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:$=>l($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:$=>d($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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(($,E)=>jsxRuntime.jsx("button",{onClick:()=>i($),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},E))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.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"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Ki({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&As(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(w=>{let v=w.cards.find($=>$.id===h);if(!v)return w;let C=v.columnId,T={...v,columnId:f,position:b},D=w.cards.map($=>$.id===h?T:$),k=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(E=>E!==h)};if($.id===f){let E=D.filter(te=>te.columnId===f).sort((te,O)=>te.position-O.position);return {...$,cardIds:E.map(te=>te.id)}}return $}),L={...w,cards:D,columns:k};return o(L),L});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(C=>C.id===h?{...C,...f}:C),v={...b,cards:w};return o(v),v});},[o]),i=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},v=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),C={...b,cards:[...b.cards,w],columns:v};return o(C),C});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),v=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(D=>D!==h)}:T),C={...f,cards:w,columns:v};return o(C),C});},[o]),l=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},v={...b,columns:[...b.columns,w]};return o(v),v});},[o]),m=react.useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(C=>C.id===h?{...C,...f}:C),v={...b,columns:w};return o(v),v});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(C=>C.columnId!==h),w=f.columns.filter(C=>C.id!==h),v={...f,cards:b,columns:w};return o(v),v});},[o]),p=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function N0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ki({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var xs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},S0={by:"none",order:"asc"};function E0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...xs,...e}),[s,n]=react.useState({...S0,...t}),i=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),l=react.useCallback(()=>{o(xs),n(S0);},[]),m=react.useCallback(()=>{a&&o({...xs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...xs,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...xs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),v=String(f.getDate()).padStart(2,"0"),C=`${b}-${w}-${v}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let D=T.endDate||T.dueDate;if(!D)return false;let k;if(typeof D=="string")k=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),E=String(D.getUTCDate()).padStart(2,"0");k=`${L}-${$}-${E}`;}switch(r.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let L=new Date(C+"T00:00:00"),$=new Date(k+"T00:00:00"),E=new Date(L);return E.setDate(E.getDate()+7),$>=L&&$<=E;case "custom":if(r.dateRange){let te=typeof D=="string"?new Date(D):D;return te>=r.dateRange.start&&te<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let v=f.createdAt?new Date(f.createdAt).getTime():0,C=b.createdAt?new Date(b.createdAt).getTime():0;w=v-C;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=T[f.priority||"LOW"],k=T[b.priority||"LOW"];w=D-k;break;case "dueDate":let L=f.endDate||f.dueDate,$=b.endDate||b.dueDate;if(!L)return 1;if(!$)return -1;let E=typeof L=="string"?new Date(L).getTime():L.getTime(),te=typeof $=="string"?new Date($).getTime():$.getTime();w=E-te;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var M0,P0;if(typeof window<"u")try{let e=Fs("ai");M0=e.generateObject,P0=e.generateText;}catch{}function A0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(M0&&P0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function pc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function L0(e){let{cards:t}=e,[a,r]=pc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(k=>k.columnId===x.columnId).sort((k,L)=>k.position-L.position),b=f.findIndex(k=>k.id===a.lastSelectedCardId),w=f.findIndex(k=>k.id===d),[v,C]=b<w?[b,w]:[w,b],T=f.slice(v,C+1).map(k=>k.id),D=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var I0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function B0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...I0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,v]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(v=>v!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(C);});}),b.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(C);});}),w.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(h.forEach(C=>{C.priority&&(v.has(C.priority)||v.set(C.priority,[]),v.get(C.priority).push(C));}),v.forEach((C,T)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${T} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of h){let D=(await r.findSimilar(C,h)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let k=[C.id,...D.map($=>$.card.id)],L=D.reduce(($,E)=>$+E.similarity,0)/D.length;f.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 ${D.length+1} similar tasks`,confidence:L});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,T)=>T.confidence-C.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var R0=react.createContext(null);function O0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Fs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Fs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Fs("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(R0.Provider,{value:{store:o},children:e})}function Yi(){let e=react.useContext(R0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ws(){let e=Yi(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),l=react.useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),p=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,w,v)=>{e.moveCard(b,w,v);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function H0(e){let{cards:t}=ws();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function z0(e="position",t="asc"){let{cards:a}=ws();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var qi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Qc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gw=new qi;function W0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:p,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function V0(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function j0(e){let t=reactVirtual.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 K0(e,t=10){return e>t}var bc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},hc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},yc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},xc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},wc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},kc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Cc={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)"},Tc={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)"},Nc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Dc={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}},Sc={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}},Xi={spacing:bc,borderRadius:hc,fontSize:yc,fontWeight:xc,lineHeight:vc,zIndex:wc,duration:kc,easing:Cc,shadows:Tc,opacity:Nc,kanban:Dc,gantt:Sc};function Y0(e,t,a){return e[t]??a}function Ec(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Ec(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Fc(e="asakaa"){let t=Ec(Xi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Sm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function oo(e,t){let a=Sm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Sd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Ed(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Md(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Em(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 Mm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=oo(t,l),p=Sd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=oo(t,l),p=Ed(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=oo(t,l),p=Md(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=oo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=oo(t,l),p=oo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=oo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Fm(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 r2(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 o2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Di(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Di(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:r2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Pm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:o2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Am(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Di(r,e,t))}var Fd={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"}},Pd={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"}},Si={en:Fd,es:Pd};function Ad(e){return Si[e]||Si.en}function Ei(e,t){let a=Ad(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Ld=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function Lm(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 Im({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Lm(e),l=Ld[0],m=Ld.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Lm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ld.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Id=[{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 Rm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Id.find(m=>m.value===e)??Id[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Id.map(m=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function ss(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function zm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ss(x.name),color:x.color||Bd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(f=>f.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:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ss(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Vm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=react.useState(false),[d,p]=react.useState(o),[g,y]=react.useState(()=>{let D=o==="start"?e:t;if(D){let k=D instanceof Date?D:new Date(D);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,b=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=k=>{x.current&&!x.current.contains(k.target)&&m(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let f=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let D=g.getFullYear(),k=g.getMonth(),L=new Date(D,k,1),E=new Date(D,k+1,0).getDate(),Z=L.getDay(),O=[],F=new Date(D,k,0).getDate();for(let te=Z-1;te>=0;te--)O.push({date:new Date(D,k-1,F-te),isCurrentMonth:false});for(let te=1;te<=E;te++)O.push({date:new Date(D,k,te),isCurrentMonth:true});let J=42-O.length;for(let te=1;te<=J;te++)O.push({date:new Date(D,k+1,te),isCurrentMonth:false});return O},[g]),v=D=>{if(r)o==="start"?a(D,b||void 0):a(h||void 0,D),m(false);else if(d==="start"){let k=b&&D>b?D:b;a(D,k||void 0),p("end");}else {let k=h&&D<h?D:h;a(k||void 0,D),m(false);}},N=()=>{let D=new Date,k=new Date(D);k.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let E=new Date(D);E.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Z=new Date(D);Z.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let D=r&&o==="start"?h:b;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:f(D)})]})}let C=r&&o==="start"?h:b;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:D=>{D.stopPropagation(),m(!l);let k=o==="start"?h:b;k&&y(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:f(C)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((D,k)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>v(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},k)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,b||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,k)=>{let L=D.date.toDateString()===new Date().toDateString(),$=h?.toDateString()===D.date.toDateString(),E=b?.toDateString()===D.date.toDateString(),Z=$||E,O=!r&&h&&b&&D.date>=h&&D.date<=b;return jsxRuntime.jsx("button",{onClick:()=>v(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",E&&!$&&"bg-[#7C3AED] text-white",O&&!Z&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Z&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},k)})})]})]})]})]})}function Pi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Vm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Tn(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ai(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),m=react.useRef([]);return react.useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let b=x/o,f=1-Math.pow(1-b,3),w=Math.round(d+g*f);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function Gm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),m=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function jm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),{isFlashing:d,triggerFlash:p}=Tn(),{displayValue:g,isAnimating:y}=Ai(e,{enabled:o,duration:300,steps:6}),x=v=>{if(r||!t)return;v.stopPropagation();let N=v.currentTarget.getBoundingClientRect(),C=v.clientX-N.left,D=Math.round(C/N.width*100),k=Math.max(0,Math.min(100,D));k!==e&&(t(k),s&&p());},h=react.useCallback(v=>{r||!t||(v.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let b=react.useCallback(()=>{i(false);let v=parseInt(c,10);if(!isNaN(v)&&t){let N=Math.max(0,Math.min(100,v));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),f=react.useCallback(v=>{v.key==="Enter"&&b(),v.key==="Escape"&&i(false);},[b]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:m,value:c,onChange:v=>l(v.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:f,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function qm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Qm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=react.useState(false),[d,p]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=Tn(),{displayValue:h,isAnimating:b}=Ai(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let f=()=>{let v=parseFloat(d);if(!isNaN(v)){let N=v;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=v=>{v.key==="Enter"?f():v.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:v=>p(v.target.value),onBlur:f,onKeyDown:w,onClick:v=>v.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:v=>{v.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:r})}function Zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function tg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=Gm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function og({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function W2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function V2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function ar({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=react.useState(false),[p,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=Tn(),b=c==="financial"&&l>0,f=b&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:W2(e,r);react.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,m]);let w=()=>{let C=V2(p);C!==e&&(t?.(C),n&&h()),d(false);},v=C=>{C.key==="Enter"?w():C.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=b?lucideReact.DollarSign:lucideReact.Clock;return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:f})]}):m?jsxRuntime.jsx("input",{ref:y,type:"text",value:p,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:v,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:f})]})}function lg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function cg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=te=>m?`$${Math.round(te*c).toLocaleString("en-US")}`:`${te}h`,[p,g]=react.useState(false),[y,x]=react.useState(false),[h,b]=react.useState(null),f=react.useRef(null),w=e.timeLoggedMinutes||0,v=e.effortMinutes||0,N=e.soldEffortMinutes||0,C=Math.round(w/60*10)/10,D=Math.round(v/60*10)/10,k=v>0?w/v*100:0,L=k>100?Math.round((w-v)/60*10)/10:0,$=k>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let te=Re=>{f.current&&!f.current.contains(Re.target)&&(x(false),b(null));};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[y,h]);let E=te=>{if(te.stopPropagation(),r&&!o&&!s){b("log");return}if(r||o||s){x(Re=>!Re),b(null);return}n&&n(e);},Z=te=>{x(false),b(te);},O=async(te,Re)=>{h==="log"&&r&&te?r(e,te,Re):h==="estimate"&&o?o(e,te):h==="quoted"&&s&&s(e,te),b(null);},H=r||o||s||n,F=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(te=>te.show),J=h==="estimate"?v:h==="quoted"?N:void 0;return v===0&&w===0&&N===0?jsxRuntime.jsxs("div",{ref:f,className:"relative flex items-center gap-2",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsxRuntime.jsx("button",{onClick:E,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:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.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:F.map(te=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),Z(te.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:f,className:"relative flex items-center gap-2 w-full",onClick:te=>te.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(C)}),v>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),L>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(L)," Over"]})]}),v>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsxRuntime.jsx("button",{onClick:E,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:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",te.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:te=>{te.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",te.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.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:F.map(te=>jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),Z(te.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsxRuntime.jsx(te.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),te.label]},te.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function X2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function J2(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:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function pg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=X2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(ug,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?J2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ug,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Q2={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:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function vg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let b=react.useRef(null),f=r==="es"?hg.es:hg.en;if(react.useEffect(()=>{let D=L=>{b.current&&!b.current.contains(L.target)&&t();},k=L=>{L.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let D=[];return o&&D.push({id:"edit",label:f.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),i&&(D.push({id:"status",label:f.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:f.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:f.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:f.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:f.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:f.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:f.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:f.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:f.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&D.push({id:"assign",label:f.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let L=e.task.assignees||[],E=L.some(Z=>Z.name===k.name)?L.filter(Z=>Z.name!==k.name):[...L,{name:k.name,initials:m1(k.name),color:k.color||g1(k.name),avatar:k.avatarUrl}];i({...e.task,assignees:E}),t();}}))})),d&&D.push({id:"log-time",label:f.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&D.push({id:"report-blocker",label:f.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&D.push({id:"copy-link",label:f.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:f.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),y&&(D.push({id:"move-up",label:f.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),D.push({id:"move-down",label:f.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&D.push({id:"indent",label:f.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&D.push({id:"outdent",label:f.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&D.push({id:"delete",label:f.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),D},v=()=>{if(!e.columnId)return [];let D=[];return l&&(D.push({id:"sort-asc",label:f.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:f.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:f.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),D},N=e.type==="task"?w():v(),C={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:C,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(D=>D.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsxRuntime.jsx(f1,{item:D,isDark:a},D.id):jsxRuntime.jsxs("button",{onClick:D.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(D.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function f1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var hg={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 Mg={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},P1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Pg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=react.useState(""),[m,d]=react.useState(null),p=react.useRef(null),g=i==="es"?Fg.es:Fg.en;if(react.useLayoutEffect(()=>{if(!e||!p.current)return;let v=()=>{if(!p.current)return;let N=p.current.getBoundingClientRect(),D=window.innerHeight-N.top-20;d(Math.max(300,D));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let N=D=>{p.current&&!p.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",N),document.addEventListener("keydown",C),p._cleanup=()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(v),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let y=v=>g.columns[v]||v,x=v=>{if(v==="name")return;let N=a.map(C=>C.id===v?{...C,visible:!C.visible}:C);o(N);},h=(v,N)=>{let C=a.find(k=>k.type===v&&(!N||k.customFieldId===N));if(C){x(C.id);return}let D={id:N||v,type:v,label:N?r.find(k=>k.id===N)?.name||v:y(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:N};o([...a,D]);},b=P1.filter(v=>y(v).toLowerCase().includes(c.toLowerCase())),f=r.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:p,style:{...m?{maxHeight:`${m}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",w);},onFocus:v=>{v.currentTarget.style.borderColor=w,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:b.map(v=>{let N=a.find(k=>k.type===v&&!k.customFieldId),C=N?.visible??false,D=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{D||(N?x(N.id):h(v));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:k=>{D||(k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Mg[v]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(v)})]},v)})})]}),f.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(D=>D.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>h(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Mg[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:v.name})]},v.id)})})]})]})]})}var Fg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var z1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function Ig({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,m]=react.useState([""]),d=o==="es"?Lg.es:Lg.en;react.useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(b=>b.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,b)=>{let f=[...l];f[h]=b,m(f);},x=h=>{l.length>1&&m(l.filter((b,f)=>f!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:z1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:f=>y(b,f.target.value),placeholder:`${d.option} ${b+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Lg={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 Og={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 $g({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),m=s==="es"?Og.es:Og.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),m.filters,p&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Hg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function cs(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function zg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxRuntime.jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#FF2D20":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:cs(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:cs(c)})]}),l>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:cs(l)})]}),i>0&&jsxRuntime.jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${cs(m)} ${s?"Disp.":"Avail."}`:`${cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Hg(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Hg(c)})]}),c>0&&jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var aw=[{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 jg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...jg(r.subtasks,t+1));return a}function rw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function ow(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function En(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=En(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Sn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function nw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Kg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:b=true,enableContextMenu:f=true,showCreateTaskButton:w=false,onCreateTask:v,persistFilter:N=false,financialBlur:C,healthSidebar:D,lens:k="hours",hourlyRate:L=0,rateMap:$,aggregateParentHours:E=false,showProjectTotals:Z=false}=t,O=Ei(d,p),H=m==="dark",F=P=>{if(!$||!P.assignees||P.assignees.length===0)return L;let de=P.assignees.map(fe=>fe.id?$[fe.id]:void 0).filter(fe=>fe!=null&&fe>0);return de.length===0?L:de.reduce((fe,I)=>fe+I,0)/de.length},J=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(N);if(P){let de=JSON.parse(P);return {statusFilter:de.statusFilter||"all",hideCompleted:de.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[N]),te=react.useMemo(()=>{function P(de){let fe=0,I=0,G=0;for(let ce of de)if(ce.subtasks&&ce.subtasks.length>0){let T=P(ce.subtasks);fe+=T.spent,I+=T.allocated,G+=T.quoted;}else fe+=ce.timeLoggedMinutes??0,I+=ce.effortMinutes??0,G+=ce.soldEffortMinutes??0;return {spent:fe,allocated:I,quoted:G}}return P(e)},[e]),Re=react.useMemo(()=>{let P=new Map;function de(fe){let I=0;for(let G of fe)if(G.subtasks&&G.subtasks.length>0){let ce=de(G.subtasks);P.set(G.id,ce),I+=ce;}else I+=G.weight||0;return I}return de(e),P},[e]),B=react.useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:te.spent,totalHoursAllocatedMinutes:te.allocated}},[D,te]),[Y,ye]=react.useState(true),[Ge,U]=react.useState("position"),[oe,ee]=react.useState("asc"),[Ee,ke]=react.useState(""),[Ie,He]=react.useState(()=>J().statusFilter),[et,ae]=react.useState(()=>J().hideCompleted),[Xe,me]=react.useState(x||aw),[at,mt]=react.useState(false),[Pt,Ce]=react.useState(false),[xt,nt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Je,z]=react.useState("all"),[se,S]=react.useState(false),q=react.useRef(null),ue=react.useRef(null),Te=react.useMemo(()=>{let P=0;function de(fe,I){for(let G of fe)I>P&&(P=I),G.subtasks?.length&&de(G.subtasks,I+1);}return de(e,1),P},[e]);react.useEffect(()=>{if(!se)return;let P=de=>{q.current?.contains(de.target)||ue.current?.contains(de.target)||S(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[se]),react.useEffect(()=>{if(Je==="all"){let fe=function(I){for(let G of I)G.subtasks?.length&&(G.isExpanded===false&&a.onTaskToggleExpand?.(G.id),fe(G.subtasks));};fe(e);}else {let fe=function(I,G){for(let ce of I)if(ce.subtasks?.length){let T=G<Je,j=ce.isExpanded!==false;T!==j&&a.onTaskToggleExpand?.(ce.id),fe(ce.subtasks,G+1);}};fe(e,1);}},[Je]);let[W,re]=react.useState(null),[Ue,Ne]=react.useState(0),[ze,Fe]=react.useState(0),Ke=react.useRef(null),[lt,ut]=react.useState(null),[st,Ze]=react.useState(null);react.useEffect(()=>{x&&me(x);},[x]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Ie,hideCompleted:et}));}catch(P){console.error("Error persisting filter state:",P);}},[N,Ie,et]);let zt=react.useMemo(()=>{let P=new Set;function de(fe){for(let I of fe)I.subtasks?.length&&(I.isExpanded!==false&&P.add(I.id),de(I.subtasks));}return de(e),P},[e]),Ct=react.useMemo(()=>Xe.filter(P=>P.visible),[Xe]),ht=react.useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),wt=react.useCallback(P=>{Ge===P?ee(de=>de==="asc"?"desc":"asc"):(U(P),ee("asc")),a.onSortChange?.({column:P,direction:oe==="asc"?"desc":"asc"});},[Ge,oe,a]),rt=react.useCallback(P=>{me(P),a.onColumnsChange?.(P);},[a]),Lt=react.useCallback(P=>{let de=Xe.map(fe=>fe.id===P?{...fe,visible:false}:fe);rt(de);},[Xe,rt]),We=react.useCallback((P,de)=>{U(P),ee(de);},[]),Be=react.useCallback((P,de,fe)=>{f&&(P.preventDefault(),nt({isOpen:true,x:P.clientX,y:P.clientY,type:de?"task":"header",task:de,columnId:fe}));},[f]),pt=react.useCallback(()=>{nt(P=>({...P,isOpen:false}));},[]),le=react.useCallback((P,de)=>{if(!b)return;P.preventDefault(),P.stopPropagation();let fe=Xe.find(I=>I.id===de);fe&&(re(de),Ne(P.clientX),Fe(fe.width));},[Xe,b]);react.useEffect(()=>{if(!W)return;let P=fe=>{let I=fe.clientX-Ue,G=Math.max(50,ze+I),ce=Xe.map(T=>T.id===W?{...T,width:G}:T);me(ce);},de=()=>{W&&a.onColumnsChange?.(Xe),re(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",de),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",de);}},[W,Ue,ze,Xe,a]);let be=react.useCallback((P,de)=>{if(de==="name"){P.preventDefault();return}ut(de),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",de),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),A=react.useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ut(null),Ze(null);},[]),K=react.useCallback((P,de)=>{P.preventDefault(),de!=="name"&&(P.dataTransfer.dropEffect="move",Ze(de));},[]),X=react.useCallback(()=>{Ze(null);},[]),ge=react.useCallback((P,de)=>{if(P.preventDefault(),!lt||lt===de||de==="name")return;let fe=[...Xe],I=fe.findIndex(T=>T.id===lt),G=fe.findIndex(T=>T.id===de);if(I===-1||G===-1)return;let ce=fe.splice(I,1);ce[0]&&(fe.splice(G,0,ce[0]),rt(fe),ut(null),Ze(null));},[lt,Xe,rt]),Me=react.useCallback(async P=>{if(a.onCreateCustomField){let de={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(de);}Ce(false);},[a]),Ye=react.useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ve=react.useMemo(()=>{let P=jg(e);if(Ee.trim()){let de=Ee.toLowerCase();P=P.filter(fe=>fe.name.toLowerCase().includes(de));}return Ie!=="all"&&(P=P.filter(de=>Ye(de)===Ie)),et&&(P=P.filter(de=>Ye(de)!=="completed")),P.sort((de,fe)=>{let I,G;switch(Ge){case "name":I=de.name.toLowerCase(),G=fe.name.toLowerCase();break;case "startDate":I=de.startDate?.getTime()||0,G=fe.startDate?.getTime()||0;break;case "endDate":I=de.endDate?.getTime()||0,G=fe.endDate?.getTime()||0;break;case "progress":I=de.progress||0,G=fe.progress||0;break;case "status":I=de.status||"todo",G=fe.status||"todo";break;case "priority":let ce={urgent:0,high:1,medium:2,low:3,none:4};I=ce[de.priority]??4,G=ce[fe.priority]??4;break;case "position":return 0;default:return 0}return I<G?oe==="asc"?-1:1:I>G?oe==="asc"?1:-1:0}),P},[e,Ee,Ie,et,Ge,oe,Ye]),Oe=react.useCallback((P,de)=>{let fe=ce=>{a.onTaskUpdate?.({...P,...ce});},I=ce=>ce?P.customFields?.find(j=>j.fieldId===ce)?.value:void 0,G=(ce,T)=>{if(!ce)return;let xe=[...P.customFields||[]],Le=xe.findIndex(Qe=>Qe.fieldId===ce);Le>=0?xe[Le]={fieldId:ce,value:T}:xe.push({fieldId:ce,value:T}),fe({customFields:xe});};switch(de.type){case "name":return null;case "status":return jsxRuntime.jsx(Im,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:T=>{fe({status:T,progress:T==="completed"?100:T==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Rm,{value:P.priority,onChange:T=>fe({priority:T}),isDark:H,locale:d});case "assignees":{let T=P.hasChildren,j=P.assignees||[];if(T&&P.subtasks?.length){let xe=new Map;(P.assignees||[]).forEach(Qe=>xe.set(Qe.name,Qe));let Le=Qe=>{(Qe||[]).forEach(tt=>{(tt.assignees||[]).forEach(vt=>{xe.has(vt.name)||xe.set(vt.name,vt);}),tt.subtasks?.length&&Le(tt.subtasks);});};Le(P.subtasks),j=Array.from(xe.values());}return jsxRuntime.jsx(zm,{value:j,availableUsers:i,onChange:xe=>fe({assignees:xe}),isDark:H,locale:d,disabled:T})}case "startDate":return jsxRuntime.jsx(Pi,{value:P.startDate,onChange:T=>fe({startDate:T}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsxRuntime.jsx(Pi,{value:P.endDate,onChange:T=>fe({endDate:T}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":return jsxRuntime.jsx(jm,{value:P.progress||0,onChange:T=>{let j=T===100?"completed":T>0?"in-progress":"todo";fe({progress:T,status:j});},isDark:H});case "tags":return jsxRuntime.jsx(og,{value:P.tags||[],isDark:H});case "text":return jsxRuntime.jsx(qm,{value:I(de.customFieldId)||"",onChange:T=>G(de.customFieldId,T),isDark:H});case "number":return jsxRuntime.jsx(Qm,{value:I(de.customFieldId)||0,onChange:T=>G(de.customFieldId,T),isDark:H});case "date":let ce=I(de.customFieldId);return jsxRuntime.jsx(Pi,{value:ce?new Date(ce):void 0,onChange:T=>G(de.customFieldId,T),isDark:H,locale:d});case "dropdown":return jsxRuntime.jsx(Zm,{value:I(de.customFieldId)||"",options:de.options||[],onChange:T=>G(de.customFieldId,T),isDark:H});case "checkbox":return jsxRuntime.jsx(tg,{value:I(de.customFieldId)||false,onChange:T=>G(de.customFieldId,T),isDark:H});case "estimatedTime":{let T=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.estimatedTime,onChange:j=>fe({estimatedTime:j}),isDark:H,locale:d,disabled:T,lens:k,hourlyRate:F(P)})}case "quotedTime":{let T=P.status==="completed"||P.progress===100,j=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsxRuntime.jsx(ar,{value:P.quotedTime,onChange:xe=>fe({quotedTime:xe}),isDark:H,locale:d,disabled:T,isBlurred:j,lens:k,hourlyRate:F(P)})}case "elapsedTime":{let T=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.elapsedTime,onChange:j=>fe({elapsedTime:j}),isDark:H,locale:d,disabled:T,lens:k,hourlyRate:F(P)})}case "effortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{allocated:Qe,quoted:tt}=En(P),vt=F(P);if(k==="financial"&&vt&&Qe>0&&tt>0){let Rt=Math.round(Qe/60*vt),Ot=Math.round(tt/60*vt)-Rt;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)}),Ot!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Ot>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})}return jsxRuntime.jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)})}let T=P.status==="completed"||P.progress===100,j=P.effortMinutes||0,xe=P.soldEffortMinutes||0,Le=F(P);if(k==="financial"&&Le&&j>0&&xe>0){let Qe=Math.round(j/60*Le),vt=Math.round(xe/60*Le)-Qe;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ar,{value:j,onChange:Rt=>fe({effortMinutes:Rt}),isDark:H,locale:d,disabled:T,lens:k,hourlyRate:F(P)}),vt!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[vt>0?"+":"",Math.abs(vt)>=1e3?`$${(vt/1e3).toFixed(1)}K`:`$${vt}`]})]})}return jsxRuntime.jsx(ar,{value:j,onChange:Qe=>fe({effortMinutes:Qe}),isDark:H,locale:d,disabled:T,lens:k,hourlyRate:F(P)})}case "timeLoggedMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{spent:j}=En(P);return jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)})}let T=P.status==="completed"||P.progress===100;return jsxRuntime.jsx(ar,{value:P.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(P,j);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:T,lens:k,hourlyRate:F(P)})}case "soldEffortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{quoted:xe}=En(P),Le=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,isBlurred:Le,lens:k,hourlyRate:F(P)})}let T=P.status==="completed"||P.progress===100,j=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(ar,{value:P.soldEffortMinutes,onChange:xe=>fe({soldEffortMinutes:xe}),isDark:H,locale:d,disabled:T,isBlurred:j,lens:k,hourlyRate:F(P)})}case "scheduleVariance":{let T=P.effortMinutes||0,j=P.soldEffortMinutes||0,xe=P.timeLoggedMinutes||0,Le=T>0||j>0||xe>0;return jsxRuntime.jsx(lg,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Le})}case "hoursBar":{if(E&&P.hasChildren){let{spent:T,allocated:j,quoted:xe}=En(P),Le=T>j&&j>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",Le?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Sn(T)}),j>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-white/60":"text-gray-600",children:Sn(j)})]}),xe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Sn(xe)})]})]})}return jsxRuntime.jsx(cg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:F(P)})}case "teamLoad":return jsxRuntime.jsx(pg,{task:P,isDark:H,locale:d});case "blockers":return jsxRuntime.jsx(gg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let T=Re.get(P.id);if(T!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",T>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:T>0?`${Number(T.toFixed(2))}%`:"\u2014"});let j=P.weight||0;return jsxRuntime.jsx(nw,{value:j,onChange:xe=>fe({weight:xe}),isDark:H})}default:return jsxRuntime.jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,E,Re]),bt=react.useCallback(P=>{let fe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[P.type]||P.label;return typeof fe=="string"?fe:String(fe||P.type)},[O,d]),gt=react.useMemo(()=>{let fe=Ct.reduce((G,ce)=>G+ce.width,0)+(h?48:0),I={};for(let G of Ct)I[G.id]=`${G.width/fe*100}%`;return I},[Ct,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Ke,className:u(H?"bg-[#0D0D0D]":"bg-white",W&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ve.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:Ee,onChange:P=>ke(P.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),y&&Te>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:q,onClick:()=>S(!se),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?se?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":se?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),Je==="all"?d==="es"?"Todos":"All":`L${Je}`]}),se&&jsxRuntime.jsx("div",{ref:ue,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Te,5)},(P,de)=>({value:de+1,label:`L${de+1}`}))].map(P=>jsxRuntime.jsxs("button",{onClick:()=>{z(P.value),S(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?Je===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Je===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:P.label}),Je===P.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsxRuntime.jsx($g,{value:Ie,hideCompleted:et,onChange:He,onHideCompletedChange:ae,isDark:H,locale:d}),B?.enabled&&B.data&&!Y&&jsxRuntime.jsx("button",{onClick:()=>ye(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&v&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ct.map(P=>{let de=P.id!=="name",fe=st===P.id&<!==P.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",de&&"cursor-grab",lt===P.id&&"opacity-50",fe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:gt[P.id],minWidth:P.minWidth},draggable:de,onDragStart:de?I=>be(I,P.id):void 0,onDragEnd:de?A:void 0,onDragOver:de?I=>K(I,P.id):void 0,onDragLeave:de?X:void 0,onDrop:de?I=>ge(I,P.id):void 0,onContextMenu:I=>Be(I,void 0,P.id),children:[de&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),P.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>wt(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[bt(P),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",Ge===P.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:bt(P)}),b&&P.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",W===P.id&&"bg-[#007BFF]"),onMouseDown:I=>le(I,P.id)})]},P.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsxRuntime.jsx("button",{onClick:P=>{P.stopPropagation(),mt(de=>!de);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",at&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Pg,{isOpen:at,onClose:()=>mt(false),columns:Xe,customFields:c,onColumnsChange:rt,onCreateCustomField:()=>{mt(false),Ce(true);},isDark:H,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ve.map((P,de)=>{let fe=zt.has(P.id),I=Math.min(de*.01,.2),G=P.hasChildren&&P.level===0,ce=P.subtasks?.length||0;if(G){let{spent:T,allocated:j,quoted:xe}=En(P),Le=rw(P),Qe=ow(P);return jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Ct.map(tt=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:gt[tt.id],minWidth:tt.minWidth},children:tt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:"flex-shrink-0 cursor-pointer",children:fe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsxRuntime.jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ce," ",d==="es"?ce===1?"Tarea":"Tareas":ce===1?"Item":"Items",")"]}),Le!==null&&jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Le>=1?"text-[#32D74B]":Le>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Le.toFixed(2)]}),Qe>0&&jsxRuntime.jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Qe]})]}):tt.type==="timeLoggedMinutes"?jsxRuntime.jsx(ar,{value:T>0?T:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)}):tt.type==="soldEffortMinutes"?jsxRuntime.jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)}):tt.type==="effortMinutes"?jsxRuntime.jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:F(P)}):Oe(P,tt)},tt.id))},P.id)}return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-b transition-colors",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:T=>Be(T,P),children:[Ct.map(T=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:gt[T.id],minWidth:T.minWidth},children:T.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsxRuntime.jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Oe(P,T)},T.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),Z&&Ve.length>0&&(()=>{let{spent:P,allocated:de,quoted:fe}=te,I=de-P,G=I<0,ce=G?`+${Sn(Math.abs(I))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Sn(I)} ${d==="es"?"AHORRADO":"SAVED"}`,T=k==="financial"&&L>0,j=Qe=>T?`$${(Qe/60*L).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Sn(Qe),xe=T?Math.abs(I/60*L):0,Le=T?`${G?"+":"-"}$${xe.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${G?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:ce;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ct.map(Qe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:gt[Qe.id],minWidth:Qe.minWidth},children:Qe.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Qe.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(P)}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),de>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold ml-1",G?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:T?Le:ce})]}):Qe.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?j(fe):"\u2013"}):Qe.type==="effortMinutes"?(()=>{if(T&&fe>0&&de>0){let tt=Math.round(fe/60*(L||25)),vt=Math.round(de/60*(L||25)),Rt=tt-vt,na=tt>0?Math.round(Rt/tt*100):0;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de>0?j(de):"\u2013"})})():Qe.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?j(P):"\u2013"}):Qe.type==="progress"?(()=>{let tt=e||[],vt=0,Rt=0,na=0,Ot=0;for(let cr of tt){let Ka=cr.weight||Re.get(cr.id)||0,Pn=cr.progress||0;Ka>0&&(vt+=Pn*Ka,Rt+=Ka),na+=Pn,Ot++;}let _a=Rt>0?Math.round(vt/Rt*10)/10:Ot>0?Math.round(na/Ot):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_a,"%"]})})():Qe.type==="weight"?(()=>{let tt=e||[],vt=[],Rt=cr=>{for(let Ka of cr)vt.push(Ka),Ka.subtasks?.length&&Rt(Ka.subtasks);};Rt(tt);let Ot=vt.filter(cr=>!cr.subtasks?.length||cr.subtasks.length===0).reduce((cr,Ka)=>cr+(Ka.weight||0),0),_a=Math.abs(Ot-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",_a?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ot.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Qe.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ve.length===0&&Ee&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),B?.enabled&&B.data&&Y&&jsxRuntime.jsx(zg,{data:B.data,isDark:H,locale:d,onClose:()=>ye(false),lens:t?.lens})]}),jsxRuntime.jsx(vg,{state:xt,onClose:pt,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Lt,onColumnSort:We,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),jsxRuntime.jsx(Ig,{isOpen:Pt,onClose:()=>Ce(false),onSave:Me,isDark:H,locale:d})]})}var Yg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],qg=[{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"}],Xg=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Jd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Qd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Zd={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"},Hi={dark:Jd,light:Qd,neutral:Zd};function Jg(e){return Hi[e]||Hi.dark}var ec={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},tc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},zi={en:ec,es:tc};function ps(e){return zi[e]||zi.en}function Ui(e,t){let a=ps(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Qg(e){let t=ps(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Zg(e,t=0,a=true){let r=ps(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function gs(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function rc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function a0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var n0=26,mw=22,gw=10;function r0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function oc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function s0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function o0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?oc(c.effortMinutes,n,i):null,b=p?s0(c,n,i):null,f=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*n0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||b)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),f&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",f.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function i0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:b,timeTrackingSummary:f,timeEntries:w,timerState:v,onLogTime:N,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:k,onStopTimer:L,onDiscardTimer:$,blurFinancials:E=false,suppressDetailModal:Z=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:J="en",customTranslations:te,showBacklog:Re=true}=t,B=Ui(J,te),Y=F==="dark"||F==="neutral",[ye,Ge]=react.useState(r||new Date),[U,oe]=react.useState(null),[ee,Ee]=react.useState(null),[ke,Ie]=react.useState(null),[He,et]=react.useState({}),ae=3,Xe=3,me=react.useCallback(W=>{Ee(W.id),Z||oe(W),h?.(W.id);},[Z,h]),[at,mt]=react.useState(null),Pt=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),Ce=react.useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),xt=react.useCallback(()=>{Ge(new Date);},[]),nt=react.useMemo(()=>{let W=ye.getFullYear(),re=ye.getMonth(),Ue=new Date(W,re,1),Ne=new Date(W,re+1,0),ze=Ue.getDay(),Fe=Ne.getDate(),Ke=gs(e),lt=new Date;lt.setHours(0,0,0,0);let ut=[],st=ze,Ze=new Date(W,re,0).getDate();for(let Ct=st-1;Ct>=0;Ct--){let ht=new Date(W,re-1,Ze-Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>rc(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ct=1;Ct<=Fe;Ct++){let ht=new Date(W,re,Ct),wt=ht.getTime()===lt.getTime();ut.push({date:ht,isCurrentMonth:true,isToday:wt,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(rt=>rc(ht,rt)).map(rt=>({id:rt.id,title:rt.name,start:rt.startDate,end:rt.endDate,task:rt}))});}let zt=42-ut.length;for(let Ct=1;Ct<=zt;Ct++){let ht=new Date(W,re+1,Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>rc(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ut},[ye,e]),Je=react.useMemo(()=>gs(e).filter(W=>!W.startDate||!W.endDate),[e]),z=react.useMemo(()=>{let W=gs(e),re=0,Ue=0,Ne=0,ze=0,Fe=0;W.forEach(Ze=>{Ze.effortMinutes&&(re+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Ue+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Ne+=Ze.scheduleVariance,ze++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Fe+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ke=Ue>0?Math.min(100,Math.round(re/Ue*100)):0,lt=ze>0?Math.round(Ne/ze):0,st=`${Fe<0?"-":"+"}${o0(Fe,O,H)}`;return {budgetUtil:Ke,avgVariance:lt,costDisplay:st,hasCostData:Ue>0}},[e,O,H]),se=react.useMemo(()=>{let W=[0,0,0,0,0,0];return nt.forEach((re,Ue)=>{let Ne=Math.floor(Ue/7);re.events.forEach(ze=>{if(ze.task.startDate&&ze.task.soldEffortMinutes){let Fe=new Date(ze.task.startDate),Ke=re.date;Fe.getFullYear()===Ke.getFullYear()&&Fe.getMonth()===Ke.getMonth()&&Fe.getDate()===Ke.getDate()&&Ne<W.length&&(W[Ne]-=ze.task.soldEffortMinutes);}});}),W},[nt]),S=react.useMemo(()=>{let W=gs(e),re=new Map,Ue=new Set,Ne=[0,0,0,0,0,0];if(nt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne};let ze=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Fe=ze(nt[0].date),Ke=ze(nt[nt.length-1].date),lt=[];for(let st of W){if(!st.startDate||!st.endDate)continue;let Ze=ze(st.startDate),zt=ze(st.endDate);if(Ze.getTime()===zt.getTime()||zt<Fe||Ze>Ke)continue;let Ct=Ze<Fe?Fe:Ze,ht=zt>Ke?Ke:zt,wt=r0(Ct,Fe),rt=r0(ht,Fe);wt<0||wt>41||rt<0||rt>41||wt!==rt&&(Ue.add(st.id),lt.push({task:st,startIdx:wt,endIdx:rt}));}lt.sort((st,Ze)=>st.startIdx!==Ze.startIdx?st.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(st.endIdx-st.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:st,startIdx:Ze,endIdx:zt}of lt){let Ct=Math.floor(Ze/7),ht=Math.floor(zt/7),wt=ze(st.startDate),rt=ze(st.endDate),Lt=false;for(let We=Ct;We<=ht;We++){let Be=We===Ct?Ze%7:0,pt=We===ht?zt%7:6,le=pt-Be+1,be=0,A=ut[We]??[];for(ut[We]||(ut[We]=A);be<A.length&&(A[be]??-1)>=Be;)be++;if(be>=gw){Lt=true;break}be>=A.length?A.push(pt):A[be]=pt,Ne[We]=Math.max(Ne[We]??0,be+1);let K=We===Ct&&wt>=Fe,X=We===ht&&rt<=Ke,ge=We*7+Be,Me={taskId:st.id,task:st,rowIndex:We,startCol:Be,endCol:pt,spanCols:le,lane:be,isStart:K,isEnd:X};re.has(ge)||re.set(ge,[]),re.get(ge).push(Me);}Lt&&(Ue.delete(st.id),re.forEach((We,Be)=>{let pt=We.filter(le=>le.taskId!==st.id);pt.length===0?re.delete(Be):re.set(Be,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne}},[nt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ue=ye.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ue.charAt(0).toUpperCase()+ue.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",Y?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",Y?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Te}),jsxRuntime.jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:nt.map((W,re)=>{let Ue=re%7===6,Ne=re>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let ze=Math.floor(re/7),Fe=(S.maxLanesPerRow[ze]??0)*n0,Ke=S.segmentsByCell.get(re);return Fe===0&&!Ke?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:Ke?.map(lt=>jsxRuntime.jsx(fw,{segment:lt,isDark:Y,blurFinancials:E,isSelected:ee===lt.taskId,t:B,lens:O,hourlyRate:H,onClick:()=>{me(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let ze=W.events.filter(Fe=>Fe.task.isMilestone&&!S.multiDayTaskIds.has(Fe.id));return ze.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[ze.slice(0,4).map(Fe=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:Ke=>{Ke.stopPropagation(),me(Fe.task);}},Fe.id)),ze.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",ze.length-4]})]})})(),(()=>{let ze=[];W.events.forEach(Ke=>{Ke.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&ze.push({taskId:Ke.id,type:lt.type,severity:lt.severity,variance:Ke.task.scheduleVariance});});});let Fe=ze[0];return Fe?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let ze=W.events.filter(ut=>!S.multiDayTaskIds.has(ut.id)),Fe=He[re]||ae,Ke=ze.slice(0,Fe),lt=ze.length-Fe;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ut=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{me(ut.task),a.onEventClick?.(ut);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",ut.task.progress===100||ut.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?ut.task.progress===100||ut.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:ut.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",ut.task.isMilestone?Y?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),lt>0&&jsxRuntime.jsxs("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:Fe+Xe}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",J==="es"?"m\xE1s":"more"]}),Fe>ae&&ze.length>ae&&jsxRuntime.jsx("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let ze=re>=28,Fe=re%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:at===re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:ze?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ze?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",ze?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",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:jsxRuntime.jsx(Ro,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||W.date,endDate:Ke.endDate||W.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:Y,locale:J==="es"?"es":"en",defaultDate:W.date,dropdownDirection:ze?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let ze=Math.floor(re/7),Fe=se[ze];if(!Fe||Fe===0)return null;let Ke=o0(Fe,O,H);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Fe<0?"-":"+",Ke]})})()]},re)})})})]}),Re&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(re=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",E&&"blur-sm select-none"),children:[oc(W.effortMinutes,O,H)&&jsxRuntime.jsxs("span",{children:[B.labels.estimate,": ",oc(W.effortMinutes,O,H)]}),(()=>{let re=s0(W,O,H);return re?jsxRuntime.jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(a0,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((re,Ue)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",Y?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),z.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",E&&"blur-sm select-none"),children:[z.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.budgetUtil}%`,background:z.budgetUtil>90?"#EF4444":z.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.avgVariance>0?"text-emerald-400":z.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[z.avgVariance>0?"+":"",z.avgVariance," ",B.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:z.costDisplay})]})]})]})]})]}),!Z&&jsxRuntime.jsx(Zr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:F==="dark"?"dark":"light",locale:J,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:U?m?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:gs(e).filter(W=>W.id!==U?.id),comments:d?.filter(W=>W.taskId===U?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:b,timeTrackingSummary:f,timeEntries:w,isTimerRunning:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:k,onTimerStop:L,onTimerDiscard:$,blurFinancials:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:ke.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",Y?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ke.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(null),me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(a0,{task:W.task,isDark:Y}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var nc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},sc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},ic={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Gi={dark:nc,light:sc,neutral:ic};function l0(e){return Gi[e]||Gi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),m=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=m.length,y=new Set(m.flatMap(b=>b.assignedUserIds||[])).size,x=m.map(b=>b.priority).filter(Boolean),h=new Set(m.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.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"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var c0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function bs(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 hs(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 u0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function p0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...c0,...n}),[n]),[l,m]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let f=new Map;return e.forEach(w=>{let v=w.timestamp.toISOString().split("T")[0],N=f.get(v);N?N.push(w):f.set(v,[w]);}),Array.from(f.entries()).sort((w,v)=>v[0].localeCompare(w[0])).map(([w,v])=>({date:new Date(w),events:v.sort((N,C)=>C.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let f=new Set,w=new Set;return e.forEach(v=>{f.add(v.userId),w.add(v.type);}),{uniqueUsers:Array.from(f),uniqueTypes:Array.from(w)}},[e]),x=f=>{m(w=>{let v=new Set(w);return v.has(f)?v.delete(f):v.add(f),v});},h=f=>{let v=new Date().getTime()-f.getTime(),N=Math.floor(v/6e4),C=Math.floor(v/36e5),D=Math.floor(v/864e5);return N<1?"just now":N<60?`${N}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:f.toLocaleDateString()},b=react.useMemo(()=>{let f=0;return t.types&&t.types.length>0&&f++,t.users&&t.users.length>0&&f++,t.dateRange&&f++,t.searchTerm&&f++,f},[t]);return react.useEffect(()=>{if(s&&d.current){let f=d.current.querySelector(`[data-event-id="${s}"]`);f&&f.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:f=>{let w=f.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(f=>jsxRuntime.jsxs("option",{value:f,children:[hs(f)," ",f.replace("_"," ")]},f))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:f=>{let w=f.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(f=>jsxRuntime.jsx("option",{value:f,children:f},f))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:f=>a({...t,searchTerm:f.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(f=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&f.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:f.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[f.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:f.events.map((w,v)=>{let N=l.has(w.id),C=s===w.id,D=u0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:hs(w.type)})}),v<f.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:bs(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},k)),w.metadata&&Object.keys(w.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},w.id)})})]},f.date?.toISOString()||"all"))})]})}function g0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&hs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&bs(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:bs(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function lc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function dc(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 f0(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 b0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,b=o.chargeStrength*l/(h*h);m.vx+=y/h*b,m.vy+=x/h*b;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function h0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[m,d]=react.useState([]),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,b]=react.useState(null),[f,w]=react.useState(1),[v,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let C=react.useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),D=react.useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),J=(O.clientX-F.left-v.x)/f,te=(O.clientY-F.top-v.y)/f;d(Re=>Re.map(B=>B.id===p?{...B,x:J,y:te,fx:J,fy:te}:B));},[p,f,v]),k=react.useCallback(()=>{g(null);},[]),L=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),$=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),E=react.useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),Z=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:u("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(f*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:lc(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[f0(O)," ",dc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${f})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=E(typeof O.source=="string"?O.source:O.source.id),F=E(typeof O.target=="string"?O.target:O.target.id),J=b0(O.type),te=h===O.id,Re=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",te&&"hovered",Re&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:B=>$(O,B),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:lc(O.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:te?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&te&&jsxRuntime.jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:dc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:J=>C(O.id,J),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:J=>L(O,J),children:[jsxRuntime.jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:Z(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function v0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,m]=react.useState(null),[d,p]=react.useState(null),g=react.useRef(null),y=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let f=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let f=await r(s.trim());p(f);}catch(f){m(f instanceof Error?f.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.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:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((f,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:f.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((f,w)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:f.title}),f.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:f.description})]}),f.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${f.priority==="URGENT"?"bg-red-500/20 text-red-400":f.priority==="HIGH"?"bg-orange-500/20 text-orange-400":f.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:f.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:f=>n(f.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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((f,w)=>jsxRuntime.jsx("button",{onClick:()=>n(f),disabled:y,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:f},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.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"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var cc={"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 Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=cc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ys(e){return `$${e.toFixed(4)}`}var uc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},jo=new uc;function C0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(jo.getStats()),[s,n]=react.useState(jo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(jo.getStats()),n(jo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=jo.getRecentOperations(5);return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ys(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:i.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.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 D0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[m,d]=react.useState(""),[p,g]=react.useState(false),[y,x]=react.useState(null),[h,b]=react.useState(null),[f,w]=react.useState(null),v=react.useRef(null),N=p||o;react.useEffect(()=>{e&&v.current&&v.current.focus();},[e]),react.useEffect(()=>{let $=E=>{E.key==="Escape"&&!N&&C();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,N]);let C=()=>{N||(i(""),l(""),d(""),x(null),b(null),w(null),t());},D=async()=>{if(!(!n.trim()||N)){g(true),x(null),b(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});b($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){x($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{h&&(a(h),C());};if(!e)return null;let L=f?.similarity?((f.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Wt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:$=>$.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:C,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[f?.mock_mode&&jsxRuntime.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"}),f?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.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"}),jsxRuntime.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:[f?.tokens_used||0," tokens"]}),f?.tokens_saved&&jsxRuntime.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:[f.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map(($,E)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:$.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),$.start," \u2192 ",$.end]}),jsxRuntime.jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:v,value:n,onChange:$=>i($.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:$=>l($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:$=>d($.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.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(($,E)=>jsxRuntime.jsx("button",{onClick:()=>i($),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:$},E))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.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"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:C,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.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"}):jsxRuntime.jsx("button",{onClick:D,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Ki({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&As(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,f,w)=>{console.warn(`Retry attempt ${f} after ${w}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,f)=>{r(w=>{let v=w.cards.find($=>$.id===h);if(!v)return w;let N=v.columnId,C={...v,columnId:b,position:f},D=w.cards.map($=>$.id===h?C:$),k=w.columns.map($=>{if($.id===N)return {...$,cardIds:$.cardIds.filter(E=>E!==h)};if($.id===b){let E=D.filter(Z=>Z.columnId===b).sort((Z,O)=>Z.position-O.position);return {...$,cardIds:E.map(Z=>Z.id)}}return $}),L={...w,cards:D,columns:k};return o(L),L});},[o]),n=react.useCallback(async(h,b)=>{r(f=>{let w=f.cards.map(N=>N.id===h?{...N,...b}:N),v={...f,cards:w};return o(v),v});},[o]),i=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let w={...h,id:b},v=f.columns.map(C=>C.id===h.columnId?{...C,cardIds:[...C.cardIds,b]}:C),N={...f,cards:[...f.cards,w],columns:v};return o(N),N});},[o]),c=react.useCallback(async h=>{r(b=>{let f=b.cards.find(C=>C.id===h);if(!f)return b;let w=b.cards.filter(C=>C.id!==h),v=b.columns.map(C=>C.id===f.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==h)}:C),N={...b,cards:w,columns:v};return o(N),N});},[o]),l=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let w={...h,id:b,cardIds:[]},v={...f,columns:[...f.columns,w]};return o(v),v});},[o]),m=react.useCallback(async(h,b)=>{r(f=>{let w=f.columns.map(N=>N.id===h?{...N,...b}:N),v={...f,columns:w};return o(v),v});},[o]),d=react.useCallback(async h=>{r(b=>{let f=b.cards.filter(N=>N.columnId!==h),w=b.columns.filter(N=>N.id!==h),v={...b,cards:f,columns:w};return o(v),v});},[o]),p=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),g=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),y=react.useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function E0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ki({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var xs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},F0={by:"none",order:"asc"};function P0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...xs,...e}),[s,n]=react.useState({...F0,...t}),i=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),l=react.useCallback(()=>{o(xs),n(F0);},[]),m=react.useCallback(()=>{a&&o({...xs,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...xs,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...xs,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let b=r.search.toLowerCase();h=h.filter(f=>f.title.toLowerCase().includes(b)||f.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,f=b.getFullYear(),w=String(b.getMonth()+1).padStart(2,"0"),v=String(b.getDate()).padStart(2,"0"),N=`${f}-${w}-${v}`;h=h.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let k;if(typeof D=="string")k=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),E=String(D.getUTCDate()).padStart(2,"0");k=`${L}-${$}-${E}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let L=new Date(N+"T00:00:00"),$=new Date(k+"T00:00:00"),E=new Date(L);return E.setDate(E.getDate()+7),$>=L&&$<=E;case "custom":if(r.dateRange){let Z=typeof D=="string"?new Date(D):D;return Z>=r.dateRange.start&&Z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(f=>r.labels.includes(f)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,f)=>{let w=0;switch(s.by){case "created":let v=b.createdAt?new Date(b.createdAt).getTime():0,N=f.createdAt?new Date(f.createdAt).getTime():0;w=v-N;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[b.priority||"LOW"],k=C[f.priority||"LOW"];w=D-k;break;case "dueDate":let L=b.endDate||b.dueDate,$=f.endDate||f.dueDate;if(!L)return 1;if(!$)return -1;let E=typeof L=="string"?new Date(L).getTime():L.getTime(),Z=typeof $=="string"?new Date($).getTime():$.getTime();w=E-Z;break;case "title":w=b.title.localeCompare(f.title);break;case "estimate":let O=b.estimatedTime||0,H=f.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var L0,I0;if(typeof window<"u")try{let e=Ms("ai");L0=e.generateObject,I0=e.generateText;}catch{}function B0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(L0&&I0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function mc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function R0(e){let{cards:t}=e,[a,r]=mc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(b=>b.id===d),h=t.find(b=>b.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,L)=>k.position-L.position),f=b.findIndex(k=>k.id===a.lastSelectedCardId),w=b.findIndex(k=>k.id===d),[v,N]=f<w?[f,w]:[w,f],C=b.slice(v,N+1).map(k=>k.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var O0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function $0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...O0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((x,h,b,f,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:b,strategy:f,color:w,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};n(N=>[...N,v]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(b=>b.id!==x));},[]),l=react.useCallback(x=>{n(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),m=react.useCallback((x,h)=>{n(b=>b.map(f=>f.id===x&&!f.cardIds.includes(h)?{...f,cardIds:[...f.cardIds,h]}:f));},[]),d=react.useCallback((x,h)=>{n(b=>b.map(f=>{if(f.id===x){let w=f.cardIds.filter(v=>v!==h);return w.length<o.minCardsPerStack?null:{...f,cardIds:w}}return f}).filter(f=>f!==null));},[o.minCardsPerStack]),p=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),g=react.useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let b=[],f=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(C=>{f.has(C)||f.set(C,[]),f.get(C).push(N);});}),f.forEach((N,C)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:N.map(D=>D.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${C}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(N);});}),w.forEach((N,C)=>{N.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:N.map(D=>D.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(h.forEach(N=>{N.priority&&(v.has(N.priority)||v.set(N.priority,[]),v.get(N.priority).push(N));}),v.forEach((N,C)=>{if(N.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";b.push({stack:{title:`${D} ${C} Priority`,cardIds:N.map(k=>k.id),columnId:x,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let D=(await r.findSimilar(N,h)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let k=[N.id,...D.map($=>$.card.id)],L=D.reduce(($,E)=>$+E.similarity,0)/D.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:L});}}return b.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,C)=>C.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await g(h),f=b[0];b.length>0&&f&&f.confidence>=.9&&y(f);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var H0=react.createContext(null);function z0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Ms("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Ms("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Ms("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(H0.Provider,{value:{store:o},children:e})}function Yi(){let e=react.useContext(H0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ws(){let e=Yi(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=react.useCallback(f=>{e.updateBoard(f);},[e]),c=react.useCallback(f=>{e.addColumn(f);},[e]),l=react.useCallback((f,w)=>{e.updateColumn(f,w);},[e]),m=react.useCallback(f=>{e.deleteColumn(f);},[e]),d=react.useCallback(f=>e.getColumn(f),[e]),p=react.useCallback(f=>{e.addCard(f);},[e]),g=react.useCallback((f,w)=>{e.updateCard(f,w);},[e]),y=react.useCallback(f=>{e.deleteCard(f);},[e]),x=react.useCallback((f,w,v)=>{e.moveCard(f,w,v);},[e]),h=react.useCallback(f=>e.getCard(f),[e]),b=react.useCallback(f=>e.getCardsByColumn(f),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:b}}function W0(e){let{cards:t}=ws();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function V0(e="position",t="asc"){let{cards:a}=ws();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var qi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Zc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Gw=new qi;function _0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:p,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,b={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:b,"data-index":y.index,children:r(x,y.index)},h)})})})}function j0(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Y0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let b=c?c(h,x.index):x.index,f={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:f,"data-index":x.index,children:o(h,x.index)},b)})})})}function q0(e){let t=reactVirtual.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 X0(e,t=10){return e>t}var hc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},yc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},xc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},vc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},wc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},kc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Cc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Tc={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)"},Nc={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)"},Dc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Sc={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}},Ec={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}},Xi={spacing:hc,borderRadius:yc,fontSize:xc,fontWeight:vc,lineHeight:wc,zIndex:kc,duration:Cc,easing:Tc,shadows:Nc,opacity:Dc,kanban:Sc,gantt:Ec};function J0(e,t,a){return e[t]??a}function Mc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Mc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Fc(e="asakaa"){let t=Mc(Xi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function ks(e,t="asakaa"){let a=[],r=
|
|
416
|
+
}`}function ks(e,t="asakaa"){let a=[],r=Mc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var Ji={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},
|
|
419
|
+
}`}var Ji={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Pc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Ac={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Lc(e=Ji,t="asakaa"){let a=Fc(t),r=ks(e,t);return `${a}
|
|
420
420
|
|
|
421
|
-
${r}`}function
|
|
421
|
+
${r}`}function Q0(){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
|
+
${Lc(Ji)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${ks(
|
|
431
|
+
${ks(Pc,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${ks(
|
|
438
|
+
${ks(Ac,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var Yw=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function
|
|
443
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=
|
|
442
|
+
`}var Yw=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.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 jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Z0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=mn();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,i])=>{let c=n,l=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Yw,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
|
|
443
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=C0;exports.AI_FEATURES=Dw;exports.AI_MODELS=cc;exports.AddCardButton=Bl;exports.AddColumnButton=Fl;exports.AttachmentUploader=_r;exports.BoardProvider=z0;exports.BulkOperationsToolbar=ti;exports.BurnDownChart=Kl;exports.CUSTOM_FIELD_TYPES=Xg;exports.CalendarBoard=i0;exports.Card=Jr;exports.CardDetailModal=Ul;exports.CardDetailModalV2=Gl;exports.CardHistoryReplay=g0;exports.CardHistoryTimeline=p0;exports.CardRelationshipsGraph=h0;exports.CardStack=hw;exports.CardTemplateSelector=ed;exports.CircuitBreaker=dl;exports.Column=nn;exports.ColumnManager=ii;exports.CommandPalette=$l;exports.ConfigMenu=od;exports.ContextMenu=hn;exports.DEFAULT_SHORTCUTS=qn;exports.DEFAULT_TABLE_COLUMNS=Yg;exports.DEFAULT_TEMPLATES=Zl;exports.DateRangePicker=Bn;exports.DependenciesSelector=On;exports.DependencyLine=as;exports.DistributionCharts=Yl;exports.EditableColumnTitle=hl;exports.ErrorBoundary=dn;exports.ExportDropdown=_p;exports.ExportImportModal=ad;exports.FilterBar=rd;exports.GANTT_AI_SYSTEM_PROMPT=Nm;exports.GanttAIAssistant=Ci;exports.GanttBoard=vm;exports.GanttI18nContext=fn;exports.GanttMilestone=yi;exports.GanttToolbar=si;exports.GenerateGanttTasksDialog=D0;exports.GeneratePlanModal=v0;exports.GroupBySelector=Jl;exports.HealthBar=Cl;exports.KanbanBoard=fo;exports.KanbanToolbar=El;exports.KanbanViewAdapter=jn;exports.KeyboardShortcutsHelp=Ql;exports.ListView=Kg;exports.MenuIcons=Zt;exports.PluginManager=qi;exports.PrioritySelector=Po;exports.ProfitabilityReport=Tl;exports.QuickTaskCreate=Ro;exports.RATE_LIMITS=Nw;exports.STANDARD_FIELDS=qg;exports.SwimlaneBoardView=ql;exports.TagBadge=xl;exports.TagList=Ru;exports.TagPicker=po;exports.TaskBar=mi;exports.TaskDetailModal=Zr;exports.TaskFormModal=Tm;exports.TaskGrid=ci;exports.ThemeModal=ld;exports.ThemeProvider=Lp;exports.ThemeSwitcher=Z0;exports.TimeInputPopover=Wr;exports.TimePill=vl;exports.TimePopover=wl;exports.Timeline=vi;exports.UserAssignmentSelector=Lo;exports.VelocityChart=jl;exports.VirtualGrid=Y0;exports.VirtualList=_0;exports.aiUsageTracker=jo;exports.borderRadius=yc;exports.calculatePosition=Ps;exports.calendarDarkTheme=nc;exports.calendarEnTranslations=ec;exports.calendarEsTranslations=tc;exports.calendarLightTheme=sc;exports.calendarNeutralTheme=ic;exports.calendarThemes=Gi;exports.calendarTranslations=zi;exports.cardToGanttTask=Di;exports.cardsToGanttTasks=Am;exports.cn=u;exports.createKanbanView=pp;exports.createRetryWrapper=If;exports.darkTheme=nd;exports.darkTokenTheme=Ji;exports.defaultTheme=ri;exports.designTokens=Xi;exports.duration=Cc;exports.easing=Tc;exports.exportTokensToCSS=Q0;exports.findTaskByName=oo;exports.fontSize=xc;exports.fontWeight=vc;exports.formatCost=ys;exports.ganttEnTranslations=ni;exports.ganttEsTranslations=Bp;exports.ganttTaskToCardUpdate=Pm;exports.ganttThemes=dt;exports.ganttTokens=Ec;exports.ganttTranslations=dd;exports.ganttUtils=Se;exports.generateCSSVariables=Fc;exports.generateCompleteCSS=Lc;exports.generateInitialPositions=Ff;exports.generateTasksContext=Dm;exports.generateThemeVariables=ks;exports.getCalendarTheme=l0;exports.getCalendarTranslations=ps;exports.getListViewTheme=Jg;exports.getListViewTranslations=Ad;exports.getMonthNames=Qg;exports.getToken=J0;exports.getTranslations=Rp;exports.getWeekdayNames=Zg;exports.kanbanTokens=Sc;exports.lightTheme=sd;exports.lightTokenTheme=Pc;exports.lineHeight=wc;exports.listViewDarkTheme=Jd;exports.listViewEnTranslations=Fd;exports.listViewEsTranslations=Pd;exports.listViewLightTheme=Qd;exports.listViewNeutralTheme=Zd;exports.listViewThemes=Hi;exports.listViewTranslations=Si;exports.mergeCalendarTranslations=Ui;exports.mergeListViewTranslations=Ei;exports.mergeTranslations=cd;exports.neutralTheme=id;exports.neutralTokenTheme=Ac;exports.opacity=Dc;exports.parseLocalCommand=Mm;exports.parseNaturalDate=Sd;exports.parseNaturalDuration=Ed;exports.parseProgress=Md;exports.parseStatus=Em;exports.pluginManager=Gw;exports.retrySyncOperation=Lf;exports.retryWithBackoff=As;exports.shadows=Nc;exports.shouldVirtualizeGrid=X0;exports.spacing=hc;exports.themes=Ho;exports.useAI=B0;exports.useBoard=E0;exports.useBoardCore=ws;exports.useBoardStore=Yi;exports.useCardStacking=$0;exports.useDragState=Dl;exports.useFilteredCards=W0;exports.useFilters=P0;exports.useGanttI18n=vr;exports.useKanbanState=Ki;exports.useKeyboardShortcuts=Fp;exports.useMultiSelect=R0;exports.useSelectionState=mc;exports.useSortedCards=V0;exports.useTheme=mn;exports.useVirtualGrid=q0;exports.useVirtualList=j0;exports.validateAIResponse=Fm;exports.withErrorBoundary=Rl;exports.wouldCreateCircularDependency=Is;exports.zIndex=kc;//# sourceMappingURL=index.cjs.map
|
|
444
444
|
//# sourceMappingURL=index.cjs.map
|