@libxai/board 1.0.0 → 1.3.0
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 +60 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +349 -8
- package/dist/index.d.ts +349 -8
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/dist/styles.css +426 -24
- package/package.json +141 -141
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=id(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=id(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,y)=>{i[f]=l[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),u={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(u),d.cardIds.push(u.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 id(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 ld(e,t){switch(t){case "json":return Zu(e);case "csv":return Qu(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dd(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 zs=react.createContext(null);function cd(){return react.useContext(zs)}var md=react.createContext(null);function pd({children:e,themeName:t}){return jsxRuntime.jsx(md.Provider,{value:{themeName:t},children:e})}function uo(){return react.useContext(md)}function gt({children:e,container:t}){let[a,r]=react.useState(false),o=cd(),s=uo();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:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,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 hd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},ig="#BDC3C7",lg=({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 Kr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,g=160,v=220,h=4,p=f.right-g;p<10&&(p=f.left),p+g>k-10&&(p=k-g-10);let w=y-f.bottom,x=f.top,S;w>=v+h?S=f.bottom+h:x>=v+h?S=f.top-v-h:S=w>=x?f.bottom+h:Math.max(10,f.top-v-h),n({top:S,left:p}),o(true);};react.useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?hd[e]:null,u=d?.color||ig;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}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:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:l,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(hd).map(([f,y])=>jsxRuntime.jsxs("button",{onClick:()=>c(f),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:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(lg,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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:()=>c(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: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var dg=[{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 Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),u=(uo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,S=320,T=380,C=4,A=p.left;A+S>x-10&&(A=x-S-10),A<10&&(A=10);let I=w-p.bottom,N=p.top,O;I>=T+C?O=p.bottom+C:N>=T+C?O=p.top-T-C:O=I>=N?p.bottom+C:Math.max(10,p.top-T-C),l({top:O,left:A}),s(true);};react.useEffect(()=>{let p=w=>{m.current&&!m.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),react.useEffect(()=>{let p=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let y=p=>{let w=new Date,x=A=>{let I=A.getFullYear(),N=String(A.getMonth()+1).padStart(2,"0"),O=String(A.getDate()).padStart(2,"0");return `${I}-${N}-${O}`},S=x(w),T=new Date(w);T.setDate(T.getDate()+p);let C=x(T);a(S,C),s(false);},k=()=>{if(!e||!t)return "Set date";let p=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=T.split("-").map(Number);if(C.length!==3||C.some(O=>isNaN(O)))return null;let A=C[0],I=C[1],N=C[2];return A===void 0||I===void 0||N===void 0?null:new Date(A,I-1,N)},w=p(e),x=p(t);if(!w||!x||isNaN(w.getTime())||isNaN(x.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[w.getMonth()]} ${w.getDate()} \u2013 ${S[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let p=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),p<w})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${k()}`:"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:k()})]}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:u?"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:u?"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:dg.map(p=>jsxRuntime.jsx("button",{onClick:()=>y(p.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:p.label},p.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:p=>a(p.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:p=>a(e,p.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&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:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function qr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),d=react.useRef(null),u=react.useRef(null),f=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),p=window.innerHeight,w=window.innerWidth,x=300,S=380,T=4,C=h.right-x;C<10&&(C=h.left),C+x>w-10&&(C=w-x-10);let A=p-h.bottom,I=h.top,N;A>=S+T?N=h.bottom+T:I>=S+T?N=h.top-S-T:N=A>=I?h.bottom+T:Math.max(10,h.top-S-T),c({top:N,left:C}),n(true);};react.useEffect(()=>{let h=p=>{d.current&&!d.current.contains(p.target)&&!u.current?.contains(p.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let p=e.some(w=>w.id===h.id);a(p?e.filter(w=>w.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?n(false):f(),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:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(gt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:k.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"}):k.map(h=>{let p=e.some(w=>w.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:p?"#3b82f6":"transparent"},children:p?"\u2713":""})]},h.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 vn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=react.useState(false),[i,c]=react.useState(""),[d,u]=react.useState(t.length>0),[f,y]=react.useState({top:0,left:0}),[k,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),p=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,O=d?380:120,R=4,_=C.right-N;_<10&&(_=C.left),_+N>I-10&&(_=I-N-10);let se=A-C.bottom,te=C.top,ie;se>=O+R?ie=C.bottom+R:te>=O+R?ie=C.top-O-R:ie=se>=te?C.bottom+R:Math.max(10,C.top-O-R),y({top:ie,left:_}),m(true);};react.useEffect(()=>{if(!l||!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,O=d?380:120,R=4,_=C.right-N;_<10&&(_=C.left),_+N>I-10&&(_=I-N-10);let se=A-C.bottom,te=C.top,ie;se>=O+R?ie=C.bottom+R:te>=O+R?ie=C.top-O-R:ie=se>=te?C.bottom+R:Math.max(10,C.top-O-R),y({top:ie,left:_});},[d,l]),react.useEffect(()=>{let C=A=>{v.current&&!v.current.contains(A.target)&&!h.current?.contains(A.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{let C=A=>{A.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let A=t.includes(C),I=a.find(N=>N.id===C);if(g(null),A){let N=t.filter(O=>O!==C);r(N),N.length===0&&u(false);}else {if(s&&vn(a,C,e)){let O=`Cannot add "${I?.title||C}" as dependency - would create circular reference`;g(O),n?.(C,I?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),u(true);}},x=()=>{let C=!d;u(C),C||r([]);},S=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?m(false):p(),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:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),l&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:x,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:i,onChange:C=>c(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:S.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"}):S.map(C=>{let A=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&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:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),u(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var gr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:fn.Transform.toString(u),transition:f};if(t)return jsxRuntime.jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(w=>e.assignedUserIds?.includes(w.id)),v=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),p={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:p,className:b("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.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:w=>{w.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,x)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),x===3&&h.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:["+",h.length-4]})})]},w.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.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:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Kr,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ro,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,x)=>n?.(e.id,{startDate:w,endDate:x})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(qr,{assignedUsers:g,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(x=>x.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:m,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsxRuntime.jsx("span",{className:"asakaa-label",children:w},w))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));gr.displayName="Card";var xn={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"}},Sd=({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 Ed({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries(xn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(xn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=xn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...xn.todo,id:"todo"}},u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,p=180,w=280,x=4,S=g.right-p;S<10&&(S=g.left),S+p>h-10&&(S=h-p-10);let T=v-g.bottom,C=g.top,A;T>=w+x?A=g.bottom+x:C>=w+x?A=g.top-w-x:A=T>=C?g.bottom+x:Math.max(10,g.top-w-x),l({top:A,left:S}),s(true);};react.useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},y=d(),k=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):u(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:y.label,children:jsxRuntime.jsx(Sd,{icon:y.icon,color:k})}),o&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsxs("div",{ref:m,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:c.map(g=>jsxRuntime.jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Sd,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Pd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,m]=react.useState(false),[i,c]=react.useState(e),[d,u]=react.useState({top:0,left:0}),f=react.useRef(null),y=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let p=y.current.getBoundingClientRect();u({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[s]),react.useEffect(()=>{let p=w=>{f.current&&!f.current.contains(w.target)&&!y.current?.contains(w.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),react.useEffect(()=>{let p=w=>{w.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,e]),react.useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{m(true),c(e);},v=()=>{let p=i.trim();p&&p!==e&&t(p),m(false),n(false),c(e);},h=p=>{p.key==="Enter"?v():p.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children: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"})]})}),s&&jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children: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:"Rename Column"}),jsxRuntime.jsx("input",{ref:k,type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,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:"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(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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:"Delete"})]})]})]})})})]})}var bo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:u,onToggleCollapse:f,onColumnRename:y,onColumnDelete:k,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:p}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),w=react.useRef(null),x=c??td(t.length),S=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>d,enabled:x});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),A=C.state==="exceeded",I=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:b("asakaa-column",p&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",v),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:b(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.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"})]}),C.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"})]}),C.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"})}),C.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||k)&&jsxRuntime.jsx(Pd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),!u&&jsxRuntime.jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(N=>N.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"})}):x?jsxRuntime.jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(N=>{let O=t[N.index];return O?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(gr,{card:O,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},O.id):null})}):t.map(N=>jsxRuntime.jsx(gr,{card:N,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Gs({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Pg(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Bd(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(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Mg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Fg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ag=["\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 Rd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:u=[],onFilesSelect:f,onRemoveFile:y,maxFileSizeMB:k=10}){let g=l==="dark",[v,h]=react.useState(false),[p,w]=react.useState([]),[x,S]=react.useState(0),[T,C]=react.useState(null),[A,I]=react.useState(false),N=react.useRef(null),O=react.useRef(null),R=react.useRef(null),_=react.useRef(null),se=react.useCallback((E,W)=>{let q=Pg(E,W);if(C(q),q){let pe=r.filter(fe=>fe.name.toLowerCase().includes(q.query)||fe.email&&fe.email.toLowerCase().includes(q.query)).slice(0,5);w(pe),h(pe.length>0),S(0);}else h(false),w([]);},[r]),te=E=>{let W=E.target.value;if(t(W),se(W,E.target.selectionStart||0),N.current){N.current.style.height="24px";let q=N.current.scrollHeight,pe=280,fe=Math.min(q,pe);N.current.style.height=`${fe}px`,N.current.style.overflowY=q>pe?"auto":"hidden";}},ie=()=>{N.current&&se(e,N.current.selectionStart||0);},xe=react.useCallback(E=>{if(!T||!N.current)return;let W=e.slice(0,T.start),q=e.slice(T.end),pe=`@${E.name.replace(/\s+/g,"")} `,fe=W+pe+q;t(fe),h(false),C(null),setTimeout(()=>{if(N.current){let Ce=T.start+pe.length;N.current.selectionStart=Ce,N.current.selectionEnd=Ce,N.current.focus();}},0);},[T,e,t]),Ne=E=>{if(v&&p.length>0)switch(E.key){case "ArrowDown":E.preventDefault(),S(W=>W<p.length-1?W+1:0);break;case "ArrowUp":E.preventDefault(),S(W=>W>0?W-1:p.length-1);break;case "Enter":{E.preventDefault();let W=p[x];W&&xe(W);break}case "Tab":{E.preventDefault();let W=p[x];W&&xe(W);break}case "Escape":E.preventDefault(),h(false);break}else E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),a());};react.useEffect(()=>{let E=W=>{O.current&&!O.current.contains(W.target)&&N.current&&!N.current.contains(W.target)&&h(false),_.current&&!_.current.contains(W.target)&&I(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let Ae=react.useCallback(E=>{if(!N.current)return;let W=N.current.selectionStart||e.length,q=e.slice(0,W)+E+e.slice(W);t(q),I(false),setTimeout(()=>{if(N.current){let pe=W+E.length;N.current.selectionStart=pe,N.current.selectionEnd=pe,N.current.focus();}},0);},[e,t]),F=react.useCallback(E=>{if(!f||!E.target.files)return;let W=Array.from(E.target.files),q=k*1024*1024,pe=W.filter(fe=>fe.size>q?(console.warn(`File ${fe.name} exceeds max size of ${k}MB`),false):true);pe.length>0&&f(pe),E.target.value="";},[f,k]),B=react.useCallback(E=>E.type.startsWith("image/")?lucideReact.Image:E.type.includes("pdf")||E.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(v&&O.current){let E=O.current.children[x];E&&E.scrollIntoView({block:"nearest"});}},[x,v]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(E=>{let W=B(E.file),q=E.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:b("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[q&&E.preview?jsxRuntime.jsx("img",{src:E.preview,alt:E.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(W,{className:b("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:b("text-xs truncate",g?"text-white":"text-gray-900"),children:E.file.name}),jsxRuntime.jsx("p",{className:b("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Fg(E.file.size)})]}),y&&jsxRuntime.jsx("button",{onClick:()=>y(E.id),className:b("p-0.5 rounded-full transition-colors",g?"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"})})]},E.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:b("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:b("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(!A),disabled:s||n,className:b("p-1 rounded transition-colors flex-shrink-0",g?"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:A&&jsxRuntime.jsx(framerMotion.motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"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:Ag.map(E=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Ae(E),className:b("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:E},E))})})})]}),d&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>R.current?.click(),disabled:s||n,className:b("p-1.5 rounded transition-colors",g?"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:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:R,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:N,value:e,onChange:te,onSelect:ie,onKeyDown:Ne,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:b("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"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()&&u.length===0||s,className:b("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"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:v&&p.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:O,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.map((E,W)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>xe(E),className:b("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",W===x?g?"bg-white/10":"bg-gray-100":g?"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:E.color||"#8B5CF6"},children:Mg(E.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:b("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:E.name}),E.email&&jsxRuntime.jsx("p",{className:b("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:E.email})]})]},E.id))})})]})]})]})}function Od({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((l,m)=>l.type==="mention"?jsxRuntime.jsx("span",{className:b("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:l.value},m):jsxRuntime.jsx("span",{children:l.value},m))})}var Nn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Sr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=react.useState(false),[i,c]=react.useState(""),[d,u]=react.useState(false),[f,y]=react.useState(Nn[10]||"#3B82F6"),[k,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),w=react.useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),S=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[l]),react.useEffect(()=>{let N=O=>{let R=O.target,_=v.current?.contains(R),se=p.current?.contains(R);!_&&!se&&(m(false),c(""),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),react.useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let T=N=>{let O=e.some(R=>R.id===N.id);a(O?e.filter(R=>R.id!==N.id):[...e,N]);},C=async()=>{if(!(!r||!i.trim())){u(true);try{let N=await r(i.trim(),f);N&&(a([...e,N]),c(""),y(Nn[Math.floor(Math.random()*Nn.length)]||"#3B82F6"));}finally{u(false);}}},A=(N,O)=>{O.stopPropagation(),a(e.filter(R=>R.id!==N));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(N=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,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:k.top,left:k.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:w,type:"text",value:i,onChange:N=>c(N.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:N=>{N.key==="Enter"&&i.trim()&&!S&&r&&C();}})}),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(N=>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:`${N.color}20`,color:N.color},onClick:O=>A(N.id,O),children:[N.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},N.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let O=e.some(R=>R.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:O?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{O||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{O||(R.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:N.name}),O&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.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"})}),i.trim()&&!S&&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:Nn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:f===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,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 "',i.trim(),'"']})]})]})}),document.body)]})}function Vs({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 Ud({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(Vs,{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 Jr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function jd(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function tf(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 fr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:u,availableTasks:f=[],comments:y=[],onAddComment:k,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let p=s==="dark",w={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),S=e,[T,C]=react.useState(e?jd(e,l):null),[A,I]=react.useState(false),[N,O]=react.useState(false),[R,_]=react.useState(false),[se,te]=react.useState(null),[ie,xe]=react.useState(new Date),[Ne,Ae]=react.useState(false),[F,B]=react.useState(false),[E,W]=react.useState(""),[q,pe]=react.useState(false),[fe,Ce]=react.useState(false),[Y,V]=react.useState(false),[Oe,ue]=react.useState(""),Le=react.useRef(null),Je=react.useRef(null),[st,Ge]=react.useState(""),bt=react.useRef(null),[ut,Pt]=react.useState(""),[ge,L]=react.useState(false),[re,Te]=react.useState([]),[Ue,Z]=react.useState(""),[Re,H]=react.useState(false),K=react.useRef(null);react.useEffect(()=>{if(e){let D=jd(e,l);C(D),ue(D.description||""),Ge(D.name||"");}},[e?.id,l]),react.useEffect(()=>{if(!t||!Oe)return;let D=setTimeout(()=>{let Q=Je.current;Q&&(Q.style.height="auto",Q.style.height=`${Math.max(100,Q.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,Oe]),react.useEffect(()=>()=>{Le.current&&clearTimeout(Le.current),bt.current&&clearTimeout(bt.current);},[]),react.useEffect(()=>{t&&K.current&&y.length>0&&setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight);},100);},[t,y.length]);let ke=react.useCallback(D=>{C(D),x&&o&&S?o(tf(D,S)):r&&r(D);},[x,S,o,r]),Ie=react.useCallback(()=>{I(false),O(false),_(false),te(null),B(false),W(""),pe(false);},[]),_e=react.useCallback((D,Q)=>{if(!T)return;let ce={...T,[D]:Q};ke(ce);},[T,ke]),We=react.useCallback(()=>{let D=Je.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ne=react.useCallback(D=>{ue(D),setTimeout(We,0),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{if(T){let Q={...T,description:D};ke(Q);}},800);},[T,ke,We]),Be=react.useCallback(D=>{Ge(D),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{if(T&&D.trim()){let Q={...T,name:D.trim()};ke(Q);}},800);},[T,ke]),ee=react.useCallback(D=>{let Q=D.map(ce=>{let Xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ce};return ce.type.startsWith("image/")&&(Xe.preview=URL.createObjectURL(ce)),Xe});Te(ce=>[...ce,...Q]);},[]),Ye=react.useCallback(D=>{Te(Q=>{let ce=Q.find(Xe=>Xe.id===D);return ce?.preview&&URL.revokeObjectURL(ce.preview),Q.filter(Xe=>Xe.id!==D)});},[]),Pa=react.useCallback(async()=>{if(!(!T||!ut.trim()&&re.length===0||!k)){L(true);try{let D=Bd(ut,v),Q=[];if(re.length>0&&h){let ce=re.map(Xe=>Xe.file);Q=await h(ce);}await k(T.id,ut.trim(),D.length>0?D:void 0,Q.length>0?Q:void 0),Pt(""),re.forEach(ce=>{ce.preview&&URL.revokeObjectURL(ce.preview);}),Te([]);}finally{L(false);}}},[T,ut,re,k,v,h]),be=react.useCallback(()=>{if(!T||!Ue.trim())return;let D={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ue.trim(),progress:0,startDate:new Date,endDate:new Date},Q=[...T.subtasks||[],D],ce={...T,subtasks:Q};ke(ce),Z(""),H(false);},[T,Ue,ke]),qe=react.useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.map(Xe=>Xe.id===D?{...Xe,progress:Xe.progress===100?0:100}:Xe),ce={...T,subtasks:Q};ke(ce);},[T,ke]),He=react.useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.filter(Xe=>Xe.id!==D),ce={...T,subtasks:Q};ke(ce);},[T,ke]),Ze=react.useCallback(D=>{let Q=typeof D=="string"?new Date(D):D,Xe=new Date().getTime()-Q.getTime(),Ft=Math.floor(Xe/6e4),Zt=Math.floor(Xe/36e5),Dt=Math.floor(Xe/864e5);return Ft<1?n==="es"?"Ahora":"Just now":Ft<60?n==="es"?`Hace ${Ft} min`:`${Ft}m ago`:Zt<24?n==="es"?`Hace ${Zt}h`:`${Zt}h ago`:Dt<7?n==="es"?`Hace ${Dt}d`:`${Dt}d ago`:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),rt=react.useCallback(D=>{if(!T)return;let Q=T.progress||0;D==="completed"?Q=100:D==="in-progress"&&Q===0?Q=10:D==="todo"&&(Q=0);let ce={...T,status:D,progress:Q};ke(ce),I(false);},[T,ke]),it=react.useCallback((D,Q)=>{if(!T)return;let ce={...T,startDate:D,endDate:Q};ke(ce);},[T,ke]),G=react.useCallback(()=>{let D=ie.getFullYear(),Q=ie.getMonth(),ce=new Date(D,Q,1),Ft=new Date(D,Q+1,0).getDate(),Zt=ce.getDay(),Dt=[],de=new Date(D,Q,0).getDate();for(let Ve=Zt-1;Ve>=0;Ve--)Dt.push({date:new Date(D,Q-1,de-Ve),isCurrentMonth:false});for(let Ve=1;Ve<=Ft;Ve++)Dt.push({date:new Date(D,Q,Ve),isCurrentMonth:true});let Qe=42-Dt.length;for(let Ve=1;Ve<=Qe;Ve++)Dt.push({date:new Date(D,Q+1,Ve),isCurrentMonth:false});return Dt},[ie]),X=react.useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),Ce(false),!T||!d)return;let Q=Array.from(D.dataTransfer.files);if(Q.length!==0){V(true);try{await d(T.id,Q);}finally{V(false);}}},[T,d]),Pe=react.useCallback(async D=>{if(!T||!d||!D.target.files)return;let Q=Array.from(D.target.files);if(Q.length!==0){V(true);try{await d(T.id,Q);}finally{V(false);}D.target.value="";}},[T,d]),Ke=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ce(true);},[]),ze=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ce(false);},[]),z=react.useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),le=react.useCallback(D=>D.startsWith("image/")?lucideReact.Image:D.includes("pdf")||D.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!T?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&T&&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:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3 h-[49px]",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),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 D=T.progress===100?0:100,ce={...T,progress:D,status:D===100?"completed":"todo"};ke(ce);},className:b("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:st,onChange:D=>Be(D.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:b("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),I(!A);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(D=>jsxRuntime.jsxs("button",{onClick:()=>rt(D.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.status===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(),_(!R);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((D,Q)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},Q)),T.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let Q=T.assignees?.some(ce=>ce.name===D.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ce=T.assignees||[],Xe;Q?Xe=ce.filter(Ft=>Ft.name!==D.name):Xe=[...ce,D],_e("assignees",Xe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:b("flex-1",p?"text-white":"text-gray-900"),children:D.name}),Q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{te(se?null:"start"),xe(T.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:b("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,Q=new Date(D);Q.setDate(D.getDate()+1);let ce=new Date(D);ce.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let Xe=new Date(D);Xe.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let Ft=new Date(D);Ft.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Zt=new Date(D);Zt.setDate(D.getDate()+14);let Dt=new Date(D);return Dt.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ce,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ft,display:Ft.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Zt,display:Zt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Dt,display:Dt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Qe,Ve)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(se==="start"){let ar=T.endDate&&Qe.date>T.endDate?Qe.date:T.endDate;it(Qe.date,ar),te("end");}else {let ar=T.startDate&&Qe.date<T.startDate?Qe.date:T.startDate;it(ar,Qe.date),te(null);}},children:[jsxRuntime.jsx("span",{children:Qe.label}),jsxRuntime.jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Qe.display})]},Ve))})(),jsxRuntime.jsx("div",{className:b("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{it(void 0,void 0),te(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"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:b("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:se==="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:b("font-medium",p?"text-white":"text-gray-900"),children:ie.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:()=>xe(new Date),className:b("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>xe(new Date(ie.getFullYear(),ie.getMonth()-1)),className:b("p-1 rounded",p?"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:()=>xe(new Date(ie.getFullYear(),ie.getMonth()+1)),className:b("p-1 rounded",p?"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(D=>jsxRuntime.jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:G().map((D,Q)=>{let ce=D.date.toDateString()===new Date().toDateString(),Xe=T.startDate?.toDateString()===D.date.toDateString(),Ft=T.endDate?.toDateString()===D.date.toDateString(),Zt=Xe||Ft,Dt=T.startDate&&T.endDate&&D.date>=T.startDate&&D.date<=T.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let de=new Date(D.date);if(se==="start"){let Qe=T.endDate&&de>T.endDate?de:T.endDate;it(de,Qe),te("end");}else {let Qe=T.startDate&&de<T.startDate?de:T.startDate;it(Qe,de),te(null);}},className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(p?"text-white":"text-gray-900"),ce&&"ring-2 ring-[#3B82F6]",Xe&&"bg-[#3B82F6] text-white",Ft&&!Xe&&"bg-[#7C3AED] text-white",Dt&&!Zt&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!Zt&&(p?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},Q)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ie(),O(!N);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>O(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(D=>jsxRuntime.jsxs("button",{onClick:()=>{_e("priority",D.id),O(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.priority===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.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:b("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ne?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:D=>{let Q=parseInt(D.target.value),ce=T.status;Q===100?ce="completed":Q>0?ce="in-progress":ce="todo";let Xe={...T,progress:Q,status:ce};ke(Xe);},onBlur:()=>Ae(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Ae(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Sr,{selectedTags:T.tags||[],availableTags:m,onChange:D=>{_e("tags",D);},onCreateTag:i,theme:w})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(D=>{let Q=f.find(ce=>ce.id===D);return jsxRuntime.jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Q?.name||D.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ce=(T.dependencies||[]).filter(Xe=>Xe!==D);_e("dependencies",ce);},className:b("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},D)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(),B(!F);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:b("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:E,onChange:D=>W(D.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:b("w-full px-3 py-2 rounded-md text-sm outline-none",p?"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:f.length>0?f.filter(D=>D.id!==T.id).filter(D=>E===""||D.name.toLowerCase().includes(E.toLowerCase())).map(D=>{let Q=T.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ce=T.dependencies||[],Xe;Q?Xe=ce.filter(Ft=>Ft!==D.id):Xe=[...ce,D.id],_e("dependencies",Xe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Q?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),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:b("block truncate",p?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ie(),pe(!q);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:T.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:Jr.find(D=>D.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pe(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",p?"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:Jr.map(D=>{let Q=T.color===D.value;return jsxRuntime.jsx("button",{onClick:()=>{_e("color",D.value),pe(false);},className:b("w-7 h-7 rounded-full flex items-center justify-center transition-all",Q&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:Q?D.value:void 0},title:D.name,children:Q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",p?"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:T.isMilestone||false,onChange:D=>_e("isMilestone",D.target.checked),className:b("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Je,value:Oe,onChange:D=>ne(D.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:b("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",p?"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:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",T.subtasks.filter(D=>D.progress===100).length,"/",T.subtasks.length,")"]})]})}),T.subtasks&&T.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(D=>jsxRuntime.jsxs("div",{className:b("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>qe(D.id),className:b("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("button",{onClick:()=>He(D.id),className:b("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",p?"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"})})]},D.id))}),Re?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Ue,onChange:D=>Z(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Ue.trim()?be():D.key==="Escape"&&(H(false),Z(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:b("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",p?"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:be,disabled:!Ue.trim(),className:b("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ue.trim()?"bg-blue-500 hover:bg-blue-600 text-white":p?"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:()=>{H(false),Z("");},className:b("p-2 rounded-lg transition-colors",p?"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:()=>H(true),className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"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:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(D=>{let Q=le(D.type),ce=D.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ce&&D.thumbnailUrl?jsxRuntime.jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:b("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(Q,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:b("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("p",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:z(D.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(D.id),className:b("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"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"})})]},D.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ke,onDragLeave:ze,onDrop:X,className:b("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",fe?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Y&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Y}),Y?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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",fe?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:fe?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:b("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-96 border-l flex flex-col",p?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between h-[49px]",p?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxRuntime.jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:b("p-1.5 rounded transition-colors",p?"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'),zm=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),$0=require('react-markdown'),z0=require('remark-gfm'),U0=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var zm__default=/*#__PURE__*/_interopDefault(zm);var $0__default=/*#__PURE__*/_interopDefault($0);var z0__default=/*#__PURE__*/_interopDefault(z0);var U0__default=/*#__PURE__*/_interopDefault(U0);var An=(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 Ln=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 [Ln.Translate.toString(e),Ln.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 In(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 wg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zs(e,t){return e.length===0?1e3:t===0?In(null,e[0].position):t>=e.length?In(e[e.length-1].position,null):In(e[t-1].position,e[t].position)}function Sd(e,t=100){return e>t}var Cg=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 Tg(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 Bn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Cg,onRetry:l}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,c===a||!n(m,c))return {error:m,attempts:i,success:false};let g=Tg(c,r,o,s);if(l)try{l(m,c,g);}catch(b){console.error("Error in retry callback:",b);}await new Promise(b=>setTimeout(b,g));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function Ng(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 Dg(e,t={}){return async(...a)=>Bn(()=>e(...a),t)}var Qs=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 Ed=(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))(Ed||{}),lo=class lo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,m?n:"");break;case "INFO":console.info(l,o,m?n:"");break;case "WARN":console.warn(l,o,m?n:"");break;case "ERROR":console.error(l,o,m?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",...lo.globalOptions};}static configure(t){lo.globalOptions={...lo.globalOptions,...t};}child(t){return new lo({...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 Rn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Rn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ed[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lo.globalOptions={};var ei=lo,Rn=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}},Pd=new ei;function Eg(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 Pg(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(l=>l.id===s.columnId);return [s.id,ti(s.title),ti(s.description||""),ti(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 Mg(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 zm__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,d=m-20,p=d/c;p>i-20&&(p=i-20,d=p*c);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,m,15,"F"),g.text(e.title||"Kanban Board",10,10);let b=(m-d)/2;return g.addImage(l,"PNG",b,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 l=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.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):l.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function ti(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Fd(e,t,a,r){switch(t){case "json":return Eg(e,r);case "csv":return Pg(e);case "pdf":return await Mg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Ad(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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"},l=new Blob([e],{type:n[t]}),m=URL.createObjectURL(l),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function Fg(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 Ag(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=Ld(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Ld(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,b)=>{i[g]=l[b]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 Ld(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 Id(e,t){switch(t){case "json":return Fg(e);case "csv":return Ag(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Bd(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 ai=react.createContext(null);function Rd(){return react.useContext(ai)}var Od=react.createContext(null);function $d({children:e,themeName:t}){return jsxRuntime.jsx(Od.Provider,{value:{themeName:t},children:e})}function Mo(){return react.useContext(Od)}function yt({children:e,container:t}){let[a,r]=react.useState(false),o=Rd(),s=Mo();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:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:i,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 Gd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Ug="#BDC3C7",Hg=({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 co({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),l=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let g=m.current.getBoundingClientRect(),b=window.innerHeight,w=window.innerWidth,f=160,y=220,h=4,v=g.right-f;v<10&&(v=g.left),v+f>w-10&&(v=w-f-10);let T=b-g.bottom,D=g.top,N;T>=y+h?N=g.bottom+h:D>=y+h?N=g.top-y-h:N=T>=D?g.bottom+h:Math.max(10,g.top-y-h),n({top:N,left:v}),o(true);};react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&!m.current?.contains(b.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},d=e?Gd[e]:null,p=d?.color||Ug;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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(yt,{children:jsxRuntime.jsxs("div",{ref:l,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(Gd).map(([g,b])=>jsxRuntime.jsxs("button",{onClick:()=>c(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:b.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Hg,{color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:b.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:"#3B82F6",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:()=>c(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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Wg=[{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 Jo({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),p=(Mo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),T=window.innerHeight,D=window.innerWidth,N=320,E=380,k=4,R=v.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let I=T-v.bottom,C=v.top,W;I>=E+k?W=v.bottom+k:C>=E+k?W=v.top-E-k:W=I>=C?v.bottom+k:Math.max(10,v.top-E-k),l({top:W,left:R}),s(true);};react.useEffect(()=>{let v=T=>{m.current&&!m.current.contains(T.target)&&!i.current?.contains(T.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),react.useEffect(()=>{let v=T=>{T.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let b=v=>{let T=new Date,D=R=>{let I=R.getFullYear(),C=String(R.getMonth()+1).padStart(2,"0"),W=String(R.getDate()).padStart(2,"0");return `${I}-${C}-${W}`},N=D(T),E=new Date(T);E.setDate(E.getDate()+v);let k=D(E);a(N,k),s(false);},w=()=>{if(!e||!t)return "Set date";let v=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=E.split("-").map(Number);if(k.length!==3||k.some(W=>isNaN(W)))return null;let R=k[0],I=k[1],C=k[2];return R===void 0||I===void 0||C===void 0?null:new Date(R,I-1,C)},T=v(e),D=v(t);if(!T||!D||isNaN(T.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[T.getMonth()]} ${T.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},f=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,T=new Date;return T.setHours(0,0,0,0),v<T})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,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 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:f?`${w()}`:"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:w()})]}),o&&jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{ref:m,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:Wg.map(v=>jsxRuntime.jsx("button",{onClick:()=>b(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",T.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.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:v=>a(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>a(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function uo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[l,m]=react.useState(""),[i,c]=react.useState({top:0,left:0}),d=react.useRef(null),p=react.useRef(null),g=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,T=window.innerWidth,D=300,N=380,E=4,k=h.right-D;k<10&&(k=h.left),k+D>T-10&&(k=T-D-10);let R=v-h.bottom,I=h.top,C;R>=N+E?C=h.bottom+E:I>=N+E?C=h.top-N-E:C=R>=I?h.bottom+E:Math.max(10,h.top-N-E),c({top:C,left:k}),n(true);};react.useEffect(()=>{let h=v=>{d.current&&!d.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let b=h=>{let v=e.some(T=>T.id===h.id);a(v?e.filter(T=>T.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),f=e.slice(0,o),y=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:[f.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(yt,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[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:l,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.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"}):w.map(h=>{let v=e.some(T=>T.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>b(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:T=>{T.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:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},h.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 On(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function Qo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=react.useState(false),[i,c]=react.useState(""),[d,p]=react.useState(t.length>0),[g,b]=react.useState({top:0,left:0}),[w,f]=react.useState(null),y=react.useRef(null),h=react.useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,x=k.right-C;x<10&&(x=k.left),x+C>I-10&&(x=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),b({top:ne,left:x}),m(true);};react.useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=d?380:120,H=4,x=k.right-C;x<10&&(x=k.left),x+C>I-10&&(x=I-C-10);let te=R-k.bottom,oe=k.top,ne;te>=W+H?ne=k.bottom+H:oe>=W+H?ne=k.top-W-H:ne=te>=oe?k.bottom+H:Math.max(10,k.top-W-H),b({top:ne,left:x});},[d,l]),react.useEffect(()=>{let k=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=R=>{R.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let T=k=>{let R=t.includes(k),I=a.find(C=>C.id===k);if(f(null),R){let C=t.filter(W=>W!==k);r(C),C.length===0&&p(false);}else {if(s&&On(a,k,e)){let W=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;f(W),n?.(k,I?.title||k),setTimeout(()=>f(null),3e3);return}r([...t,k]),p(true);}},D=()=>{let k=!d;p(k),k||r([]);},N=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),E=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>l?m(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),l&&jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{ref:y,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:[w&&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:w})]}),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:D,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:i,onChange:k=>c(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:N.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"}):N.map(k=>{let R=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>T(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Er=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:g,isDragging:b}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Ln.Transform.toString(p),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:w,...i,...c,onClick:()=>a?.(e),children:t(e)});let f=l.filter(T=>e.assignedUserIds?.includes(T.id)),y=e.progress===100,h=(e.attachments||[]).filter(T=>T.type.startsWith("image/")),v={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:v,className:u("asakaa-card",b&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:T=>{T.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:T=>{T.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsxRuntime.jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((T,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:T.url,alt:T.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&h.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:["+",h.length-4]})})]},T.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:T=>T.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(co,{priority:e.priority,onChange:T=>n?.(e.id,{priority:T})})}),jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Jo,{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:(T,D)=>n?.(e.id,{startDate:T,endDate:D})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(uo,{assignedUsers:f,availableUsers:l,onChange:T=>n?.(e.id,{assignedUserIds:T.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:T=>T.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Qo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(T=>typeof T=="string"?T:T.taskId):[],availableTasks:m,onChange:T=>n?.(e.id,{dependencies:T})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(T=>jsxRuntime.jsx("span",{className:"asakaa-label",children:T},T))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Er.displayName="Card";var $n={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"}},Qd=({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 ec({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),c=[...Object.entries($n).map(([f,y])=>({id:f,label:y.label,color:y.color,icon:y.icon})),...r.filter(f=>!Object.keys($n).includes(f.id)).map(f=>({id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let f=$n[e];if(f)return {...f,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...$n.todo,id:"todo"}},p=()=>{if(!i.current)return;let f=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,v=180,T=280,D=4,N=f.right-v;N<10&&(N=f.left),N+v>h-10&&(N=h-v-10);let E=y-f.bottom,k=f.top,R;E>=T+D?R=f.bottom+D:k>=T+D?R=f.top-T-D:R=E>=k?f.bottom+D:Math.max(10,f.top-T-D),l({top:R,left:N}),s(true);};react.useEffect(()=>{let f=y=>{m.current&&!m.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let g=f=>{t(f),s(false);},b=d(),w=b.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:b.label,children:jsxRuntime.jsx(Qd,{icon:b.icon,color:w})}),o&&jsxRuntime.jsx(yt,{children:jsxRuntime.jsxs("div",{ref:m,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:c.map(f=>jsxRuntime.jsxs("button",{onClick:()=>g(f.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:f.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Qd,{icon:f.icon,color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:f.label}),e===f.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f.id))})]})})]})}function tc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[l,m]=react.useState(false),[i,c]=react.useState(e),[d,p]=react.useState({top:0,left:0}),g=react.useRef(null),b=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(s&&b.current){let v=b.current.getBoundingClientRect();p({top:v.bottom+window.scrollY+8,left:v.left+window.scrollX});}},[s]),react.useEffect(()=>{let v=T=>{g.current&&!g.current.contains(T.target)&&!b.current?.contains(T.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=T=>{T.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s,e]),react.useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let f=()=>{m(true),c(e);},y=()=>{let v=i.trim();v&&v!==e&&t(v),m(false),n(false),c(e);},h=v=>{v.key==="Enter"?y():v.key==="Escape"&&(m(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:b,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children: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"})]})}),s&&jsxRuntime.jsx(yt,{children:jsxRuntime.jsx("div",{ref:g,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children: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:"Rename Column"}),jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:v=>c(v.target.value),onKeyDown:h,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):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:"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(),n(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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:"Delete"})]})]})]})})})]})}var Lo=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:b,onColumnDelete:w,isDeletable:f=false,className:y})=>{let{setNodeRef:h,isOver:v}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),T=react.useRef(null),D=c??Sd(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:h,className:y,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),R=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:u("asakaa-column",v&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&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"})]}),k.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"})]}),k.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"})}),k.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"})]})]}),(b||w)&&jsxRuntime.jsx(tc,{columnTitle:e.title,onRename:C=>b?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:f}),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"})]})]}),!p&&jsxRuntime.jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.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:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(C=>{let W=t[C.index];return W?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(Er,{card:W,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},W.id):null})}):t.map(C=>jsxRuntime.jsx(Er,{card:C,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},C.id))})})]})});Lo.displayName="Column";function ii({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,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 df(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 ic(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(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function cf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function mf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var uf=["\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 lc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:b,maxFileSizeMB:w=10}){let f=l==="dark",[y,h]=react.useState(false),[v,T]=react.useState([]),[D,N]=react.useState(0),[E,k]=react.useState(null),[R,I]=react.useState(false),C=react.useRef(null),W=react.useRef(null),H=react.useRef(null),x=react.useRef(null),te=react.useCallback((S,K)=>{let J=df(S,K);if(k(J),J){let ie=r.filter(ue=>ue.name.toLowerCase().includes(J.query)||ue.email&&ue.email.toLowerCase().includes(J.query)).slice(0,5);T(ie),h(ie.length>0),N(0);}else h(false),T([]);},[r]),oe=S=>{let K=S.target.value;if(t(K),te(K,S.target.selectionStart||0),C.current){C.current.style.height="24px";let J=C.current.scrollHeight,ie=280,ue=Math.min(J,ie);C.current.style.height=`${ue}px`,C.current.style.overflowY=J>ie?"auto":"hidden";}},ne=()=>{C.current&&te(e,C.current.selectionStart||0);},A=react.useCallback(S=>{if(!E||!C.current)return;let K=e.slice(0,E.start),J=e.slice(E.end),ie=`@${S.name.replace(/\s+/g,"")} `,ue=K+ie+J;t(ue),h(false),k(null),setTimeout(()=>{if(C.current){let ye=E.start+ie.length;C.current.selectionStart=ye,C.current.selectionEnd=ye,C.current.focus();}},0);},[E,e,t]),ke=S=>{if(y&&v.length>0)switch(S.key){case "ArrowDown":S.preventDefault(),N(K=>K<v.length-1?K+1:0);break;case "ArrowUp":S.preventDefault(),N(K=>K>0?K-1:v.length-1);break;case "Enter":{S.preventDefault();let K=v[D];K&&A(K);break}case "Tab":{S.preventDefault();let K=v[D];K&&A(K);break}case "Escape":S.preventDefault(),h(false);break}else S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),a());};react.useEffect(()=>{let S=K=>{W.current&&!W.current.contains(K.target)&&C.current&&!C.current.contains(K.target)&&h(false),x.current&&!x.current.contains(K.target)&&I(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let Ie=react.useCallback(S=>{if(!C.current)return;let K=C.current.selectionStart||e.length,J=e.slice(0,K)+S+e.slice(K);t(J),I(false),setTimeout(()=>{if(C.current){let ie=K+S.length;C.current.selectionStart=ie,C.current.selectionEnd=ie,C.current.focus();}},0);},[e,t]),L=react.useCallback(S=>{if(!g||!S.target.files)return;let K=Array.from(S.target.files),J=w*1024*1024,ie=K.filter(ue=>ue.size>J?(console.warn(`File ${ue.name} exceeds max size of ${w}MB`),false):true);ie.length>0&&g(ie),S.target.value="";},[g,w]),U=react.useCallback(S=>S.type.startsWith("image/")?lucideReact.Image:S.type.includes("pdf")||S.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(y&&W.current){let S=W.current.children[D];S&&S.scrollIntoView({block:"nearest"});}},[D,y]),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(S=>{let K=U(S.file),J=S.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",f?"bg-white/10":"bg-gray-100"),children:[J&&S.preview?jsxRuntime.jsx("img",{src:S.preview,alt:S.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(K,{className:u("w-4 h-4",f?"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",f?"text-white":"text-gray-900"),children:S.file.name}),jsxRuntime.jsx("p",{className:u("text-xs",f?"text-[#6B7280]":"text-gray-400"),children:mf(S.file.size)})]}),b&&jsxRuntime.jsx("button",{onClick:()=>b(S.id),className:u("p-0.5 rounded-full transition-colors",f?"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"})})]},S.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.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",f?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>I(!R),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",f?"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:R&&jsxRuntime.jsx(framerMotion.motion.div,{ref:x,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",f?"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:uf.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>Ie(S),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",f?"hover:bg-white/10":"hover:bg-gray-100"),children:S},S))})})})]}),d&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",f?"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:m==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:H,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:C,value:e,onChange:oe,onSelect:ne,onKeyDown:ke,placeholder:o||(m==="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",f?"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":f?"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:y&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:W,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",f?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((S,K)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(S),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",K===D?f?"bg-white/10":"bg-gray-100":f?"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:S.color||"#8B5CF6"},children:cf(S.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:u("text-sm font-medium truncate",f?"text-white":"text-gray-900"),children:S.name}),S.email&&jsxRuntime.jsx("p",{className:u("text-xs truncate",f?"text-[#6B7280]":"text-gray-500"),children:S.email})]})]},S.id))})})]})]})]})}function dc({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((l,m)=>l.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:l.value},m):jsxRuntime.jsx("span",{children:l.value},m))})}var Gn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Gr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=react.useState(false),[i,c]=react.useState(""),[d,p]=react.useState(false),[g,b]=react.useState(Gn[10]||"#3B82F6"),[w,f]=react.useState({top:0,left:0}),y=react.useRef(null),h=react.useRef(null),v=react.useRef(null),T=react.useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),N=t.some(C=>C.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&h.current){let C=h.current.getBoundingClientRect();f({top:C.bottom+6,left:C.left});}},[l]),react.useEffect(()=>{let C=W=>{let H=W.target,x=y.current?.contains(H),te=v.current?.contains(H);!x&&!te&&(m(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{l&&T.current&&T.current.focus();},[l]);let E=C=>{let W=e.some(H=>H.id===C.id);a(W?e.filter(H=>H.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){p(true);try{let C=await r(i.trim(),g);C&&(a([...e,C]),c(""),b(Gn[Math.floor(Math.random()*Gn.length)]||"#3B82F6"));}finally{p(false);}}},R=(C,W)=>{W.stopPropagation(),a(e.filter(H=>H.id!==C));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:y,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:w.top,left:w.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:T,type:"text",value:i,onChange:C=>c(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&i.trim()&&!N&&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(C=>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:`${C.color}20`,color:C.color},onClick:W=>R(C.id,W),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let W=e.some(H=>H.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>E(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:H=>{W||(H.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:H=>{W||(H.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):i.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"})}),i.trim()&&!N&&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:Gn.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>b(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:g===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),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 "',i.trim(),'"']})]})]})}),document.body)]})}function di({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 mc({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(di,{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 go=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function uc(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 kf(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 wf({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 ci({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=kf(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"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},m=uc(e.loggedMinutes),i=e.estimateMinutes?uc(e.estimateMinutes):null,c=a&&i?`${m} / ${i}`:m;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(wf,{className:l[t]}),jsxRuntime.jsx("span",{children:c})]})}function gc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o)}function _n(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 Nf(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 Df({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Sf({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 fc({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 Ef({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 mi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:m,onDiscardTimer:i,onClose:c,className:d}){let[p,g]=react.useState(""),[b,w]=react.useState(t.estimateMinutes?_n(t.estimateMinutes):""),[f,y]=react.useState(""),[h,v]=react.useState(false),[T,D]=react.useState(false),N=react.useRef(null);react.useEffect(()=>{N.current?.focus();},[]);let E=async()=>{let I=gc(p);if(!(I<=0||!s)){v(true);try{await s({durationMinutes:I,note:f.trim()||void 0,source:"manual"}),g(""),y("");}finally{v(false);}}},k=async()=>{if(!n)return;let I=b.trim()?gc(b):null;await n(I),D(false);},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),E()),I.key==="Escape"&&c?.();};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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(fc,{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:Nf(o)})]}),jsxRuntime.jsx("button",{onClick:m,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Sf,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(fc,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,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(Df,{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(Ef,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:N,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:R,placeholder:"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:E,disabled:h||!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:f,onChange:I=>y(I.target.value),onKeyDown:R,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:_n(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"}),T?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:b,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&D(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:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?_n(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(I=>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:I.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:_n(I.durationMinutes)})]},I.id))})]})]})}function Af(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o)}function Lf(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 fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,m]=react.useState(Lf(r)),[i,c]=react.useState(""),[d,p]=react.useState(false),g=react.useRef(null);react.useEffect(()=>{g.current?.focus();},[]);let b=async()=>{p(true);let v=Af(l);await o(v&&v>0?v:null,i||void 0),p(false);},w=async()=>{p(true),await o(null),p(false);},f=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),b()),v.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"1h 30m",quoted:"1h 30m",log:"1h 30m"};return jsxRuntime.jsxs("div",{className:u("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:u("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:u("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsxs("div",{className:"mb-3",children:[jsxRuntime.jsx("input",{ref:g,type:"text",value:l,onChange:v=>m(v.target.value),onKeyDown:f,placeholder:h[e],className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 1h 30m, 45m, 2:30":"e.g. 1h 30m, 45m, 2:30"})]}),e==="log"&&jsxRuntime.jsx("div",{className:"mb-3",children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>c(v.target.value),onKeyDown:f,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsxRuntime.jsx("button",{type:"button",onClick:b,disabled:d||!l.trim(),className:u("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:w,disabled:d,className:u("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function If(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 Bf(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 gi({summary:e,showLabel:t=false,size:a="md",className:r}){let o=If(e.health),s=Bf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,m=Math.min(100,l),i=l>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:`${m}%`}}),i&&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:[l,"%"]})]})}function Io(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 Of(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 $f(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 zf(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 Uf({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",l=a?"text-[#9CA3AF]":"text-gray-500",m=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",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Io(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:u("text-xs mt-1",l),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",l),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",m),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",m),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",m),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",l),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:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:u("font-medium",m),children:Io(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:u("font-medium",m),children:Io(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:u("font-medium",m),children:e.totalTasksWithEstimate})]})]})]})]})}function Hf({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null&&e.varianceMinutes>0?"+":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=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",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Io(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Io(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":l),children:[o,Io(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":l),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",$f(e.status,a),Of(e.status,a)),children:zf(e.status,t)})})]})}function fi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",m=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",g=react.useMemo(()=>e?[...e.tasks].sort((b,w)=>b.varianceMinutes===null?1:w.varianceMinutes===null?-1:w.varianceMinutes-b.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",l,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",c),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(Uf,{summary:e.summary,locale:a,isDark:n}),jsxRuntime.jsx("div",{className:u("rounded-lg border overflow-hidden",m,i),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",i),children:g.map(b=>jsxRuntime.jsx(Hf,{task:b,locale:a,isDark:n,onClick:s},b.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 Jn(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 a0(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 Tc(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function r0(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 Mr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:b=[],onAddComment:w,currentUser:f,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:T,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:E=0,onTimeLog:k,onEstimateUpdate:R,onSoldEffortUpdate:I,onTimerStart:C,onTimerStop:W,onTimerDiscard:H}){let x=s==="dark",te={textTertiary:x?"#6B7280":"#9CA3AF",textSecondary:x?"#9CA3AF":"#6B7280",textPrimary:x?"#FFFFFF":"#111827",borderLight:x?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:x?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:x?"#1A1D25":"#FFFFFF",bgSecondary:x?"#0F1117":"#F9FAFB",hoverBg:x?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},oe=e&&"title"in e&&!("name"in e),ne=e,[A,ke]=react.useState(e?Tc(e,l):null),[Ie,L]=react.useState(false),[U,S]=react.useState(false),[K,J]=react.useState(false),[ie,ue]=react.useState(null),[ye,Oe]=react.useState(new Date),[Q,Je]=react.useState(false),[Pe,rt]=react.useState(false),[ut,It]=react.useState(""),[Xe,pt]=react.useState(false),[ce,Ge]=react.useState(false),[Be,B]=react.useState(false),[X,ge]=react.useState(false),[Ae,Ue]=react.useState(""),nt=react.useRef(null),Pt=react.useRef(null),[$e,O]=react.useState(""),ae=react.useRef(null),[Le,je]=react.useState(""),[qe,j]=react.useState(false),[$,Me]=react.useState([]),[ht,le]=react.useState(""),[He,De]=react.useState(false),Re=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 P=Tc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),ke(P),Ue(P.description||""),O(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!Ae)return;let P=setTimeout(()=>{let re=Pt.current;re&&(re.style.height="auto",re.style.height=`${Math.max(100,re.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,Ae]),react.useEffect(()=>()=>{nt.current&&clearTimeout(nt.current),ae.current&&clearTimeout(ae.current);},[]),react.useEffect(()=>{t&&Re.current&&b.length>0&&setTimeout(()=>{Re.current&&(Re.current.scrollTop=Re.current.scrollHeight);},100);},[t,b.length]);let de=react.useCallback(P=>{ke(P),oe&&o&&ne?o(r0(P,ne)):r&&r(P);},[oe,ne,o,r]),Ve=react.useCallback(()=>{L(false),S(false),J(false),ue(null),rt(false),It(""),pt(false);},[]),V=react.useCallback((P,re)=>{if(!A)return;let ve={...A,[P]:re};de(ve);},[A,de]),q=react.useCallback(()=>{let P=Pt.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),Se=react.useCallback(P=>{Ue(P),setTimeout(q,0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>{if(A){let re={...A,description:P};de(re);}},800);},[A,de,q]),Ye=react.useCallback(P=>{O(P),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{if(A&&P.trim()){let re={...A,name:P.trim()};de(re);}},800);},[A,de]),ze=react.useCallback(P=>{let re=P.map(ve=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ve};return ve.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(ve)),Ze});Me(ve=>[...ve,...re]);},[]),G=react.useCallback(P=>{Me(re=>{let ve=re.find(Ze=>Ze.id===P);return ve?.preview&&URL.revokeObjectURL(ve.preview),re.filter(Ze=>Ze.id!==P)});},[]),me=react.useCallback(async()=>{if(!(!A||!Le.trim()&&$.length===0||!w)){j(true);try{let P=ic(Le,y),re=[];if($.length>0&&h){let ve=$.map(Ze=>Ze.file);re=await h(ve);}await w(A.id,Le.trim(),P.length>0?P:void 0,re.length>0?re:void 0),je(""),$.forEach(ve=>{ve.preview&&URL.revokeObjectURL(ve.preview);}),Me([]);}finally{j(false);}}},[A,Le,$,w,y,h]),_e=react.useCallback(()=>{if(!A||!ht.trim())return;let P={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ht.trim(),progress:0,startDate:new Date,endDate:new Date},re=[...A.subtasks||[],P],ve={...A,subtasks:re};de(ve),le(""),De(false);},[A,ht,de]),Tt=react.useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.map(Ze=>Ze.id===P?{...Ze,progress:Ze.progress===100?0:100}:Ze),ve={...A,subtasks:re};de(ve);},[A,de]),gt=react.useCallback(P=>{if(!A?.subtasks)return;let re=A.subtasks.filter(Ze=>Ze.id!==P),ve={...A,subtasks:re};de(ve);},[A,de]),Sr=react.useCallback(P=>{let re=typeof P=="string"?new Date(P):P,Ze=new Date().getTime()-re.getTime(),aa=Math.floor(Ze/6e4),ia=Math.floor(Ze/36e5),ra=Math.floor(Ze/864e5);return aa<1?n==="es"?"Ahora":"Just now":aa<60?n==="es"?`Hace ${aa} min`:`${aa}m ago`:ia<24?n==="es"?`Hace ${ia}h`:`${ia}h ago`:ra<7?n==="es"?`Hace ${ra}d`:`${ra}d ago`:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),fr=react.useCallback(P=>{if(!A)return;let re=A.progress||0;P==="completed"?re=100:P==="in-progress"&&re===0?re=10:P==="todo"&&(re=0);let ve={...A,status:P,progress:re};de(ve),L(false);},[A,de]),Ia=react.useCallback((P,re)=>{if(!A)return;let ve={...A,startDate:P,endDate:re};de(ve);},[A,de]),Ba=react.useCallback(()=>{let P=ye.getFullYear(),re=ye.getMonth(),ve=new Date(P,re,1),aa=new Date(P,re+1,0).getDate(),ia=ve.getDay(),ra=[],rr=new Date(P,re,0).getDate();for(let Sa=ia-1;Sa>=0;Sa--)ra.push({date:new Date(P,re-1,rr-Sa),isCurrentMonth:false});for(let Sa=1;Sa<=aa;Sa++)ra.push({date:new Date(P,re,Sa),isCurrentMonth:true});let Ta=42-ra.length;for(let Sa=1;Sa<=Ta;Sa++)ra.push({date:new Date(P,re+1,Sa),isCurrentMonth:false});return ra},[ye]),fe=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),B(false),!A||!d)return;let re=Array.from(P.dataTransfer.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}}},[A,d]),Nt=react.useCallback(async P=>{if(!A||!d||!P.target.files)return;let re=Array.from(P.target.files);if(re.length!==0){ge(true);try{await d(A.id,re);}finally{ge(false);}P.target.value="";}},[A,d]),ot=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(true);},[]),Or=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),B(false);},[]),oo=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),br=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!A?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&A&&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",x?"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]",x?"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",x?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",x?"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",x?"text-[#6B7280]":"text-gray-400"),children:A.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 P=A.progress===100?0:100,ve={...A,progress:P,status:P===100?"completed":"todo"};de(ve);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":x?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:$e,onChange:P=>Ye(P.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",A.progress===100?"line-through text-[#6B7280]":x?"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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Ve(),L(!Ie);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":x?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>L(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]",x?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>fr(P.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",A.status===P.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Ve(),J(!K);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((P,re)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},re)),A.assignees.length>3&&jsxRuntime.jsxs("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:u("text-sm",x?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",x?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>J(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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let re=A.assignees?.some(ve=>ve.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ve=A.assignees||[],Ze;re?Ze=ve.filter(aa=>aa.name!==P.name):Ze=[...ve,P],V("assignees",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",re&&(x?"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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:u("flex-1",x?"text-white":"text-gray-900"),children:P.name}),re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",x?"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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ue(ie?null:"start"),Oe(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:u("mx-1",x?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(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",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",x?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,re=new Date(P);re.setDate(P.getDate()+1);let ve=new Date(P);ve.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ze=new Date(P);Ze.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let aa=new Date(P);aa.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let ia=new Date(P);ia.setDate(P.getDate()+14);let ra=new Date(P);return ra.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:re,display:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:aa,display:aa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ra,display:ra.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ta,Sa)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ie==="start"){let no=A.endDate&&Ta.date>A.endDate?Ta.date:A.endDate;Ia(Ta.date,no),ue("end");}else {let no=A.startDate&&Ta.date<A.startDate?Ta.date:A.startDate;Ia(no,Ta.date),ue(null);}},children:[jsxRuntime.jsx("span",{children:Ta.label}),jsxRuntime.jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:Ta.display})]},Sa))})(),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Ia(void 0,void 0),ue(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",x?"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",x?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ie==="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",x?"text-white":"text-gray-900"),children:ye.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:()=>Oe(new Date),className:u("p-1 rounded text-sm transition-colors",x?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()-1)),className:u("p-1 rounded",x?"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:()=>Oe(new Date(ye.getFullYear(),ye.getMonth()+1)),className:u("p-1 rounded",x?"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(P=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",x?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Ba().map((P,re)=>{let ve=P.date.toDateString()===new Date().toDateString(),Ze=A.startDate?.toDateString()===P.date.toDateString(),aa=A.endDate?.toDateString()===P.date.toDateString(),ia=Ze||aa,ra=A.startDate&&A.endDate&&P.date>=A.startDate&&P.date<=A.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let rr=new Date(P.date);if(ie==="start"){let Ta=A.endDate&&rr>A.endDate?rr:A.endDate;Ia(rr,Ta),ue("end");}else {let Ta=A.startDate&&rr<A.startDate?rr:A.startDate;Ia(Ta,rr),ue(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(x?"text-white":"text-gray-900"),ve&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",aa&&!Ze&&"bg-[#7C3AED] text-white",ra&&!ia&&(x?"bg-[#7C3AED]/20":"bg-purple-100"),!ia&&(x?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},re)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Ve(),S(!U);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":x?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.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:()=>S(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]",x?"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(P=>jsxRuntime.jsxs("button",{onClick:()=>{V("priority",P.id),S(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",A.priority===P.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:u("text-sm",x?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.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",x?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Q?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:P=>{let re=parseInt(P.target.value),ve=A.status;re===100?ve="completed":re>0?ve="in-progress":ve="todo";let Ze={...A,progress:re,status:ve};de(Ze);},onBlur:()=>Je(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",x?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Je(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",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:u("text-sm font-medium min-w-[40px]",x?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),v&&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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"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:T?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm px-2 py-0.5 rounded",x?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jn(T.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge("estimate"),className:u("text-sm",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce==="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(fo,{mode:"estimate",locale:n,isDark:x,currentValue:T?.estimateMinutes||null,onSave:async P=>{await R?.(A.id,P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:A.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm px-2 py-0.5 rounded",x?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Jn(A.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge("quoted"),className:u("text-sm",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce==="quoted"&&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(fo,{mode:"quoted",locale:n,isDark:x,currentValue:A.quotedMinutes||null,onSave:async P=>{I?(await I(A.id,P),ke(re=>re?{...re,quotedMinutes:P}:null)):V("quotedMinutes",P),Ge(false);},onClose:()=>Ge(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[N?jsxRuntime.jsxs("button",{type:"button",onClick:()=>W?.(A.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"}),a0(E||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>C?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",x?"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"})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ge("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",x?"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"]}),T&&T.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[jsxRuntime.jsxs("span",{className:u("text-sm font-medium",T.health==="over-budget"?"text-red-500":T.health==="at-risk"?"text-yellow-500":x?"text-white":"text-gray-900"),children:[Jn(T.loggedMinutes),T.estimateMinutes&&jsxRuntime.jsxs("span",{className:u("font-normal",x?"text-[#6B7280]":"text-gray-400"),children:[" / ",Jn(T.estimateMinutes)]})]}),T.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",T.health==="over-budget"?"bg-red-500":T.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,T.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce==="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(fo,{mode:"log",locale:n,isDark:x,currentValue:null,onSave:async(P,re)=>{P&&await k?.(A.id,{durationMinutes:P,note:re,source:"manual"}),Ge(false);},onClose:()=>Ge(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Gr,{selectedTags:A.tags||[],availableTags:m,onChange:P=>{V("tags",P);},onCreateTag:i,theme:te})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:u("w-4 h-4 mt-1.5",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(P=>{let re=g.find(ve=>ve.id===P);return jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",x?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[re?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ve=(A.dependencies||[]).filter(Ze=>Ze!==P);V("dependencies",ve);},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"})})]},P)})}),jsxRuntime.jsxs("button",{onClick:()=>{Ve(),rt(!Pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"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",x?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{rt(false),It("");}}),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]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("p-2 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ut,onChange:P=>It(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",x?"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(P=>P.id!==A.id).filter(P=>ut===""||P.name.toLowerCase().includes(ut.toLowerCase())).map(P=>{let re=A.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ve=A.dependencies||[],Ze;re?Ze=ve.filter(aa=>aa!==P.id):Ze=[...ve,P.id],V("dependencies",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",re&&(x?"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",re?"bg-blue-500 border-blue-500":x?"border-white/30":"border-gray-300"),children:re&&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",x?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:u("px-3 py-4 text-sm text-center",x?"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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Ve(),pt(!Xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",x?"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:A.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:u("text-sm",x?"text-white":"text-gray-900"),children:go.find(P=>P.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",x?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pt(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",x?"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:go.map(P=>{let re=A.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{V("color",P.value),pt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",re&&"ring-2 ring-offset-2",x?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:re?P.value:void 0},title:P.name,children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:u("w-4 h-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",x?"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:A.isMilestone||false,onChange:P=>V("isMilestone",P.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":x?"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",x?"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",x?"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",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:u("text-sm font-semibold",x?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:Pt,value:Ae,onChange:P=>Se(P.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",x?"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",x?"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",x?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(P=>P.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:A.subtasks.map(P=>jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Tt(P.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":x?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:u("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":x?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("button",{onClick:()=>gt(P.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",x?"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"})})]},P.id))}),He?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:ht,onChange:P=>le(P.target.value),onKeyDown:P=>{P.key==="Enter"&&ht.trim()?_e():P.key==="Escape"&&(De(false),le(""));},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",x?"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:_e,disabled:!ht.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",ht.trim()?"bg-blue-500 hover:bg-blue-600 text-white":x?"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:()=>{De(false),le("");},className:u("p-2 rounded-lg transition-colors",x?"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:()=>De(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",x?"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",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold mb-3",x?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let re=br(P.type),ve=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ve&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(re,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",x?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:oo(P.size)})]}),p&&jsxRuntime.jsx("button",{onClick:()=>p(P.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",x?"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"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:ot,onDragLeave:Or,onDrop:fe,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?x?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":x?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",X&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Nt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||X}),X?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",x?"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",Be?"text-blue-500":x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-500"),children:Be?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",x?"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",x?"border-white/10 bg-[#0F1117]":"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]",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:u("text-sm font-semibold",x?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",b.length>0&&jsxRuntime.jsxs("span",{className:u("ml-2 text-xs font-normal",x?"text-[#6B7280]":"text-gray-400"),children:["(",b.length,")"]})]}),jsxRuntime.jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",x?"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: ${x?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsxRuntime.jsx("div",{ref:K,className:b("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",p?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...y].sort((D,Q)=>{let ce=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,Xe=typeof Q.createdAt=="string"?new Date(Q.createdAt):Q.createdAt;return ce.getTime()-Xe.getTime()}).map(D=>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:D.user?.color||"#8B5CF6"},children:D.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:b("text-sm font-medium",p?"text-white":"text-gray-900"),children:D.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ze(D.createdAt)})]}),jsxRuntime.jsx("div",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Od,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(Q=>{let ce=Q.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:Q.url,target:"_blank",rel:"noopener noreferrer",className:b("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ce?jsxRuntime.jsx(lucideReact.Image,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:b("text-xs truncate max-w-[100px]",p?"text-white":"text-gray-900"),children:Q.name})]},Q.id)})})]})]},D.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:b("w-10 h-10 mb-3",p?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:b("py-4 pl-4 pr-2 border-t",p?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Rd,{value:ut,onChange:Pt,onSubmit:Pa,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:ge,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:re,onFilesSelect:ee,onRemoveFile:Ye})})]})]})]})})}function Ks(){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 Mr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:u,attachmentsByCard:f,onUploadAttachments:y,onDeleteAttachment:k,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onTaskOpen:w,onUploadCommentAttachments:x}){let[S,T]=Ks(),[C,A]=react.useState(null),[I,N]=react.useState(false),O=react.useRef(null),R=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),_=o?.theme||"dark",se=_==="dark"||_==="neutral",te=se?"dark":"",ie=react.useCallback((Y,V)=>{t.onCardUpdate?.(Y,V);},[t]),xe=react.useCallback((Y,V)=>{t.onColumnUpdate?.(Y,{title:V});},[t]),Ne=react.useCallback(Y=>{t.onColumnDelete?.(Y);},[t]),Ae=["todo","in-progress","completed"],F=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),B=react.useMemo(()=>{let Y=new Map;return e.columns.forEach(V=>{let Oe=V.cardIds.map(ue=>e.cards.find(Le=>Le.id===ue)).filter(ue=>ue!==void 0).sort((ue,Le)=>ue.position-Le.position);Y.set(V.id,Oe);}),Y},[e.cards,e.columns]);react.useEffect(()=>{let Y=O.current;if(!Y)return;let V=Je=>{let st=Je.target,Ge=Je.button===1,bt=st===Y||st.classList.contains("asakaa-column")&&!st.closest(".asakaa-card");(Ge||Je.button===0&&bt&&!S.isDragging)&&(Je.preventDefault(),N(true),R.current={x:Je.clientX,y:Je.clientY,scrollLeft:Y.scrollLeft,scrollTop:Y.scrollTop},Y.style.cursor="grabbing",Y.style.userSelect="none");},Oe=Je=>{if(!I)return;let st=Je.clientX-R.current.x,Ge=Je.clientY-R.current.y;Y.scrollLeft=R.current.scrollLeft-st,Y.scrollTop=R.current.scrollTop-Ge;},ue=()=>{I&&(N(false),Y.style.cursor="",Y.style.userSelect="");},Le=()=>{I&&(N(false),Y.style.cursor="",Y.style.userSelect="");};return Y.addEventListener("mousedown",V),document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",ue),Y.addEventListener("mouseleave",Le),()=>{Y.removeEventListener("mousedown",V),document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",ue),Y.removeEventListener("mouseleave",Le);}},[I,S.isDragging]);let E=react.useMemo(()=>e.cards.map(Y=>({id:Y.id,name:Y.title,startDate:Y.startDate?new Date(Y.startDate):void 0,endDate:Y.endDate?new Date(Y.endDate):void 0,progress:Y.progress||0,status:Y.columnId,priority:Y.priority?.toLowerCase(),dependencies:Array.isArray(Y.dependencies)?Y.dependencies.map(V=>typeof V=="string"?V:V.taskId):[]})),[e.cards]),W=react.useCallback(Y=>{let{active:V}=Y,Oe=e.cards.find(ue=>ue.id===V.id);Oe&&T({isDragging:true,draggedCardId:Oe.id,sourceColumnId:Oe.columnId,targetColumnId:Oe.columnId});},[e.cards,T]),q=react.useCallback(Y=>{let{active:V,over:Oe}=Y;if(!Oe||!e.cards.find(Je=>Je.id===V.id))return;let Le=null;Oe.data.current?.type==="column"?Le=Oe.id:Oe.data.current?.type==="card"&&(Le=e.cards.find(st=>st.id===Oe.id)?.columnId||null),Le&&Le!==S.targetColumnId&&T({...S,targetColumnId:Le});},[e.cards,S,T]),pe=react.useCallback(async Y=>{let{active:V,over:Oe}=Y;if(T({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Oe)return;let ue=e.cards.find(Ge=>Ge.id===V.id);if(!ue)return;let Le,Je;if(Oe.data.current?.type==="column"){Le=Oe.id;let Ge=B.get(Le)||[];Je=Is(Ge,0);}else {let Ge=e.cards.find(Pt=>Pt.id===Oe.id);if(!Ge)return;Le=Ge.columnId;let bt=B.get(Le)||[],ut=bt.findIndex(Pt=>Pt.id===Oe.id);Je=Is(bt,ut);}let st=e.columns.find(Ge=>Ge.id===Le);if(st&&st.wipLimit&&st.wipLimitType==="hard"){let Ge=B.get(Le)||[];if(ue.columnId!==Le&&Ge.length>=st.wipLimit){t.onWipLimitExceeded?.(st,ue);return}}(ue.columnId!==Le||ue.position!==Je)&&await t.onCardMove?.(ue.id,Le,Je);},[e.cards,e.columns,B,t,T]),fe=react.useCallback(Y=>{A(Y),a?.(Y),w?.(Y.id);},[a,w]),Ce=react.useCallback(Y=>{t.onCardUpdate?.(Y.id,Y),A(Y);},[t]);return m?jsxRuntime.jsx("div",{className:b("asakaa-board",te,n),style:l,children:jsxRuntime.jsx(gf,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:b("asakaa-board",te,n),style:l,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 i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(pd,{themeName:_,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:F,collisionDetection:core$1.closestCorners,onDragStart:W,onDragOver:q,onDragEnd:pe,children:[jsxRuntime.jsxs("div",{ref:O,className:b("asakaa-board",te,n),style:{...l,cursor:I?"grabbing":void 0},"data-theme":_,children:[e.columns.sort((Y,V)=>Y.position-V.position).map(Y=>{let V=B.get(Y.id)||[],Oe=!Ae.includes(Y.id);return jsxRuntime.jsx(bo,{column:Y,cards:V,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:fe,onCardUpdate:ie,onColumnRename:xe,onColumnDelete:Ne,isDeletable:Oe,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},Y.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:S.draggedCardId?jsxRuntime.jsx(gr,{card:e.cards.find(Y=>Y.id===S.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(fr,{task:C,isOpen:!!C,onClose:()=>A(null),onCardUpdate:Ce,theme:se?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:u,attachments:C?f?.get(C.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:k,availableTasks:E,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onUploadCommentAttachments:x})]})}function gf({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 vf={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},xf={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},kf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},wf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Cf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),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:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[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((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Tf({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let f=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[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(f=>f.handler),u=async(f,y)=>{if(y){m(f);try{await y();}catch(k){console.error(`Export ${f} failed:`,k);}finally{m(null),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:{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((f,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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: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-4 h-4"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function Nf({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, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function qs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?vf:xf,d={...o==="es"?kf:wf,...i},u=n||l||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tf,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(Cf,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsxRuntime.jsx(Nf,{onClick:()=>t(),label:a||d.newTask}))]})})}function Js({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,m]=react.useState(""),i=react.useCallback(()=>{let u=l.trim();u&&(e(u),m(""),n(false));},[l,e]),c=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(m(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:b("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:l,onChange:u=>m(u.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.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:()=>{m(""),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:b("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 Zs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=react.useState(false),[d,u]=react.useState(false),[f,y]=react.useState(""),[k,g]=react.useState([]),[v,h]=react.useState(""),[p,w]=react.useState(""),[x,S]=react.useState(""),[T,C]=react.useState(false),[A,I]=react.useState(false),[N,O]=react.useState(false),R=react.useRef(null),_=react.useRef(null),se={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},te=react.useCallback(()=>{y(""),g([]),h(""),w(""),S(""),C(false),I(false),O(false),c(false);},[]);react.useEffect(()=>{i&&R.current&&R.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let F=B=>{_.current&&!_.current.contains(B.target)&&(f.trim()||te());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,f,te]);let ie=react.useCallback(async()=>{let F=f.trim();if(!(!F||d)){u(true);try{await t({name:F,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:v?new Date(v):void 0,endDate:p?new Date(p):void 0,priority:x||void 0}),y(""),g([]),h(""),w(""),S(""),C(!1),I(!1),O(!1),R.current?.focus();}catch(B){console.error("Error creating card:",B);}finally{u(false);}}},[f,e,k,v,p,x,t,d]),xe=react.useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ie()):F.key==="Escape"&&te();},[ie,te]),Ne=react.useCallback(F=>{g(B=>B.includes(F)?B.filter(E=>E!==F):[...B,F]);},[]),Ae=l==="dark";return i?jsxRuntime.jsxs("div",{ref:_,className:b("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:R,type:"text",value:f,onChange:F=>y(F.target.value),onKeyDown:xe,placeholder:se.placeholder,disabled:d,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!T),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||k.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),k.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:k.length})]}),jsxRuntime.jsx("button",{onClick:()=>I(!A),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||v||p?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>O(!N),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ie,disabled:!f.trim()||d,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):se.save})]})]}),T&&a.length>0&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxRuntime.jsxs("button",{onClick:()=>Ne(F.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(F.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsxRuntime.jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),A&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.endDate}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:F=>w(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsxRuntime.jsx("button",{onClick:()=>S(x===F?"":F),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:se[F]},F))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),disabled:n,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:se.buttonLabel})]})}var _o=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(Mr,{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 sc(e={}){return new _o(e)}var yo=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 Qs(e,t){let a=r=>jsxRuntime.jsx(yo,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ti({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[d,u]=react.useState(false),[f,y]=react.useState(""),[k,g]=react.useState("home"),[v,h]=react.useState(""),[p,w]=react.useState("");react.useEffect(()=>{let C=A=>{(A.metaKey||A.ctrlKey)&&A.key===i&&(A.preventDefault(),u(I=>!I)),A.key==="Escape"&&(u(false),g("home"),y(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),react.useEffect(()=>{d||(g("home"),y(""),h(""),w(""));},[d]);let x=react.useCallback(()=>{u(false);},[]),S=react.useCallback(C=>{let[A,I]=C.split(":");switch(A){case "create-card":g("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),x()):g("navigate");break;case "search":r?.(f),x();break;case "priority":g("priority");break;case "set-priority":p&&I&&(o?.(p,I),x());break;case "assign":g("assign");break;case "assign-user":p&&I&&(s?.(p,I),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":l?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[f,p,t,a,r,o,s,n,l,m,x]),T=react.useCallback(()=>{v&&f.trim()&&(t?.(v,f.trim()),x());},[v,f,t,x]);return d?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:x,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,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:k==="create-card"&&v?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&k==="create-card"&&v&&T();}}),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."}),k==="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:S,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:S,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:S,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:S,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:S,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},C.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:S,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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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(C=>{let A=e.columns.find(I=>I.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:S,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:A?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},C.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 dc(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsxRuntime.jsx("div",{ref:Re,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",x?"scrollbar-slim":"scrollbar-slim-light"),children:b.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...b].sort((P,re)=>{let ve=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ze=typeof re.createdAt=="string"?new Date(re.createdAt):re.createdAt;return ve.getTime()-Ze.getTime()}).map(P=>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:P.user?.color||"#8B5CF6"},children:P.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",x?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:u("text-xs",x?"text-[#6B7280]":"text-gray-400"),children:Sr(P.createdAt)})]}),jsxRuntime.jsx("div",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(dc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(re=>{let ve=re.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:re.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",x?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ve?jsxRuntime.jsx(lucideReact.Image,{className:u("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:u("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:u("text-xs truncate max-w-[100px]",x?"text-white":"text-gray-900"),children:re.name})]},re.id)})})]})]},P.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",x?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:u("text-sm",x?"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",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(lc,{value:Le,onChange:je,onSubmit:me,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:qe,theme:s,locale:n,currentUser:f,enableEmoji:true,enableAttachments:!!h,pendingFiles:$,onFilesSelect:ze,onRemoveFile:G})})]})]})]})})}function yi(){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 _r({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:b,onDeleteAttachment:w,comments:f,onAddComment:y,currentUser:h,mentionableUsers:v,onTaskOpen:T,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,timerState:R,onLogTime:I,onUpdateEstimate:C,onStartTimer:W,onStopTimer:H,onDiscardTimer:x}){let[te,oe]=yi(),[ne,A]=react.useState(null),[ke,Ie]=react.useState(false),L=react.useRef(null),U=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),S=o?.theme||"dark",K=S==="dark"||S==="neutral",J=K?"dark":"",ie=react.useCallback((ce,Ge)=>{t.onCardUpdate?.(ce,Ge);},[t]),ue=react.useCallback((ce,Ge)=>{t.onColumnUpdate?.(ce,{title:Ge});},[t]),ye=react.useCallback(ce=>{t.onColumnDelete?.(ce);},[t]),Oe=["todo","in-progress","completed"],Q=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Je=react.useMemo(()=>{let ce=new Map;return e.columns.forEach(Ge=>{let Be=Ge.cardIds.map(B=>e.cards.find(X=>X.id===B)).filter(B=>B!==void 0).sort((B,X)=>B.position-X.position);ce.set(Ge.id,Be);}),ce},[e.cards,e.columns]);react.useEffect(()=>{let ce=L.current;if(!ce)return;let Ge=ge=>{let Ae=ge.target,Ue=ge.button===1,nt=Ae===ce||Ae.classList.contains("asakaa-column")&&!Ae.closest(".asakaa-card");(Ue||ge.button===0&&nt&&!te.isDragging)&&(ge.preventDefault(),Ie(true),U.current={x:ge.clientX,y:ge.clientY,scrollLeft:ce.scrollLeft,scrollTop:ce.scrollTop},ce.style.cursor="grabbing",ce.style.userSelect="none");},Be=ge=>{if(!ke)return;let Ae=ge.clientX-U.current.x,Ue=ge.clientY-U.current.y;ce.scrollLeft=U.current.scrollLeft-Ae,ce.scrollTop=U.current.scrollTop-Ue;},B=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");},X=()=>{ke&&(Ie(false),ce.style.cursor="",ce.style.userSelect="");};return ce.addEventListener("mousedown",Ge),document.addEventListener("mousemove",Be),document.addEventListener("mouseup",B),ce.addEventListener("mouseleave",X),()=>{ce.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",Be),document.removeEventListener("mouseup",B),ce.removeEventListener("mouseleave",X);}},[ke,te.isDragging]);let Pe=react.useMemo(()=>e.cards.map(ce=>({id:ce.id,name:ce.title,startDate:ce.startDate?new Date(ce.startDate):void 0,endDate:ce.endDate?new Date(ce.endDate):void 0,progress:ce.progress||0,status:ce.columnId,priority:ce.priority?.toLowerCase(),dependencies:Array.isArray(ce.dependencies)?ce.dependencies.map(Ge=>typeof Ge=="string"?Ge:Ge.taskId):[]})),[e.cards]),rt=react.useCallback(ce=>{let{active:Ge}=ce,Be=e.cards.find(B=>B.id===Ge.id);Be&&oe({isDragging:true,draggedCardId:Be.id,sourceColumnId:Be.columnId,targetColumnId:Be.columnId});},[e.cards,oe]),ut=react.useCallback(ce=>{let{active:Ge,over:Be}=ce;if(!Be||!e.cards.find(ge=>ge.id===Ge.id))return;let X=null;Be.data.current?.type==="column"?X=Be.id:Be.data.current?.type==="card"&&(X=e.cards.find(Ae=>Ae.id===Be.id)?.columnId||null),X&&X!==te.targetColumnId&&oe({...te,targetColumnId:X});},[e.cards,te,oe]),It=react.useCallback(async ce=>{let{active:Ge,over:Be}=ce;if(oe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Be)return;let B=e.cards.find(Ue=>Ue.id===Ge.id);if(!B)return;let X,ge;if(Be.data.current?.type==="column"){X=Be.id;let Ue=Je.get(X)||[];ge=Zs(Ue,0);}else {let Ue=e.cards.find($e=>$e.id===Be.id);if(!Ue)return;X=Ue.columnId;let nt=Je.get(X)||[],Pt=nt.findIndex($e=>$e.id===Be.id);ge=Zs(nt,Pt);}let Ae=e.columns.find(Ue=>Ue.id===X);if(Ae&&Ae.wipLimit&&Ae.wipLimitType==="hard"){let Ue=Je.get(X)||[];if(B.columnId!==X&&Ue.length>=Ae.wipLimit){t.onWipLimitExceeded?.(Ae,B);return}}(B.columnId!==X||B.position!==ge)&&await t.onCardMove?.(B.id,X,ge);},[e.cards,e.columns,Je,t,oe]),Xe=react.useCallback(ce=>{A(ce),a?.(ce),T?.(ce.id);},[a,T]),pt=react.useCallback(ce=>{t.onCardUpdate?.(ce.id,ce),A(ce);},[t]);return m?jsxRuntime.jsx("div",{className:u("asakaa-board",J,n),style:l,children:jsxRuntime.jsx(f0,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:u("asakaa-board",J,n),style:l,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 i=="string"?i:i.message})]})})}):jsxRuntime.jsxs($d,{themeName:S,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:Q,collisionDetection:core$1.closestCorners,onDragStart:rt,onDragOver:ut,onDragEnd:It,children:[jsxRuntime.jsxs("div",{ref:L,className:u("asakaa-board",J,n),style:{...l,cursor:ke?"grabbing":void 0},"data-theme":S,children:[e.columns.sort((ce,Ge)=>ce.position-Ge.position).map(ce=>{let Ge=Je.get(ce.id)||[],Be=!Oe.includes(ce.id);return jsxRuntime.jsx(Lo,{column:ce,cards:Ge,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Xe,onCardUpdate:ie,onColumnRename:ue,onColumnDelete:ye,isDeletable:Be,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ce.id)}),c]}),jsxRuntime.jsx(core$1.DragOverlay,{children:te.draggedCardId?jsxRuntime.jsx(Er,{card:e.cards.find(ce=>ce.id===te.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onCardUpdate:pt,theme:K?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:ne?g?.get(ne.id)||[]:[],onUploadAttachments:b,onDeleteAttachment:w,availableTasks:Pe,comments:f,onAddComment:y,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:k,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:C,onTimerStart:W,onTimerStop:H,onTimerDiscard:x})]})}function f0({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 x0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},k0={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},w0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},C0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function T0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),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:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[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((i,c)=>i.position-c.position).map((i,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function N0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[l,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let g=b=>{i.current&&!i.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon: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,b)=>{if(b){m(g);try{await b();}catch(w){console.error(`Export ${g} failed:`,w);}finally{m(null),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:{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,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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 D0({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, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function xi({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?x0:k0,d={...o==="es"?w0:C0,...i},p=n||l||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(N0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsxRuntime.jsx(T0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsxRuntime.jsx(D0,{onClick:()=>t(),label:a||d.newTask}))]})})}function wi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[l,m]=react.useState(""),i=react.useCallback(()=>{let p=l.trim();p&&(e(p),m(""),n(false));},[l,e]),c=react.useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);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:l,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.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:()=>{m(""),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 Ci({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=react.useState(false),[d,p]=react.useState(false),[g,b]=react.useState(""),[w,f]=react.useState([]),[y,h]=react.useState(""),[v,T]=react.useState(""),[D,N]=react.useState(""),[E,k]=react.useState(false),[R,I]=react.useState(false),[C,W]=react.useState(false),H=react.useRef(null),x=react.useRef(null),te={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},oe=react.useCallback(()=>{b(""),f([]),h(""),T(""),N(""),k(false),I(false),W(false),c(false);},[]);react.useEffect(()=>{i&&H.current&&H.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let L=U=>{x.current&&!x.current.contains(U.target)&&(g.trim()||oe());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,g,oe]);let ne=react.useCallback(async()=>{let L=g.trim();if(!(!L||d)){p(true);try{await t({name:L,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:v?new Date(v):void 0,priority:D||void 0}),b(""),f([]),h(""),T(""),N(""),k(!1),I(!1),W(!1),H.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{p(false);}}},[g,e,w,y,v,D,t,d]),A=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),ne()):L.key==="Escape"&&oe();},[ne,oe]),ke=react.useCallback(L=>{f(U=>U.includes(L)?U.filter(S=>S!==L):[...U,L]);},[]),Ie=l==="dark";return i?jsxRuntime.jsxs("div",{ref:x,className:u("rounded-lg overflow-hidden shadow-lg",Ie?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:H,type:"text",value:g,onChange:L=>b(L.target.value),onKeyDown:A,placeholder:te.placeholder,disabled:d,className:u("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ie?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>k(!E),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||w.length>0?"bg-emerald-500/20 text-emerald-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>I(!R),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||v?"bg-blue-500/20 text-blue-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>W(!C),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ie?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:te.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ne,disabled:!g.trim()||d,className:u("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):te.save})]})]}),E&&a.length>0&&jsxRuntime.jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>ke(L.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(L.id)?"bg-emerald-500 text-white":Ie?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:u("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),R&&jsxRuntime.jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:L=>h(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ie?"text-gray-500":"text-gray-400"),children:te.endDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:L=>T(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ie?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ie?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>N(D===L?"":L),className:u("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Ie?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:te[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),disabled:n,className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ie?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:te.buttonLabel})]})}var ln=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(_r,{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 $c(e={}){return new ln(e)}var Ro=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 Ti(e,t){let a=r=>jsxRuntime.jsx(Ro,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Di({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[d,p]=react.useState(false),[g,b]=react.useState(""),[w,f]=react.useState("home"),[y,h]=react.useState(""),[v,T]=react.useState("");react.useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(I=>!I)),R.key==="Escape"&&(p(false),f("home"),b(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{d||(f("home"),b(""),h(""),T(""));},[d]);let D=react.useCallback(()=>{p(false);},[]),N=react.useCallback(k=>{let[R,I]=k.split(":");switch(R){case "create-card":f("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),D()):f("navigate");break;case "search":r?.(g),D();break;case "priority":f("priority");break;case "set-priority":v&&I&&(o?.(v,I),D());break;case "assign":f("assign");break;case "assign-user":v&&I&&(s?.(v,I),D());break;case "ai":f("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":m?.(),D();break;case "back":f("home");break;}},[g,v,t,a,r,o,s,n,l,m,D]),E=react.useCallback(()=>{y&&g.trim()&&(t?.(y,g.trim()),D());},[y,g,t,D]);return d?jsxRuntime.jsx(yt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${c}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:b,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:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&w==="create-card"&&y&&E();}}),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."}),w==="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:N,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:N,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:N,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:N,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:N,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"?"#3B82F6":"#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(R=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:R},R))})]},k.id))})]}),w==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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))})]}),w==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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 R=e.columns.find(I=>I.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:N,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"?"#3B82F6":"#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:R?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),w==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 Hc(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;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let
|
|
41
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(d.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,d.onclick=
|
|
51
|
+
`,d.onclick=b=>b.stopPropagation(),a.forEach((b,w)=>{let f=document.createElement("button");f.className=`attachment-lightbox-dot ${w===r?"active":""}`,f.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
55
|
-
background: ${
|
|
55
|
+
background: ${w===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,
|
|
59
|
+
`,f.onclick=y=>{y.stopPropagation(),i(),o(w);},d.appendChild(f);});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;
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,
|
|
72
|
+
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=b=>{b.stopPropagation();let w=r>0?r-1:a.length-1;i(),o(w);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=y=>{y.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(u),n.appendChild(f);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Ff(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 Af(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 ri(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[m,i]=react.useState(false),[c,d]=react.useState(null),u=react.useRef(null),f=react.useRef(e);f.current=e;let y=react.useCallback((C,A)=>{A.preventDefault(),A.stopPropagation();let I=f.current.filter(R=>ri(R.type)),N=I.findIndex(R=>R.id===C.id),O=R=>{let _=f.current.filter(te=>ri(te.type)),se=_[R];se&&dc(se.url,se.name,_,R,O);};dc(C.url,C.name,I,N,O);},[]),k=react.useCallback(C=>{let A=[],I=[];return e.length+C.length>s?(I.push(`Maximum ${s} files allowed`),{valid:A,errors:I}):(C.forEach(N=>{if(N.size/1048576>r){I.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>N.type.match(R))){I.push(`${N.name} has invalid file type`);return}A.push(N);}),{valid:A,errors:I})},[e.length,s,r,o]),g=react.useCallback(async C=>{let{valid:A,errors:I}=k(C);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(A.length!==0){i(true),d(null);try{await t?.(A);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),v=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),h=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),p=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let A=Array.from(C.dataTransfer.files);g(A);},[g]),x=react.useCallback(C=>{let A=C.target.files?Array.from(C.target.files):[];g(A),u.current&&(u.current.value="");},[g]),S=react.useCallback(()=>{u.current?.click();},[]),T=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:p,onDrop:w,onClick:S,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?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"]})]})})]}),c&&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:c})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:ri(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:A=>y(C,A),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:Af(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Ff(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(C.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"})})})]},C.id))})]})}function oi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:u,onDeleteAttachment:f,onSuggestAssignee:y,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,p]=react.useState("details"),[w,x]=react.useState(false),[S,T]=react.useState({}),[C,A]=react.useState(""),[I,N]=react.useState(false),[O,R]=react.useState({});if(!t||!e)return null;let _=react.useCallback(()=>{x(false),T({}),p("details"),A(""),R({}),a();},[a]),se=react.useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),T({}),x(false));},[e.id,S,r]),te=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),_());},[e.id,o,_]),ie=react.useCallback(()=>{c&&C.trim()&&(c(e.id,C.trim()),A(""));},[e.id,C,c]),xe=react.useCallback(async()=>{if(y){N(true);try{let E=await y(e);R(W=>({...W,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{N(false);}}},[e,y]),Ne=react.useCallback(async()=>{if(k){N(true);try{let E=await k(e);R(W=>({...W,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{N(false);}}},[e,k]),Ae=react.useCallback(async()=>{if(g){N(true);try{let E=await g(e);R(W=>({...W,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{N(false);}}},[e,g]),F={...e,...S},B=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:_,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsxRuntime.jsx("input",{type:"text",value:S.title??F.title,onChange:E=>T({...S,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:se,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>x(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:te,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:_,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:()=>p("details"),className:`card-detail-tab ${h==="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:()=>p("comments"),className:`card-detail-tab ${h==="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:()=>p("activity"),className:`card-detail-tab ${h==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>p("attachments"),className:`card-detail-tab ${h==="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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>p("ai"),className:`card-detail-tab ${h==="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:[h==="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"}),w?jsxRuntime.jsx("textarea",{value:S.description??F.description??"",onChange:E=>T({...S,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsxRuntime.jsx("select",{multiple:true,value:S.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let W=Array.from(E.target.selectedOptions,q=>q.value);T({...S,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:B.length>0?B.map(E=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsxRuntime.jsx("span",{children:E.name})]},E.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"}),w?jsxRuntime.jsxs("select",{value:S.priority??F.priority??"",onChange:E=>T({...S,priority:E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:F.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:F.labels&&F.labels.length>0?F.labels.map(E=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:E},E)):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"}),w?jsxRuntime.jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsxRuntime.jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??F.estimatedTime??"",onChange:E=>T({...S,estimatedTime:E.target.value?parseFloat(E.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:F.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:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let W=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:E=>A(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ie,disabled:!C.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(E=>{let W=s.find(q=>q.id===E.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:[W&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(E.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:E.content})]},E.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"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(E=>{let W=s.find(q=>q.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:W?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(dr,{cardId:e.id,attachments:i,onUpload:u?E=>u(e.id,E):void 0,onDelete:f,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="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:xe,disabled:I||!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:Ne,disabled:I||!k,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:Ae,disabled:I||!g,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"]})]}),O.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),O.assignees.map((E,W)=>{let q=s.find(pe=>pe.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:q?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},W)})]}),O.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),O.subtasks.map((E,W)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},W))]}),O.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:[O.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(O.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!O.assignees&&!O.subtasks&&!O.effort&&m.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 jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),u=window.innerHeight,f=window.innerWidth,y=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=u-d.bottom,v=d.top,h;return g>=s+y?h=d.bottom+y:v>=s+y?h=d.top-s-y:g>=v?h=d.bottom+y:h=Math.max(10,d.top-s-y),{top:h,left:k}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let d=f=>{let y=f.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},u=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(u),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(gt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var et={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var $f=["LOW","MEDIUM","HIGH","URGENT"],Hf=["todo","in-progress","review","done"];function ii({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:u,onAIFindSimilar:f,availableColumns:y=[],availableLabels:k=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:p,theme:w,onSubtasksChange:x,attachments:S=[],onUploadAttachments:T,onDeleteAttachment:C}){let A=uo(),I=w||A?.themeName||"dark",[N,O]=react.useState(e),[R,_]=react.useState(false),[se,te]=react.useState(e?.subtasks||[]),[ie,xe]=react.useState(false),[Ne,Ae]=react.useState(""),[F,B]=react.useState(""),[E,W]=react.useState("all"),[q,pe]=react.useState(false),[fe,Ce]=react.useState(false),[Y,V]=react.useState(false),[Oe,ue]=react.useState(false),[Le,Je]=react.useState(false),[st,Ge]=react.useState(false),bt=react.useRef(null),ut=react.useRef(null),Pt=react.useRef(null),ge=react.useRef(null),L=react.useRef(null),re=react.useRef(null),Te=react.useRef(null),Ue=react.useRef(null),Z=react.useRef(null),Re=react.useRef(null),H=react.useRef(null),K=react.useRef(null);react.useEffect(()=>{e&&!N?(O({...e}),te(e.subtasks||[])):e&&N&&e.id!==N.id&&(O({...e}),te(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let z=le=>{let D=le.target;ge.current&&!ge.current.contains(D)&&pe(false),L.current&&!L.current.contains(D)&&Ce(false),re.current&&!re.current.contains(D)&&V(false),Te.current&&!Te.current.contains(D)&&ue(false);};if(q||fe||Y||Oe)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[q,fe,Y,Oe]),react.useEffect(()=>{if(!t)return;let z=le=>{let D=le.target,Q=D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable;if(le.key==="Escape"){le.preventDefault(),q||fe||Y||Oe||Le||st?(pe(false),Ce(false),V(false),ue(false),Je(false),Ge(false)):Q||a();return}if(Q&&le.key!=="Escape")return;let ce=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),pe(true);break;case "a":le.preventDefault(),V(true);break;case "p":le.preventDefault(),Ce(true);break;case "l":le.preventDefault(),ue(true);break;case "d":ce||(le.preventDefault(),Je(true),setTimeout(()=>Ue.current?.focus(),0));break;case "e":ce||(le.preventDefault(),Ge(true));break;case "i":le.preventDefault(),_(true),setTimeout(()=>ut.current?.focus(),0);break;case "t":le.preventDefault(),xe(true);break;case "c":le.preventDefault(),Pt.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,q,fe,Y,Oe,Le,st]);let ke=react.useCallback(z=>{let le=z.currentTarget.textContent?.trim()||"";if(N&&le!==N.title){let D={...N,title:le};O(D),r?.(N.id,{title:le});}},[N,r]),Ie=react.useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=N?.title||"",z.currentTarget.blur());},[N]),_e=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),_(false);},[N,e,r]),We=react.useCallback(z=>{if(N){let le={...N,columnId:z};O(le),r?.(N.id,{columnId:z}),pe(false);}},[N,r]),ne=react.useCallback(z=>{if(N){let le={...N,priority:z};O(le),r?.(N.id,{priority:z}),Ce(false);}},[N,r]),Be=react.useCallback(z=>{if(N){let le=N.assignedUserIds||[],D=le.includes(z)?le.filter(ce=>ce!==z):[...le,z],Q={...N,assignedUserIds:D};O(Q),r?.(N.id,{assignedUserIds:D});}},[N,r]),ee=react.useCallback(z=>{if(N){let le=N.labels||[],D=le.includes(z)?le.filter(ce=>ce!==z):[...le,z],Q={...N,labels:D};O(Q),r?.(N.id,{labels:D});}},[N,r]),Ye=react.useCallback(z=>{if(N){let le={...N,tags:z};O(le),r?.(N.id,{tags:z});}},[N,r]),Pa=react.useCallback(z=>{if(N){let le=z.target.value,D={...N,endDate:le};O(D),r?.(N.id,{endDate:le}),Je(false);}},[N,r]),be=react.useCallback(z=>{if(N){let le={...N,estimatedTime:parseFloat(z)||0};O(le),r?.(N.id,{estimatedTime:parseFloat(z)||0});}},[N,r]),qe=react.useCallback(()=>{if(Ne.trim()&&N){let z={id:`subtask-${Date.now()}`,title:Ne.trim(),completed:false,createdAt:new Date},le=[...se,z];te(le),Ae(""),xe(false),x?.(N.id,le);}},[Ne,se,N,x]),He=react.useCallback(z=>{let le=se.map(D=>D.id===z?{...D,completed:!D.completed,updatedAt:new Date}:D);te(le),N&&x?.(N.id,le);},[se,N,x]),Ze=react.useCallback(z=>{let le=se.filter(D=>D.id!==z);te(le),N&&x?.(N.id,le);},[se,N,x]),rt=react.useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),B(""));},[F,N,m]),it=react.useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),rt());},[rt]),G=z=>jsxRuntime.jsx(Of__default.default,{remarkPlugins:[zf__default.default],rehypePlugins:[Uf__default.default],components:{a:({node:le,...D})=>jsxRuntime.jsx("a",{...D,target:"_blank",rel:"noopener noreferrer"})},children:z}),X=l.filter(z=>E==="comments"?z.type.includes("COMMENT"):E==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=N||e,Ke=s.filter(z=>Pe.assignedUserIds?.includes(z.id)),ze=se.filter(z=>z.completed).length;return jsxRuntime.jsx(gt,{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:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:bt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ke,onKeyDown:Ie,children:Pe.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:ge,children:[jsxRuntime.jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>pe(!q),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:Pe.columnId||"No status"})]}),jsxRuntime.jsx(jo,{triggerRef:Z,isOpen:q,onClose:()=>pe(false),width:250,estimatedHeight:200,children:(y.length>0?y:Hf.map(z=>({id:z,title:z}))).map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===z.id?"active":""}`,onClick:()=>We(z.id),children:z.title},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:re,children:[jsxRuntime.jsxs("button",{ref:Re,className:"modal-v2-field",onClick:()=>V(!Y),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:Ke.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ke.map(z=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:Re,isOpen:Y,onClose:()=>V(false),width:280,estimatedHeight:300,children:s.map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>Be(z.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,Pe.assignedUserIds?.includes(z.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"})})]},z.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:L,children:[jsxRuntime.jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>Ce(!fe),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:Pe.priority||"None"})]}),jsxRuntime.jsxs(jo,{triggerRef:H,isOpen:fe,onClose:()=>Ce(false),width:180,estimatedHeight:220,children:[$f.map(z=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${Pe.priority===z?"active":""}`,onClick:()=>ne(z),children:z},z)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ne(""),children:"None"})]})]}),g.length>0||v?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(Sr,{selectedTags:Pe.tags||[],availableTags:g,onChange:Ye,onCreateTag:v,theme:et[I]||et.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Te,children:[jsxRuntime.jsxs("button",{ref:K,className:"modal-v2-field",onClick:()=>ue(!Oe),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:Pe.labels&&Pe.labels.length>0?jsxRuntime.jsx("span",{children:Pe.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(jo,{triggerRef:K,isOpen:Oe,onClose:()=>ue(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(z)?"active":""}`,onClick:()=>ee(z),children:[z,Pe.labels?.includes(z)&&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"})})]},z))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Je(!Le),setTimeout(()=>Ue.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:Pe.endDate?new Date(Pe.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ue,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let z=new Date(Pe.endDate),le=z.getUTCFullYear(),D=String(z.getUTCMonth()+1).padStart(2,"0"),Q=String(z.getUTCDate()).padStart(2,"0");return `${le}-${D}-${Q}`})():"",onChange:Pa,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ge(!st),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:Pe.estimatedTime?`${Pe.estimatedTime}h`:"Not set"})]}),st&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:z=>be(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ge(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"})]}),R?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:z=>{if(N){let le={...N,description:z.target.value};O(le);}},onBlur:_e,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>_(true),children:Pe.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:G(Pe.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"}),se.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ze,"/",se.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>xe(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:[se.map(z=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>He(z.id),children:z.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:z.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ze(z.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"})]})})]},z.id)),ie&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Ne,onChange:z=>Ae(z.target.value),onKeyDown:z=>{z.key==="Enter"&&qe(),z.key==="Escape"&&(xe(false),Ae(""));},onBlur:qe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||S.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"}),S.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:S.length})]}),jsxRuntime.jsx(dr,{cardId:Pe.id,attachments:S,onUpload:T?z=>T(Pe.id,z):void 0,onDelete:C,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 ${E==="all"?"active":""}`,onClick:()=>W("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>W("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>W("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Pt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:z=>B(z.target.value),onKeyDown:it,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:!F.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[X.map(z=>{let le=s.find(Q=>Q.id===z.userId);if(z.type.includes("COMMENT")){let Q=n.find(ce=>ce.id===z.metadata?.commentId);return Q?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.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:le?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Q.content})]})]},z.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.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:le?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:z.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),X.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 Xf({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 di({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((l,m)=>l+m.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(Xf,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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,l)=>n+l.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,l)=>n+l.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:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function nb({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 ci({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,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;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(nb,{})}),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:i?"#10B981":"#EF4444",fill:i?"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:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:i?"#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:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var gb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},yc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function fb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function vc({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return 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 mi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||gb[m.name]||yc[e.indexOf(m)%yc.length]})),l=n.map(m=>m.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?fb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(vc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.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(vc,{})}),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((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),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:"#3B82F6"},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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var In=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[m,i]=react.useState(false),[c,d]=react.useState(false),[u,f]=react.useState(false);if(e.length===0)return null;let y=e.map(w=>w.id),k=w=>{r.onBulkUpdate?.(y,{priority:w}),l(false);},g=w=>{r.onBulkMove?.(y,w),i(false),a();},v=w=>{r.onBulkUpdate?.(y,{assignedUserIds:w}),d(false);},h=w=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(C=>x.add(C));});let S=Array.from(new Set([...x,...w]));r.onBulkUpdate?.(y,{labels:S}),f(false);},p=()=>{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:()=>l(!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(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(w),children:[jsxRuntime.jsx("span",{className:b("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:p,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"})})]})]})})});In.displayName="BulkOperationsToolbar";function xb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let y=a?.find(k=>k.id===f);n=`assignee-${f}`,l=y?.name||`User ${f}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=u.title,m=u.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function pi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>xb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(Mr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:b("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),u={...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&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Mr,{board:u,callbacks:r,availableUsers:a})})]},i.id)}),l.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 ui=[{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 gi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=ui.find(i=>i.value===e)||ui[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:b("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:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:b("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:ui.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:b("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.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:i.label}),e===i.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:i.description})]})]},i.value))})]})]})}var Ko=[{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 Cb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function Tc(e={}){let{shortcuts:t=Ko,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(m=>{o.current=[...o.current,m];},[]),l=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Cb(i,d)){r&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Nb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Db(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 Sb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Db(e),r=t?Nb(t):"";return a?`${a} + ${r}`:r}function Eb(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 fi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Eb(e);return jsxRuntime.jsxs("div",{className:b("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(([l,m])=>m.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"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>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:i.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:Sb(i)})]},i.action))})]},l))})}),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 bi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=b=>{b.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function A0(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 L0(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 Ei(e){return e.startsWith("image/")}function wr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=react.useState(false),[m,i]=react.useState(false),[c,d]=react.useState(null),p=react.useRef(null),g=react.useRef(e);g.current=e;let b=react.useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let I=g.current.filter(H=>Ei(H.type)),C=I.findIndex(H=>H.id===k.id),W=H=>{let x=g.current.filter(oe=>Ei(oe.type)),te=x[H];te&&Hc(te.url,te.name,x,H,W);};Hc(k.url,k.name,I,C,W);},[]),w=react.useCallback(k=>{let R=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:R,errors:I}):(k.forEach(C=>{if(C.size/1048576>r){I.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(H=>C.type.match(H))){I.push(`${C.name} has invalid file type`);return}R.push(C);}),{valid:R,errors:I})},[e.length,s,r,o]),f=react.useCallback(async k=>{let{valid:R,errors:I}=w(k);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[w,t]),y=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),T=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let R=Array.from(k.dataTransfer.files);f(R);},[f]),D=react.useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];f(R),p.current&&(p.current.value="");},[f]),N=react.useCallback(()=>{p.current?.click();},[]),E=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":""} ${m?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:v,onDrop:T,onClick:N,children:[jsxRuntime.jsx("input",{ref:p,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?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"]})]})})]}),c&&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:c})]}),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:Ei(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>b(k,R),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:L0(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:A0(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:()=>E(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 Pi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:b,onGenerateSubtasks:w,onEstimateEffort:f,currentUserId:y="user-1"}){let[h,v]=react.useState("details"),[T,D]=react.useState(false),[N,E]=react.useState({}),[k,R]=react.useState(""),[I,C]=react.useState(false),[W,H]=react.useState({});if(!t||!e)return null;let x=react.useCallback(()=>{D(false),E({}),v("details"),R(""),H({}),a();},[a]),te=react.useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),E({}),D(false));},[e.id,N,r]),oe=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),x());},[e.id,o,x]),ne=react.useCallback(()=>{c&&k.trim()&&(c(e.id,k.trim()),R(""));},[e.id,k,c]),A=react.useCallback(async()=>{if(b){C(true);try{let S=await b(e);H(K=>({...K,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{C(false);}}},[e,b]),ke=react.useCallback(async()=>{if(w){C(true);try{let S=await w(e);H(K=>({...K,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{C(false);}}},[e,w]),Ie=react.useCallback(async()=>{if(f){C(true);try{let S=await f(e);H(K=>({...K,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{C(false);}}},[e,f]),L={...e,...N},U=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(yt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:x,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),T?jsxRuntime.jsx("input",{type:"text",value:N.title??L.title,onChange:S=>E({...N,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[T?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:te,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(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:oe,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:x,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:()=>v("details"),className:`card-detail-tab ${h==="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:()=>v("comments"),className:`card-detail-tab ${h==="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:()=>v("activity"),className:`card-detail-tab ${h==="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",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${h==="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",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${h==="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:[h==="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"}),T?jsxRuntime.jsx("textarea",{value:N.description??L.description??"",onChange:S=>E({...N,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),T?jsxRuntime.jsx("select",{multiple:true,value:N.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let K=Array.from(S.target.selectedOptions,J=>J.value);E({...N,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:U.length>0?U.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.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"}),T?jsxRuntime.jsxs("select",{value:N.priority??L.priority??"",onChange:S=>E({...N,priority:S.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.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:L.labels&&L.labels.length>0?L.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):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"}),T?jsxRuntime.jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),T?jsxRuntime.jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>E({...N,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),T?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??L.estimatedTime??"",onChange:S=>E({...N,estimatedTime:S.target.value?parseFloat(S.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:L.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:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let K=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):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:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:S=>R(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ne,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(S=>{let K=s.find(J=>J.id===S.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:[K&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(S.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:S.content})]},S.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"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:l.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:l.map(S=>{let K=s.find(J=>J.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.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:K?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.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"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(wr,{cardId:e.id,attachments:i,onUpload:p?S=>p(e.id,S):void 0,onDelete:g,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="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:A,disabled:I||!b,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:ke,disabled:I||!w,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:Ie,disabled:I||!f,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"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((S,K)=>{let J=s.find(ie=>ie.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},K)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((S,K)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},K))]}),W.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:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.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 cn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=react.useState({top:0,left:0}),i=react.useRef(null),c=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,b=4,w=d.left;w+o>g-10&&(w=g-o-10),w<10&&(w=10);let f=p-d.bottom,y=d.top,h;return f>=s+b?h=d.bottom+b:y>=s+b?h=d.top-s-b:f>=y?h=d.bottom+b:h=Math.max(10,d.top-s-b),{top:h,left:w}},[e,o,s]);return react.useEffect(()=>{t&&m(c());},[t,c]),react.useEffect(()=>{if(!t)return;let d=g=>{let b=g.target;i.current&&!i.current.contains(b)&&e.current&&!e.current.contains(b)&&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(yt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var et={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#57534E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var H0=["LOW","MEDIUM","HIGH","URGENT"],W0=["todo","in-progress","review","done"];function Ai({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:b=[],availableLabels:w=[],availableTags:f=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:v,theme:T,onSubtasksChange:D,attachments:N=[],onUploadAttachments:E,onDeleteAttachment:k}){let R=Mo(),I=T||R?.themeName||"dark",[C,W]=react.useState(e),[H,x]=react.useState(false),[te,oe]=react.useState(e?.subtasks||[]),[ne,A]=react.useState(false),[ke,Ie]=react.useState(""),[L,U]=react.useState(""),[S,K]=react.useState("all"),[J,ie]=react.useState(false),[ue,ye]=react.useState(false),[Oe,Q]=react.useState(false),[Je,Pe]=react.useState(false),[rt,ut]=react.useState(false),[It,Xe]=react.useState(false),pt=react.useRef(null),ce=react.useRef(null),Ge=react.useRef(null),Be=react.useRef(null),B=react.useRef(null),X=react.useRef(null),ge=react.useRef(null),Ae=react.useRef(null),Ue=react.useRef(null),nt=react.useRef(null),Pt=react.useRef(null),$e=react.useRef(null);react.useEffect(()=>{e&&!C?(W({...e}),oe(e.subtasks||[])):e&&C&&e.id!==C.id&&(W({...e}),oe(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let G=me=>{let _e=me.target;Be.current&&!Be.current.contains(_e)&&ie(false),B.current&&!B.current.contains(_e)&&ye(false),X.current&&!X.current.contains(_e)&&Q(false),ge.current&&!ge.current.contains(_e)&&Pe(false);};if(J||ue||Oe||Je)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[J,ue,Oe,Je]),react.useEffect(()=>{if(!t)return;let G=me=>{let _e=me.target,Tt=_e.tagName==="INPUT"||_e.tagName==="TEXTAREA"||_e.isContentEditable;if(me.key==="Escape"){me.preventDefault(),J||ue||Oe||Je||rt||It?(ie(false),ye(false),Q(false),Pe(false),ut(false),Xe(false)):Tt||a();return}if(Tt&&me.key!=="Escape")return;let gt=me.metaKey||me.ctrlKey;switch(me.key.toLowerCase()){case "s":me.preventDefault(),ie(true);break;case "a":me.preventDefault(),Q(true);break;case "p":me.preventDefault(),ye(true);break;case "l":me.preventDefault(),Pe(true);break;case "d":gt||(me.preventDefault(),ut(true),setTimeout(()=>Ae.current?.focus(),0));break;case "e":gt||(me.preventDefault(),Xe(true));break;case "i":me.preventDefault(),x(true),setTimeout(()=>ce.current?.focus(),0);break;case "t":me.preventDefault(),A(true);break;case "c":me.preventDefault(),Ge.current?.focus();break}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[t,a,J,ue,Oe,Je,rt,It]);let O=react.useCallback(G=>{let me=G.currentTarget.textContent?.trim()||"";if(C&&me!==C.title){let _e={...C,title:me};W(_e),r?.(C.id,{title:me});}},[C,r]),ae=react.useCallback(G=>{G.key==="Enter"&&(G.preventDefault(),G.currentTarget.blur()),G.key==="Escape"&&(G.preventDefault(),G.currentTarget.textContent=C?.title||"",G.currentTarget.blur());},[C]),Le=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),x(false);},[C,e,r]),je=react.useCallback(G=>{if(C){let me={...C,columnId:G};W(me),r?.(C.id,{columnId:G}),ie(false);}},[C,r]),qe=react.useCallback(G=>{if(C){let me={...C,priority:G};W(me),r?.(C.id,{priority:G}),ye(false);}},[C,r]),j=react.useCallback(G=>{if(C){let me=C.assignedUserIds||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,assignedUserIds:_e};W(Tt),r?.(C.id,{assignedUserIds:_e});}},[C,r]),$=react.useCallback(G=>{if(C){let me=C.labels||[],_e=me.includes(G)?me.filter(gt=>gt!==G):[...me,G],Tt={...C,labels:_e};W(Tt),r?.(C.id,{labels:_e});}},[C,r]),Me=react.useCallback(G=>{if(C){let me={...C,tags:G};W(me),r?.(C.id,{tags:G});}},[C,r]),ht=react.useCallback(G=>{if(C){let me=G.target.value,_e={...C,endDate:me};W(_e),r?.(C.id,{endDate:me}),ut(false);}},[C,r]),le=react.useCallback(G=>{if(C){let me={...C,estimatedTime:parseFloat(G)||0};W(me),r?.(C.id,{estimatedTime:parseFloat(G)||0});}},[C,r]),He=react.useCallback(()=>{if(ke.trim()&&C){let G={id:`subtask-${Date.now()}`,title:ke.trim(),completed:false,createdAt:new Date},me=[...te,G];oe(me),Ie(""),A(false),D?.(C.id,me);}},[ke,te,C,D]),De=react.useCallback(G=>{let me=te.map(_e=>_e.id===G?{..._e,completed:!_e.completed,updatedAt:new Date}:_e);oe(me),C&&D?.(C.id,me);},[te,C,D]),Re=react.useCallback(G=>{let me=te.filter(_e=>_e.id!==G);oe(me),C&&D?.(C.id,me);},[te,C,D]),de=react.useCallback(()=>{L.trim()&&C&&m&&(m(C.id,L.trim()),U(""));},[L,C,m]),Ve=react.useCallback(G=>{(G.metaKey||G.ctrlKey)&&G.key==="Enter"&&(G.preventDefault(),de());},[de]),V=G=>jsxRuntime.jsx($0__default.default,{remarkPlugins:[z0__default.default],rehypePlugins:[U0__default.default],components:{a:({node:me,..._e})=>jsxRuntime.jsx("a",{..._e,target:"_blank",rel:"noopener noreferrer"})},children:G}),q=l.filter(G=>S==="comments"?G.type.includes("COMMENT"):S==="history"?!G.type.includes("COMMENT"):true);if(!t||!e)return null;let Se=C||e,Ye=s.filter(G=>Se.assignedUserIds?.includes(G.id)),ze=te.filter(G=>G.completed).length;return jsxRuntime.jsx(yt,{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:G=>G.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:pt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:O,onKeyDown:ae,children:Se.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:Be,children:[jsxRuntime.jsxs("button",{ref:Ue,className:"modal-v2-field",onClick:()=>ie(!J),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:Se.columnId||"No status"})]}),jsxRuntime.jsx(cn,{triggerRef:Ue,isOpen:J,onClose:()=>ie(false),width:250,estimatedHeight:200,children:(b.length>0?b:W0.map(G=>({id:G,title:G}))).map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${Se.columnId===G.id?"active":""}`,onClick:()=>je(G.id),children:G.title},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:X,children:[jsxRuntime.jsxs("button",{ref:nt,className:"modal-v2-field",onClick:()=>Q(!Oe),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:Ye.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Ye.map(G=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:G.color},title:G.name,children:G.initials},G.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(cn,{triggerRef:nt,isOpen:Oe,onClose:()=>Q(false),width:280,estimatedHeight:300,children:s.map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Se.assignedUserIds?.includes(G.id)?"active":""}`,onClick:()=>j(G.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:G.color},children:G.initials}),G.name,Se.assignedUserIds?.includes(G.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"})})]},G.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxRuntime.jsxs("button",{ref:Pt,className:"modal-v2-field",onClick:()=>ye(!ue),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:Se.priority||"None"})]}),jsxRuntime.jsxs(cn,{triggerRef:Pt,isOpen:ue,onClose:()=>ye(false),width:180,estimatedHeight:220,children:[H0.map(G=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${G.toLowerCase()} ${Se.priority===G?"active":""}`,onClick:()=>qe(G),children:G},G)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>qe(""),children:"None"})]})]}),f.length>0||y?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(Gr,{selectedTags:Se.tags||[],availableTags:f,onChange:Me,onCreateTag:y,theme:et[I]||et.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ge,children:[jsxRuntime.jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>Pe(!Je),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:Se.labels&&Se.labels.length>0?jsxRuntime.jsx("span",{children:Se.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(cn,{triggerRef:$e,isOpen:Je,onClose:()=>Pe(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(G=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${Se.labels?.includes(G)?"active":""}`,onClick:()=>$(G),children:[G,Se.labels?.includes(G)&&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"})})]},G))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ut(!rt),setTimeout(()=>Ae.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:Se.endDate?new Date(Se.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ae,type:"date",value:typeof Se.endDate=="string"?Se.endDate.split("T")[0]:Se.endDate?(()=>{let G=new Date(Se.endDate),me=G.getUTCFullYear(),_e=String(G.getUTCMonth()+1).padStart(2,"0"),Tt=String(G.getUTCDate()).padStart(2,"0");return `${me}-${_e}-${Tt}`})():"",onChange:ht,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!It),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:Se.estimatedTime?`${Se.estimatedTime}h`:"Not set"})]}),It&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Se.estimatedTime||"",onChange:G=>le(G.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(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"})]}),H?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:Se.description||"",onChange:G=>{if(C){let me={...C,description:G.target.value};W(me);}},onBlur:Le,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>x(true),children:Se.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:V(Se.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"}),te.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ze,"/",te.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(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:[te.map(G=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${G.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>De(G.id),children:G.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:G.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(G.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"})]})})]},G.id)),ne&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ke,onChange:G=>Ie(G.target.value),onKeyDown:G=>{G.key==="Enter"&&He(),G.key==="Escape"&&(A(false),Ie(""));},onBlur:He,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||N.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"}),N.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:N.length})]}),jsxRuntime.jsx(wr,{cardId:Se.id,attachments:N,onUpload:E?G=>E(Se.id,G):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 ${S==="all"?"active":""}`,onClick:()=>K("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>K("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>K("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Ge,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:G=>U(G.target.value),onKeyDown:Ve,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:de,disabled:!L.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[q.map(G=>{let me=s.find(Tt=>Tt.id===G.userId);if(G.type.includes("COMMENT")){let Tt=n.find(gt=>gt.id===G.metadata?.commentId);return Tt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[me&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:me.color},children:me.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:me?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Tt.content})]})]},G.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[G.type.includes("CREATED")&&"\u2795",G.type.includes("UPDATED")&&"\u270F\uFE0F",G.type.includes("MOVED")&&"\u27A1\uFE0F",G.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",G.type.includes("ASSIGNED")&&"\u{1F464}",G.type.includes("PRIORITY")&&"\u{1F3AF}",G.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:me?.name||"Unknown"})," ",G.type.replace(/_/g," ").toLowerCase(),G.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:G.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(G.timestamp).toLocaleString()})]})]},G.id)}),q.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 J0({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 Ii({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((l,m)=>l+m.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(J0,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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,l)=>n+l.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,l)=>n+l.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:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function sb({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 Bi({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,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;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(sb,{})}),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:i?"#10B981":"#EF4444",fill:i?"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:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#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:m>=50?"#10B981":"#F59E0B"},children:[m.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:i?"#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:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var fb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Xc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function bb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Jc({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 Ri({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||fb[m.name]||Xc[e.indexOf(m)%Xc.length]})),l=n.map(m=>m.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?bb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Jc,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.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(Jc,{})}),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((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),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:"#3B82F6"},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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var as=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=react.useState(false),[m,i]=react.useState(false),[c,d]=react.useState(false),[p,g]=react.useState(false);if(e.length===0)return null;let b=e.map(T=>T.id),w=T=>{r.onBulkUpdate?.(b,{priority:T}),l(false);},f=T=>{r.onBulkMove?.(b,T),i(false),a();},y=T=>{r.onBulkUpdate?.(b,{assignedUserIds:T}),d(false);},h=T=>{let D=new Set;e.forEach(E=>{E.labels?.forEach(k=>D.add(k));});let N=Array.from(new Set([...D,...T]));r.onBulkUpdate?.(b,{labels:N}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(b),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:()=>l(!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(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(T),children:[jsxRuntime.jsx("span",{className:u("asakaa-priority-dot",T==="LOW"&&"bg-asakaa-priority-low",T==="MEDIUM"&&"bg-asakaa-priority-medium",T==="HIGH"&&"bg-asakaa-priority-high",T==="URGENT"&&"bg-asakaa-priority-urgent")}),T]},T))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(T.id),children:T.title},T.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(T=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([T.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:T.color},children:T.initials}),T.name]},T.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(T=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([T]),children:T},T))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,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"})})]})]})})});as.displayName="BulkOperationsToolbar";function kb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let b=a?.find(w=>w.id===g);n=`assignee-${g}`,l=b?.name||`User ${g}`,m=b?.color,i=b?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m,icon:i}),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];l=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Oi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),l=react.useMemo(()=>kb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsxRuntime.jsx(_r,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(g=>i.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&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(_r,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 $i=[{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 zi({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),l=$i.find(i=>i.value===e)||$i[0];react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),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:l.icon}),jsxRuntime.jsx("span",{children:l.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:$i.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.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:i.label}),e===i.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:i.description})]})]},i.value))})]})]})}var mn=[{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 Tb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function am(e={}){let{shortcuts:t=mn,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(m=>{o.current=[...o.current,m];},[]),l=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Tb(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Db(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Sb(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 Eb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Sb(e),r=t?Db(t):"";return a?`${a} + ${r}`:r}function Pb(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 Ui({shortcuts:e=mn,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Pb(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(([l,m])=>m.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"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(i=>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:i.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:Eb(i)})]},i.action))})]},l))})}),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 Hi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,48 +122,48 @@
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function hi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxRuntime.jsxs("div",{className:b("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:b("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(m).map(([i,c])=>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:i})}),jsxRuntime.jsx("div",{children:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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))})]},i)),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 vi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[m,i]=react.useState("json"),[c,d]=react.useState(null),u=react.useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await nd(e,m,k);sd(g,m);},y=async k=>{let g=k.target.files?.[0];if(g){try{let v=await dd(g),h=g.name.endsWith(".json")?"json":"csv",p=ld(v,h);d(p),p.success&&r&&r(p,v);}catch(v){d({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:b("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:()=>l("export"),className:b("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:()=>l("import"),className:b("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(k=>jsxRuntime.jsxs("button",{onClick:()=>i(k),className:b("p-4 rounded-lg border-2 transition-all text-center",m===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),c&&jsxRuntime.jsxs("div",{className:b("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:b("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Lb=["URGENT","HIGH","MEDIUM","LOW"],Ib=[{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"}],Bb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function xi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:u=false,groupBy:f="none",onGroupByChange:y}){let[k,g]=react.useState(true),v=react.useCallback(S=>{a({search:S.target.value});},[a]),h=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),p=react.useCallback(S=>{r({by:S.target.value});},[r]),w=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.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:k?"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"}),x&&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)"]})]}),!k&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:S=>{let T=S.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Lb.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let T=S.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let T=S.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),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:p,className:"filter-bar__select filter-bar__select--sm",children:Ib.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,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:f,onChange:S=>y(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Bb.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),x&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ki({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let u=f=>{f(),c(false);};return jsxRuntime.jsxs("div",{className:b("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,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"})]}),i&&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:()=>u(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 wi={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Ci={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Ti={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"}},to={dark:wi,light:Ci,neutral:Ti},Rn="dark";var On=react.createContext(void 0),Vb="asakaa-theme";function Sc({children:e,defaultTheme:t=Rn,storageKey:a=Vb}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=to[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${jb(c)}`,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(([c,d])=>{let u=m.colors[c];u&&l.style.setProperty(d,u);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:to};return jsxRuntime.jsx(On.Provider,{value:n,children:e})}function wo(){let e=react.useContext(On);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function jb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ni({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxRuntime.jsxs("div",{className:b("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(to).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:b("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 Ec(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var zn={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Pc={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Di={en:zn,es:Pc};function Mc(e){return Di[e]||Di.en}function Si(e,t){let a=Mc(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var To=react.createContext(zn);function Br(){return react.useContext(To)}function uh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=react.useState(false),[i,c]=react.useState(null),d=react.useRef(null),u=Br();if(react.useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let y=[{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(g=>g.handler),k=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:u.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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: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:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(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:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.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 gh({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-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&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 fh({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-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[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 bh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Br();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,c)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function hh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),m=Br();react.useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},y=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u=>{u.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":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:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(u=>{let f=t===u.value&&!r,y=()=>u.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(u.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},u.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function $n({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:u,taskFilter:f="all",onTaskFilterChange:y,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}){let T=Br(),C=v||h||p||w||x||S,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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"})}];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(fh,{options:A,value:t,onChange:N=>a(N),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsxRuntime.jsx(bh,{theme:e,value:l,onChange:m}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(hh,{theme:e,value:f,onChange:y,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||T.toolbar.createTask})]}),(C||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(uh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(gh,{options:I,value:s,onChange:N=>n(N),theme:e})]})]})}function Hn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(gt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,u=8,f=window.innerWidth,y=window.innerHeight,k=t,g=a;t+c+u>f&&(k=t-c,k<u&&(k=u)),a+d+u>y&&(g=y-d-u,g<u&&(g=u)),m({x:k,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},d=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Ot={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"}),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 Uc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:u=true}){let f=react.useRef(false),y=react.useCallback(p=>{f.current=p;},[]),k=react.useCallback(p=>{let w=[],x=S=>{for(let T of S)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),w},[]),g=react.useCallback(()=>{let p=k(e);for(let w of p)if(t.has(w.id))return w;return null},[e,t,k]),v=react.useCallback((p,w)=>{let x=k(e);if(x.length===0)return;let S=g();if(!S){a(x[0].id,false);return}let T=x.findIndex(I=>I.id===S.id);if(T===-1)return;let C=p==="up"?T-1:T+1;if(C<0||C>=x.length)return;let A=x[C];a(A.id,w);},[e,g,k,a]),h=react.useCallback(p=>{if(!u)return;let w=p.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){p.key==="Escape"&&(w.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,C=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){C.length>0&&(p.preventDefault(),n(C,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){C.length>0&&(p.preventDefault(),l(C));return}if(p.key==="Tab"&&p.shiftKey){C.length>0&&(p.preventDefault(),m(C));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),d(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){C.length>0&&(p.preventDefault(),o(C));return}if(p.key==="d"&&T&&!p.shiftKey){C.length>0&&(p.preventDefault(),s(C));return}},[u,t,g,v,r,o,s,n,l,m,i,c,d]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Hc(){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(u=>{let f=new Set(u);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,u)=>{if(!a){o(d);return}let f=u.indexOf(a),y=u.indexOf(d);if(f===-1||y===-1){o(d);return}let k=Math.min(f,y),g=Math.max(f,y),v=u.slice(k,g+1);t(new Set(v)),r(d);},[a,o]),l=react.useCallback((d,u,f,y)=>{y?n(d,u):f?s(d):o(d);},[o,s,n]),m=react.useCallback((d,u)=>{u?t(f=>{let y=new Set(f);return y.add(d),y}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Wc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Wc(a.subtasks,t);if(r)return r}}return null}function Ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ii(a.subtasks,t);if(r)return r}return null}function Bi(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,u)=>{let f=[];return {tasks:d.filter(k=>{if(u.has(k.id))return f.push(k),false;if(k.subtasks){let g=n(k.subtasks,u);k.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,u,f)=>d.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...f],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,u,f)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function Ri(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ii(a,r);if(!o)continue;let s=Ii(a,o.id),n=(i,c,d)=>{for(let u=0;u<i.length;u++){let f=i[u];if(f.id===c&&f.subtasks){let y=f.subtasks.findIndex(k=>k.id===d);if(y!==-1){let[k]=f.subtasks.splice(y,1);return k}}if(f.subtasks){let y=n(f.subtasks,c,d);if(y)return y}}return null},l=(i,c,d)=>{let u=i.findIndex(f=>f.id===c);if(u!==-1)return i.splice(u+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function Oi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function zi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Ui(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function Gc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function $i(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:$i(r.subtasks,t,a)}:r)}function Hi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Hi(a.subtasks,t)}:a)}function Wi(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let u=a(d.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let u=d.subtasks||[];return {...d,subtasks:[...u,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function _c(e,t,a,r){if(t===a)return e;let o=Wc(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,u=[...c];return u.splice(d,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function _n({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:u,onTaskUpdate:f,onTaskIndent:y,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:w,onCreateSubtask:x,onOpenTaskModal:S,onDeleteRequest:T,onTaskReparent:C}){let A=react.useContext(To),[I,N]=react.useState(null),[O,R]=react.useState(null),[_,se]=react.useState(""),te=react.useRef(null),[ie,xe]=react.useState(null),[Ne,Ae]=react.useState(0),[F,B]=react.useState(0),[E,W]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[q,pe]=react.useState(null),[fe,Ce]=react.useState(null),[Y,V]=react.useState(null),Oe=react.useRef(0),ue=5,Le=react.useRef(false),[Je,st]=react.useState(null),[Ge,bt]=react.useState(false),[ut,Pt]=react.useState(null),[ge,L]=react.useState(false),re=react.useRef(null);react.useEffect(()=>{function G(X){re.current&&!re.current.contains(X.target)&&L(false);}if(ge)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[ge]),react.useEffect(()=>{O&&te.current&&(te.current.focus(),te.current.select());},[O]),react.useEffect(()=>{if(!ie)return;let G=Pe=>{let Ke=Pe.clientX-Ne,ze=F+Ke;u?.(ie,ze);},X=()=>{xe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",X),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",X),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ne,F,u]);let{selectedTaskIds:Te,handleTaskClick:Ue,isTaskSelected:Z}=Hc(),{setIsEditing:Re}=Uc({tasks:e,selectedTaskIds:Te,onTaskSelect:(G,X)=>{let Ke=Do(e).map(ze=>ze.id);Ue(G,Ke,X||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:G=>{let X=Do(e).find(Pe=>Pe.id===G);X&&We(X);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:G=>{let X=Do(e).find(Pe=>Pe.id===G);X&&S&&S(X);},enableKeyboard:true}),H=(G,X=0)=>{let Pe=[];for(let Ke of G)Pe.push({task:Ke,level:X}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&Pe.push(...H(Ke.subtasks,X+1));return Pe},K=H(e),ke=48,Ie=Math.max(K.length*a,600-ke),_e=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,We=G=>{R(G.id),se(G.name),Re(true);},ne=G=>{_.trim()&&_!==e.find(X=>X.id===G)?.name&&w?.(G,_.trim()),R(null),se(""),Re(false);},Be=()=>{R(null),se(""),Re(false);},ee=(G,X)=>{X.stopPropagation(),x?.(G.id);},Ye=(G,X)=>{X.preventDefault(),Oe.current=X.clientY,pe(G),Le.current=false,bt(false),st({x:X.clientX,y:X.clientY});},Pa=G=>{if(!q||(Math.abs(G.clientY-Oe.current)>ue&&!Le.current&&(Le.current=true,bt(true)),st({x:G.clientX,y:G.clientY}),!Le.current))return;let Pe=document.querySelectorAll("[data-task-row]"),Ke=null,ze=null;Pe.forEach(z=>{let le=z.getBoundingClientRect(),D=z.getAttribute("data-task-row");if(D&&D!==q&&G.clientY>=le.top&&G.clientY<=le.bottom){Ke=D;let Q=G.clientY-le.top,ce=le.height;Q<ce*.25?ze="above":Q>ce*.75?ze="below":ze="child";}}),Ce(Ke),V(ze);},be=()=>{if(Le.current&&q&&fe&&Y){if(Y==="child")C?.(q,fe);else if(Y==="above"||Y==="below"){let G=(Ke,ze,z=null)=>{for(let le of Ke){if(le.id===ze)return z;if(le.subtasks){let D=G(le.subtasks,ze,le.id);if(D!==void 0)return D}}},X=G(e,fe,null),Pe=(Ke,ze)=>{let z=Ke.findIndex(le=>le.id===ze);return Y==="below"?z+1:z};if(X===null){let Ke=Pe(e,fe);C?.(q,null,Ke);}else {let Ke=K.find(ze=>ze.task.id===X)?.task;if(Ke?.subtasks){let ze=Pe(Ke.subtasks,fe);C?.(q,X,ze);}}}}pe(null),Ce(null),V(null),st(null),Le.current=false,bt(false);};react.useEffect(()=>{if(q)return document.addEventListener("mousemove",Pa),document.addEventListener("mouseup",be),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Pa),document.removeEventListener("mouseup",be),document.body.style.cursor="",document.body.style.userSelect="";}},[q,fe,Y]);let qe=(G,X,Pe)=>{switch(G.id){case "name":let Ke=O===X.id,ze=I===X.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Pe*20}px`},children:[C&&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:ze?1:.3},onMouseDown:de=>Ye(X.id,de),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),X.subtasks&&X.subtasks.length>0?jsxRuntime.jsx("button",{onClick:de=>{de.stopPropagation(),m?.(X.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:X.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:X.color||"#3B82F6",opacity:X.parentId?.6:1,borderColor:X.isMilestone?t.accent:"transparent",borderWidth:X.isMilestone?"2px":"0px"},title:X.isMilestone?"Milestone":X.parentId?"Subtask":"Task"})}),Ke?jsxRuntime.jsx("input",{ref:te,type:"text",value:_,onChange:de=>se(de.target.value),onKeyDown:de=>{de.key==="Enter"?ne(X.id):de.key==="Escape"&&Be();},onBlur:()=>ne(X.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:de=>de.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:X.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:X.parentId?"13px":"14px",fontWeight:X.isMilestone?600:X.parentId?400:600,letterSpacing:X.parentId?"0":"-0.01em"},title:X.name,children:X.name}),ze&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:de=>ee(X,de),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:de=>{de.stopPropagation(),We(X);},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 le=G.id==="startDate"?"startDate":"endDate",D=X[le],Q=ut?.taskId===X.id&&ut?.field===le,ce=de=>de?(typeof de=="string"?new Date(de):de).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:de=>de.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},onClick:de=>{if(Q)Pt(null);else {let Qe=de.currentTarget.getBoundingClientRect();Pt({taskId:X.id,field:le,month:D?typeof D=="string"?new Date(D):D:new Date,position:{top:Qe.bottom+4,left:Qe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ce(D)})]}),Q&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Pt(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:ut?.position.top,left:ut?.position.left},onClick:de=>de.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let de=new Date,Qe=new Date(de);Qe.setDate(de.getDate()+1);let Ve=new Date(de);Ve.setDate(de.getDate()+7);let ar=new Date(de);return ar.setDate(de.getDate()+14),[{label:"Hoy",date:de},{label:"Ma\xF1ana",date:Qe},{label:"Pr\xF3xima semana",date:Ve},{label:"2 semanas",date:ar}].map((kr,rr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:or=>or.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:or=>or.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(X.id,{[le]:kr.date}),Pt(null);},children:kr.label},rr))})(),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:de=>de.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(X.id,{[le]:void 0}),Pt(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:()=>Pt(de=>de?{...de,month:new Date(de.month.getFullYear(),de.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:ut?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Pt(de=>de?{...de,month:new Date(de.month.getFullYear(),de.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((de,Qe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:de},Qe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=ut?.month||new Date,Qe=de.getFullYear(),Ve=de.getMonth(),ar=new Date(Qe,Ve,1).getDay(),Lo=new Date(Qe,Ve+1,0).getDate(),kr=new Date,rr=[];for(let Kt=ar-1;Kt>=0;Kt--)rr.push({day:new Date(Qe,Ve,-Kt).getDate(),date:new Date(Qe,Ve-1,new Date(Qe,Ve,-Kt).getDate()),isCurrentMonth:false});for(let Kt=1;Kt<=Lo;Kt++)rr.push({day:Kt,date:new Date(Qe,Ve,Kt),isCurrentMonth:true});let or=42-rr.length;for(let Kt=1;Kt<=or;Kt++)rr.push({day:Kt,date:new Date(Qe,Ve+1,Kt),isCurrentMonth:false});return rr.map((Kt,Ts)=>{let Ns=Kt.date.toDateString()===kr.toDateString(),Io=(D?typeof D=="string"?new Date(D):D:null)?.toDateString()===Kt.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:Kt.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:Ns&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(X.id,{[le]:Kt.date}),Pt(null);},children:Kt.day},Ts)})})()})]})]})]}),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:_e(X)})});case "assignees":let Xe=r.filter(de=>X.assignees?.some(Qe=>Qe.name===de.name||Qe.initials===de.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(qr,{assignedUsers:Xe,availableUsers:r,onChange:de=>{let Qe=de.map(Ve=>({id:Ve.id,name:Ve.name,initials:Ve.initials,color:Ve.color}));f?.(X.id,{assignees:Qe.length>0?Qe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Ed,{status:X.status||"todo",onChange:de=>{f?.(X.id,{status:de,progress:de==="completed"?100:X.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${X.progress}%`,backgroundColor:X.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:[X.progress,"%"]})]});case "priority":let Ft={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Zt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Dt=Ft[X.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsxRuntime.jsx(Kr,{priority:Dt,onChange:de=>{de&&f?.(X.id,{priority:Zt[de]||"medium"});}})});default:return null}},He=G=>[{id:"hide",label:"Hide Column",icon:Ot.Hide,onClick:()=>d(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ot.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ot.SortDesc,onClick:()=>{}}],Ze=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{x?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{T?T(G.id,G.name):v?.([G.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{n?.(G);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{x?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{f?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{f?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{f?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{T?T(G.id,G.name):v?.([G.id]);}}],rt=c.filter(G=>G.visible),it=rt.reduce((G,X)=>G+X.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:it},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ke}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:rt.map((G,X)=>{let Pe=X===rt.length-1,Ke=G.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ke?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(Ke?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),W({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:G.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.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:G.label,children:G.label}),G.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ie===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),xe(G.id),Ae(ze.clientX),B(G.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"}})})]},G.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(Hn,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>L(!ge),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"})}),ge&&jsxRuntime.jsxs("div",{ref:re,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:G=>G.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:()=>L(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:Ie},children:K.map(({task:G,level:X},Pe)=>{let Ke=Z(G.id),ze=fe===G.id,z=ze&&Y==="above",le=ze&&Y==="below",D=ze&&Y==="child",Q={};return D&&(Q.backgroundColor=`${t.accent}15`,Q.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${q===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:D?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...Q},onMouseEnter:()=>N(G.id),onMouseLeave:()=>N(null),onClick:ce=>{let Ft=Do(e).map(de=>de.id),Dt=navigator.platform.toUpperCase().indexOf("MAC")>=0?ce.metaKey:ce.ctrlKey;Ue(G.id,Ft,Dt,ce.shiftKey),s?.(G);},onDoubleClick:ce=>{ce.stopPropagation(),n?.(G);},onContextMenu:ce=>{ce.preventDefault(),W({isOpen:true,x:ce.clientX,y:ce.clientY,type:"task",task:G}),l?.(G,ce);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:[z&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),rt.map((ce,Xe)=>{let Ft=Xe===rt.length-1,Zt=ce.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Zt?"justify-start":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(Zt?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ft?"none":`1px solid ${I===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:qe(ce,G,Zt?X:0)},`${G.id}-${ce.id}`)})]},G.id)})}),jsxRuntime.jsx(No,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?He(E.columnId):E.type==="task"&&E.task?Ze(E.task):[],onClose:()=>W({...E,isOpen:false}),theme:t}),Ge&&Je&&q&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=K.find(X=>X.task.id===q)?.task;return G?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:G.name})}):null})()}),document.body)]})}function qc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[m,i]=react.useState(t),[c,d]=react.useState(null),[u,f]=react.useState(null),[y,k]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(0),[w,x]=react.useState(0),[S,T]=react.useState(null),[C,A]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:u,setHoveredTaskId:f,activeZone:y,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:w,setSegmentDragOffsetX:x,hoveredSegmentIndex:S,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(_,se)=>{r("none"),d(null),f(null),l(_),i(se),x(0),v(null),p(0);}}}function jn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:u,allTaskPositions:f=[],onDragMove:y,onHoverChange:k}){let g=qc(t,r),v=react.useRef(null),h=react.useRef(null),p=react.useRef(null),{dragMode:w,setDragMode:x,dragOffset:S,setDragOffset:T,ghostX:C,setGhostX:A,ghostWidth:I,setGhostWidth:N,connectionLine:O,setConnectionLine:R,hoveredTaskId:_,setHoveredTaskId:se,activeZone:te,setActiveZone:ie,draggedSegmentIndex:xe,setDraggedSegmentIndex:Ne,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:B,setSegmentDragOffsetX:E,hoveredSegmentIndex:W,setHoveredSegmentIndex:q,isHovered:pe,setIsHovered:fe,isDragging:Ce,isResizing:Y,isConnecting:V,resetDragState:Oe}=g,ue=32,Le=8,Je=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,Ge=o.name==="neutral"||o.today==="#1C1917",bt=e.status==="completed"||e.progress===100,ut={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ge=e.isCriticalPath||Je?"#DC2626":e.color?e.color:e.priority&&ut[e.priority]?ut[e.priority]:o.taskBarPrimary,re=(be=>be>=80?20:be>=60?15:be>=50?12:10)(r),Te=r<50,Ue=r<40;react.useEffect(()=>{if(k)if(pe&&!Ce&&!e.segments){let be=a<100;k({task:e,x:t,y:a,width:r,height:ue,showBelow:be});}else k(null);},[pe,Ce,e,t,a,r,ue,k]);let Z=be=>be.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Re=()=>{let be=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${be} day${be!==1?"s":""}`},H=be=>Math.round(be/s)*s,K=be=>{let qe=Math.round(be/s),He=new Date(n);return He.setDate(He.getDate()+qe),He},ke=(be,qe)=>{for(let He of f){if(He.id===e.id)continue;let Ze=5;if(be>=He.x-Ze&&be<=He.x+He.width+Ze&&qe>=He.y-Ze&&qe<=He.y+He.height+Ze)return He.id}return null},Ie=react.useCallback((be,qe,He)=>{be.preventDefault(),be.stopPropagation();let Ze=v.current?.ownerSVGElement;if(!Ze)return;let rt=Ze.createSVGPoint();rt.x=be.clientX,rt.y=be.clientY;let it=rt.matrixTransform(Ze.getScreenCTM()?.inverse()),G=He!==void 0?He:t,X=qe;if(!X){let Pe=it.x-G;be.shiftKey?(X="connect",R({x:t+r,y:a+ue/2})):be.ctrlKey||be.metaKey?X="move":be.altKey?X=Pe<r/2?"resize-start":"resize-end":Ue?Pe<r/2?X="move":X="resize-end":Te?Pe<=re/2?X="resize-start":Pe>=r-re/2?X="resize-end":X="move":Pe<=re?X="resize-start":Pe>=r-re?X="resize-end":X="move";}x(X),fe(false),ie(null),X==="move"?T(it.x-G):X==="connect"?R({x:t+r,y:a+ue/2}):T(0),A(G),N(r);},[t,r,a,ue]),_e=react.useCallback(be=>{let qe=v.current?.ownerSVGElement;if(!qe)return;let He=qe.closest(".gantt-timeline-scroll");if(!He)return;let Ze=He.getBoundingClientRect(),rt=60,it=15,G=0;if(be.clientX<Ze.left+rt){let X=Ze.left+rt-be.clientX;G=-Math.min(it,X/2);}else if(be.clientX>Ze.right-rt){let X=be.clientX-(Ze.right-rt);G=Math.min(it,X/2);}return G!==0&&(He.scrollLeft+=G),G!==0},[]),We=react.useCallback(be=>{if(w==="none")return;p.current=be;let qe=v.current?.ownerSVGElement;if(!qe)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let rt=_e(be);rt&&!h.current?h.current=window.setInterval(()=>{p.current&&(_e(p.current),We(p.current));},16):!rt&&h.current&&(window.clearInterval(h.current),h.current=null);}let He=qe.createSVGPoint();He.x=be.clientX,He.y=be.clientY;let Ze=He.matrixTransform(qe.getScreenCTM()?.inverse());if(w==="connect"){R({x:Ze.x,y:Ze.y});let rt=ke(Ze.x,Ze.y);se(rt);}else if(w==="move"){let rt=Ze.x-S,it=H(rt);A(it),N(r);let G=Math.round((it-t)/s);if(y?.(e.id,G,true),e.segments&&e.segments.length>0&&xe!==null){let X=it-Ae;E(X);}}else if(w==="resize-start"){let rt=Ze.x,it=H(rt),G=t+r-it;G>=s&&(A(it),N(G));}else if(w==="resize-end"){let rt=Ze.x,G=H(rt)-t;G>=s&&N(G);}},[w,t,r,s,S,e,H,xe,Ae,ke,se,R,A,N,E,y,_e]),ne=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,w!=="none"){if(w==="connect")_&&u&&u(e,_),R(null),se(null);else {let be=e.endDate.getTime()-e.startDate.getTime(),qe,He,Ze=true;if(w==="move"){if(qe=K(C),He=new Date(qe.getTime()+be),e.segments&&e.segments.length>0&&xe!==null){let rt=Math.round(B/s),it=e.segments.map((Ke,ze)=>{if(ze===xe){let z=new Date(Ke.startDate),le=new Date(Ke.endDate);return z.setDate(z.getDate()+rt),le.setDate(le.getDate()+rt),{startDate:z,endDate:le}}return Ke}),G=it.flatMap(Ke=>[Ke.startDate,Ke.endDate]),X=new Date(Math.min(...G.map(Ke=>Ke.getTime()))),Pe=new Date(Math.max(...G.map(Ke=>Ke.getTime())));d?.({...e,segments:it},X,Pe),Oe(t,r);return}}else w==="resize-start"?(qe=K(C),He=e.endDate,qe>He&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ze=false)):w==="resize-end"?(qe=e.startDate,He=K(C+I),He<qe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ze=false)):Ze=false;Ze&&qe&&He&&(He.getTime()<qe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,qe,He));}y?.(e.id,0,false),Oe(t,r);}},[w,C,I,e,d,_,u,t,r,s,K,B,xe,Oe,y]);react.useEffect(()=>{if(w==="none")return;let be=He=>{We(He);},qe=()=>{ne();};return window.addEventListener("mousemove",be),window.addEventListener("mouseup",qe),()=>{window.removeEventListener("mousemove",be),window.removeEventListener("mouseup",qe),h.current&&(window.clearInterval(h.current),h.current=null);}},[w,We,ne]);let Be=Ce&&!V?C:t,ee=Ce&&!V?I:r,Ye=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!Ce&&m?.(e),onDoubleClick:be=>{Ce||(be.stopPropagation(),i?.(e));},onContextMenu:be=>{be.preventDefault(),c?.(e,be);},onMouseEnter:()=>!Ce&&fe(true),onMouseLeave:()=>{Ce||(fe(false),ie(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ue,fill:"transparent",style:{pointerEvents:"all"}}),pe&&!Ce&&!Te&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:re,height:ue,fill:te==="resize-start"?o.accent:"transparent",opacity:te==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:be=>Ie(be,"resize-start")}),jsxRuntime.jsx("rect",{x:t+re,y:a,width:r-re*2,height:ue,fill:te==="move"?o.accent:"transparent",opacity:te==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:be=>Ie(be,"move")}),jsxRuntime.jsx("rect",{x:t+r-re,y:a,width:re,height:ue,fill:te==="resize-end"?o.accent:"transparent",opacity:te==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:be=>Ie(be,"resize-end")})]}),pe&&!Ce&&Ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ue,fill:te==="move"?o.accent:"transparent",opacity:te==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:be=>Ie(be,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ue,fill:te==="resize-end"?o.accent:"transparent",opacity:te==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:be=>Ie(be,"resize-end")}),pe&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ue-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ce&&!V&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:C,y:a,width:I,height:ue,rx:Le,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Be,y:a,width:ee,height:ue,rx:Le,fill:ge,"data-task-class":Ye,initial:{opacity:0,scale:.95},animate:{opacity:Ce&&!V?.15:e.parentId?.6:pe?.9:.8,scale:pe&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:be=>Ie(be),style:{cursor:Ce?V?"crosshair":Y?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Be,y:a,width:ee*(e.progress/100),height:ue,rx:Le,fill:ge,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((be,qe)=>{let He=(be.startDate.getTime()-n.getTime())/864e5*s,rt=(be.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-He+s,it=Ce&&w==="move"&&xe===qe,G=W===qe,X=it?He+B:He;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Ce&&q(qe),onMouseLeave:()=>!Ce&&q(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:X,y:a,width:rt,height:ue,rx:Le,fill:ge,initial:{opacity:0,scale:.95},animate:{opacity:it||e.parentId?.6:G?.9:.8,scale:G&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Pe=>{Pe.stopPropagation(),Ne(qe),F(He),Ie(Pe,void 0,He);},style:{cursor:Ce?V?"crosshair":Y?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:X,y:a,width:rt*(e.progress/100),height:ue,rx:Le,fill:ge,opacity:1,style:{pointerEvents:"none"}})]},`segment-${qe}`)}),Ge&&(Je||st)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[st&&!Je&&jsxRuntime.jsx("rect",{x:Be,y:a,width:ee,height:ue,rx:Le,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Je&&jsxRuntime.jsx("rect",{x:Be,y:a,width:ee,height:ue,rx:Le,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let be=l.taskLabel(e),qe=typeof be=="string"?be:e.name,He=qe.length>Math.floor(ee/8)?`${qe.substring(0,Math.floor(ee/8))}...`:qe;return jsxRuntime.jsx("text",{x:Be+12,y:a+ue/2,dominantBaseline:"middle",fill:bt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:bt?"line-through":"none"},children:He})})(),ee>100&&e.progress>0&&e.progress<100&&!Ce&&!e.segments&&jsxRuntime.jsxs("text",{x:Be+ee-12,y:a+ue/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ee>80&&!Ce&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Be+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Be+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(pe||Y)&&!V&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:Be-2,y:a,width:16,height:ue,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:be=>{be.stopPropagation(),Ie(be,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Be+4,y:a+8,width:3,height:ue-16,rx:1.5,fill:te==="resize-start"||w==="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:Be+ee-14,y:a,width:16,height:ue,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:be=>{be.stopPropagation(),Ie(be,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Be+ee-7,y:a+8,width:3,height:ue-16,rx:1.5,fill:te==="resize-end"||w==="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:pe&&!Ce&&!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+ue/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:be=>{be.stopPropagation(),Ie(be,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ue/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:te==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),V&&O&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ue/2,x2:O.x,y2:O.y,stroke:_?o.statusCompleted:o.accent,strokeWidth:_?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:_?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:O.x,cy:O.y,r:_?8:6,fill:_?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),_&&jsxRuntime.jsx(framerMotion.motion.text,{x:O.x+15,y:O.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:O.x+10},animate:{opacity:1,x:O.x+15},transition:{duration:.2},children:"Connect"})]}),(pe||Ce)&&!V&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Be-2,y:a-2,width:ee+4,height:ue+4,rx:Le+2,fill:"none",stroke:Ce?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:Ce?.6:.4,initial:{opacity:0},animate:{opacity:Ce?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:C,y1:0,x2:C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:C+I,y1:0,x2:C+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&!Ce&&!e.segments&&!k&&(()=>{let He=a<100,Ze=He?a+ue+13:a-82-13,rt=He?`M ${Be+ee/2-6} ${a+ue+3} L ${Be+ee/2} ${a+ue+13} L ${Be+ee/2+6} ${a+ue+3}`:`M ${Be+ee/2-6} ${a-13} L ${Be+ee/2} ${a-3} L ${Be+ee/2+6} ${a-13}`,it=Ze+22,G=Ze+40,X=Ze+55,Pe=Ze+70,Ke=He?Ze+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:He?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:He?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:rt,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Be+ee/2-120,y:Ze,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Be+ee/2,y:it,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:Be+ee/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Be+ee/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.startDate)}),jsxRuntime.jsx("text",{x:Be+ee/2-110,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Be+ee/2-70,y:X,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.endDate)}),jsxRuntime.jsx("text",{x:Be+ee/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Be+ee/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Re()}),jsxRuntime.jsx("text",{x:Be+ee/2+10,y:X,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Be+ee/2+65,y:X,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:Be+ee/2-110,y:Pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Be+ee/2-50,y:Pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!He&&jsxRuntime.jsx("text",{x:Be+ee/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ue?"Left: move \u2022 Right: resize":Te?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Zc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:l}=e,m=82,i=13,c=l?o+n+i:o-m-i,d=l?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,u=c+22,f=c+40,y=c+55,k=c+70,g=w=>w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let w=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${w} day${w!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:l?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:l?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:u,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(w=>w.name).join(", ").substring(0,30),a.assignees.map(w=>w.name).join(", ").length>30?"...":""]})]})]})})}function qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=react.useState(false),[c,d]=react.useState(null),u=r-t,f=u>0,y=Math.abs(u)<5,k=20,g=!y&&a<=e,v,h,p=a-e,w=e+p/2;if(h=w,n==="squared")if(y)v=`M ${e} ${t} L ${a} ${r}`;else if(g){let ie=e+15,xe=a-k,Ne=f?t+20:t-20;h=xe,v=`M ${e} ${t} L ${ie} ${t} L ${ie} ${Ne} L ${xe} ${Ne} L ${xe} ${r} L ${a} ${r}`;}else h=a-k,v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else v=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let x=5,S=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,C=o.dependencyHover||T,A="#f87171",I="rgba(248, 113, 113, 0.15)",N=h,O=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),O=t;else if(g){let te=e+15,ie=a-k,xe=f?t+20:t-20,Ne=[[e,t,te,t],[te,t,te,xe],[te,xe,ie,xe],[ie,xe,ie,r],[ie,r,a,r]],Ae=1/0,F={x:N,y:O};for(let B of Ne){let E=R(c.x,c.y,B[0],B[1],B[2],B[3]),W=Math.hypot(c.x-E.x,c.y-E.y);W<Ae&&(Ae=W,F=E);}N=F.x,O=F.y;}else {let te=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ie=1/0,xe={x:N,y:O};for(let Ne of te){let Ae=R(c.x,c.y,Ne[0],Ne[1],Ne[2],Ne[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<ie&&(ie=F,xe=Ae);}N=xe.x,O=xe.y;}function R(te,ie,xe,Ne,Ae,F){let B=Ae-xe,E=F-Ne,W=B*B+E*E;if(W===0)return {x:xe,y:Ne};let q=((te-xe)*B+(ie-Ne)*E)/W;return q=Math.max(0,Math.min(1,q)),{x:xe+q*B,y:Ne+q*E}}let _=te=>{let ie=te.currentTarget.ownerSVGElement;if(!ie)return;let xe=ie.getBoundingClientRect();d({x:te.clientX-xe.left,y:te.clientY-xe.top});},se=()=>{i(false),d(null);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:se,onMouseMove:_,children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:C,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:te=>{te.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:O,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:O-3,x2:N+3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:O-3,x2:N-3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:se,onMouseMove:_,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:v,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?C:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:te=>{te.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:N,cy:O,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:O-3,x2:N+3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:O-3,x2:N-3,y2:O+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Jn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,m=i=>i.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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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:m(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 ve={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ve.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ve.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ve.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=ve.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(`
|
|
126
|
-
`)},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=
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Wi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[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(m).map(([i,c])=>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:i})}),jsxRuntime.jsx("div",{children:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(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))})]},i)),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 Vi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[m,i]=react.useState("json"),[c,d]=react.useState(null),p=react.useRef(null);if(!t)return null;let g=async()=>{let w=o?.current||void 0,f=await Fd(e,m,w);Ad(f,m);},b=async w=>{let f=w.target.files?.[0];if(f){try{let y=await Bd(f),h=f.name.endsWith(".json")?"json":"csv",v=Id(y,h);d(v),v.success&&r&&r(v,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.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:()=>l("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:()=>l("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(w=>jsxRuntime.jsxs("button",{onClick:()=>i(w),className:u("p-4 rounded-lg border-2 transition-all text-center",m===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),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:b,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"})]})]}),c&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",c.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",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((w,f)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},f))})]})]})]})]})]})}var Ib=["URGENT","HIGH","MEDIUM","LOW"],Bb=[{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"}],Rb=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function _i({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:b}){let[w,f]=react.useState(true),y=react.useCallback(N=>{a({search:N.target.value});},[a]),h=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),v=react.useCallback(N=>{r({by:N.target.value});},[r]),T=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>f(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.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:w?"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"}),D&&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)"]})]}),!w&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,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:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,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:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ib.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:Bb.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:T,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),b&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:N=>b(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Rb.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ji({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=b=>{d.current&&!d.current.contains(b.target)&&c(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),c(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,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"})]}),i&&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 l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 Ki={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Yi={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},qi={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"}},yo={dark:Ki,light:Yi,neutral:qi},os="dark";var ns=react.createContext(void 0),jb="asakaa-theme";function nm({children:e,defaultTheme:t=os,storageKey:a=jb}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Kb(c)}`,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(([c,d])=>{let p=m.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsxRuntime.jsx(ns.Provider,{value:n,children:e})}function Uo(){let e=react.useContext(ns);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Kb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xi({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Uo();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(yo).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 sm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var ss={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},im={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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Ji={en:ss,es:im};function lm(e){return Ji[e]||Ji.en}function Zi(e,t){let a=lm(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 Wo=react.createContext(ss);function Xr(){return react.useContext(Wo)}function gh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=react.useState(false),[i,c]=react.useState(null),d=react.useRef(null),p=Xr();if(react.useEffect(()=>{let f=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),!(t||a||r||o||s||n))return null;let b=[{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),w=async(f,y)=>{if(y){c(f);try{await y();}catch(h){console.error(`Export ${f} failed:`,h);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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: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:b.map((f,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(f.id,f.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<b.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===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-4 h-4"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function fh({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-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&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 bh({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-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[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 hh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Xr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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 left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,c)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function yh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),m=Xr();react.useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let g=w=>{l.current&&!l.current.contains(w.target)&&n(false);},b=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",g),document.addEventListener("keydown",b),l._cleanup=()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p=>{p.stopPropagation(),n(g=>!g);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":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:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(p=>{let g=t===p.value&&!r,b=()=>p.value==="all"?g?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:g?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${g?p.color:"text-gray-400"} flex-shrink-0`,children:b()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),g&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function ls({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:b,hideCompleted:w=false,onHideCompletedChange:f,onExportPNG:y,onExportPDF:h,onExportExcel:v,onExportCSV:T,onExportJSON:D,onExportMSProject:N}){let E=Xr(),k=y||h||v||T||D||N,R=[{value:"day",label:E.toolbar.day},{value:"week",label:E.toolbar.week},{value:"month",label:E.toolbar.month}],I=[{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"})}];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(bh,{options:R,value:t,onChange:C=>a(C),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsxRuntime.jsx(hh,{theme:e,value:l,onChange:m}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(yh,{theme:e,value:g,onChange:b,hideCompleted:w,onHideCompletedChange:f})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&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-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||E.toolbar.createTask})]}),(k||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(gh,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:v,onExportCSV:T,onExportJSON:D,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(fh,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function ds({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(yt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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"}),i.map(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Go({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,g=window.innerWidth,b=window.innerHeight,w=t,f=a;t+c+p>g&&(w=t-c,w<p&&(w=p)),a+d+p>b&&(f=b-d-p,f<p&&(f=p)),m({x:w,y:f});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Ht={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"}),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 hm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let g=react.useRef(false),b=react.useCallback(v=>{g.current=v;},[]),w=react.useCallback(v=>{let T=[],D=N=>{for(let E of N)T.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(v),T},[]),f=react.useCallback(()=>{let v=w(e);for(let T of v)if(t.has(T.id))return T;return null},[e,t,w]),y=react.useCallback((v,T)=>{let D=w(e);if(D.length===0)return;let N=f();if(!N){a(D[0].id,false);return}let E=D.findIndex(I=>I.id===N.id);if(E===-1)return;let k=v==="up"?E-1:E+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,T);},[e,f,w,a]),h=react.useCallback(v=>{if(!p)return;let T=v.target;if(T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.isContentEditable||g.current){v.key==="Escape"&&(T.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),R=f();if(v.key==="ArrowUp"){v.preventDefault(),y("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),y("down",v.shiftKey);return}if(R&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!R.isExpanded||v.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),n(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),m(k));return}if(v.key==="Enter"&&!v.shiftKey&&!E){R&&(v.preventDefault(),r(R.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!E){R&&(v.preventDefault(),r(R.id,"above"));return}if(v.key==="Enter"&&E){R&&(v.preventDefault(),d(R.id));return}if(v.key==="F2"){R&&(v.preventDefault(),i(R.id));return}if(v.key==="Delete"||v.key==="Backspace"&&E){k.length>0&&(v.preventDefault(),o(k));return}if(v.key==="d"&&E&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[p,t,f,y,r,o,s,n,l,m,i,c,d]);return react.useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:b}}function vm(){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),b=p.indexOf(d);if(g===-1||b===-1){o(d);return}let w=Math.min(g,b),f=Math.max(g,b),y=p.slice(w,f+1);t(new Set(y)),r(d);},[a,o]),l=react.useCallback((d,p,g,b)=>{b?n(d,p):g?s(d):o(d);},[o,s,n]),m=react.useCallback((d,p)=>{p?t(g=>{let b=new Set(g);return b.add(d),b}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function xm(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xm(a.subtasks,t);if(r)return r}}return null}function nl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=nl(a.subtasks,t);if(r)return r}return null}function sl(e,t){if(t.length===0)return e;let a=Vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,p)=>{let g=[];return {tasks:d.filter(w=>{if(p.has(w.id))return g.push(w),false;if(w.subtasks){let f=n(w.subtasks,p);w.subtasks=f.tasks,g.push(...f.removed);}return true}),removed:g}},l=(d,p,g)=>d.map(b=>b.id===p?{...b,subtasks:[...b.subtasks||[],...g],isExpanded:true}:b.subtasks?{...b,subtasks:l(b.subtasks,p,g)}:b),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function il(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=nl(a,r);if(!o)continue;let s=nl(a,o.id),n=(i,c,d)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===c&&g.subtasks){let b=g.subtasks.findIndex(w=>w.id===d);if(b!==-1){let[w]=g.subtasks.splice(b,1);return w}}if(g.subtasks){let b=n(g.subtasks,c,d);if(b)return b}}return null},l=(i,c,d)=>{let p=i.findIndex(g=>g.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function ll(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function dl(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 cl(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function km(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function ml(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ml(r.subtasks,t,a)}:r)}function ul(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ul(a.subtasks,t)}:a)}function pl(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let p=a(d.subtasks);if(p)return p}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let p=d.subtasks||[];return {...d,subtasks:[...p,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function wm(e,t,a,r){if(t===a)return e;let o=xm(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];return p.splice(d,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function us({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:b,onTaskOutdent:w,onTaskMove:f,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:T,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:k}){let R=react.useContext(Wo),[I,C]=react.useState(null),[W,H]=react.useState(null),[x,te]=react.useState(""),oe=react.useRef(null),[ne,A]=react.useState(null),[ke,Ie]=react.useState(0),[L,U]=react.useState(0),[S,K]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,ie]=react.useState(null),[ue,ye]=react.useState(null),[Oe,Q]=react.useState(null),Je=react.useRef(0),Pe=5,rt=react.useRef(false),[ut,It]=react.useState(null),[Xe,pt]=react.useState(false),[ce,Ge]=react.useState(null),[Be,B]=react.useState(false),X=react.useRef(null);react.useEffect(()=>{function V(q){X.current&&!X.current.contains(q.target)&&B(false);}if(Be)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[Be]),react.useEffect(()=>{W&&oe.current&&(oe.current.focus(),oe.current.select());},[W]),react.useEffect(()=>{if(!ne)return;let V=Se=>{let Ye=Se.clientX-ke,ze=L+Ye;p?.(ne,ze);},q=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,L,p]);let{selectedTaskIds:ge,handleTaskClick:Ae,isTaskSelected:Ue}=vm(),{setIsEditing:nt}=hm({tasks:e,selectedTaskIds:ge,onTaskSelect:(V,q)=>{let Ye=Vo(e).map(ze=>ze.id);Ae(V,Ye,q||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:f||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&je(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:V=>{let q=Vo(e).find(Se=>Se.id===V);q&&N&&N(q);},enableKeyboard:true}),Pt=(V,q=0)=>{let Se=[];for(let Ye of V)Se.push({task:Ye,level:q}),Ye.subtasks&&Ye.subtasks.length>0&&Ye.isExpanded&&Se.push(...Pt(Ye.subtasks,q+1));return Se},$e=Pt(e),O=48,ae=Math.max($e.length*a,600-O),Le=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,je=V=>{H(V.id),te(V.name),nt(true);},qe=V=>{x.trim()&&x!==e.find(q=>q.id===V)?.name&&T?.(V,x.trim()),H(null),te(""),nt(false);},j=()=>{H(null),te(""),nt(false);},$=(V,q)=>{q.stopPropagation(),D?.(V.id);},Me=(V,q)=>{q.preventDefault(),Je.current=q.clientY,ie(V),rt.current=false,pt(false),It({x:q.clientX,y:q.clientY});},ht=V=>{if(!J||(Math.abs(V.clientY-Je.current)>Pe&&!rt.current&&(rt.current=true,pt(true)),It({x:V.clientX,y:V.clientY}),!rt.current))return;let Se=document.querySelectorAll("[data-task-row]"),Ye=null,ze=null;Se.forEach(G=>{let me=G.getBoundingClientRect(),_e=G.getAttribute("data-task-row");if(_e&&_e!==J&&V.clientY>=me.top&&V.clientY<=me.bottom){Ye=_e;let Tt=V.clientY-me.top,gt=me.height;Tt<gt*.25?ze="above":Tt>gt*.75?ze="below":ze="child";}}),ye(Ye),Q(ze);},le=()=>{if(rt.current&&J&&ue&&Oe){if(Oe==="child")k?.(J,ue);else if(Oe==="above"||Oe==="below"){let V=(Ye,ze,G=null)=>{for(let me of Ye){if(me.id===ze)return G;if(me.subtasks){let _e=V(me.subtasks,ze,me.id);if(_e!==void 0)return _e}}},q=V(e,ue,null),Se=(Ye,ze)=>{let G=Ye.findIndex(me=>me.id===ze);return Oe==="below"?G+1:G};if(q===null){let Ye=Se(e,ue);k?.(J,null,Ye);}else {let Ye=$e.find(ze=>ze.task.id===q)?.task;if(Ye?.subtasks){let ze=Se(Ye.subtasks,ue);k?.(J,q,ze);}}}}ie(null),ye(null),Q(null),It(null),rt.current=false,pt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,ue,Oe]);let He=(V,q,Se)=>{switch(V.id){case "name":let Ye=W===q.id,ze=I===q.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Se*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:ze?1:.3},onMouseDown:fe=>Me(q.id,fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.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 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ye?jsxRuntime.jsx("input",{ref:oe,type:"text",value:x,onChange:fe=>te(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?qe(q.id):fe.key==="Escape"&&j();},onBlur:()=>qe(q.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:fe=>fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),ze&&!Ye&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:fe=>$(q,fe),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:fe=>{fe.stopPropagation(),je(q);},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 me=V.id==="startDate"?"startDate":"endDate",_e=q[me],Tt=ce?.taskId===q.id&&ce?.field===me,gt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).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:fe=>fe.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},onClick:fe=>{if(Tt)Ge(null);else {let Nt=fe.currentTarget.getBoundingClientRect();Ge({taskId:q.id,field:me,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Nt.bottom+4,left:Nt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:gt(_e)})]}),Tt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ge(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:ce?.position.top,left:ce?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,Nt=new Date(fe);Nt.setDate(fe.getDate()+1);let ot=new Date(fe);ot.setDate(fe.getDate()+7);let Or=new Date(fe);return Or.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:Nt},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:Or}].map((br,P)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(q.id,{[me]:br.date}),Ge(null);},children:br.label},P))})(),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:fe=>fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(q.id,{[me]:void 0}),Ge(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:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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((fe,Nt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},Nt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=ce?.month||new Date,Nt=fe.getFullYear(),ot=fe.getMonth(),Or=new Date(Nt,ot,1).getDay(),oo=new Date(Nt,ot+1,0).getDate(),br=new Date,P=[];for(let ve=Or-1;ve>=0;ve--)P.push({day:new Date(Nt,ot,-ve).getDate(),date:new Date(Nt,ot-1,new Date(Nt,ot,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=oo;ve++)P.push({day:ve,date:new Date(Nt,ot,ve),isCurrentMonth:true});let re=42-P.length;for(let ve=1;ve<=re;ve++)P.push({day:ve,date:new Date(Nt,ot+1,ve),isCurrentMonth:false});return P.map((ve,Ze)=>{let aa=ve.date.toDateString()===br.toDateString(),ra=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===ve.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:ve.isCurrentMonth?ra?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ra?"#3B82F6":"transparent",boxShadow:aa&&!ra?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{g?.(q.id,{[me]:ve.date}),Ge(null);},children:ve.day},Ze)})})()})]})]})]}),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:Le(q)})});case "assignees":let Sr=r.filter(fe=>q.assignees?.some(Nt=>Nt.name===fe.name||Nt.initials===fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(uo,{assignedUsers:Sr,availableUsers:r,onChange:fe=>{let Nt=fe.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));g?.(q.id,{assignees:Nt.length>0?Nt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(ec,{status:q.status||"todo",onChange:fe=>{g?.(q.id,{status:fe,progress:fe==="completed"?100:q.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${q.progress}%`,backgroundColor:q.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:[q.progress,"%"]})]});case "priority":let fr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ia={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ba=fr[q.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(co,{priority:Ba,onChange:fe=>{fe&&g?.(q.id,{priority:Ia[fe]||"medium"});}})});default:return null}},De=V=>[{id:"hide",label:"Hide Column",icon:Ht.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ht.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ht.SortDesc,onClick:()=>{}}],Re=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):y?.([V.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{D?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{E?E(V.id,V.name):y?.([V.id]);}}],de=c.filter(V=>V.visible),Ve=de.reduce((V,q)=>V+q.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ve},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}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:de.map((V,q)=>{let Se=q===de.length-1,Ye=V.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ye?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Ye?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Se?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),K({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:V.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.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:V.label,children:V.label}),V.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),A(V.id),Ie(ze.clientX),U(V.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"}})})]},V.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(ds,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!Be),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"})}),Be&&jsxRuntime.jsxs("div",{ref:X,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:V=>V.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:()=>B(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:ae},children:$e.map(({task:V,level:q},Se)=>{let Ye=Ue(V.id),ze=ue===V.id,G=ze&&Oe==="above",me=ze&&Oe==="below",_e=ze&&Oe==="child",Tt={};return _e&&(Tt.backgroundColor=`${t.accent}15`,Tt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${J===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ye?t.accentLight:_e?`${t.accent}15`:Se%2===0?t.bgPrimary:t.bgGrid,...Tt},onMouseEnter:()=>C(V.id),onMouseLeave:()=>C(null),onClick:gt=>{let fr=Vo(e).map(fe=>fe.id),Ba=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;Ae(V.id,fr,Ba,gt.shiftKey),s?.(V);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(V);},onContextMenu:gt=>{gt.preventDefault(),K({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:V}),l?.(V,gt);},whileHover:{backgroundColor:Ye?t.accentLight:t.hoverBg},children:[G&&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}}),de.map((gt,Sr)=>{let fr=Sr===de.length-1,Ia=gt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ia?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ia?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fr?"none":`1px solid ${I===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:He(gt,V,Ia?q:0)},`${V.id}-${gt.id}`)})]},V.id)})}),jsxRuntime.jsx(Go,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?De(S.columnId):S.type==="task"&&S.task?Re(S.task):[],onClose:()=>K({...S,isOpen:false}),theme:t}),Xe&&ut&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=$e.find(q=>q.task.id===J)?.task;return V?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:V.name})}):null})()}),document.body)]})}function Sm(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[m,i]=react.useState(t),[c,d]=react.useState(null),[p,g]=react.useState(null),[b,w]=react.useState(null),[f,y]=react.useState(null),[h,v]=react.useState(0),[T,D]=react.useState(0),[N,E]=react.useState(null),[k,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:b,setActiveZone:w,draggedSegmentIndex:f,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:T,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(x,te)=>{r("none"),d(null),g(null),l(x),i(te),D(0),y(null),v(0);}}}function gs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:b,onHoverChange:w}){let f=Sm(t,r),y=react.useRef(null),h=react.useRef(null),v=react.useRef(null),{dragMode:T,setDragMode:D,dragOffset:N,setDragOffset:E,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:H,hoveredTaskId:x,setHoveredTaskId:te,activeZone:oe,setActiveZone:ne,draggedSegmentIndex:A,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ie,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:S,hoveredSegmentIndex:K,setHoveredSegmentIndex:J,isHovered:ie,setIsHovered:ue,isDragging:ye,isResizing:Oe,isConnecting:Q,resetDragState:Je}=f,Pe=32,rt=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Be=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,X=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),ge=r<50,Ae=r<40;react.useEffect(()=>{if(w)if(ie&&!ye&&!e.segments){let le=a<100;w({task:e,x:t,y:a,width:r,height:Pe,showBelow:le});}else w(null);},[ie,ye,e,t,a,r,Pe,w]);let Ue=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},Pt=le=>Math.round(le/s)*s,$e=le=>{let He=Math.round(le/s),De=new Date(n);return De.setDate(De.getDate()+He),De},O=(le,He)=>{for(let De of g){if(De.id===e.id)continue;let Re=5;if(le>=De.x-Re&&le<=De.x+De.width+Re&&He>=De.y-Re&&He<=De.y+De.height+Re)return De.id}return null},ae=react.useCallback((le,He,De)=>{le.preventDefault(),le.stopPropagation();let Re=y.current?.ownerSVGElement;if(!Re)return;let de=Re.createSVGPoint();de.x=le.clientX,de.y=le.clientY;let Ve=de.matrixTransform(Re.getScreenCTM()?.inverse()),V=De!==void 0?De:t,q=He;if(!q){let Se=Ve.x-V;le.shiftKey?(q="connect",H({x:t+r,y:a+Pe/2})):le.ctrlKey||le.metaKey?q="move":le.altKey?q=Se<r/2?"resize-start":"resize-end":Ae?Se<r/2?q="move":q="resize-end":ge?Se<=X/2?q="resize-start":Se>=r-X/2?q="resize-end":q="move":Se<=X?q="resize-start":Se>=r-X?q="resize-end":q="move";}D(q),ue(false),ne(null),q==="move"?E(Ve.x-V):q==="connect"?H({x:t+r,y:a+Pe/2}):E(0),R(V),C(r);},[t,r,a,Pe]),Le=react.useCallback(le=>{let He=y.current?.ownerSVGElement;if(!He)return;let De=He.closest(".gantt-timeline-scroll");if(!De)return;let Re=De.getBoundingClientRect(),de=60,Ve=15,V=0;if(le.clientX<Re.left+de){let q=Re.left+de-le.clientX;V=-Math.min(Ve,q/2);}else if(le.clientX>Re.right-de){let q=le.clientX-(Re.right-de);V=Math.min(Ve,q/2);}return V!==0&&(De.scrollLeft+=V),V!==0},[]),je=react.useCallback(le=>{if(T==="none")return;v.current=le;let He=y.current?.ownerSVGElement;if(!He)return;if(T==="move"||T==="resize-start"||T==="resize-end"){let de=Le(le);de&&!h.current?h.current=window.setInterval(()=>{v.current&&(Le(v.current),je(v.current));},16):!de&&h.current&&(window.clearInterval(h.current),h.current=null);}let De=He.createSVGPoint();De.x=le.clientX,De.y=le.clientY;let Re=De.matrixTransform(He.getScreenCTM()?.inverse());if(T==="connect"){H({x:Re.x,y:Re.y});let de=O(Re.x,Re.y);te(de);}else if(T==="move"){let de=Re.x-N,Ve=Pt(de);R(Ve),C(r);let V=Math.round((Ve-t)/s);if(b?.(e.id,V,true),e.segments&&e.segments.length>0&&A!==null){let q=Ve-Ie;S(q);}}else if(T==="resize-start"){let de=Re.x,Ve=Pt(de),V=t+r-Ve;V>=s&&(R(Ve),C(V));}else if(T==="resize-end"){let de=Re.x,V=Pt(de)-t;V>=s&&C(V);}},[T,t,r,s,N,e,Pt,A,Ie,O,te,H,R,C,S,b,Le]),qe=react.useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),v.current=null,T!=="none"){if(T==="connect")x&&p&&p(e,x),H(null),te(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),He,De,Re=true;if(T==="move"){if(He=$e(k),De=new Date(He.getTime()+le),e.segments&&e.segments.length>0&&A!==null){let de=Math.round(U/s),Ve=e.segments.map((Ye,ze)=>{if(ze===A){let G=new Date(Ye.startDate),me=new Date(Ye.endDate);return G.setDate(G.getDate()+de),me.setDate(me.getDate()+de),{startDate:G,endDate:me}}return Ye}),V=Ve.flatMap(Ye=>[Ye.startDate,Ye.endDate]),q=new Date(Math.min(...V.map(Ye=>Ye.getTime()))),Se=new Date(Math.max(...V.map(Ye=>Ye.getTime())));d?.({...e,segments:Ve},q,Se),Je(t,r);return}}else T==="resize-start"?(He=$e(k),De=e.endDate,He>De&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):T==="resize-end"?(He=e.startDate,De=$e(k+I),De<He&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&He&&De&&(De.getTime()<He.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,He,De));}b?.(e.id,0,false),Je(t,r);}},[T,k,I,e,d,x,p,t,r,s,$e,U,A,Je,b]);react.useEffect(()=>{if(T==="none")return;let le=De=>{je(De);},He=()=>{qe();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",He),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",He),h.current&&(window.clearInterval(h.current),h.current=null);}},[T,je,qe]);let j=ye&&!Q?k:t,$=ye&&!Q?I:r,Me=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ye&&m?.(e),onDoubleClick:le=>{ye||(le.stopPropagation(),i?.(e));},onContextMenu:le=>{le.preventDefault(),c?.(e,le);},onMouseEnter:()=>!ye&&ue(true),onMouseLeave:()=>{ye||(ue(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Pe,fill:"transparent",style:{pointerEvents:"all"}}),ie&&!ye&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:X,height:Pe,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:le=>ae(le,"resize-start")}),jsxRuntime.jsx("rect",{x:t+X,y:a,width:r-X*2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r-X,y:a,width:X,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")})]}),ie&&!ye&&Ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Pe,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Pe,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")}),ie&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Pe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ye&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:a,width:I,height:Pe,rx:rt,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:j,y:a,width:$,height:Pe,rx:rt,fill:Be,"data-task-class":Me,initial:{opacity:0,scale:.95},animate:{opacity:ye&&!Q?.15:e.parentId?.6:ie?.9:.8,scale:ie&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>ae(le),style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:j,y:a,width:$*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,He)=>{let De=(le.startDate.getTime()-n.getTime())/864e5*s,de=(le.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-De+s,Ve=ye&&T==="move"&&A===He,V=K===He,q=Ve?De+U:De;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ye&&J(He),onMouseLeave:()=>!ye&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:q,y:a,width:de,height:Pe,rx:rt,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:V?.9:.8,scale:V&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Se=>{Se.stopPropagation(),ke(He),L(De),ae(Se,void 0,De);},style:{cursor:ye?Q?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:q,y:a,width:de*(e.progress/100),height:Pe,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${He}`)}),Xe&&(ut||It)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[It&&!ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Pe,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$>60&&!e.segments&&(()=>{let le=l.taskLabel(e),He=typeof le=="string"?le:e.name,De=He.length>Math.floor($/8)?`${He.substring(0,Math.floor($/8))}...`:He;return jsxRuntime.jsx("text",{x:j+12,y:a+Pe/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:De})})(),$>100&&e.progress>0&&e.progress<100&&!ye&&!e.segments&&jsxRuntime.jsxs("text",{x:j+$-12,y:a+Pe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&$>80&&!ye&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ie||Oe)&&!Q&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-2,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+4,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-start"||T==="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:j+$-14,y:a,width:16,height:Pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+$-7,y:a+8,width:3,height:Pe-16,rx:1.5,fill:oe==="resize-end"||T==="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:ie&&!ye&&!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+Pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Pe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:oe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Q&&W&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Pe/2,x2:W.x,y2:W.y,stroke:x?o.statusCompleted:o.accent,strokeWidth:x?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:x?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:W.x,cy:W.y,r:x?8:6,fill:x?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),x&&jsxRuntime.jsx(framerMotion.motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(ie||ye)&&!Q&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:j-2,y:a-2,width:$+4,height:Pe+4,rx:rt+2,fill:"none",stroke:ye?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ye?.6:.4,initial:{opacity:0},animate:{opacity:ye?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&!ye&&!e.segments&&!w&&(()=>{let De=a<100,Re=De?a+Pe+13:a-82-13,de=De?`M ${j+$/2-6} ${a+Pe+3} L ${j+$/2} ${a+Pe+13} L ${j+$/2+6} ${a+Pe+3}`:`M ${j+$/2-6} ${a-13} L ${j+$/2} ${a-3} L ${j+$/2+6} ${a-13}`,Ve=Re+22,V=Re+40,q=Re+55,Se=Re+70,Ye=De?Re+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:De?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:De?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:j+$/2-120,y:Re,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:j+$/2,y:Ve,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:j+$/2-110,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsxRuntime.jsx("text",{x:j+$/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsxRuntime.jsx("text",{x:j+$/2+10,y:V,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:j+$/2+65,y:V,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:j+$/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:j+$/2+65,y:q,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:j+$/2-110,y:Se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:j+$/2-50,y:Se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!De&&jsxRuntime.jsx("text",{x:j+$/2,y:Ye,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":ge?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Mm({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,p=m?s+l+d:s-c-d,g=m?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,b=p+22,w=p+40,f=p+55,y=p+70,h=p+90,v=p+105,T=p+120,D=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},E=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),H=C%60;return W===0?`${H}m`:H===0?`${W}h`:`${W}h ${H}m`},k={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:"};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:g,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:o+n/2,y:b,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y:v,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:E(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.soldEffortMinutes)})]})]})]})})}function bs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=react.useState(false),[c,d]=react.useState(null),p=r-t,g=p>0,b=Math.abs(p)<5,w=20,f=!b&&a<=e,y,h,v=a-e,T=e+v/2;if(h=T,n==="squared")if(b)y=`M ${e} ${t} L ${a} ${r}`;else if(f){let ne=e+15,A=a-w,ke=g?t+20:t-20;h=A,y=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${A} ${ke} L ${A} ${r} L ${a} ${r}`;}else h=a-w,y=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else y=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let D=5,N=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,E=o.dependency,k=o.dependencyHover||E,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=h,W=(t+r)/2;if(c)if(b)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(f){let oe=e+15,ne=a-w,A=g?t+20:t-20,ke=[[e,t,oe,t],[oe,t,oe,A],[oe,A,ne,A],[ne,A,ne,r],[ne,r,a,r]],Ie=1/0,L={x:C,y:W};for(let U of ke){let S=H(c.x,c.y,U[0],U[1],U[2],U[3]),K=Math.hypot(c.x-S.x,c.y-S.y);K<Ie&&(Ie=K,L=S);}C=L.x,W=L.y;}else {let oe=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ne=1/0,A={x:C,y:W};for(let ke of oe){let Ie=H(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),L=Math.hypot(c.x-Ie.x,c.y-Ie.y);L<ne&&(ne=L,A=Ie);}C=A.x,W=A.y;}function H(oe,ne,A,ke,Ie,L){let U=Ie-A,S=L-ke,K=U*U+S*S;if(K===0)return {x:A,y:ke};let J=((oe-A)*U+(ne-ke)*S)/K;return J=Math.max(0,Math.min(1,J)),{x:A+J*U,y:ke+J*S}}let x=oe=>{let ne=oe.currentTarget.ownerSVGElement;if(!ne)return;let A=ne.getBoundingClientRect();d({x:oe.clientX-A.left,y:oe.clientY-A.top});},te=()=>{i(false),d(null);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:x,children:[jsxRuntime.jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:x,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:y,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:E,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function ys({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,m=i=>i.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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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:m(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 xe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
|
|
126
|
+
`)},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=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],l=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((p,g)=>{o.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),n=xe.getEarliestStartDate(e)||new Date,l=xe.getLatestEndDate(e)||new Date,m=r.map((p,g)=>{let b=o.get(p.id),w=p.startDate&&p.endDate?xe.calculateDuration(p.startDate,p.endDate):0,f=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
|
|
127
127
|
<PredecessorLink>
|
|
128
|
-
<PredecessorUID>${o.get(
|
|
128
|
+
<PredecessorUID>${o.get(y)}</PredecessorUID>
|
|
129
129
|
<Type>1</Type>
|
|
130
130
|
<CrossProject>0</CrossProject>
|
|
131
131
|
<LinkLag>0</LinkLag>
|
|
132
132
|
<LagFormat>7</LagFormat>
|
|
133
133
|
</PredecessorLink>`).join("");return `
|
|
134
134
|
<Task>
|
|
135
|
-
<UID>${
|
|
136
|
-
<ID>${
|
|
137
|
-
<Name>${
|
|
135
|
+
<UID>${b}</UID>
|
|
136
|
+
<ID>${g+1}</ID>
|
|
137
|
+
<Name>${p.name.replace(/[<>&'"]/g,y=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[y]||y)}</Name>
|
|
138
138
|
<Type>0</Type>
|
|
139
139
|
<IsNull>0</IsNull>
|
|
140
140
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
141
|
-
<WBS>${
|
|
142
|
-
<OutlineNumber>${
|
|
143
|
-
<OutlineLevel>${
|
|
141
|
+
<WBS>${g+1}</WBS>
|
|
142
|
+
<OutlineNumber>${g+1}</OutlineNumber>
|
|
143
|
+
<OutlineLevel>${p.level||0}</OutlineLevel>
|
|
144
144
|
<Priority>500</Priority>
|
|
145
|
-
<Start>${
|
|
146
|
-
<Finish>${
|
|
147
|
-
<Duration>PT${
|
|
145
|
+
<Start>${p.startDate?s(p.startDate):""}</Start>
|
|
146
|
+
<Finish>${p.endDate?s(p.endDate):""}</Finish>
|
|
147
|
+
<Duration>PT${w*8}H0M0S</Duration>
|
|
148
148
|
<DurationFormat>7</DurationFormat>
|
|
149
|
-
<Work>PT${
|
|
150
|
-
<Stop>${
|
|
151
|
-
<Resume>${
|
|
149
|
+
<Work>PT${w*8}H0M0S</Work>
|
|
150
|
+
<Stop>${p.endDate?s(p.endDate):""}</Stop>
|
|
151
|
+
<Resume>${p.startDate?s(p.startDate):""}</Resume>
|
|
152
152
|
<ResumeValid>0</ResumeValid>
|
|
153
153
|
<EffortDriven>1</EffortDriven>
|
|
154
154
|
<Recurring>0</Recurring>
|
|
155
155
|
<OverAllocated>0</OverAllocated>
|
|
156
156
|
<Estimated>0</Estimated>
|
|
157
|
-
<Milestone>${
|
|
158
|
-
<Summary>${
|
|
159
|
-
<Critical>${
|
|
157
|
+
<Milestone>${p.isMilestone?"1":"0"}</Milestone>
|
|
158
|
+
<Summary>${p.subtasks&&p.subtasks.length>0?"1":"0"}</Summary>
|
|
159
|
+
<Critical>${p.isCriticalPath?"1":"0"}</Critical>
|
|
160
160
|
<IsSubproject>0</IsSubproject>
|
|
161
161
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
162
162
|
<ExternalTask>0</ExternalTask>
|
|
163
|
-
<EarlyStart>${
|
|
164
|
-
<EarlyFinish>${
|
|
165
|
-
<LateStart>${
|
|
166
|
-
<LateFinish>${
|
|
163
|
+
<EarlyStart>${p.startDate?s(p.startDate):""}</EarlyStart>
|
|
164
|
+
<EarlyFinish>${p.endDate?s(p.endDate):""}</EarlyFinish>
|
|
165
|
+
<LateStart>${p.startDate?s(p.startDate):""}</LateStart>
|
|
166
|
+
<LateFinish>${p.endDate?s(p.endDate):""}</LateFinish>
|
|
167
167
|
<StartVariance>0</StartVariance>
|
|
168
168
|
<FinishVariance>0</FinishVariance>
|
|
169
169
|
<WorkVariance>0</WorkVariance>
|
|
@@ -171,22 +171,22 @@
|
|
|
171
171
|
<TotalSlack>0</TotalSlack>
|
|
172
172
|
<FixedCost>0</FixedCost>
|
|
173
173
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
174
|
-
<PercentComplete>${
|
|
175
|
-
<PercentWorkComplete>${
|
|
174
|
+
<PercentComplete>${p.progress}</PercentComplete>
|
|
175
|
+
<PercentWorkComplete>${p.progress}</PercentWorkComplete>
|
|
176
176
|
<Cost>0</Cost>
|
|
177
177
|
<OvertimeCost>0</OvertimeCost>
|
|
178
178
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
179
|
-
<ActualStart>${
|
|
180
|
-
<ActualFinish>${
|
|
181
|
-
<ActualDuration>PT${Math.round(
|
|
179
|
+
<ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
|
|
180
|
+
<ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
|
|
181
|
+
<ActualDuration>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualDuration>
|
|
182
182
|
<ActualCost>0</ActualCost>
|
|
183
183
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
184
|
-
<ActualWork>PT${Math.round(
|
|
184
|
+
<ActualWork>PT${Math.round(w*p.progress/100)*8}H0M0S</ActualWork>
|
|
185
185
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
186
|
-
<RegularWork>PT${
|
|
187
|
-
<RemainingDuration>PT${Math.round(
|
|
186
|
+
<RegularWork>PT${w*8}H0M0S</RegularWork>
|
|
187
|
+
<RemainingDuration>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
|
|
188
188
|
<RemainingCost>0</RemainingCost>
|
|
189
|
-
<RemainingWork>PT${Math.round(
|
|
189
|
+
<RemainingWork>PT${Math.round(w*(100-p.progress)/100)*8}H0M0S</RemainingWork>
|
|
190
190
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
191
191
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
192
192
|
<ACWP>0</ACWP>
|
|
@@ -205,12 +205,12 @@
|
|
|
205
205
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
206
206
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
207
207
|
<IsPublished>1</IsPublished>
|
|
208
|
-
<CommitmentType>0</CommitmentType>${
|
|
208
|
+
<CommitmentType>0</CommitmentType>${f}
|
|
209
209
|
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
210
210
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
211
211
|
<SaveVersion>14</SaveVersion>
|
|
212
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
213
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
212
|
+
<Name>${t.replace(/[<>&'"]/g,p=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[p]||p)}</Name>
|
|
213
|
+
<Title>${t.replace(/[<>&'"]/g,p=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[p]||p)}</Title>
|
|
214
214
|
<CreationDate>${s(new Date)}</CreationDate>
|
|
215
215
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
216
216
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
@@ -353,9 +353,9 @@
|
|
|
353
353
|
</Calendars>
|
|
354
354
|
<Tasks>${m}
|
|
355
355
|
</Tasks>
|
|
356
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ve.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let y=t.find(k=>k.id===f);if(y){o(y);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let u=d+c;r.set(i.id,{es:d,ef:u});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),u=s;if(d.length>0)for(let y of d){l(y);let k=n.get(y.id)?.ls||0;u=Math.min(u,k);}let f=u-c;n.set(i.id,{ls:f,lf:u});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let u=d.ls-c.es;Math.abs(u)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=ve.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ve.calculateCriticalPath(e).includes(t))return 0;let o=ve.getDependentTasks(e,t);if(o.length===0){let l=ve.getLatestEndDate(e);if(!l)return null;let m=ve.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=ve.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ve.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ve.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ve.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=ve.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=ve.calculateEndDate(m,l),c=d=>d.map(u=>u.id===n.id?{...u,startDate:m,endDate:i}:u.subtasks?{...u,subtasks:c(u.subtasks)}:u);s=c(s),s=ve.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=ve.findTaskById(e,t);if(!d||!d.endDate)return [];let u=(f,y,k=new Set)=>{if(k.has(f))return;k.add(f);let g=ve.getDependentTasks(e,f);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let p=v.startDate.getTime(),x=(v.endDate.getTime()-p)/c,T=(p-i)/c*s,C=T+y*s,A=Math.max(x*s,s),I=l+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:C,width:A,y:I,rowIndex:h,daysDelta:y,color:v.color}),u(v.id,y,k);}};return u(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ve.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:u,onTaskDateChange:f,onDependencyCreate:y,onDependencyDelete:k}){let v=Br(),[h,p]=react.useState([]),[w,x]=react.useState(null),S=react.useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,A=T*C*n,I=F=>{let B=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),E=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-E);let W=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-W.getTime())/864e5+1)/7)},N=F=>{let B=F.getDay();return B===0||B===6},O=react.useCallback(F=>{let B=Math.round(F/(C*n)),E=new Date(o);return E.setDate(E.getDate()+B),E},[o,C,n]),R=react.useCallback((F,B)=>{if(B.startDate&&B.endDate)return;let E=F.currentTarget.ownerSVGElement;if(!E)return;let W=E.createSVGPoint();W.x=F.clientX,W.y=F.clientY;let q=W.matrixTransform(E.getScreenCTM()?.inverse()),pe=O(q.x),fe=new Date(pe);fe.setDate(fe.getDate()+1),f?.(B,pe,fe);},[O,f]),_=react.useMemo(()=>{let F=q=>q.map(pe=>{if(pe.subtasks&&pe.subtasks.length>0){let fe=F(pe.subtasks),Ce=fe.filter(Y=>Y.startDate&&Y.endDate);if(Ce.length>0){let Y=Ce.map(Le=>Le.startDate.getTime()),V=Ce.map(Le=>Le.endDate.getTime()),Oe=new Date(Math.min(...Y)),ue=new Date(Math.max(...V));return {...pe,subtasks:fe,startDate:Oe,endDate:ue}}return {...pe,subtasks:fe}}return pe}),B=(q,pe=[])=>{for(let fe of q)pe.push(fe),fe.subtasks&&fe.subtasks.length>0&&(fe.isExpanded===void 0||fe.isExpanded)&&B(fe.subtasks,pe);return pe},E=F(e);return B(E)},[e]),se=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let B=F.startDate.getTime(),E=F.endDate.getTime(),W=o.getTime(),q=(B-W)/(1e3*60*60*24),pe=(E-B)/(1e3*60*60*24),fe=q*C*n,Ce=Math.max(C*n,40),Y=Math.max(pe*C*n,Ce);return {x:fe,width:Y}},[o,C,n]),te=react.useMemo(()=>_.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:B,width:E}=se(F),q=_.findIndex(pe=>pe.id===F.id)*a+12;return {id:F.id,x:B,y:q,width:E,height:32}}),[_,se]),ie=react.useCallback((F,B,E)=>{if(!E||B===0){p([]);return}let W=ve.calculateCascadePreview(e,F,B,_,o,C*n,a,48);p(W);},[e,_,o,C,n,a,48]),xe=react.useMemo(()=>{let F=[],B=new Date(o);for(;B<=s;){let q=(B.getTime()-o.getTime())/864e5*C*n;if(r==="day")F.push({date:new Date(B),label:B.toLocaleDateString(l,{day:"numeric",month:"short"}),x:q}),B.setDate(B.getDate()+1);else if(r==="week"){let pe=I(B);F.push({date:new Date(B),label:`${v.labels.week} ${pe}`,x:q}),B.setDate(B.getDate()+7);}else F.push({date:new Date(B),label:B.toLocaleDateString(l,{month:"short",year:"numeric"}),x:q}),B.setMonth(B.getMonth()+1);}return F},[o,s,r,C,n,l,v.labels.week]),Ne=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*n,[o,C,n]),Ae=Math.max(_.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),xe.map((F,B)=>jsxRuntime.jsxs("g",{children:[B>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${B}`)),Ne>=0&&Ne<=A&&jsxRuntime.jsx("circle",{cx:Ne,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(A,1e3),height:Ae,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(A,1e3),height:Ae,fill:t.bgPrimary}),xe.map((F,B)=>{let E=xe[B+1]?.x||A,W=N(F.date);return jsxRuntime.jsxs("g",{children:[W&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:E-F.x,height:_.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:_.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),_.map((F,B)=>{let E=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:A,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:W=>R(W,F),onMouseEnter:W=>{W.currentTarget.setAttribute("fill",t.accentLight),W.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:W=>{W.currentTarget.setAttribute("fill","transparent"),W.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:Ne>0?Ne:100,y:B*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),_.map((F,B)=>{if(!F.startDate||!F.endDate)return null;let{x:E,width:W}=se(F),q=B*a+12,pe=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(Jn,{task:F,x:E+W/2,y:q+16,theme:t,onClick:c},F.id):pe?jsxRuntime.jsxs("g",{onClick:()=>c?.(F),onContextMenu:fe=>{fe.preventDefault(),fe.stopPropagation(),u?.(F,fe);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:E,y:q,width:W,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:E,y1:q,x2:E+W,y2:q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:q,x2:E,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E+W,y1:q,x2:E+W,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:q+32,x2:E+W,y2:q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),W>60&&jsxRuntime.jsx("text",{x:E+12,y:q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(jn,{task:F,x:E,y:q,width:W,theme:t,dayWidth:C*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:u,onDateChange:f,onDependencyCreate:y,allTaskPositions:te,onDragMove:ie,onHoverChange:S},F.id)}),_.map((F,B)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(E=>{let W=_.find(ue=>ue.id===E);if(!W||!W.startDate||!W.endDate)return null;let q=_.findIndex(ue=>ue.id===E),pe=se(W),fe=se(F),Ce=pe.x+pe.width,Y=q*a+28,V=fe.x,Oe=B*a+28;return jsxRuntime.jsx(qn,{x1:Ce,y1:Y,x2:V,y2:Oe,theme:t,lineStyle:i,onDelete:()=>k?.(F.id,E)},`dep-${E}-${F.id}`)})),h.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Ne>=0&&Ne<=A&&jsxRuntime.jsx("line",{x1:Ne,y1:0,x2:Ne,y2:Ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsxRuntime.jsx(Zc,{tooltipData:w,theme:t})]})]})}var s0=['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"'],am=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),i0=()=>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"})}),l0=()=>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"})}),d0=()=>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"})}),c0=()=>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 es({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=react.useState(false),[d,u]=react.useState(false),[f,y]=react.useState([]),[k,g]=react.useState(""),[v,h]=react.useState(false),[p,w]=react.useState(true),x=react.useRef(null),S=react.useRef(null),T=react.useRef(null),{enabled:C=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:N,suggestions:O=s0,maxHistory:R=50,persistHistory:_}=a,se=_?.storageKey||"gantt-ai-history",te=_?.maxMessages??5;react.useEffect(()=>{if(_?.enabled)try{let B=localStorage.getItem(se);if(B){let W=JSON.parse(B).map(q=>({...q,timestamp:new Date(q.timestamp)}));y(W.slice(-te));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[_?.enabled,se,te]),react.useEffect(()=>{if(_?.enabled&&f.length>0)try{let B=f.filter(E=>!E.isLoading).slice(-te);localStorage.setItem(se,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[f,_?.enabled,se,te]),react.useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,d]);let ie=react.useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&m?.(B.taskId,B.dependencyFrom);break}},[o,s,n,l,m]),xe=react.useCallback(async B=>{if(!B.trim()||v)return;let E={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};y(q=>[...q.slice(-(R-1)),E]),g(""),w(false),h(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(q=>[...q,W]);try{if(N){let q=await N(B,e);y(pe=>{let fe=pe.filter(Y=>!Y.isLoading),Ce={id:`assistant-${Date.now()}`,role:"assistant",content:q.message,timestamp:new Date,command:q};return [...fe,Ce]}),ie(q);}else y(q=>[...q.filter(fe=>!fe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(q){y(pe=>[...pe.filter(Ce=>!Ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${q instanceof Error?q.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,R,N,e,ie]),Ne=B=>{B.preventDefault(),xe(k);},Ae=B=>{g(B),x.current?.focus();};if(react.useEffect(()=>{let B=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),c(W=>!W),i||u(false)),E.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),react.useEffect(()=>{if(!i)return;let B=W=>{let q=W.target;T.current&&!T.current.contains(q)&&c(false);},E=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",B);}},[i]),!C)return null;let F={"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(gt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsxRuntime.jsx(am,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:T,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 ${F[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(am,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>u(B=>!B),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(d0,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(l0,{})})]})]}),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:[f.length===0&&p&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:O.slice(0,4).map((B,E)=>jsxRuntime.jsx("button",{onClick:()=>Ae(B),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:B.length>30?B.slice(0,30)+"...":B},E))})]}),f.map(B=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:B.role==="user"?"white":t.textPrimary},children:[B.isLoading?jsxRuntime.jsx(c0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:B.command.success?"#10B981":"#EF4444"},children:[B.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsxRuntime.jsx("div",{ref:S})]}),jsxRuntime.jsxs("form",{onSubmit:Ne,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:x,type:"text",value:k,onChange:B=>g(B.target.value),placeholder:A,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(i0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function rm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let u=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:u};if(!c)return {...d,present:u};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:u,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function om({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var g0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ve.formatDate(e.startDate)} - ${ve.formatDate(e.endDate)}`);let a=ve.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=>ve.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function nm(e){return {...g0,...e}}var w0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},lm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:u=true,persistExpandedState:f,persistFilter:y,aiAssistant:k,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:p,onCreateTask:w,taskFilter:x,onTaskFilterChange:S,onThemeChange:T,onTaskClick:C,onTaskDblClick:A,onTaskContextMenu:I,onTaskUpdate:N,onProgressChange:O,onTaskEdit:R,onTaskAddSubtask:_,onTaskMarkIncomplete:se,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:xe,onBeforeTaskAdd:Ne,onAfterTaskAdd:Ae,onBeforeTaskUpdate:F,onAfterTaskUpdate:B,onBeforeTaskDelete:E,onAfterTaskDelete:W}=a,pe=react.useContext(On)?.theme,[fe,Ce]=react.useState(pe||s||"dark"),[Y,V]=react.useState(n),[Oe,ue]=react.useState(l),[Le,Je]=react.useState(1),st=react.useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Ge,bt]=react.useState(()=>{if(!y)return "all";try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if($.taskFilter)return $.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),ut=x??Ge,Pt=S??bt,[ge,L]=react.useState(()=>{if(!y)return false;try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if(typeof $.hideCompleted=="boolean")return $.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=st();if(P)try{let M={taskFilter:ut,hideCompleted:ge};localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[ut,ge,st]);let[re,Te]=react.useState(0),[Ue,Z]=react.useState(false),[Re,H]=react.useState(null),[K,ke]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ie,_e]=react.useState(null),[We,ne]=react.useState(null);react.useEffect(()=>{pe&&pe!==fe&&Ce(pe);},[pe]),react.useEffect(()=>{s&&s!==fe&&Ce(s);},[s]);let Be=react.useCallback(P=>{Ce(P),T?.(P);},[T]),{state:ee,setState:Ye,undo:Pa,redo:be,canUndo:qe,canRedo:He,clearHistory:Ze}=rm(t,50),rt=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),it=react.useRef(new Map),G=react.useRef(false);if(!G.current&&f){G.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(P);if(M){let $=JSON.parse(M);Array.isArray($)&&(it.current=new Map($));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let X=react.useCallback(()=>{let P=rt();if(P)try{let M=Array.from(it.current.entries());localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[rt]);react.useEffect(()=>{let P=$=>{let ae=new Map;for(let me of $){let ye=me.name.toLowerCase().trim(),ht=ae.get(ye);ht?ht.id.startsWith("subtask-")&&!me.id.startsWith("subtask-")&&ae.set(ye,me):ae.set(ye,me);}return Array.from(ae.values())},M=$=>$.map(ae=>{let me=it.current.get(ae.id),ye=me!==void 0?{...ae,isExpanded:me}:ae;if(ye.subtasks?.length){let ht=P(ye.subtasks);return {...ye,subtasks:M(ht)}}return ye});if(it.current.size>0)Ye(M(t));else {let $=ae=>ae.map(me=>me.subtasks?.length?{...me,subtasks:P($(me.subtasks))}:me);Ye($(t));}},[t,Ye]);let Pe=react.useRef(t),Ke=react.useRef(true);react.useEffect(()=>{if(Ke.current){Ke.current=false,Pe.current=ee;return}if(!r)return;let P=JSON.stringify(Pe.current),M=JSON.stringify(ee);P!==M&&(Pe.current=ee,r(ee));},[ee,r]);let ze=react.useMemo(()=>Si(g,v),[g,v]),z=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[le,D]=react.useState(()=>z(ze));react.useEffect(()=>{D(P=>P.map(M=>({...M,label:ze.columns[M.id==="name"?"taskName":M.id]||M.label})));},[ze]);let Q=react.useMemo(()=>le.filter(M=>M.visible).reduce((M,$)=>M+$.width,0),[le]),ce=react.useRef(le.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=le.filter(ae=>ae.visible),M=P.map(ae=>ae.id).join(","),$=ce.current;if(M!==$){let ae=P.some(ye=>ye.id!=="name"),me=$.includes(",");ae?!me&&ae&&H(null):H(null),ce.current=M;}},[le]);let Xe=60,Ft=.6,Zt=react.useMemo(()=>{let M=Q+Xe,$=typeof window<"u"?window.innerWidth*Ft:800,ae=Math.max(M,$);return Re!==null?Math.max(200,Math.min(Re,ae)):Math.max(200,M)},[Re,Q]),Dt=react.useRef(null),de=react.useRef(null),Qe=react.useRef(null),Ve=react.useMemo(()=>Ec(fe),[fe]),ar=react.useMemo(()=>({theme:Ve,themeName:fe}),[Ve,fe]),Lo=react.useMemo(()=>nm(d),[d]),kr=react.useMemo(()=>{if(!u)return ee;let P=ve.calculateCriticalPath(ee),M=$=>$.map(ae=>({...ae,isCriticalPath:P.includes(ae.id),subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(ee)},[ee,u]),rr=react.useMemo(()=>{if(ut==="all"&&!ge)return kr;let P=M=>{let $=[];for(let ae of M){let me=ae.subtasks?.length?P(ae.subtasks):void 0,ye=false;if(ge)ye=ae.progress<100;else switch(ut){case "all":ye=true;break;case "incomplete":ye=ae.progress<100;break;case "in_progress":ye=ae.progress>0&&ae.progress<100;break;case "completed":ye=ae.progress===100;break}(ye||me&&me.length>0)&&$.push({...ae,subtasks:me});}return $};return P(kr)},[kr,ut,ge]),or=w0(Oe);om({undo:Pa,redo:be,canUndo:qe,canRedo:He,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>ve.findTaskById(ee,P),addTask:(P,M)=>{Ye($=>{if(!M)return [...$,{...P,level:0}];let ae=me=>me.map(ye=>ye.id===M?{...ye,subtasks:[...ye.subtasks||[],{...P,parentId:M,level:(ye.level||0)+1}],isExpanded:true}:ye.subtasks?{...ye,subtasks:ae(ye.subtasks)}:ye);return ae($)});},updateTask:(P,M)=>{Ye($=>{let ae=me=>me.map(ye=>ye.id===P?{...ye,...M}:ye.subtasks?{...ye,subtasks:ae(ye.subtasks)}:ye);return ae($)});},deleteTask:P=>{Ye(M=>{let $=ae=>ae.filter(me=>me.id===P?false:(me.subtasks&&(me.subtasks=$(me.subtasks)),true));return $(M)});},deleteTasks:P=>{Ye(M=>zi(M,P));},duplicateTask:P=>{Ye(M=>Ui(M,[P]));},splitTask:(P,M,$=3)=>{Ye(ae=>ve.splitTask(ae,P,M,$));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(P,M)=>!ve.validateDependencies(ee,P,M),getAllTasks:()=>ve.flattenTasks(ee),getTasksByStatus:P=>ve.flattenTasks(ee).filter(M=>M.status===P),getTasksByParent:P=>P?ve.findTaskById(ee,P)?.subtasks||[]:ee.filter($=>!$.parentId),getCriticalPath:()=>ve.flattenTasks(ee).filter(P=>P.isCriticalPath),indentTask:P=>{Ye(M=>Bi(M,[P]));},outdentTask:P=>{Ye(M=>Ri(M,[P]));},moveTask:(P,M)=>{Ye($=>Oi($,[P],M));},createSubtask:async P=>{let{tasks:M,newTask:$}=Wi(ee,P);if(Ne){let ae=Ne({...$,parentId:P});if((ae instanceof Promise?await ae:ae)===false)return}Ye(M),Ae&&Ae({...$,parentId:P});},scrollToTask:P=>{let $=ve.flattenTasks(ee).findIndex(ae=>ae.id===P);if($!==-1&&Dt.current){let ae=$*or;Dt.current.scrollTo({top:ae,behavior:"smooth"}),de.current&&de.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(P,M=2e3)=>{},expandTask:P=>{Ye(M=>{let $=ae=>ae.map(me=>me.id===P?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:$(me.subtasks)}:me);return $(M)});},collapseTask:P=>{Ye(M=>{let $=ae=>ae.map(me=>me.id===P?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:$(me.subtasks)}:me);return $(M)});},expandAll:()=>{Ye(P=>{let M=$=>$.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(P)});},collapseAll:()=>{Ye(P=>{let M=$=>$.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(P)});},undo:Pa,redo:be,canUndo:()=>qe,canRedo:()=>He,clearHistory:Ze,exportToPNG:async()=>{if(!Qe.current||!Dt.current||!de.current)throw new Error("Gantt container not found");let P=Qe.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=de.current,ae=M?.scrollTop||0,me=$.scrollTop,ye=P.style.overflow,ht=P.style.height;try{let ct=M?.querySelector(".gantt-taskgrid-content"),Ht=$.querySelector("svg"),fa=ct?.scrollHeight||M?.scrollHeight||600,ha=Ht?.getBoundingClientRect().height||$.scrollHeight,_r=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(fa,ha)+20;M&&(M.scrollTop=0),$.scrollTop=0,P.style.overflow="visible",P.style.height=`${_r}px`,await new Promise(Cr=>setTimeout(Cr,100));let nr=await im__default.default(P,{backgroundColor:Ve.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Cr=>{let po=window.getComputedStyle(Cr),Vr=parseInt(po.zIndex,10);return !isNaN(Vr)&&Vr>=50||po.position==="fixed"}});return new Promise((Cr,po)=>{nr.toBlob(Vr=>{Vr?Cr(Vr):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=ye,P.style.height=ht,M&&(M.scrollTop=ae),$.scrollTop=me;}},exportToPDF:async P=>{await ve.exportToPDF(ee,P);},exportToExcel:async P=>{await ve.exportToExcel(ee,P);},exportToJSON:()=>ve.exportToJSON(ee),exportToCSV:()=>ve.exportToCSV(ee),importFromJSON:P=>{let M=ve.importFromJSON(P);Ye(M);},getTasks:()=>ee,refresh:()=>{Ye(P=>[...P]);},clearAll:()=>{Ye([]);}}),[ee,Pa,be,qe,He,Ze,Ve,or]);let Kt=react.useCallback(P=>{D(M=>M.map($=>$.id===P?{...$,visible:!$.visible}:$));},[]),Ts=react.useCallback((P,M)=>{D($=>$.map(ae=>{if(ae.id!==P)return ae;let me=ae.minWidth??100,ye=ae.maxWidth??800,ht=Math.max(me,Math.min(ye,M));return {...ae,width:ht}}));},[]),Ns=react.useCallback(P=>{Ye(M=>{let $=Hi(M,P),ae=me=>{for(let ye of me){if(ye.id===P){it.current.set(P,ye.isExpanded??true);return}ye.subtasks?.length&&ae(ye.subtasks);}};return ae($),X(),$}),a.onTaskToggleExpand?.(P);},[a,X]),Gr=react.useCallback((P,M)=>{if(F&&F(P,M)===false)return;let ae=ve.findTaskById(ee,P)?.progress,me=ht=>ht.map(ct=>ct.id===P?{...ct,...M}:ct.subtasks?{...ct,subtasks:me(ct.subtasks)}:ct);Ye(me(ee));let ye=ve.findTaskById(me(ee),P);ye&&(N?.(ye),B?.(ye),M.progress!==void 0&&ae!==void 0&&M.progress!==ae&&O?.(P,ae,M.progress));},[ee,N,F,B,O]),Io=react.useCallback(P=>{P.length!==0&&(Ye(M=>Bi(M,P)),a.onTaskIndent?.(P[0]));},[a]),ku=react.useCallback(P=>{P.length!==0&&(Ye(M=>Ri(M,P)),a.onTaskOutdent?.(P[0]));},[a]),wu=react.useCallback((P,M,$)=>{Ye(ae=>_c(ae,P,M,$)),a.onTaskReparent?.(P,M,$);},[a]),Cu=react.useCallback((P,M)=>{P.length!==0&&(Ye($=>Oi($,P,M)),a.onTaskMove?.(P[0],M));},[a]),Ds=react.useCallback(async P=>{let M=[];for(let $ of P)E&&await Promise.resolve(E($))===false||M.push($);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(Ye($=>zi($,M)),M.forEach($=>a.onTaskDelete?.($))),W&&M.forEach($=>W($)));},[a,E,W]),Tu=react.useCallback(P=>{Ye(M=>Ui(M,P)),P.forEach(M=>a.onTaskDuplicate?.(M));},[a]),Nu=react.useCallback((P,M)=>{Ye($=>{let{tasks:ae,newTask:me}=Gc($,P,M);return Ne&&Ne(me)===false?$:(a.onTaskCreate?.(me.parentId,me.position||0),Ae?.(me),ae)});},[a,Ne,Ae]),Du=react.useCallback((P,M)=>{Ye($=>$i($,P,M)),a.onTaskRename?.(P,M);},[a]),Ss=react.useCallback(P=>{Ye(M=>{let{tasks:$}=Wi(M,P);return a.onTaskCreate?.(P,0),$});},[a]),Su=react.useCallback((P,M,$)=>{let ae=P.startDate?Math.round((M.getTime()-P.startDate.getTime())/864e5):0,me=ct=>ct.map(Ht=>Ht.id===P.id?{...Ht,startDate:M,endDate:$,...P.segments&&{segments:P.segments}}:Ht.subtasks?{...Ht,subtasks:me(Ht.subtasks)}:Ht),ye=me(ee);ye=ve.autoScheduleDependents(ye,P.id,ae),Ye(ye);let ht={...P,startDate:M,endDate:$};N?.(ht);},[ee,N]),Eu=react.useCallback((P,M)=>{I?.(P,M),ke({isOpen:true,x:M.clientX,y:M.clientY,task:P});},[I]),Pu=react.useCallback((P,M)=>{let $=ve.splitTask(ee,P.id,M);Ye($),ke({isOpen:false,x:0,y:0,task:null});},[ee]),jl=react.useCallback(P=>{let M=ve.findTaskById(ee,P.id)||P;A?.(M),R||_e(M);},[ee,A,R]),Kl=react.useCallback((P,M,$)=>{let ae=new Map,me=fa=>{fa.forEach(ha=>{ha.dependencies&&ae.set(ha.id,ha.dependencies),ha.subtasks&&me(ha.subtasks);});};me($);let ye=ae.get(M)||[];ae.set(M,[...ye,P]);let ht=new Set,ct=new Set,Ht=fa=>{if(!ht.has(fa)){ht.add(fa),ct.add(fa);let ha=ae.get(fa)||[];for(let wr of ha){if(!ht.has(wr)&&Ht(wr))return true;if(ct.has(wr))return true}}return ct.delete(fa),false};return Ht(M)},[]),Yl=react.useCallback((P,M)=>{if(Kl(P.id,M,ee)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
356
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let b=t.find(w=>w.id===g);if(b){o(b);let w=r.get(g)?.ef||0;d=Math.max(d,w);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(b=>b.dependencies&&b.dependencies.includes(i.id)),p=s;if(d.length>0)for(let b of d){l(b);let w=n.get(b.id)?.ls||0;p=Math.min(p,w);}let g=p-c;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=xe.calculateEndDate(m,l),c=d=>d.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,b,w=new Set)=>{if(w.has(g))return;w.add(g);let f=xe.getDependentTasks(e,g);for(let y of f){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(C=>C.id===y.id);if(h===-1)continue;let v=y.startDate.getTime(),D=(y.endDate.getTime()-v)/c,E=(v-i)/c*s,k=E+b*s,R=Math.max(D*s,s),I=l+h*n+12;m.push({taskId:y.id,taskName:y.name,originalX:E,previewX:k,width:R,y:I,rowIndex:h,daysDelta:b,color:y.color}),p(y.id,b,w);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function xs({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:g,onDependencyCreate:b,onDependencyDelete:w}){let y=Xr(),[h,v]=react.useState([]),[T,D]=react.useState(null),N=react.useCallback(L=>{D(L);},[]),E=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=E*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-S);let K=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-K.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=react.useCallback(L=>{let U=Math.round(L/(k*n)),S=new Date(o);return S.setDate(S.getDate()+U),S},[o,k,n]),H=react.useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let K=S.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let J=K.matrixTransform(S.getScreenCTM()?.inverse()),ie=W(J.x),ue=new Date(ie);ue.setDate(ue.getDate()+1),g?.(U,ie,ue);},[W,g]),x=react.useMemo(()=>{let L=J=>J.map(ie=>{if(ie.subtasks&&ie.subtasks.length>0){let ue=L(ie.subtasks),ye=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(ye.length>0){let Oe=ye.map(rt=>rt.startDate.getTime()),Q=ye.map(rt=>rt.endDate.getTime()),Je=new Date(Math.min(...Oe)),Pe=new Date(Math.max(...Q));return {...ie,subtasks:ue,startDate:Je,endDate:Pe}}return {...ie,subtasks:ue}}return ie}),U=(J,ie=[])=>{for(let ue of J)ie.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,ie);return ie},S=L(e);return U(S)},[e]),te=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),S=L.endDate.getTime(),K=o.getTime(),J=(U-K)/(1e3*60*60*24),ie=(S-U)/(1e3*60*60*24),ue=J*k*n,ye=Math.max(k*n,40),Oe=Math.max(ie*k*n,ye);return {x:ue,width:Oe}},[o,k,n]),oe=react.useMemo(()=>x.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:S}=te(L),J=x.findIndex(ie=>ie.id===L.id)*a+12;return {id:L.id,x:U,y:J,width:S,height:32}}),[x,te]),ne=react.useCallback((L,U,S)=>{if(!S||U===0){v([]);return}let K=xe.calculateCascadePreview(e,L,U,x,o,k*n,a,48);v(K);},[e,x,o,k,n,a,48]),A=react.useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let J=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),U.setDate(U.getDate()+1);else if(r==="week"){let ie=I(U);L.push({date:new Date(U),label:`${y.labels.week} ${ie}`,x:J}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,y.labels.week]),ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ie=Math.max(x.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),A.map((L,U)=>jsxRuntime.jsxs("g",{children:[U>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${U}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:Ie,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(R,1e3),height:Ie,fill:t.bgPrimary}),A.map((L,U)=>{let S=A[U+1]?.x||R,K=C(L.date);return jsxRuntime.jsxs("g",{children:[K&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:S-L.x,height:x.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:x.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),x.map((L,U)=>{let S=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>H(K,L),onMouseEnter:K=>{K.currentTarget.setAttribute("fill",t.accentLight),K.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:K=>{K.currentTarget.setAttribute("fill","transparent"),K.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:ke>0?ke:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),x.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:K}=te(L),J=U*a+12,ie=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(ys,{task:L,x:S+K/2,y:J+16,theme:t,onClick:c},L.id):ie?jsxRuntime.jsxs("g",{onClick:()=>c?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),p?.(L,ue);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:J,width:K,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S+K,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+K,y1:J,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J+32,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),K>60&&jsxRuntime.jsx("text",{x:S+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(gs,{task:L,x:S,y:J,width:K,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:p,onDateChange:g,onDependencyCreate:b,allTaskPositions:oe,onDragMove:ne,onHoverChange:N},L.id)}),x.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let K=x.find(Pe=>Pe.id===S);if(!K||!K.startDate||!K.endDate)return null;let J=x.findIndex(Pe=>Pe.id===S),ie=te(K),ue=te(L),ye=ie.x+ie.width,Oe=J*a+28,Q=ue.x,Je=U*a+28;return jsxRuntime.jsx(bs,{x1:ye,y1:Oe,x2:Q,y2:Je,theme:t,lineStyle:i,onDelete:()=>w?.(L.id,S)},`dep-${S}-${L.id}`)})),h.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("line",{x1:ke,y1:0,x2:ke,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),T&&jsxRuntime.jsx(Mm,{tooltipData:T,theme:t,locale:l==="es"?"es":"en"})]})]})}var sy=['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"'],Im=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),iy=()=>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"})}),ly=()=>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"})}),dy=()=>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"})}),cy=()=>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 ks({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=react.useState(false),[d,p]=react.useState(false),[g,b]=react.useState([]),[w,f]=react.useState(""),[y,h]=react.useState(false),[v,T]=react.useState(true),D=react.useRef(null),N=react.useRef(null),E=react.useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=sy,maxHistory:H=50,persistHistory:x}=a,te=x?.storageKey||"gantt-ai-history",oe=x?.maxMessages??5;react.useEffect(()=>{if(x?.enabled)try{let U=localStorage.getItem(te);if(U){let K=JSON.parse(U).map(J=>({...J,timestamp:new Date(J.timestamp)}));b(K.slice(-oe));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[x?.enabled,te,oe]),react.useEffect(()=>{if(x?.enabled&&g.length>0)try{let U=g.filter(S=>!S.isLoading).slice(-oe);localStorage.setItem(te,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,x?.enabled,te,oe]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ne=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,m]),A=react.useCallback(async U=>{if(!U.trim()||y)return;let S={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};b(J=>[...J.slice(-(H-1)),S]),f(""),T(false),h(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};b(J=>[...J,K]);try{if(C){let J=await C(U,e);b(ie=>{let ue=ie.filter(Oe=>!Oe.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...ue,ye]}),ne(J);}else b(J=>[...J.filter(ue=>!ue.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(J){b(ie=>[...ie.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,H,C,e,ne]),ke=U=>{U.preventDefault(),A(w);},Ie=U=>{f(U),D.current?.focus();};if(react.useEffect(()=>{let U=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(K=>!K),i||p(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),react.useEffect(()=>{if(!i)return;let U=K=>{let J=K.target;E.current&&!E.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",U);}},[i]),!k)return null;let L={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsxRuntime.jsx(Im,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:E,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(Im,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(dy,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ly,{})})]})]}),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&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((U,S)=>jsxRuntime.jsx("button",{onClick:()=>Ie(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},S))})]}),g.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(cy,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:ke,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:w,onChange:U=>f(U.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(iy,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Bm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)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(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Rm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var gy={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Om(e){return {...gy,...e}}var wy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Um=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:g,persistFilter:b,aiAssistant:w,locale:f="en",customTranslations:y,showCreateTaskButton:h=false,createTaskLabel:v,onCreateTask:T,taskFilter:D,onTaskFilterChange:N,onThemeChange:E,onTaskClick:k,onTaskDblClick:R,onTaskContextMenu:I,onTaskUpdate:C,onProgressChange:W,onTaskEdit:H,onTaskAddSubtask:x,onTaskMarkIncomplete:te,onTaskSetInProgress:oe,onDependencyCreate:ne,onDependencyDelete:A,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:L,onAfterTaskUpdate:U,onBeforeTaskDelete:S,onAfterTaskDelete:K}=a,ie=react.useContext(ns)?.theme,[ue,ye]=react.useState(ie||s||"dark"),[Oe,Q]=react.useState(n),[Je,Pe]=react.useState(l),[rt,ut]=react.useState(1),It=react.useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Xe,pt]=react.useState(()=>{if(!b)return "all";try{let M=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ce=D??Xe,Ge=N??pt,[Be,B]=react.useState(()=>{if(!b)return false;try{let M=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=It();if(M)try{let F={taskFilter:ce,hideCompleted:Be};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ce,Be,It]);let[X,ge]=react.useState(0),[Ae,Ue]=react.useState(false),[nt,Pt]=react.useState(null),[$e,O]=react.useState({isOpen:false,x:0,y:0,task:null}),[ae,Le]=react.useState(null),[je,qe]=react.useState(null);react.useEffect(()=>{ie&&ie!==ue&&ye(ie);},[ie]),react.useEffect(()=>{s&&s!==ue&&ye(s);},[s]);let j=react.useCallback(M=>{ye(M),E?.(M);},[E]),{state:$,setState:Me,undo:ht,redo:le,canUndo:He,canRedo:De,clearHistory:Re}=Bm(t,50),de=react.useCallback(()=>g?typeof g=="string"?g:"gantt-expanded-tasks":null,[g]),Ve=react.useRef(new Map),V=react.useRef(false);if(!V.current&&g){V.current=true;let M=typeof g=="string"?g:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let _=JSON.parse(F);Array.isArray(_)&&(Ve.current=new Map(_));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let q=react.useCallback(()=>{let M=de();if(M)try{let F=Array.from(Ve.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[de]);react.useEffect(()=>{let M=_=>{let ee=new Map;for(let pe of _){let we=pe.id;ee.get(we)||ee.set(we,pe);}return Array.from(ee.values())},F=_=>_.map(ee=>{let pe=Ve.current.get(ee.id),we=pe!==void 0?{...ee,isExpanded:pe}:ee;if(we.subtasks?.length){let Dt=M(we.subtasks);return {...we,subtasks:F(Dt)}}return we});if(Ve.current.size>0)Me(F(t));else {let _=ee=>ee.map(pe=>pe.subtasks?.length?{...pe,subtasks:M(_(pe.subtasks))}:pe);Me(_(t));}},[t,Me]);let Se=react.useRef(t),Ye=react.useRef(true);react.useEffect(()=>{if(Ye.current){Ye.current=false,Se.current=$;return}if(!r)return;let M=JSON.stringify(Se.current),F=JSON.stringify($);M!==F&&(Se.current=$,r($));},[$,r]);let ze=react.useMemo(()=>Zi(f,y),[f,y]),G=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}],[]),[me,_e]=react.useState(()=>G(ze));react.useEffect(()=>{_e(M=>M.map(F=>({...F,label:ze.columns[F.id==="name"?"taskName":F.id]||F.label})));},[ze]);let Tt=react.useMemo(()=>me.filter(F=>F.visible).reduce((F,_)=>F+_.width,0),[me]),gt=react.useRef(me.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=me.filter(ee=>ee.visible),F=M.map(ee=>ee.id).join(","),_=gt.current;if(F!==_){let ee=M.some(we=>we.id!=="name"),pe=_.includes(",");ee?!pe&&ee&&Pt(null):Pt(null),gt.current=F;}},[me]);let Sr=60,fr=.6,Ia=react.useMemo(()=>{let F=Tt+Sr,_=typeof window<"u"?window.innerWidth*fr:800,ee=Math.max(F,_);return nt!==null?Math.max(200,Math.min(nt,ee)):Math.max(200,F)},[nt,Tt]),Ba=react.useRef(null),fe=react.useRef(null),Nt=react.useRef(null),ot=react.useMemo(()=>sm(ue),[ue]),Or=react.useMemo(()=>({theme:ot,themeName:ue}),[ot,ue]),oo=react.useMemo(()=>Om(d),[d]),br=react.useMemo(()=>{if(!p)return $;let M=xe.calculateCriticalPath($),F=_=>_.map(ee=>({...ee,isCriticalPath:M.includes(ee.id),subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F($)},[$,p]),P=react.useMemo(()=>{if(ce==="all"&&!Be)return br;let M=F=>{let _=[];for(let ee of F){let pe=ee.subtasks?.length?M(ee.subtasks):void 0,we=false;if(Be)we=ee.progress<100;else switch(ce){case "all":we=true;break;case "incomplete":we=ee.progress<100;break;case "in_progress":we=ee.progress>0&&ee.progress<100;break;case "completed":we=ee.progress===100;break}(we||pe&&pe.length>0)&&_.push({...ee,subtasks:pe});}return _};return M(br)},[br,ce,Be]),re=wy(Je);Rm({undo:ht,redo:le,canUndo:He,canRedo:De,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>xe.findTaskById($,M),addTask:(M,F)=>{Me(_=>{if(!F)return [..._,{...M,level:0}];let ee=pe=>pe.map(we=>we.id===F?{...we,subtasks:[...we.subtasks||[],{...M,parentId:F,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},updateTask:(M,F)=>{Me(_=>{let ee=pe=>pe.map(we=>we.id===M?{...we,...F}:we.subtasks?{...we,subtasks:ee(we.subtasks)}:we);return ee(_)});},deleteTask:M=>{Me(F=>{let _=ee=>ee.filter(pe=>pe.id===M?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(F)});},deleteTasks:M=>{Me(F=>dl(F,M));},duplicateTask:M=>{Me(F=>cl(F,[M]));},splitTask:(M,F,_=3)=>{Me(ee=>xe.splitTask(ee,M,F,_));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(M,F)=>!xe.validateDependencies($,M,F),getAllTasks:()=>xe.flattenTasks($),getTasksByStatus:M=>xe.flattenTasks($).filter(F=>F.status===M),getTasksByParent:M=>M?xe.findTaskById($,M)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>xe.flattenTasks($).filter(M=>M.isCriticalPath),indentTask:M=>{Me(F=>sl(F,[M]));},outdentTask:M=>{Me(F=>il(F,[M]));},moveTask:(M,F)=>{Me(_=>ll(_,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:_}=pl($,M);if(ke){let ee=ke({..._,parentId:M});if((ee instanceof Promise?await ee:ee)===false)return}Me(F),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=xe.flattenTasks($).findIndex(ee=>ee.id===M);if(_!==-1&&Ba.current){let ee=_*re;Ba.current.scrollTo({top:ee,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},collapseTask:M=>{Me(F=>{let _=ee=>ee.map(pe=>pe.id===M?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},expandAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},collapseAll:()=>{Me(M=>{let F=_=>_.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?F(ee.subtasks):void 0}));return F(M)});},undo:ht,redo:le,canUndo:()=>He,canRedo:()=>De,clearHistory:Re,exportToPNG:async()=>{if(!Nt.current||!Ba.current||!fe.current)throw new Error("Gantt container not found");let M=Nt.current,F=Ba.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=_.scrollTop,we=M.style.overflow,Dt=M.style.height;try{let ft=F?.querySelector(".gantt-taskgrid-content"),_t=_.querySelector("svg"),Na=ft?.scrollHeight||F?.scrollHeight||600,Ea=_t?.getBoundingClientRect().height||_.scrollHeight,so=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Ea)+20;F&&(F.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${so}px`,await new Promise(zr=>setTimeout(zr,100));let hr=await zm__default.default(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:zr=>{let Po=window.getComputedStyle(zr),io=parseInt(Po.zIndex,10);return !isNaN(io)&&io>=50||Po.position==="fixed"}});return new Promise((zr,Po)=>{hr.toBlob(io=>{io?zr(io):Po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=we,M.style.height=Dt,F&&(F.scrollTop=ee),_.scrollTop=pe;}},exportToPDF:async M=>{await xe.exportToPDF($,M);},exportToExcel:async M=>{await xe.exportToExcel($,M);},exportToJSON:()=>xe.exportToJSON($),exportToCSV:()=>xe.exportToCSV($),importFromJSON:M=>{let F=xe.importFromJSON(M);Me(F);},getTasks:()=>$,refresh:()=>{Me(M=>[...M]);},clearAll:()=>{Me([]);}}),[$,ht,le,He,De,Re,ot,re]);let ve=react.useCallback(M=>{_e(F=>F.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),Ze=react.useCallback((M,F)=>{_e(_=>_.map(ee=>{if(ee.id!==M)return ee;let pe=ee.minWidth??100,we=ee.maxWidth??800,Dt=Math.max(pe,Math.min(we,F));return {...ee,width:Dt}}));},[]),aa=react.useCallback(M=>{Me(F=>{let _=ul(F,M),ee=pe=>{for(let we of pe){if(we.id===M){Ve.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&ee(we.subtasks);}};return ee(_),q(),_}),a.onTaskToggleExpand?.(M);},[a,q]),ia=react.useCallback((M,F)=>{if(L&&L(M,F)===false)return;let ee=xe.findTaskById($,M)?.progress,pe=Dt=>Dt.map(ft=>ft.id===M?{...ft,...F}:ft.subtasks?{...ft,subtasks:pe(ft.subtasks)}:ft);Me(pe($));let we=xe.findTaskById(pe($),M);we&&(C?.(we),U?.(we),F.progress!==void 0&&ee!==void 0&&F.progress!==ee&&W?.(M,ee,F.progress));},[$,C,L,U,W]),ra=react.useCallback(M=>{M.length!==0&&(Me(F=>sl(F,M)),a.onTaskIndent?.(M[0]));},[a]),rr=react.useCallback(M=>{M.length!==0&&(Me(F=>il(F,M)),a.onTaskOutdent?.(M[0]));},[a]),Ta=react.useCallback((M,F,_)=>{Me(ee=>wm(ee,M,F,_)),a.onTaskReparent?.(M,F,_);},[a]),Sa=react.useCallback((M,F)=>{M.length!==0&&(Me(_=>ll(_,M,F)),a.onTaskMove?.(M[0],F));},[a]),no=react.useCallback(async M=>{let F=[];for(let _ of M)S&&await Promise.resolve(S(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Me(_=>dl(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),K&&F.forEach(_=>K(_)));},[a,S,K]),rg=react.useCallback(M=>{Me(F=>cl(F,M)),M.forEach(F=>a.onTaskDuplicate?.(F));},[a]),og=react.useCallback((M,F)=>{Me(_=>{let{tasks:ee,newTask:pe}=km(_,M,F);return ke&&ke(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ie?.(pe),ee)});},[a,ke,Ie]),ng=react.useCallback((M,F)=>{Me(_=>ml(_,M,F)),a.onTaskRename?.(M,F);},[a]),_s=react.useCallback(M=>{Me(F=>{let{tasks:_}=pl(F,M);return a.onTaskCreate?.(M,0),_});},[a]),sg=react.useCallback((M,F,_)=>{let ee=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/864e5):0,pe=ft=>ft.map(_t=>_t.id===M.id?{..._t,startDate:F,endDate:_,...M.segments&&{segments:M.segments}}:_t.subtasks?{..._t,subtasks:pe(_t.subtasks)}:_t),we=pe($);we=xe.autoScheduleDependents(we,M.id,ee),Me(we);let Dt={...M,startDate:F,endDate:_};C?.(Dt);},[$,C]),ig=react.useCallback((M,F)=>{I?.(M,F),O({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[I]),lg=react.useCallback((M,F)=>{let _=xe.splitTask($,M.id,F);Me(_),O({isOpen:false,x:0,y:0,task:null});},[$]),yd=react.useCallback(M=>{let F=xe.findTaskById($,M.id)||M;R?.(F),H||Le(F);},[$,R,H]),vd=react.useCallback((M,F,_)=>{let ee=new Map,pe=Na=>{Na.forEach(Ea=>{Ea.dependencies&&ee.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(_);let we=ee.get(F)||[];ee.set(F,[...we,M]);let Dt=new Set,ft=new Set,_t=Na=>{if(!Dt.has(Na)){Dt.add(Na),ft.add(Na);let Ea=ee.get(Na)||[];for(let $r of Ea){if(!Dt.has($r)&&_t($r))return true;if(ft.has($r))return true}}return ft.delete(Na),false};return _t(F)},[]),xd=react.useCallback((M,F)=>{if(vd(M.id,F,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
357
357
|
|
|
358
|
-
Task dependencies must flow in one direction only.`);return}let $=ae=>ae.map(me=>{if(me.id===M){let ye=me.dependencies||[];if(!ye.includes(P.id))return {...me,dependencies:[...ye,P.id]}}return me.subtasks?{...me,subtasks:$(me.subtasks)}:me});Ye($(ee)),ie?.(P.id,M);},[ee,ie,Kl]),ql=react.useCallback((P,M)=>{let $=ae=>ae.map(me=>{if(me.id===P&&me.dependencies){let ye=me.dependencies.filter(ht=>ht!==M);return {...me,dependencies:ye}}return me.subtasks?{...me,subtasks:$(me.subtasks)}:me});Ye($(ee)),xe?.(P,M);},[ee,xe]),{startDate:pn,endDate:Mu}=react.useMemo(()=>{let P=ee.filter(ye=>ye.startDate&&ye.endDate);if(P.length===0){let ye=new Date,ht=new Date(ye);ht.setDate(ht.getDate()-30);let ct=new Date(ye);return ct.setDate(ct.getDate()+60),{startDate:ht,endDate:ct}}let M=P.flatMap(ye=>[ye.startDate,ye.endDate]).filter(ye=>ye!==void 0),$=new Date(Math.min(...M.map(ye=>ye.getTime()))),ae=new Date(Math.max(...M.map(ye=>ye.getTime()))),me=Y==="day"?7:Y==="week"?14:30;return $.setDate($.getDate()-me),ae.setDate(ae.getDate()+me),{startDate:$,endDate:ae}},[ee,Y]),Fu=react.useCallback(async()=>{if(!Qe.current||!Dt.current||!de.current)return;await new Promise(_r=>setTimeout(_r,200));let P=Qe.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=de.current,ae=M?.scrollTop||0,me=M?.scrollLeft||0,ye=$.scrollTop,ht=$.scrollLeft,ct=P.style.overflow,Ht=P.style.height,fa=M?.style.overflow||"",ha=$.style.overflow,wr=P.style.width,un=$.style.width;try{let _r=M?.querySelector(".gantt-taskgrid-content"),nr=$.querySelector("svg"),Cr=nr?.getAttribute("height")?parseInt(nr.getAttribute("height"),10):nr?.getBoundingClientRect().height||0,po=_r?.scrollHeight||M?.scrollHeight||600,Vr=Math.max(Cr,$.scrollHeight),Zl=nr?.getAttribute("width")?parseInt(nr.getAttribute("width"),10):nr?.getBoundingClientRect().width||$.scrollWidth,Uu=P.querySelector('[class*="h-12"]')?.offsetHeight||48,Ps=Math.max(po,Vr,Cr),Ms=Uu+Ps+50,Fs=(M?.offsetWidth||300)+Zl+10;M&&(M.scrollTop=0,M.scrollLeft=0),$.scrollTop=0,$.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Ms}px`,P.style.width=`${Fs}px`,M&&(M.style.overflow="visible",M.style.height=`${Ps+50}px`),$.style.overflow="visible",$.style.height=`${Ps+50}px`,$.style.width=`${Zl+10}px`,await new Promise(Ls=>setTimeout(Ls,150));let $u=await im__default.default(P,{backgroundColor:Ve.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Fs,height:Ms,windowWidth:Fs+100,windowHeight:Ms+100,scrollX:0,scrollY:0,ignoreElements:Ls=>{let Ql=window.getComputedStyle(Ls),ed=parseInt(Ql.zIndex,10);return !isNaN(ed)&&ed>=50||Ql.position==="fixed"}}),As=document.createElement("a");As.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,As.href=$u.toDataURL("image/png"),As.click();}finally{P.style.overflow=ct,P.style.height=Ht,P.style.width=wr,M&&(M.style.overflow=fa,M.style.height="",M.scrollTop=ae,M.scrollLeft=me),$.style.overflow=ha,$.style.height="",$.style.width=un,$.scrollTop=ye,$.scrollLeft=ht;}},[Ve]),Au=react.useCallback(async()=>{await ve.exportToPDF(ee);},[ee]),Lu=react.useCallback(async()=>{await ve.exportToExcel(ee);},[ee]),Iu=react.useCallback(()=>{let P=ve.exportToCSV(ee),M=new Blob([P],{type:"text/csv;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.csv",$.click(),URL.revokeObjectURL($.href);},[ee]),Bu=react.useCallback(()=>{let P=ve.exportToJSON(ee),M=new Blob([P],{type:"application/json;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.json",$.click(),URL.revokeObjectURL($.href);},[ee]),Ru=react.useCallback(()=>{ve.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),Ou=P=>{P.preventDefault(),Z(true);},mo=react.useRef(false),[Es,Xl]=react.useState(false),Bo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=de.current,M=Dt.current?.querySelector(".gantt-grid-scroll");if(!P||!M)return;let $=()=>{if(mo.current)return;mo.current=true;let ct=P.scrollTop;Te(ct),M.scrollTop=ct,requestAnimationFrame(()=>{mo.current=false;});},ae=()=>{if(mo.current)return;mo.current=true;let ct=M.scrollTop;Te(ct),P.scrollTop=ct,requestAnimationFrame(()=>{mo.current=false;});},me=ct=>{if(Ue&&M){let fa=M.parentElement?.getBoundingClientRect()?.left||0,ha=ct.clientX-fa,wr=200,un=Q+Xe,_r=window.innerWidth*Ft,nr=Math.max(un,_r);ha>=wr&&ha<=nr&&H(ha);}if(Es&&P){let Ht=ct.clientX-Bo.current.x,fa=ct.clientY-Bo.current.y;P.scrollLeft=Bo.current.scrollLeft-Ht,P.scrollTop=Bo.current.scrollTop-fa;}},ye=()=>{Z(false),Xl(false);},ht=ct=>{if(ct.button!==0)return;let Ht=ct.target;Ht.closest("[data-task-bar]")||Ht.closest("[data-dependency-line]")||Ht.closest("button")||Ht.closest('[role="button"]')||Ht.tagName==="rect"&&Ht.getAttribute("data-clickable")==="true"||(Xl(true),Bo.current={x:ct.clientX,y:ct.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},ct.preventDefault());};return P.addEventListener("scroll",$),M.addEventListener("scroll",ae),P.addEventListener("mousedown",ht),document.addEventListener("mousemove",me),document.addEventListener("mouseup",ye),()=>{P.removeEventListener("scroll",$),M.removeEventListener("scroll",ae),P.removeEventListener("mousedown",ht),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",ye);}},[Ue,Es,Q]);let Jl=react.useRef(false),zu=react.useRef(null);return react.useLayoutEffect(()=>{if(Jl.current||ee.length===0||!de.current)return;Jl.current=true,zu.current=pn;let P=de.current,M=new Date,$=Y==="day"?60:Y==="week"?20:8,ae=(M.getTime()-pn.getTime())/(1e3*60*60*24),me=P.clientWidth,ht=ae*$*Le-me/2;ae>=0&&me>0&&(P.scrollLeft=Math.max(0,ht));},[ee.length,pn,Y,Le]),jsxRuntime.jsx(To.Provider,{value:ze,children:jsxRuntime.jsx(zs.Provider,{value:ar,children:jsxRuntime.jsxs("div",{ref:Qe,className:"flex flex-col h-full w-full",style:{backgroundColor:Ve.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx($n,{theme:Ve,timeScale:Y,onTimeScaleChange:V,zoom:Le,onZoomChange:Je,currentTheme:fe,onThemeChange:Be,rowDensity:Oe,onRowDensityChange:ue,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:p,onCreateTask:w,taskFilter:ut,onTaskFilterChange:Pt,hideCompleted:ge,onHideCompletedChange:L,onExportPNG:i?Fu:void 0,onExportPDF:i?Au:void 0,onExportExcel:i?Lu:void 0,onExportCSV:i?Iu:void 0,onExportJSON:i?Bu:void 0,onExportMSProject:i?Ru:void 0}),jsxRuntime.jsxs("div",{ref:Dt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Zt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(_n,{tasks:rr,theme:Ve,rowHeight:or,availableUsers:c,templates:Lo,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:I,onTaskToggle:Ns,scrollTop:re,columns:le,onToggleColumn:Kt,onColumnResize:Ts,onTaskUpdate:Gr,onTaskIndent:Io,onTaskOutdent:ku,onTaskMove:Cu,onMultiTaskDelete:Ds,onTaskDuplicate:Tu,onTaskCreate:Nu,onTaskRename:Du,onCreateSubtask:Ss,onOpenTaskModal:C?P=>C(P):void 0,onDeleteRequest:(P,M)=>ne({taskId:P,taskName:M}),onTaskReparent:wu})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ve.border,zIndex:15},onMouseDown:Ou}),jsxRuntime.jsx("div",{ref:de,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Es?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Qn,{tasks:rr,theme:Ve,rowHeight:or,timeScale:Y,startDate:pn,endDate:Mu,zoom:Le,locale:g,templates:Lo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:Eu,onTaskDateChange:Su,onDependencyCreate:Yl,onDependencyDelete:ql})})]}),K.task&&jsxRuntime.jsx(No,{isOpen:K.isOpen,x:K.x,y:K.y,theme:Ve,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=K.task;if(!P)return [];let M=ve.findTaskById(ee,P.id)||P;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{_?_(M):Ss(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ne({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:ze.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{R?R(M):_e(M);}},{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{_?_(M):Ss(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{se?se(M):Gr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:ze.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{te?te(M):Gr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:ze.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{Gr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ze.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let ae=M.startDate.getTime(),me=M.endDate.getTime(),ye=ae+(me-ae)/2,ht=new Date(ye);Pu(M,ht);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ne({taskId:M.id,taskName:M.name});}}]})()}),jsxRuntime.jsx(fr,{task:Ie,isOpen:!!Ie,onClose:()=>_e(null),onTaskUpdate:P=>{Ie&&(Gr(Ie.id,P),_e(null));},theme:fe==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We&&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:()=>ne(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ve.bgSecondary,border:`1px solid ${Ve.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ve.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:Ve.textPrimary,fontFamily:"Inter, sans-serif"},children:[ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Ve.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:Ve.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Ve.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ve.bgPrimary,borderTop:`1px solid ${Ve.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ne(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ve.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Ve.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ds([We.taskId]),ne(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsxRuntime.jsx(es,{tasks:ee,theme:Ve,config:k,onTasksUpdate:Ye,onTaskUpdate:Gr,onTaskCreate:P=>{Ye(M=>[...M,P]);},onTaskDelete:P=>{Ds([P]);},onDependencyCreate:(P,M)=>{let $=ve.findTaskById(ee,P);$&&Yl($,M);},onDependencyDelete:ql})]})})})});var Ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Yi=[{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 pm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:u=[],onUploadAttachments:f,onDeleteAttachment:y}){let k=[...Ki,...i.filter(L=>!Ki.some(re=>re.id===L.id))],g=et[m]||et.dark,[v,h]=react.useState(false),[p,w]=react.useState(false),[x,S]=react.useState(false),[T,C]=react.useState(false),[A,I]=react.useState({top:0,left:0}),[N,O]=react.useState(null),[R,_]=react.useState(new Date),[se,te]=react.useState({top:0,left:0}),[ie,xe]=react.useState(false),[Ne,Ae]=react.useState([]),[F,B]=react.useState(false),[E,W]=react.useState(""),q=react.useRef(null),pe=react.useRef(null),fe=react.useRef(null),Ce=react.useRef(null),Y=react.useRef(null),[V,Oe]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ue,Le]=react.useState({});react.useEffect(()=>{a?(Oe({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&xe(true)):(Oe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),xe(false),Ae([]));},[a,e]),react.useEffect(()=>{let L=re=>{q.current&&!q.current.contains(re.target)&&h(false),pe.current&&!pe.current.contains(re.target)&&w(false),fe.current&&!fe.current.contains(re.target)&&S(false),Ce.current&&!Ce.current.contains(re.target)&&C(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let Je=()=>{let L={};return V.name.trim()||(L.name="El nombre es requerido"),V.startDate&&V.endDate&&V.startDate>V.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Le(L),Object.keys(L).length===0},st=async L=>{if(L.preventDefault(),!!Je())try{let re=l==="create"&&Ne.length>0?{...V,pendingFiles:Ne}:V;await s(re),Ae([]),t();}catch(re){console.error("Error submitting task:",re);}},Ge=(L,re)=>{Oe(Te=>{let Ue={...Te,[L]:re};if(L==="status"){let Z=re;Z==="todo"?Ue.progress=0:Z==="in-progress"?(Te.progress===0||Te.progress===100)&&(Ue.progress=50):Z==="completed"||Z==="closed"?Ue.progress=100:(Z==="in-review"||Z==="review")&&(Ue.progress=75);}if(L==="progress"){let Z=typeof re=="number"?re:parseInt(re,10);Z===100&&Te.status!=="completed"?Ue.status="completed":Z>0&&Z<100&&Te.status==="todo"?Ue.status="in-progress":Z===0&&Te.status!=="todo"&&(Ue.status="todo");}return Ue}),ue[L]&&Le(Te=>{let Ue={...Te};return delete Ue[L],Ue});},bt=k.find(L=>L.id===V.status)??Ki[0],ut=Yi.find(L=>L.id===V.priority)??Yi[1],Pt=Jr.find(L=>L.value===V.color)??Jr[0],ge={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:bt.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=g.hoverBg,L.currentTarget.style.color=g.textPrimary;},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:st,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:V.name,onChange:L=>Ge("name",L.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ue.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"}),ue.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:V.description||"",onChange:L=>Ge("description",L.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ge,borderColor:bt.color,backgroundColor:`${bt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:bt.color}}),jsxRuntime.jsx("span",{style:{color:bt.color},children:bt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:bt.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(L=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("status",L.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,V.status===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),jsxRuntime.jsxs("div",{ref:pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsxRuntime.jsx("span",{children:ut.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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 shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Yi.map(L=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("priority",L.id),w(false);},children:[jsxRuntime.jsx("span",{children:L.icon}),L.label,V.priority===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:fe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[V.assignees&&V.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,3).map((L,re)=>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:L.color||g.accent,borderColor:g.bgSecondary},children:L.initials},re))}),V.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",V.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&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 shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(L=>{let re=V.assignees?.some(Te=>Te.name===L.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:g.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Te=re?(V.assignees||[]).filter(Ue=>Ue.name!==L.name):[...V.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(Ue=>Ue[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ge("assignees",Te);},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:g.accent},children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},L.id)})})})]}),jsxRuntime.jsxs("div",{ref:Ce,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)C(false);else {if(Ce.current){let L=Ce.current.getBoundingClientRect(),re=window.innerHeight,Te=120,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;I({top:Z,left:L.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:V.color}}),jsxRuntime.jsx("span",{children:Pt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Jr.slice(0,18).map(L=>{let re=V.color===L.value;return jsxRuntime.jsx("button",{type:"button",onClick:Te=>{Te.preventDefault(),Te.stopPropagation(),Ge("color",L.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:re?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),c.length>0||d?jsxRuntime.jsx(Sr,{selectedTags:V.tags||[],availableTags:c,onChange:L=>Ge("tags",L),onCreateTag:d,theme:g,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:Y,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="start")O(null);else {if(Y.current){let L=Y.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;te({top:Z,left:L.left});}O("start"),_(V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:n||V.isMilestone,children:V.startDate?V.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="end")O(null);else {if(Y.current){let L=Y.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;te({top:Z,left:L.left});}O("end"),_(V.endDate||V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:n||V.isMilestone,children:V.endDate?V.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(gt,{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:`${se.top}px`,left:`${se.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let L=new Date,re=new Date(L);re.setDate(L.getDate()+1);let Te=new Date(L);Te.setDate(L.getDate()+7);let Ue=new Date(L);return Ue.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:Te},{label:"2 semanas",date:Ue}].map((Re,H)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Ge("startDate",Re.date),(!V.endDate||Re.date>V.endDate)&&Ge("endDate",Re.date),O("end")):(Ge("endDate",Re.date),(!V.startDate||Re.date<V.startDate)&&Ge("startDate",Re.date),O(null));},children:Re.label},H))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.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:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("startDate",void 0),Ge("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:()=>_(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>_(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,re)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:L},re))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=R.getFullYear(),re=R.getMonth(),Te=new Date(L,re,1).getDay(),Ue=new Date(L,re+1,0).getDate(),Z=new Date,Re=[];for(let K=Te-1;K>=0;K--)Re.push({day:new Date(L,re,-K).getDate(),date:new Date(L,re-1,new Date(L,re,-K).getDate()),isCurrentMonth:false});for(let K=1;K<=Ue;K++)Re.push({day:K,date:new Date(L,re,K),isCurrentMonth:true});let H=42-Re.length;for(let K=1;K<=H;K++)Re.push({day:K,date:new Date(L,re+1,K),isCurrentMonth:false});return Re.map((K,ke)=>{let Ie=K.date.toDateString()===Z.toDateString(),_e=V.startDate?.toDateString()===K.date.toDateString(),We=V.endDate?.toDateString()===K.date.toDateString(),ne=V.startDate&&V.endDate&&K.date>=V.startDate&&K.date<=V.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:K.isCurrentMonth?_e||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:_e?"#3B82F6":We?"#7C3AED":ne?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ie&&!_e&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Ge("startDate",K.date),V.endDate&&K.date>V.endDate&&Ge("endDate",K.date),O("end")):(Ge("endDate",K.date),V.startDate&&K.date<V.startDate&&Ge("startDate",K.date),O(null));},children:K.day},ke)})})()})]})]})]})})]}),ue.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ue.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.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:V.progress,onChange:L=>Ge("progress",parseInt(L.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:V.progress<30?"#EF4444":V.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:`${V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"}20`,color:V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"},children:[V.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>xe(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&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:[(f||u.length>0||l==="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:g.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:g.textTertiary},children:["Adjuntos ",l==="create"?Ne.length>0&&`(${Ne.length})`:u.length>0&&`(${u.length})`]})]}),l==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:Ne.map((L,re)=>({id:`pending-${re}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Ae(re=>[...re,...L]),onDelete:L=>{let re=parseInt(L.replace("pending-",""),10);Ae(Te=>Te.filter((Ue,Z)=>Z!==re));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:u,onUpload:f&&a?.id?L=>f(a.id,L):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&Ne.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Ne.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 hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:V.isMilestone,onChange:L=>Ge("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.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:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),V.dependencies&&V.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:V.dependencies.map(L=>{let re=r.find(Te=>Te.id===L);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[re?.name||L.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Te=(V.dependencies||[]).filter(Ue=>Ue!==L);Ge("dependencies",Te);},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"})})]},L)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{B(!F),W("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.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:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsxRuntime.jsx("input",{type:"text",value:E,onChange:L=>W(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>E===""||L.name.toLowerCase().includes(E.toLowerCase())).map(L=>{let re=V.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let Te=V.dependencies||[],Ue;re?Ue=Te.filter(Z=>Z!==L.id):Ue=[...Te,L.id],Ge("dependencies",Ue);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:re?`${g.accent}10`:"transparent"},onMouseEnter:Te=>{re||(Te.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor=re?`${g.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:re?g.accent:"transparent",borderColor:re?g.accent:g.borderLight},children:re&&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:g.textPrimary},children:L.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),r.filter(L=>L.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.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 ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:L=>!n&&(L.currentTarget.style.opacity="0.9"),onMouseLeave:L=>!n&&(L.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var um=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
358
|
+
Task dependencies must flow in one direction only.`);return}let _=ee=>ee.map(pe=>{if(pe.id===F){let we=pe.dependencies||[];if(!we.includes(M.id))return {...pe,dependencies:[...we,M.id]}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),ne?.(M.id,F);},[$,ne,vd]),kd=react.useCallback((M,F)=>{let _=ee=>ee.map(pe=>{if(pe.id===M&&pe.dependencies){let we=pe.dependencies.filter(Dt=>Dt!==F);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});Me(_($)),A?.(M,F);},[$,A]),{startDate:Mn,endDate:dg}=react.useMemo(()=>{let M=$.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,Dt=new Date(we);Dt.setDate(Dt.getDate()-30);let ft=new Date(we);return ft.setDate(ft.getDate()+60),{startDate:Dt,endDate:ft}}let F=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),_=new Date(Math.min(...F.map(we=>we.getTime()))),ee=new Date(Math.max(...F.map(we=>we.getTime()))),pe=Oe==="day"?7:Oe==="week"?14:30;return _.setDate(_.getDate()-pe),ee.setDate(ee.getDate()+pe),{startDate:_,endDate:ee}},[$,Oe]),cg=react.useCallback(async()=>{if(!Nt.current||!Ba.current||!fe.current)return;await new Promise(so=>setTimeout(so,200));let M=Nt.current,F=Ba.current.querySelector(".gantt-grid-scroll"),_=fe.current,ee=F?.scrollTop||0,pe=F?.scrollLeft||0,we=_.scrollTop,Dt=_.scrollLeft,ft=M.style.overflow,_t=M.style.height,Na=F?.style.overflow||"",Ea=_.style.overflow,$r=M.style.width,Fn=_.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),hr=_.querySelector("svg"),zr=hr?.getAttribute("height")?parseInt(hr.getAttribute("height"),10):hr?.getBoundingClientRect().height||0,Po=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(zr,_.scrollHeight),Td=hr?.getAttribute("width")?parseInt(hr.getAttribute("width"),10):hr?.getBoundingClientRect().width||_.scrollWidth,yg=M.querySelector('[class*="h-12"]')?.offsetHeight||48,Ks=Math.max(Po,io,zr),Ys=yg+Ks+50,qs=(F?.offsetWidth||300)+Td+10;F&&(F.scrollTop=0,F.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Ys}px`,M.style.width=`${qs}px`,F&&(F.style.overflow="visible",F.style.height=`${Ks+50}px`),_.style.overflow="visible",_.style.height=`${Ks+50}px`,_.style.width=`${Td+10}px`,await new Promise(Js=>setTimeout(Js,150));let vg=await zm__default.default(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qs,height:Ys,windowWidth:qs+100,windowHeight:Ys+100,scrollX:0,scrollY:0,ignoreElements:Js=>{let Nd=window.getComputedStyle(Js),Dd=parseInt(Nd.zIndex,10);return !isNaN(Dd)&&Dd>=50||Nd.position==="fixed"}}),Xs=document.createElement("a");Xs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xs.href=vg.toDataURL("image/png"),Xs.click();}finally{M.style.overflow=ft,M.style.height=_t,M.style.width=$r,F&&(F.style.overflow=Na,F.style.height="",F.scrollTop=ee,F.scrollLeft=pe),_.style.overflow=Ea,_.style.height="",_.style.width=Fn,_.scrollTop=we,_.scrollLeft=Dt;}},[ot]),mg=react.useCallback(async()=>{await xe.exportToPDF($);},[$]),ug=react.useCallback(async()=>{await xe.exportToExcel($);},[$]),pg=react.useCallback(()=>{let M=xe.exportToCSV($),F=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[$]),gg=react.useCallback(()=>{let M=xe.exportToJSON($),F=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[$]),fg=react.useCallback(()=>{xe.exportToMSProject($,"Gantt Project","project.xml");},[$]),bg=M=>{M.preventDefault(),Ue(true);},Eo=react.useRef(false),[js,wd]=react.useState(false),Xo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=fe.current,F=Ba.current?.querySelector(".gantt-grid-scroll");if(!M||!F)return;let _=()=>{if(Eo.current)return;Eo.current=true;let ft=M.scrollTop;ge(ft),F.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},ee=()=>{if(Eo.current)return;Eo.current=true;let ft=F.scrollTop;ge(ft),M.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},pe=ft=>{if(Ae&&F){let Na=F.parentElement?.getBoundingClientRect()?.left||0,Ea=ft.clientX-Na,$r=200,Fn=Tt+Sr,so=window.innerWidth*fr,hr=Math.max(Fn,so);Ea>=$r&&Ea<=hr&&Pt(Ea);}if(js&&M){let _t=ft.clientX-Xo.current.x,Na=ft.clientY-Xo.current.y;M.scrollLeft=Xo.current.scrollLeft-_t,M.scrollTop=Xo.current.scrollTop-Na;}},we=()=>{Ue(false),wd(false);},Dt=ft=>{if(ft.button!==0)return;let _t=ft.target;_t.closest("[data-task-bar]")||_t.closest("[data-dependency-line]")||_t.closest("button")||_t.closest('[role="button"]')||_t.tagName==="rect"&&_t.getAttribute("data-clickable")==="true"||(wd(true),Xo.current={x:ft.clientX,y:ft.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},ft.preventDefault());};return M.addEventListener("scroll",_),F.addEventListener("scroll",ee),M.addEventListener("mousedown",Dt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",_),F.removeEventListener("scroll",ee),M.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[Ae,js,Tt]);let Cd=react.useRef(false),hg=react.useRef(null);return react.useLayoutEffect(()=>{if(Cd.current||$.length===0||!fe.current)return;Cd.current=true,hg.current=Mn;let M=fe.current,F=new Date,_=Oe==="day"?60:Oe==="week"?20:8,ee=(F.getTime()-Mn.getTime())/(1e3*60*60*24),pe=M.clientWidth,Dt=ee*_*rt-pe/2;ee>=0&&pe>0&&(M.scrollLeft=Math.max(0,Dt));},[$.length,Mn,Oe,rt]),jsxRuntime.jsx(Wo.Provider,{value:ze,children:jsxRuntime.jsx(ai.Provider,{value:Or,children:jsxRuntime.jsxs("div",{ref:Nt,className:"flex flex-col h-full w-full",style:{backgroundColor:ot.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(ls,{theme:ot,timeScale:Oe,onTimeScaleChange:Q,zoom:rt,onZoomChange:ut,currentTheme:ue,onThemeChange:j,rowDensity:Je,onRowDensityChange:Pe,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:v,onCreateTask:T,taskFilter:ce,onTaskFilterChange:Ge,hideCompleted:Be,onHideCompletedChange:B,onExportPNG:i?cg:void 0,onExportPDF:i?mg:void 0,onExportExcel:i?ug:void 0,onExportCSV:i?pg:void 0,onExportJSON:i?gg:void 0,onExportMSProject:i?fg:void 0}),jsxRuntime.jsxs("div",{ref:Ba,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ia,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(us,{tasks:P,theme:ot,rowHeight:re,availableUsers:c,templates:oo,onTaskClick:k,onTaskDblClick:yd,onTaskContextMenu:I,onTaskToggle:aa,scrollTop:X,columns:me,onToggleColumn:ve,onColumnResize:Ze,onTaskUpdate:ia,onTaskIndent:ra,onTaskOutdent:rr,onTaskMove:Sa,onMultiTaskDelete:no,onTaskDuplicate:rg,onTaskCreate:og,onTaskRename:ng,onCreateSubtask:_s,onOpenTaskModal:k?M=>k(M):void 0,onDeleteRequest:(M,F)=>qe({taskId:M,taskName:F}),onTaskReparent:Ta})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ot.border,zIndex:15},onMouseDown:bg}),jsxRuntime.jsx("div",{ref:fe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:js?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(xs,{tasks:P,theme:ot,rowHeight:re,timeScale:Oe,startDate:Mn,endDate:dg,zoom:rt,locale:f,templates:oo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:yd,onTaskContextMenu:ig,onTaskDateChange:sg,onDependencyCreate:xd,onDependencyDelete:kd})})]}),$e.task&&jsxRuntime.jsx(Go,{isOpen:$e.isOpen,x:$e.x,y:$e.y,theme:ot,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=$e.task;if(!M)return [];let F=xe.findTaskById($,M.id)||M;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{x?x(F):_s(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:ze.contextMenu?.editTask||"Edit Task",icon:Ht.Pencil,onClick:()=>{H?H(F):Le(F);}},{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ht.Add,onClick:()=>{x?x(F):_s(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ht.MarkIncomplete,onClick:()=>{te?te(F):ia(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:ze.contextMenu?.setInProgress||"Set In Progress",icon:Ht.SetInProgress,onClick:()=>{oe?oe(F):ia(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:ze.contextMenu?.markComplete||"Mark Complete",icon:Ht.MarkComplete,onClick:()=>{ia(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ze.contextMenu?.splitTask||"Split Task",icon:Ht.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let ee=F.startDate.getTime(),pe=F.endDate.getTime(),we=ee+(pe-ee)/2,Dt=new Date(we);lg(F,Dt);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ht.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]})()}),jsxRuntime.jsx(Mr,{task:ae,isOpen:!!ae,onClose:()=>Le(null),onTaskUpdate:M=>{ae&&(ia(ae.id,M),Le(null));},theme:ue==="light"?"light":"dark",locale:f==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&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:()=>qe(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:ot.bgSecondary,border:`1px solid ${ot.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ot.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:ot.textPrimary,fontFamily:"Inter, sans-serif"},children:[ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ot.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:ot.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:ot.textPrimary},children:['"',je.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ot.bgPrimary,borderTop:`1px solid ${ot.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>qe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=ot.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:f==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{no([je.taskId]),qe(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"]})]})]})})}),w?.enabled&&jsxRuntime.jsx(ks,{tasks:$,theme:ot,config:w,onTasksUpdate:Me,onTaskUpdate:ia,onTaskCreate:M=>{Me(F=>[...F,M]);},onTaskDelete:M=>{no([M]);},onDependencyCreate:(M,F)=>{let _=xe.findTaskById($,M);_&&xd(_,F);},onDependencyDelete:kd})]})})})});function Ly(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 Iy(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 l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}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):null}var yl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vl=[{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 Vm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:b}){let w=[...yl,...i.filter(B=>!yl.some(X=>X.id===B.id))],f=et[m]||et.dark,[y,h]=react.useState(false),[v,T]=react.useState(false),[D,N]=react.useState(false),[E,k]=react.useState(false),[R,I]=react.useState({top:0,left:0}),[C,W]=react.useState(null),[H,x]=react.useState(new Date),[te,oe]=react.useState({top:0,left:0}),[ne,A]=react.useState(false),[ke,Ie]=react.useState([]),[L,U]=react.useState(false),[S,K]=react.useState(""),J=react.useRef(null),ie=react.useRef(null),ue=react.useRef(null),ye=react.useRef(null),Oe=react.useRef(null),[Q,Je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Pe,rt]=react.useState({});react.useEffect(()=>{a?(Je({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&A(true)):(Je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),A(false),Ie([]));},[a,e]),react.useEffect(()=>{let B=X=>{J.current&&!J.current.contains(X.target)&&h(false),ie.current&&!ie.current.contains(X.target)&&T(false),ue.current&&!ue.current.contains(X.target)&&N(false),ye.current&&!ye.current.contains(X.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ut=()=>{let B={};return Q.name.trim()||(B.name="El nombre es requerido"),Q.startDate&&Q.endDate&&Q.startDate>Q.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(B),Object.keys(B).length===0},It=async B=>{if(B.preventDefault(),!!ut())try{let X=l==="create"&&ke.length>0?{...Q,pendingFiles:ke}:Q;await s(X),Ie([]),t();}catch(X){console.error("Error submitting task:",X);}},Xe=(B,X)=>{Je(ge=>{let Ae={...ge,[B]:X};if(B==="status"){let Ue=X;Ue==="todo"?Ae.progress=0:Ue==="in-progress"?(ge.progress===0||ge.progress===100)&&(Ae.progress=50):Ue==="completed"||Ue==="closed"?Ae.progress=100:(Ue==="in-review"||Ue==="review")&&(Ae.progress=75);}if(B==="progress"){let Ue=typeof X=="number"?X:parseInt(X,10);Ue===100&&ge.status!=="completed"?Ae.status="completed":Ue>0&&Ue<100&&ge.status==="todo"?Ae.status="in-progress":Ue===0&&ge.status!=="todo"&&(Ae.status="todo");}return Ae}),Pe[B]&&rt(ge=>{let Ae={...ge};return delete Ae[B],Ae});},pt=w.find(B=>B.id===Q.status)??yl[0],ce=vl.find(B=>B.id===Q.priority)??vl[1],Ge=go.find(B=>B.value===Q.color)??go[0],Be={backgroundColor:f.bgSecondary,border:`1px solid ${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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pt.color||f.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=f.hoverBg,B.currentTarget.style.color=f.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:It,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:Q.name,onChange:B=>Xe("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:f.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Pe.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"}),Pe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:Q.description||"",onChange:B=>Xe("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:f.textSecondary},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:J,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Be,borderColor:pt.color,backgroundColor:`${pt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsxRuntime.jsx("span",{style:{color:pt.color},children:pt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:pt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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 shadow-xl overflow-hidden",style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},children:w.map(B=>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:X=>X.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("status",B.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,Q.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&T(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ce.color}}),jsxRuntime.jsx("span",{children:ce.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 shadow-xl overflow-hidden",style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},children:vl.map(B=>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:X=>X.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("priority",B.id),T(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,Q.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:ue,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[Q.assignees&&Q.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:Q.assignees.slice(0,3).map((B,X)=>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:B.color||f.accent,borderColor:f.bgSecondary},children:B.initials},X))}),Q.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",Q.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:D&&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 shadow-xl",style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},children:o.map(B=>{let X=Q.assignees?.some(ge=>ge.name===B.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:ge=>ge.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=X?(Q.assignees||[]).filter(Ae=>Ae.name!==B.name):[...Q.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ae=>Ae[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Xe("assignees",ge);},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:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:ye,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(E)k(false);else {if(ye.current){let B=ye.current.getBoundingClientRect(),X=window.innerHeight,ge=120,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;I({top:Ue,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Q.color}}),jsxRuntime.jsx("span",{children:Ge.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let X=Q.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Xe("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:X?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),c.length>0||d?jsxRuntime.jsx(Gr,{selectedTags:Q.tags||[],availableTags:c,onChange:B=>Xe("tags",B),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:Oe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!Q.isMilestone)if(C==="start")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("start"),x(Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.startDate?Q.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&&!Q.isMilestone)if(C==="end")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("end"),x(Q.endDate||Q.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:Q.isMilestone?.5:1,cursor:Q.isMilestone?"not-allowed":"pointer"},disabled:n||Q.isMilestone,children:Q.endDate?Q.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(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:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${f.border}`},children:[(()=>{let B=new Date,X=new Date(B);X.setDate(B.getDate()+1);let ge=new Date(B);ge.setDate(B.getDate()+7);let Ae=new Date(B);return Ae.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:Ae}].map((nt,Pt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:$e=>$e.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:$e=>$e.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Xe("startDate",nt.date),(!Q.endDate||nt.date>Q.endDate)&&Xe("endDate",nt.date),W("end")):(Xe("endDate",nt.date),(!Q.startDate||nt.date<Q.startDate)&&Xe("startDate",nt.date),W(null));},children:nt.label},Pt))})(),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:B=>B.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("startDate",void 0),Xe("endDate",void 0),W(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:()=>x(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",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},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>x(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",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((B,X)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:B},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=H.getFullYear(),X=H.getMonth(),ge=new Date(B,X,1).getDay(),Ae=new Date(B,X+1,0).getDate(),Ue=new Date,nt=[];for(let $e=ge-1;$e>=0;$e--)nt.push({day:new Date(B,X,-$e).getDate(),date:new Date(B,X-1,new Date(B,X,-$e).getDate()),isCurrentMonth:false});for(let $e=1;$e<=Ae;$e++)nt.push({day:$e,date:new Date(B,X,$e),isCurrentMonth:true});let Pt=42-nt.length;for(let $e=1;$e<=Pt;$e++)nt.push({day:$e,date:new Date(B,X+1,$e),isCurrentMonth:false});return nt.map(($e,O)=>{let ae=$e.date.toDateString()===Ue.toDateString(),Le=Q.startDate?.toDateString()===$e.date.toDateString(),je=Q.endDate?.toDateString()===$e.date.toDateString(),qe=Q.startDate&&Q.endDate&&$e.date>=Q.startDate&&$e.date<=Q.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:$e.isCurrentMonth?Le||je?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Le?"#3B82F6":je?"#7C3AED":qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ae&&!Le&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Xe("startDate",$e.date),Q.endDate&&$e.date>Q.endDate&&Xe("endDate",$e.date),W("end")):(Xe("endDate",$e.date),Q.startDate&&$e.date<Q.startDate&&Xe("startDate",$e.date),W(null));},children:$e.day},O)})})()})]})]})]})})]}),Pe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Pe.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:Q.progress,onChange:B=>Xe("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:Q.progress<30?"#EF4444":Q.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:`${Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"}20`,color:Q.progress<30?"#EF4444":Q.progress<70?"#F59E0B":"#10B981"},children:[Q.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(!ne),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 ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&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: 2h 30m, 4h, 1d",value:Q.effortMinutes?Ly(Q.effortMinutes):"",onChange:B=>{let X=Iy(B.target.value);Xe("effortMinutes",X);},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:'Formatos: "2h 30m", "4h", "1d" (1 d\xEDa = 8h)'})]}),(g||p.length>0||l==="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 ",l==="create"?ke.length>0&&`(${ke.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsxRuntime.jsx(wr,{cardId:"pending",attachments:ke.map((B,X)=>({id:`pending-${X}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Ie(X=>[...X,...B]),onDelete:B=>{let X=parseInt(B.replace("pending-",""),10);Ie(ge=>ge.filter((Ae,Ue)=>Ue!==X));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(wr,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?B=>g(a.id,B):void 0,onDelete:b,maxSizeMB:10,maxFiles:20}),l==="create"&&ke.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[ke.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 hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:Q.isMilestone,onChange:B=>Xe("isMilestone",B.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"]}),Q.dependencies&&Q.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Q.dependencies.map(B=>{let X=r.find(ge=>ge.id===B);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:[X?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ge=(Q.dependencies||[]).filter(Ae=>Ae!==B);Xe("dependencies",ge);},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"})})]},B)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!L),K("");},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:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),K("");}}),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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:f.bgPrimary,border:`1px solid ${f.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:B=>K(B.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(B=>B.id!==a?.id).filter(B=>S===""||B.name.toLowerCase().includes(S.toLowerCase())).map(B=>{let X=Q.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ge=Q.dependencies||[],Ae;X?Ae=ge.filter(Ue=>Ue!==B.id):Ae=[...ge,B.id],Xe("dependencies",Ae);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${f.accent}10`:"transparent"},onMouseEnter:ge=>{X||(ge.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=X?`${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:X?f.accent:"transparent",borderColor:X?f.accent:f.borderLight},children:X&&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:B.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.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}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:f.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var _m=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
359
359
|
|
|
360
360
|
AVAILABLE COMMANDS:
|
|
361
361
|
1. move_task - Move a task to a different date
|
|
@@ -396,39 +396,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
396
396
|
|
|
397
397
|
Always try to match task names case-insensitively and handle partial matches.
|
|
398
398
|
If you can't find a task by name, search through the provided task list.
|
|
399
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
400
|
-
${
|
|
399
|
+
If ambiguous, ask for clarification in the message field.`;function jm(e){return `CURRENT TASKS:
|
|
400
|
+
${Km(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(`
|
|
401
401
|
`)}
|
|
402
402
|
|
|
403
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function fm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xr(e,t){let a=fm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function qi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 f={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(f!==void 0){let y=new Date(r),k=y.getDay(),g=f-k;return g<=0&&(g+=7),y.setDate(y.getDate()+g),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 u=parseInt(s[1],10),f=s[2].toLowerCase(),y=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?y.setDate(y.getDate()+u):f==="week"||f==="semana"||f==="semanas"?y.setDate(y.getDate()+u*7):(f==="month"||f==="mes"||f==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),f=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,f,u)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),f=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(y,f,u)}let c={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 u=c[d[1].toLowerCase()],f=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,f)}return null}function Xi(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 Ji(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 bm(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 hm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=xr(t,i),u=qi(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:u,endDate:y},message:`Moved "${d.name}" to ${u.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=xr(t,i),u=Xi(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+u),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${u} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=xr(t,i),u=Ji(c);return d?u===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:u},message:`Set "${d.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=xr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=xr(t,i),u=xr(t,c);return d?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:d.id,dependencyTo:u.id,message:`Linked "${d.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=xr(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function ym(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 L0(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 I0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(u=>u.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>rs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:L0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function vm(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:I0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rs(r,e,t))}var Zi={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",elapsedTime:"Time Spent",tags:"Tags"},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"}},Qi={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",elapsedTime:"Tiempo",tags:"Etiquetas"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},os={en:Zi,es:Qi};function el(e){return os[e]||os.en}function ns(e,t){let a=el(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 tl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function km(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 wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let m=km(e),i=tl[0],c=tl.find(f=>f.value===m)??i,d=c.icon,u=f=>{switch(km(f)){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:b("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:b("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(f=>{let y=f.icon;return jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:b("w-4 h-4",f.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u(f.value)})]},f.value)})})]})}var al=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Tm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=al.find(c=>c.value===e)??al[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(c=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function ls(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ds(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Dm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=k=>{c.current&&!c.current.contains(k.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let d=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(k=>k.name===y),f=y=>{if(a)if(u(y.name))a(e.filter(k=>k.name!==y.name));else {let k={name:y.name,initials:ls(y.name),color:y.color||ds(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,k]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:b("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,k)=>jsxRuntime.jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>3&&jsxRuntime.jsxs("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),l(!n);},className:b("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:b("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,k)=>jsxRuntime.jsx("div",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>2&&jsxRuntime.jsxs("span",{className:b("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:b("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsxRuntime.jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(y=>jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),f(y);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ds(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):ls(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:b("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,k)=>jsxRuntime.jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${k}`))})]})]})}var oy={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ny={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function cs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[l,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,d=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",f=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),k=()=>{let g=l.getFullYear(),v=l.getMonth(),h=f(g,v),p=y(g,v),w=new Date,x=[];for(let S=0;S<p;S++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${S}`));for(let S=1;S<=h;S++){let T=new Date(g,v,S),C=c&&c.getDate()===S&&c.getMonth()===v&&c.getFullYear()===g,A=w.getDate()===S&&w.getMonth()===v&&w.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),t?.(T),n(false);},className:b("w-8 h-8 rounded-full text-sm transition-colors",C?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:S},S));}return x};return o||!t?jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:b("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxRuntime.jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()-1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium",a?"text-white":"text-gray-900"),children:[oy[d][l.getMonth()]," ",l.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()+1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:ny[d].map(g=>jsxRuntime.jsx("div",{className:b("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:k()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Mm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:b("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:b("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Lm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:b("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:d,onClick:u=>u.stopPropagation(),className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:b("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Rm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[l,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),d=react.useRef(null);react.useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);if(!isNaN(y)){let k=y;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&t?.(k);}m(false);},f=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):l?jsxRuntime.jsx("input",{ref:d,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:f,onClick:y=>y.stopPropagation(),min:o,max:s,className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:b("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Om({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:b("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:b("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:b("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:b("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Wm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:b("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:b("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function fy(e,t="en"){if(e==null||e===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?t==="es"?`${r}min`:`${r}m`:r===0?`${a}h`:t==="es"?`${a}h ${r}min`:`${a}h ${r}m`}function by(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function sl({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false}){let [n,l]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null),u=fy(e,r);react.useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]),react.useEffect(()=>{if(e){let k=Math.floor(e/60),g=e%60;k>0&&g>0?i(`${k}h ${g}m`):k>0?i(`${k}h`):i(`${g}m`);}else i("");},[e,n]);let f=()=>{let k=by(m);k!==e&&t?.(k),l(false);},y=k=>{k.key==="Enter"?f():k.key==="Escape"&&l(false);};return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:u})]}):n?jsxRuntime.jsx("input",{ref:c,type:"text",value:m,onChange:k=>i(k.target.value),onBlur:f,onKeyDown:y,onClick:k=>k.stopPropagation(),placeholder:"1h 30m",className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),l(true);},className:b("flex items-center gap-1.5 text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400"),children:[e&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{children:u})]})}function My(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Fy(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 Xm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=react.useRef(null),u=r==="es"?Ym.es:Ym.en;if(react.useEffect(()=>{let v=p=>{d.current&&!d.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.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}),l&&(v.push({id:"status",label:u.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.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:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(S=>S.name===h.name)?p.filter(S=>S.name!==h.name):[...p,{name:h.name,initials:My(h.name),color:h.color||Fy(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},k=e.type==="task"?f():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:g,className:b("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(v=>v.separator?jsxRuntime.jsx("div",{className:b("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Ay,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:b(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Ay({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:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:b("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Ym={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Qm={name: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"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{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"})},Xy=["name","status","priority","assignees","startDate","endDate","progress","tags","estimatedTime","elapsedTime"];function tp({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=react.useState(""),c=react.useRef(null),d=l==="es"?ep.es:ep.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=w=>{c.current&&!c.current.contains(w.target)&&t();},p=w=>{w.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>d.columns[v]||v,f=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){f(p.id);return}let w={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,w]);},k=Xy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:b("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:b("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:b("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:b("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:d.searchPlaceholder,className:b("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:k.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,w=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{w||(h?f(h.id):y(v));},disabled:w,className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",w&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Qm[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(w=>w.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Qm[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:b("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:b("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.createField]})})]})}var ep={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",elapsedTime:"Time Spent",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",elapsedTime:"Tiempo",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var nv=[{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 op({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,m]=react.useState("text"),[i,c]=react.useState([""]),d=o==="es"?rp.es:rp.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},f=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},k=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};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:b("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:b("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:b("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:b("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:b("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:b("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("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:nv.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:b("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:b("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${d.option} ${v+1}`,className:b("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>k(v),className:b("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:f,className:b("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:b("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var rp={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 ip={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 lp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?ip.es:ip.en;react.useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||m.current&&!m.current.contains(k.target)&&l(false);},y=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,u&&jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:b("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:b("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(f=>{let y=e===f.value&&!t,k=()=>f.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b(y?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsxRuntime.jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsxRuntime.jsx("div",{className:b("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:b("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var wv=[{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 up(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(...up(r.subtasks,t+1));return a}function Cv({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function gp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:u=true,showHierarchy:f=true,tableColumns:y,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,w=ns(c,d),x=i==="dark",[S,T]=react.useState("startDate"),[C,A]=react.useState("asc"),[I,N]=react.useState(""),[O,R]=react.useState("all"),[_,se]=react.useState(false),[te,ie]=react.useState(y||wv),[xe,Ne]=react.useState(false),[Ae,F]=react.useState(false),[B,E]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[W,q]=react.useState(null),[pe,fe]=react.useState(0),[Ce,Y]=react.useState(0),V=react.useRef(null);react.useEffect(()=>{y&&ie(y);},[y]);let Oe=react.useMemo(()=>{let H=new Set;function K(ke){for(let Ie of ke)Ie.subtasks?.length&&(Ie.isExpanded!==false&&H.add(Ie.id),K(Ie.subtasks));}return K(e),H},[e]),ue=react.useMemo(()=>te.filter(H=>H.visible),[te]),Le=react.useCallback(H=>{a.onTaskToggleExpand?.(H);},[a]),Je=react.useCallback(H=>{S===H?A(K=>K==="asc"?"desc":"asc"):(T(H),A("asc")),a.onSortChange?.({column:H,direction:C==="asc"?"desc":"asc"});},[S,C,a]),st=react.useCallback(H=>{ie(H),a.onColumnsChange?.(H);},[a]),Ge=react.useCallback(H=>{let K=te.map(ke=>ke.id===H?{...ke,visible:false}:ke);st(K);},[te,st]),bt=react.useCallback((H,K)=>{T(H),A(K);},[]),ut=react.useCallback((H,K,ke)=>{v&&(H.preventDefault(),E({isOpen:true,x:H.clientX,y:H.clientY,type:K?"task":"header",task:K,columnId:ke}));},[v]),Pt=react.useCallback(()=>{E(H=>({...H,isOpen:false}));},[]),ge=react.useCallback((H,K)=>{if(!g)return;H.preventDefault(),H.stopPropagation();let ke=te.find(Ie=>Ie.id===K);ke&&(q(K),fe(H.clientX),Y(ke.width));},[te,g]);react.useEffect(()=>{if(!W)return;let H=ke=>{let Ie=ke.clientX-pe,_e=Math.max(50,Ce+Ie),We=te.map(ne=>ne.id===W?{...ne,width:_e}:ne);ie(We);},K=()=>{W&&a.onColumnsChange?.(te),q(null);};return document.addEventListener("mousemove",H),document.addEventListener("mouseup",K),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",K);}},[W,pe,Ce,te,a]);let L=react.useCallback(async H=>{if(a.onCreateCustomField){let K={...H,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(K);}F(false);},[a]),re=react.useCallback(H=>H.progress===100||H.status==="completed"?"completed":H.progress&&H.progress>0||H.status==="in-progress"?"in-progress":"todo",[]),Te=react.useMemo(()=>{let H=up(e);if(I.trim()){let K=I.toLowerCase();H=H.filter(ke=>ke.name.toLowerCase().includes(K));}return O!=="all"&&(H=H.filter(K=>re(K)===O)),_&&(H=H.filter(K=>re(K)!=="completed")),H.sort((K,ke)=>{let Ie,_e;switch(S){case "name":Ie=K.name.toLowerCase(),_e=ke.name.toLowerCase();break;case "startDate":Ie=K.startDate?.getTime()||0,_e=ke.startDate?.getTime()||0;break;case "endDate":Ie=K.endDate?.getTime()||0,_e=ke.endDate?.getTime()||0;break;case "progress":Ie=K.progress||0,_e=ke.progress||0;break;case "status":Ie=K.status||"todo",_e=ke.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Ie=We[K.priority]??4,_e=We[ke.priority]??4;break;default:return 0}return Ie<_e?C==="asc"?-1:1:Ie>_e?C==="asc"?1:-1:0}),H},[e,I,O,_,S,C,re]),Ue=react.useCallback((H,K)=>{let ke=We=>{a.onTaskUpdate?.({...H,...We});},Ie=We=>We?H.customFields?.find(Be=>Be.fieldId===We)?.value:void 0,_e=(We,ne)=>{if(!We)return;let ee=[...H.customFields||[]],Ye=ee.findIndex(Pa=>Pa.fieldId===We);Ye>=0?ee[Ye]={fieldId:We,value:ne}:ee.push({fieldId:We,value:ne}),ke({customFields:ee});};switch(K.type){case "name":return null;case "status":return jsxRuntime.jsx(wm,{value:H.status||(H.progress===100?"completed":H.progress&&H.progress>0?"in-progress":"todo"),onChange:ne=>{ke({status:ne,progress:ne==="completed"?100:ne==="in-progress"?50:0});},isDark:x,locale:c,translations:w.status});case "priority":return jsxRuntime.jsx(Tm,{value:H.priority,onChange:ne=>ke({priority:ne}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(Dm,{value:H.assignees||[],availableUsers:l,onChange:ne=>ke({assignees:ne}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(cs,{value:H.startDate,onChange:ne=>ke({startDate:ne}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(cs,{value:H.endDate,onChange:ne=>ke({endDate:ne}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Mm,{value:H.progress||0,onChange:ne=>{let Be=ne===100?"completed":ne>0?"in-progress":"todo";ke({progress:ne,status:Be});},isDark:x});case "tags":return jsxRuntime.jsx(Wm,{value:H.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Lm,{value:Ie(K.customFieldId)||"",onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "number":return jsxRuntime.jsx(Rm,{value:Ie(K.customFieldId)||0,onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "date":let We=Ie(K.customFieldId);return jsxRuntime.jsx(cs,{value:We?new Date(We):void 0,onChange:ne=>_e(K.customFieldId,ne),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Om,{value:Ie(K.customFieldId)||"",options:K.options||[],onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "checkbox":return jsxRuntime.jsx(Um,{value:Ie(K.customFieldId)||false,onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "estimatedTime":return jsxRuntime.jsx(sl,{value:H.estimatedTime,onChange:ne=>ke({estimatedTime:ne}),isDark:x,locale:c});case "elapsedTime":return jsxRuntime.jsx(sl,{value:H.elapsedTime,onChange:ne=>ke({elapsedTime:ne}),isDark:x,locale:c});default:return jsxRuntime.jsx("span",{className:b("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,l,w]),Z=react.useCallback(H=>{let ke={name:w.columns.name,status:w.columns.status,priority:w.columns.priority,assignees:w.columns.assignees,startDate:w.columns.startDate,endDate:w.columns.endDate,progress:w.columns.progress,tags:w.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:w.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),elapsedTime:w.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent")}[H.type]||H.label;return typeof ke=="string"?ke:String(ke||H.type)},[w,c]),Re=react.useMemo(()=>ue.reduce((H,K)=>H+K.width,0)+(k?48:0),[ue,k]);return r?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.empty.noTasks}),jsxRuntime.jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:V,className:b("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",W&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(lp,{value:O,hideCompleted:_,onChange:R,onHideCompletedChange:se,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[Te.length," ",w.pagination.tasks]}),u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:I,onChange:H=>N(H.target.value),placeholder:w.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&p&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:w.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Re},children:[jsxRuntime.jsxs("div",{className:b("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ue.map(H=>jsxRuntime.jsxs("div",{className:b("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:H.width,minWidth:H.minWidth},onContextMenu:K=>ut(K,void 0,H.id),children:[H.sortable?jsxRuntime.jsxs("button",{onClick:()=>Je(H.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Z(H),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:b("w-3 h-3",S===H.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Z(H)}),g&&H.resizable&&jsxRuntime.jsx("div",{className:b("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",W===H.id&&"bg-[#3B82F6]"),onMouseDown:K=>ge(K,H.id)})]},H.id)),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:H=>{H.stopPropagation(),Ne(K=>!K);},className:b("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",xe&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(tp,{isOpen:xe,onClose:()=>Ne(false),columns:te,customFields:m,onColumnsChange:st,onCreateCustomField:()=>{Ne(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Te.map((H,K)=>{let ke=Oe.has(H.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:K*.02},className:b("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(H),onDoubleClick:()=>a.onTaskDoubleClick?.(H),onContextMenu:Ie=>ut(Ie,H),children:[ue.map(Ie=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Ie.width,minWidth:Ie.minWidth},children:Ie.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&H.level>0&&jsxRuntime.jsx("div",{style:{width:`${H.level*24}px`},className:"flex-shrink-0"}),f&&H.hasChildren&&jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),Le(H.id);},className:b("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:ke?jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),f&&!H.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:_e=>{_e.stopPropagation(),a.onTaskUpdate?.({...H,progress:H.progress===100?0:100,status:H.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Cv,{status:H.status,progress:H.progress})}),jsxRuntime.jsx("span",{className:b("truncate font-medium",x?"text-white":"text-gray-900",H.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:H.name})]}):Ue(H,Ie)},Ie.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},H.id)})}),Te.length===0&&I&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:b("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b(x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.noResults})]})})]})}),jsxRuntime.jsx(Xm,{state:B,onClose:Pt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ge,onColumnSort:bt,availableUsers:l}),jsxRuntime.jsx(op,{isOpen:Ae,onClose:()=>F(false),onSave:L,isDark:x,locale:c})]})}var fp=[{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:"estimatedTime",type:"estimatedTime",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"elapsedTime",type:"elapsedTime",label:"Time Spent",width:100,visible:false,sortable:true,resizable:true}],bp=[{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:"estimatedTime",labelKey:"columns.estimatedTime",icon:"Clock"},{type:"elapsedTime",labelKey:"columns.elapsedTime",icon:"Timer"}],hp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var dl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},cl={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},ml={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},us={dark:dl,light:cl,neutral:ml};function yp(e){return us[e]||us.dark}var pl={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ul={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},gs={en:pl,es:ul};function an(e){return gs[e]||gs.en}function fs(e,t){let a=an(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 vp(e){let t=an(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 xp(e,t=0,a=true){let r=an(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 Np(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 fl(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 Dp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Ep({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,w=fs(h,p),x=v==="dark",[S,T]=react.useState(r||new Date),[C,A]=react.useState(null),[I,N]=react.useState(null),[O,R]=react.useState({}),_=4,se=3,[te,ie]=react.useState(null),[xe,Ne]=react.useState(""),[Ae,F]=react.useState(void 0),[B,E]=react.useState(null),[W,q]=react.useState(false),[pe,fe]=react.useState(false),[Ce,Y]=react.useState(null),[V,Oe]=react.useState(false),[ue,Le]=react.useState(new Date),Je=react.useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()-1,1));},[S]),st=react.useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()+1,1));},[S]),Ge=react.useCallback(()=>{T(new Date);},[]),bt=react.useMemo(()=>{let ge=S.getFullYear(),L=S.getMonth(),re=new Date(ge,L,1),Te=new Date(ge,L+1,0),Ue=re.getDay(),Z=Te.getDate(),Re=Np(e),H=new Date;H.setHours(0,0,0,0);let K=[],ke=Ue,Ie=new Date(ge,L,0).getDate();for(let We=ke-1;We>=0;We--){let ne=new Date(ge,L-1,Ie-We);K.push({date:ne,isCurrentMonth:false,isToday:false,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(Be=>fl(ne,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}for(let We=1;We<=Z;We++){let ne=new Date(ge,L,We),Be=ne.getTime()===H.getTime();K.push({date:ne,isCurrentMonth:true,isToday:Be,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(ee=>fl(ne,ee)).map(ee=>({id:ee.id,title:ee.name,start:ee.startDate,end:ee.endDate,task:ee}))});}let _e=42-K.length;for(let We=1;We<=_e;We++){let ne=new Date(ge,L+1,We);K.push({date:ne,isCurrentMonth:false,isToday:false,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(Be=>fl(ne,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}return K},[S,e]),ut=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Pt=S.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.labels.noEvents}),jsxRuntime.jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:b("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Pt}),jsxRuntime.jsx("button",{onClick:Ge,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:w.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Je,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:st,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:ut.map(ge=>jsxRuntime.jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ge},ge))}),jsxRuntime.jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:bt.map((ge,L)=>{let re=ge.date.getDay()===0||ge.date.getDay()===6;return jsxRuntime.jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?re?"bg-[#1C1F26]":ge.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":re?"bg-gray-100":ge.isCurrentMonth?"bg-white":"bg-gray-50",ge.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Te=O[L]||_,Ue=ge.events.slice(0,Te),Z=ge.events.length-Te;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Ue.map(Re=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{A(Re.task),a.onEventClick?.(Re),g?.(Re.task.id);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Dp,{task:Re.task}),jsxRuntime.jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),Z>0&&jsxRuntime.jsxs("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:Te+se}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",h==="es"?"M\xC1S":"MORE"]}),Te>_&&ge.events.length>_&&jsxRuntime.jsx("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:_}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Te=L>=28,Ue=L%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),te===L?ie(null):(ie(L),Ne(""),F(void 0),E(null),Y(null),q(false),fe(false),Oe(false),Le(ge.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",te===L?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:b("w-3.5 h-3.5 transition-transform",te===L&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:te===L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),Ne(""),F(void 0),E(null),Y(null),q(false),fe(false),Oe(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Te?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Te?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",Te?"bottom-full mb-1":"top-full mt-1",Ue?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),q(false),fe(false),Oe(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:xe,onChange:Z=>Ne(Z.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&xe.trim()){let Re=t.availableUsers?.find(K=>K.id===B),H=Ce||ge.date;a.onTaskCreate?.({name:xe.trim(),startDate:H,endDate:H,priority:Ae,assignees:Re?[Re]:void 0}),Ne(""),F(void 0),E(null),Y(null),ie(null);}Z.key==="Escape"&&(ie(null),Ne(""),F(void 0),E(null),Y(null));}})}),jsxRuntime.jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),q(!W),fe(false);},className:b("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{F(Z.id),q(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===Z.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",Z.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Z=>{Z.stopPropagation(),Oe(!V),q(false),fe(false),Le(Ce||ge.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ce?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Ce||ge.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,Re=new Date(Z);Re.setDate(Z.getDate()+1);let H=new Date(Z);H.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let K=new Date(Z);K.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let ke=new Date(Z);ke.setDate(Z.getDate()+14);let Ie=new Date(Z);return Ie.setDate(Z.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:H,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:K,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:ke,display:ke.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Ie,display:Ie.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,ne)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Y(We.date),Oe(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:b("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},ne))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:b("text-xs font-medium",x?"text-white":"text-gray-900"),children:ue.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Le(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Le(new Date(ue.getFullYear(),ue.getMonth()-1)),className:b("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Le(new Date(ue.getFullYear(),ue.getMonth()+1)),className:b("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsxRuntime.jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=ue.getFullYear(),Re=ue.getMonth(),H=new Date(Z,Re,1).getDay(),K=new Date(Z,Re+1,0).getDate(),ke=new Date(Z,Re,0).getDate(),Ie=new Date,_e=[];for(let ne=H-1;ne>=0;ne--)_e.push({dayNum:ke-ne,isCurrentMonth:false,date:new Date(Z,Re-1,ke-ne)});for(let ne=1;ne<=K;ne++)_e.push({dayNum:ne,isCurrentMonth:true,date:new Date(Z,Re,ne)});let We=42-_e.length;for(let ne=1;ne<=We;ne++)_e.push({dayNum:ne,isCurrentMonth:false,date:new Date(Z,Re+1,ne)});return _e.map((ne,Be)=>{let ee=ne.date.toDateString()===Ie.toDateString(),Ye=(Ce||ge.date).toDateString()===ne.date.toDateString();return jsxRuntime.jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ne.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),ne.isCurrentMonth&&(x?"text-white":"text-gray-900"),ee&&"ring-1 ring-[#3B82F6]",Ye&&"bg-[#7C3AED] text-white",!Ye&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Y(ne.date),Oe(false);},children:ne.dayNum},Be)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),fe(!pe),q(false);},className:b("p-1 rounded transition-colors",B?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:B?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Z=>Z.id===B)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===B)?.initials||t.availableUsers?.find(Z=>Z.id===B)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{E(null),fe(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!B&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{E(Z.id),fe(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",B===Z.id&&(x?"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-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:b("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(xe.trim()){let Z=t.availableUsers?.find(H=>H.id===B),Re=Ce||ge.date;a.onTaskCreate?.({name:xe.trim(),startDate:Re,endDate:Re,priority:Ae,assignees:Z?[Z]:void 0}),Ne(""),F(void 0),E(null),Y(null),ie(null);}},disabled:!xe.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",xe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:b("text-sm font-medium",ge.isToday?"text-[#3B82F6]":ge.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ge.date.getDate()})]})]},L)})})]})}),jsxRuntime.jsx(fr,{task:C,isOpen:!!C,onClose:()=>A(null),onTaskUpdate:ge=>{a.onTaskUpdate?.(ge),A(ge);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ge=>({id:ge.id,name:ge.name,avatar:ge.avatar,initials:ge.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:C?c?.get(C.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Np(e).filter(ge=>ge.id!==C?.id),comments:d?.filter(ge=>ge.taskId===C?.id).map(ge=>({...ge,createdAt:ge.createdAt instanceof Date?ge.createdAt:new Date(ge.createdAt),updatedAt:ge.updatedAt instanceof Date?ge.updatedAt:ge.updatedAt?new Date(ge.updatedAt):void 0})),onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 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:b("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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:b("font-medium",x?"text-white":"text-gray-900"),children:I.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:b("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:I.events.map(ge=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),A(ge.task),g?.(ge.task.id);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Dp,{task:ge.task}),jsxRuntime.jsx("span",{className:b("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ge.title}),ge.task.priority==="high"||ge.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ge.id))})]})]})})]})}var bl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},hl={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"},yl={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"},bs={dark:bl,light:hl,neutral:yl};function Pp(e){return bs[e]||bs.dark}function Lv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=react.useMemo(()=>{let f=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,k=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:f,uniqueAssignees:y,priorities:k,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,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:b("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"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.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:c.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:c.map(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Fp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function on(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 nn(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 Ap(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 Lp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let m=react.useMemo(()=>({...Fp,...n}),[n]),[i,c]=react.useState(new Set),d=react.useRef(null),u=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let w=p.timestamp.toISOString().split("T")[0],x=h.get(w);x?x.push(p):h.set(w,[p]);}),Array.from(h.entries()).sort((p,w)=>w[0].localeCompare(p[0])).map(([p,w])=>({date:new Date(p),events:w.sort((x,S)=>S.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,p=new Set;return e.forEach(w=>{h.add(w.userId),p.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),k=h=>{c(p=>{let w=new Set(p);return w.has(h)?w.delete(h):w.add(h),w});},g=h=>{let w=new Date().getTime()-h.getTime(),x=Math.floor(w/6e4),S=Math.floor(w/36e5),T=Math.floor(w/864e5);return x<1?"just now":x<60?`${x}m ago`:S<24?`${S}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:b("history-timeline-empty",l),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:b("history-timeline",m.compact&&"compact",l),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:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[nn(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:u.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((p,w)=>{let x=i.has(p.id),S=s===p.id,T=Ap(p.type);return jsxRuntime.jsxs("div",{"data-event-id":p.id,className:b("history-timeline-event",x&&"expanded",S&&"selected"),onClick:()=>o?.(p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:nn(p.type)})}),w<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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:[m.showAvatars&&p.userAvatar&&jsxRuntime.jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:on(p)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),k(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([C,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},C)),p.metadata&&Object.keys(p.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(p.metadata).map(([C,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},C))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Bp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:b("history-replay-empty",i),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:b("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&nn(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&on(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:f=>l(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,y)=>jsxRuntime.jsx("div",{className:b("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:on(f)},f.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:c.map(f=>jsxRuntime.jsxs("button",{className:b("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),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(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:b("history-replay-start",i),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 vl(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 xl(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 Rp(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 Op(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Uv(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,u=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let y=c.x-f.x,k=c.y-f.y,g=Math.sqrt(y*y+k*k)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=k/g*v;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),u=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!u)return;let f=u.x-d.x,y=u.y-d.y,k=Math.sqrt(f*f+y*y)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=y*g,u.vx-=f*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function zp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:m}){let i=react.useRef(null),[c,d]=react.useState([]),[u,f]=react.useState(null),[y,k]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(1),[w,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Uv(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let S=react.useCallback((R,_)=>{a.enableDragging&&(_.stopPropagation(),f(R));},[a.enableDragging]),T=react.useCallback(R=>{if(!u||!i.current)return;let se=i.current.getBoundingClientRect(),te=(R.clientX-se.left-w.x)/h,ie=(R.clientY-se.top-w.y)/h;d(xe=>xe.map(Ne=>Ne.id===u?{...Ne,x:te,y:ie,fx:te,fy:ie}:Ne));},[u,h,w]),C=react.useCallback(()=>{f(null);},[]),A=react.useCallback((R,_)=>{_.stopPropagation(),l?.({type:"node-click",node:R,position:{x:_.clientX,y:_.clientY}});},[l]),I=react.useCallback((R,_)=>{_.stopPropagation(),l?.({type:"edge-click",edge:R,position:{x:_.clientX,y:_.clientY}});},[l]),N=react.useCallback(R=>{let _=c.find(se=>se.id===R);return _?{x:_.x,y:_.y}:{x:0,y:0}},[c]),O=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let _=R.card.priority;return _==="URGENT"?"#ef4444":_==="HIGH"?"#f59e0b":_==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:b("relationships-graph-empty",m),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:b("relationships-graph",m),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:()=>p(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:vl(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Rp(R)," ",xl(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let _=N(typeof R.source=="string"?R.source:R.source.id),se=N(typeof R.target=="string"?R.target:R.target.id),te=Op(R.type),ie=g===R.id,xe=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-edge",ie&&"hovered",xe&&"critical"),onMouseEnter:()=>v(R.id),onMouseLeave:()=>v(null),onClick:Ne=>I(R,Ne),children:[jsxRuntime.jsx("line",{x1:_.x,y1:_.y,x2:se.x,y2:se.y,stroke:vl(R.type),strokeWidth:xe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:te?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsxRuntime.jsx("text",{x:(_.x+se.x)/2,y:(_.y+se.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xl(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(R=>{let _=y===R.id,se=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-node",_&&"hovered",se&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:te=>S(R.id,te),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:te=>A(R,te),children:[jsxRuntime.jsx("circle",{r:se?a.nodeSize*1.2:a.nodeSize,fill:O(R),stroke:se?"#fbbf24":"#ffffff",strokeWidth:se?3:2,opacity:_?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Hp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,m]=react.useState(false),[i,c]=react.useState(null),[d,u]=react.useState(null),f=react.useRef(null),y=l||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let k=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{d&&(a(d),k());};return e?jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:h=>h.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:k,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((h,p)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},p))})]}),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((h,p)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},p)),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:f,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-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."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,p)=>jsxRuntime.jsx("button",{onClick:()=>n(h),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:h},p))})]})]})}),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:k,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:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var kl={"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 Hv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Wv={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 Gv(e,t,a){let r=kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function sn(e){return `$${e.toFixed(4)}`}var wl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Gv(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,u)=>d+u.cost,0),s=a.reduce((d,u)=>d+u.inputTokens,0),n=a.reduce((d,u)=>d+u.outputTokens,0),l=a.filter(d=>d.success),m=a.reduce((d,u)=>d+u.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=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)}},so=new wl;function _p({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(so.getStats()),[s,n]=react.useState(so.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(so.getStats()),n(so.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let l=so.getRecentOperations(5);return jsxRuntime.jsxs(gt,{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:m=>m.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:sn(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(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/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:m.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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:sn(c)})]})]}),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}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:sn(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 Kp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[m,i]=react.useState(""),[c,d]=react.useState(""),[u,f]=react.useState(false),[y,k]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(null),w=react.useRef(null),x=u||o;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let I=N=>{N.key==="Escape"&&!x&&S();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,x]);let S=()=>{x||(l(""),i(""),d(""),k(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){f(true),k(null),v(null),p(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(I.tasks.tasks),p({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){k(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},C=()=>{g&&(a(g),S());};if(!e)return null;let A=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(gt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),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:I=>I.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:S,disabled:x,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:g?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:[h?.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"}),h?.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 (",A,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:w,value:n,onChange:I=>l(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:x}),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:m,onChange:I=>i(I.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:x})]}),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:c,onChange:I=>d(I.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:x})]})]}),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((I,N)=>jsxRuntime.jsx("button",{onClick:()=>l(I),disabled:x,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:I},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&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:S,disabled:x,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"}),g?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function vs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&hn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(p=>{let w=p.cards.find(I=>I.id===g);if(!w)return p;let x=w.columnId,S={...w,columnId:v,position:h},T=p.cards.map(I=>I.id===g?S:I),C=p.columns.map(I=>{if(I.id===x)return {...I,cardIds:I.cardIds.filter(N=>N!==g)};if(I.id===v){let N=T.filter(O=>O.columnId===v).sort((O,R)=>O.position-R.position);return {...I,cardIds:N.map(O=>O.id)}}return I}),A={...p,cards:T,columns:C};return o(A),A});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),w={...h,cards:p};return o(w),w});},[o]),l=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},w=h.columns.map(S=>S.id===g.columnId?{...S,cardIds:[...S.cardIds,v]}:S),x={...h,cards:[...h.cards,p],columns:w};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(S=>S.id===g);if(!h)return v;let p=v.cards.filter(S=>S.id!==g),w=v.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(T=>T!==g)}:S),x={...v,cards:p,columns:w};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},w={...h,columns:[...h.columns,p]};return o(w),w});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),w={...h,columns:p};return o(w),w});},[o]),d=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),w={...v,cards:h,columns:p};return o(w),w});},[o]),u=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),v},[l]),f=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:u,addColumn:f,deleteCard:m,deleteColumn:d,clearBoard:y}}}function qp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=vs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+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 ln={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Jp={by:"none",order:"asc"};function Zp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...ln,...e}),[s,n]=react.useState({...Jp,...t}),l=react.useCallback(k=>{o(g=>({...g,...k}));},[]),m=react.useCallback(k=>{n(g=>({...g,...k}));},[]),i=react.useCallback(()=>{o(ln),n(Jp);},[]),c=react.useCallback(()=>{a&&o({...ln,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...ln,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{o({...ln,priorities:["HIGH","URGENT"]});},[]),f=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(k=>{let g=[...k];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),w=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${w}`;g=g.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let T=S.endDate||S.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");C=`${A}-${I}-${N}`;}switch(r.dateFilter){case "overdue":return C<x;case "today":return C===x;case "this-week":let A=new Date(x+"T00:00:00"),I=new Date(C+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),I>=A&&I<=N;case "custom":if(r.dateRange){let O=typeof T=="string"?new Date(T):T;return O>=r.dateRange.start&&O<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let w=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=w-x;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=S[v.priority||"LOW"],C=S[h.priority||"LOW"];p=T-C;break;case "dueDate":let A=v.endDate||v.dueDate,I=h.endDate||h.dueDate;if(!A)return 1;if(!I)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),O=typeof I=="string"?new Date(I).getTime():I.getTime();p=N-O;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let R=v.estimatedTime||0,_=h.estimatedTime||0;p=R-_;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:u,applyFilters:y,hasActiveFilters:f}}var eu,tu;if(typeof window<"u")try{let e=gn("ai");eu=e.generateObject,tu=e.generateText;}catch{}function au(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(eu&&tu&&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(u){let f=u instanceof Error?u:new Error("Failed to generate plan");throw o(f),f}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("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let f=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(f),f}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("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let f=u instanceof Error?u:new Error("Failed to predict risks");throw o(f),f}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("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(u){let f=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(f),f}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("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(u){let f=u instanceof Error?u:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Tl(){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 ru(e){let{cards:t}=e,[a,r]=Tl(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,u)=>{if(!u){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=u.ctrlKey||u.metaKey,y=u.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let k=t.find(v=>v.id===d),g=t.find(v=>v.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let v=t.filter(C=>C.columnId===k.columnId).sort((C,A)=>C.position-A.position),h=v.findIndex(C=>C.id===a.lastSelectedCardId),p=v.findIndex(C=>C.id===d),[w,x]=h<p?[h,p]:[p,h],S=v.slice(w,x+1).map(C=>C.id),T=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:T,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(u=>u!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=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:l,selectAll:m,toggleCard:i,getSelectedCards:c}}var ou={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function nu(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...ou,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((k,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,w]);},[o.minCardsPerStack,s]),m=react.useCallback(k=>{n(g=>g.filter(v=>v.id!==k));},[]),i=react.useCallback(k=>{n(g=>g.map(v=>v.id===k?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((k,g)=>{n(v=>v.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((k,g)=>{n(v=>v.map(h=>{if(h.id===k){let p=h.cardIds.filter(w=>w!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=react.useCallback(k=>s.filter(g=>g.columnId===k).sort((g,v)=>g.position-v.position),[s]),f=react.useCallback(async k=>{let g=t.filter(x=>x.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(x);});}),h.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${S}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(S=>{p.has(S)||p.set(S,[]),p.get(S).push(x);});}),p.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(g.forEach(x=>{x.priority&&(w.has(x.priority)||w.set(x.priority,[]),w.get(x.priority).push(x));}),w.forEach((x,S)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${S} Priority`,cardIds:x.map(C=>C.id),columnId:k,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let C=[x.id,...T.map(I=>I.card.id)],A=T.reduce((I,N)=>I+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:C,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,S)=>S.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await f(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:u,getSuggestions:f,applySuggestion:y,config:o}}var su=react.createContext(null);function iu({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=gn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=gn("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=gn("@libxai/core");l=new m(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(su.Provider,{value:{store:o},children:e})}function xs(){let e=react.useContext(su);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function cn(){let e=xs(),[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 l=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),u=react.useCallback(h=>{e.addCard(h);},[e]),f=react.useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),k=react.useCallback((h,p,w)=>{e.moveCard(h,p,w);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:u,updateCard:f,deleteCard:y,moveCard:k,getCard:g,getCardsByColumn:v}}function du(e){let{cards:t}=cn();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 cu(e="position",t="asc"){let{cards:a}=cn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ks=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=rd.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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},sx=new ks;function pu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:o,children:jsxRuntime.jsx("div",{style:f,children:d.map(y=>{let k=e[y.index];if(!k)return null;let g=m?m(k,y.index):y.index,v={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:v,"data-index":y.index,children:r(k,y.index)},g)})})})}function uu(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 fu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),u=d.getVirtualItems(),f={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:c,style:f,className:s,children:jsxRuntime.jsx("div",{style:y,children:u.map(k=>{let g=e[k.index];if(!g)return null;let v=m?m(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},v)})})})}function bu(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 hu(e,t=10){return e>t}var El={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ml={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ll={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Il={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bl={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)"},Rl={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)"},Ol={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zl={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}},Ul={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}},ws={spacing:El,borderRadius:Pl,fontSize:Ml,fontWeight:Fl,lineHeight:Al,zIndex:Ll,duration:Il,easing:Bl,shadows:Rl,opacity:Ol,kanban:zl,gantt:Ul};function yu(e,t,a){return e[t]??a}function $l(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?$l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function dx(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Hl(e="asakaa"){let t=$l(ws),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=dx(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
403
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Km(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Br(e,t){let a=Km(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function xl(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 b=new Date(r),w=b.getDay(),f=g-w;return f<=0&&(f+=7),b.setDate(b.getDate()+f),b}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),b=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?b.setDate(b.getDate()+p):g==="week"||g==="semana"||g==="semanas"?b.setDate(b.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&b.setMonth(b.getMonth()+p),b}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,b=parseInt(l[3],10);return new Date(b,g,p)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),g=m[i[2].toLowerCase()],b=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(b,g,p)}let c={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=c[d[1].toLowerCase()],g=parseInt(d[2],10),b=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(b,p,g)}return null}function kl(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 wl(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 Ym(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 qm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=Br(t,i),p=xl(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,b=new Date(p);return b.setDate(b.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:b},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 i=o[1].trim(),c=o[2].trim(),d=Br(t,i),p=kl(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,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 "${c}".`,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 i=s[1].trim(),c=s[2].trim(),d=Br(t,i),p=wl(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=Br(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Br(t,i),p=Br(t,c);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:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=Br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Xm(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 By(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 Ry(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ts(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Ts(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:By(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Jm(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:Ry(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Zm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ts(r,e,t))}var Cl={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Tl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},Ns={en:Cl,es:Tl};function Nl(e){return Ns[e]||Ns.en}function Ds(e,t){let a=Nl(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 Dl=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function Qm(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 eu({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let g=b=>{l.current&&!l.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let m=Qm(e),i=Dl[0],c=Dl.find(g=>g.value===m)??i,d=c.icon,p=g=>{switch(Qm(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",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:l,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/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Dl.map(g=>{let b=g.icon;return jsxRuntime.jsxs("button",{onClick:w=>{w.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/10":"hover:bg-gray-100",m===g.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{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 Sl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function au({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=Sl.find(c=>c.value===e)??Sl[4],i=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",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Sl.map(c=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Ps(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ms(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function ou({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let b=w=>{c.current&&!c.current.contains(w.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]);let d=t.filter(b=>b.name.toLowerCase().includes(m.toLowerCase())||b.email?.toLowerCase().includes(m.toLowerCase())),p=b=>e.some(w=>w.name===b),g=b=>{if(a)if(p(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:Ps(b.name),color:b.color||Ms(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl};a([...e,w]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>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-[#0F1117]":"border-white",!b.avatar&&Ms(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Ps(b.name)},`${b.name}-${w}`)),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-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),l(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>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-[#0F1117]":"border-white",!b.avatar&&Ms(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Ps(b.name)},`${b.name}-${w}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:u("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:b=>b.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(b=>jsxRuntime.jsxs("button",{onClick:w=>{w.stopPropagation(),g(b);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!b.avatarUrl&&Ms(b.name)),children:b.avatarUrl?jsxRuntime.jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Ps(b.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:b.name}),b.email&&jsxRuntime.jsx("div",{className:u("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:b.email})]}),p(b.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},b.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((b,w)=>jsxRuntime.jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[b.name,jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(y=>y.name!==b.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${b.name}-${w}`))})]})]})}function iu({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:m}){let[i,c]=react.useState(false),[d,p]=react.useState(o),[g,b]=react.useState(()=>{let E=o==="start"?e:t;if(E){let k=E instanceof Date?E:new Date(E);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),w=react.useRef(null),f=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let E=k=>{w.current&&!w.current.contains(k.target)&&c(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),react.useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):m||"-",v=react.useCallback(()=>{let E=g.getFullYear(),k=g.getMonth(),R=new Date(E,k,1),C=new Date(E,k+1,0).getDate(),W=R.getDay(),H=[],te=new Date(E,k,0).getDate();for(let ne=W-1;ne>=0;ne--)H.push({date:new Date(E,k-1,te-ne),isCurrentMonth:false});for(let ne=1;ne<=C;ne++)H.push({date:new Date(E,k,ne),isCurrentMonth:true});let oe=42-H.length;for(let ne=1;ne<=oe;ne++)H.push({date:new Date(E,k+1,ne),isCurrentMonth:false});return H},[g]),T=E=>{if(r)o==="start"?a(E,y||void 0):a(f||void 0,E),c(false);else if(d==="start"){let k=y&&E>y?E:y;a(E,k||void 0),p("end");}else {let k=f&&E<f?E:f;a(k||void 0,E),c(false);}},D=()=>{let E=new Date,k=new Date(E);k.setDate(E.getDate()+1);let R=new Date(E);R.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let C=new Date(E);C.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let W=new Date(E);W.setDate(E.getDate()+14);let H=new Date(E);return H.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.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:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let E=r&&o==="start"?f:y;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(E)})]})}let N=r&&o==="start"?f:y;return jsxRuntime.jsxs("div",{ref:w,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:E=>{E.stopPropagation(),c(!i);let k=o==="start"?f:y;k&&b(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/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((E,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/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(E.date),children:[jsxRuntime.jsx("span",{children:E.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E.display})]},k)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(f||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 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/5 text-[#9CA3AF]":"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:()=>b(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>b(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/10":"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:()=>b(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/10":"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(E=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:v().map((E,k)=>{let R=E.date.toDateString()===new Date().toDateString(),I=f?.toDateString()===E.date.toDateString(),C=y?.toDateString()===E.date.toDateString(),W=I||C,H=!r&&f&&y&&E.date>=f&&E.date<=y;return jsxRuntime.jsx("button",{onClick:()=>T(new Date(E.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",C&&!I&&"bg-[#7C3AED] text-white",H&&!W&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!W&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},k)})})]})]})]})]})}function Fs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let m=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(iu,{startDate:s==="start"?m:n||null,endDate:s==="end"?m:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function cu({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:u("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function pu({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[l,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):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-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function bu({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[l,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),d=react.useRef(null);react.useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let p=()=>{let b=parseFloat(i);if(!isNaN(b)){let w=b;o!==void 0&&(w=Math.max(o,w)),s!==void 0&&(w=Math.min(s,w)),w!==e&&t?.(w);}m(false);},g=b=>{b.key==="Enter"?p():b.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):l?jsxRuntime.jsx("input",{ref:d,type:"number",value:i,onChange:b=>c(b.target.value),onBlur:p,onKeyDown:g,onClick:b=>b.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function hu({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function vu({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:u("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function wu({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function hv(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?t==="es"?`${r}min`:`${r}m`:r===0?`${a}h`:t==="es"?`${a}h ${r}min`:`${a}h ${r}m`}function yv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function ko({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false}){let [n,l]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null),p=hv(e,r);react.useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]),react.useEffect(()=>{if(e){let w=Math.floor(e/60),f=e%60;w>0&&f>0?i(`${w}h ${f}m`):w>0?i(`${w}h`):i(`${f}m`);}else i("");},[e,n]);let g=()=>{let w=yv(m);w!==e&&t?.(w),l(false);},b=w=>{w.key==="Enter"?g():w.key==="Escape"&&l(false);};return s||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:p})]}):n?jsxRuntime.jsx("input",{ref:c,type:"text",value:m,onChange:w=>i(w.target.value),onBlur:g,onKeyDown:b,onClick:w=>w.stopPropagation(),placeholder:"1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:w=>{w.stopPropagation(),l(true);},className:u("flex items-center gap-1.5 text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400"),children:[e!=null&&e>0&&jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{children:p})]})}function Av(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Lv(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 Mu({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=react.useRef(null),p=r==="es"?Eu.es:Eu.en;if(react.useEffect(()=>{let y=v=>{d.current&&!d.current.contains(v.target)&&t();},h=v=>{v.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let g=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.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:h.name.charAt(0).toUpperCase()}),onClick:()=>{let v=e.task.assignees||[],D=v.some(N=>N.name===h.name)?v.filter(N=>N.name!==h.name):[...v,{name:h.name,initials:Av(h.name),color:h.color||Lv(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},b=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),y},w=e.type==="task"?g():b(),f={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:d,style:f,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(y=>y.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsxRuntime.jsx(Iv,{item:y,isDark:a},y.id):jsxRuntime.jsxs("button",{onClick:y.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Iv({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/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"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-[#6B7280]":"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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Eu={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Ru={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"}),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"})},Xv=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function $u({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=react.useState(""),c=react.useRef(null),d=l==="es"?Ou.es:Ou.en;if(react.useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let h=T=>{c.current&&!c.current.contains(T.target)&&t();},v=T=>{T.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let p=y=>d.columns[y]||y,g=y=>{if(y==="name")return;let h=a.map(v=>v.id===y?{...v,visible:!v.visible}:v);o(h);},b=(y,h)=>{let v=a.find(D=>D.type===y&&(!h||D.customFieldId===h));if(v){g(v.id);return}let T={id:h||y,type:y,label:h?r.find(D=>D.id===h)?.name||y:p(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,T]);},w=Xv.filter(y=>p(y).toLowerCase().includes(m.toLowerCase())),f=r.filter(y=>y.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:u("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:d.searchPlaceholder,className:u("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto max-h-[calc(100vh-300px)] min-h-[200px]",children:[jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:w.map(y=>{let h=a.find(D=>D.type===y&&!D.customFieldId),v=h?.visible??false,T=y==="name";return jsxRuntime.jsxs("button",{onClick:()=>{T||(h?g(h.id):b(y));},disabled:T,className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",T&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",v?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:v&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Ru[y]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:p(y)})]},y)})})]}),f.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:f.map(y=>{let v=a.find(T=>T.customFieldId===y.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>b(y.type,y.id),className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",v?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:v&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Ru[y.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:y.name})]},y.id)})})]})]}),s&&jsxRuntime.jsx("div",{className:u("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.createField]})})]})}var Ou={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var nx=[{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 Hu({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[l,m]=react.useState("text"),[i,c]=react.useState([""]),d=o==="es"?Uu.es:Uu.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let f=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,t]);let p=()=>{if(!s.trim())return;let f={name:s.trim(),type:l};l==="dropdown"&&(f.options=i.filter(y=>y.trim())),a(f),t();},g=()=>{c([...i,""]);},b=(f,y)=>{let h=[...i];h[f]=y,c(h);},w=f=>{i.length>1&&c(i.filter((y,h)=>h!==f));};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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"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/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-[#9CA3AF]":"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:f=>n(f.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),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:nx.map(f=>jsxRuntime.jsxs("button",{onClick:()=>m(f.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===f.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===f.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:f.icon}),jsxRuntime.jsx("span",{className:u("text-xs",l===f.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[f.type]})]},f.type))})]}),l==="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:[i.map((f,y)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:f,onChange:h=>b(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>w(y),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},y)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[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-white/10":"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-[#9CA3AF] hover:bg-white/10":"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-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Uu={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 Vu={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 _u({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Vu.es:Vu.en;react.useEffect(()=>{if(!n)return;let g=w=>{Date.now()-i.current<100||m.current&&!m.current.contains(w.target)&&l(false);},b=w=>{w.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(b=>!b);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,p&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let b=e===g.value&&!t,w=()=>g.value==="all"?b?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):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),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",b&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(b?g.color:"text-gray-400","flex-shrink-0"),children:w()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),b&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var vx=[{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 qu(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(...qu(r.subtasks,t+1));return a}function Xu({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:p=true,showHierarchy:g=true,tableColumns:b,allowColumnCustomization:w=true,allowColumnResize:f=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:v,persistFilter:T=false}=t,D=Ds(c,d),N=i==="dark",E=react.useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let O=localStorage.getItem(T);if(O){let ae=JSON.parse(O);return {statusFilter:ae.statusFilter||"all",hideCompleted:ae.hideCompleted||!1}}}catch(O){console.error("Error loading persisted filter:",O);}return {statusFilter:"all",hideCompleted:false}},[T]),[k,R]=react.useState("startDate"),[I,C]=react.useState("asc"),[W,H]=react.useState(""),[x,te]=react.useState(()=>E().statusFilter),[oe,ne]=react.useState(()=>E().hideCompleted),[A,ke]=react.useState(b||vx),[Ie,L]=react.useState(false),[U,S]=react.useState(false),[K,J]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[ie,ue]=react.useState(null),[ye,Oe]=react.useState(0),[Q,Je]=react.useState(0),Pe=react.useRef(null);react.useEffect(()=>{b&&ke(b);},[b]),react.useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:x,hideCompleted:oe}));}catch(O){console.error("Error persisting filter state:",O);}},[T,x,oe]);let rt=react.useMemo(()=>{let O=new Set;function ae(Le){for(let je of Le)je.subtasks?.length&&(je.isExpanded!==false&&O.add(je.id),ae(je.subtasks));}return ae(e),O},[e]),ut=react.useMemo(()=>A.filter(O=>O.visible),[A]),It=react.useCallback(O=>{a.onTaskToggleExpand?.(O);},[a]),Xe=react.useCallback(O=>{k===O?C(ae=>ae==="asc"?"desc":"asc"):(R(O),C("asc")),a.onSortChange?.({column:O,direction:I==="asc"?"desc":"asc"});},[k,I,a]),pt=react.useCallback(O=>{ke(O),a.onColumnsChange?.(O);},[a]),ce=react.useCallback(O=>{let ae=A.map(Le=>Le.id===O?{...Le,visible:false}:Le);pt(ae);},[A,pt]),Ge=react.useCallback((O,ae)=>{R(O),C(ae);},[]),Be=react.useCallback((O,ae,Le)=>{y&&(O.preventDefault(),J({isOpen:true,x:O.clientX,y:O.clientY,type:ae?"task":"header",task:ae,columnId:Le}));},[y]),B=react.useCallback(()=>{J(O=>({...O,isOpen:false}));},[]),X=react.useCallback((O,ae)=>{if(!f)return;O.preventDefault(),O.stopPropagation();let Le=A.find(je=>je.id===ae);Le&&(ue(ae),Oe(O.clientX),Je(Le.width));},[A,f]);react.useEffect(()=>{if(!ie)return;let O=Le=>{let je=Le.clientX-ye,qe=Math.max(50,Q+je),j=A.map($=>$.id===ie?{...$,width:qe}:$);ke(j);},ae=()=>{ie&&a.onColumnsChange?.(A),ue(null);};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",ae);}},[ie,ye,Q,A,a]);let ge=react.useCallback(async O=>{if(a.onCreateCustomField){let ae={...O,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ae);}S(false);},[a]),Ae=react.useCallback(O=>O.progress===100||O.status==="completed"?"completed":O.progress&&O.progress>0||O.status==="in-progress"?"in-progress":"todo",[]),Ue=react.useMemo(()=>{let O=qu(e);if(W.trim()){let ae=W.toLowerCase();O=O.filter(Le=>Le.name.toLowerCase().includes(ae));}return x!=="all"&&(O=O.filter(ae=>Ae(ae)===x)),oe&&(O=O.filter(ae=>Ae(ae)!=="completed")),O.sort((ae,Le)=>{let je,qe;switch(k){case "name":je=ae.name.toLowerCase(),qe=Le.name.toLowerCase();break;case "startDate":je=ae.startDate?.getTime()||0,qe=Le.startDate?.getTime()||0;break;case "endDate":je=ae.endDate?.getTime()||0,qe=Le.endDate?.getTime()||0;break;case "progress":je=ae.progress||0,qe=Le.progress||0;break;case "status":je=ae.status||"todo",qe=Le.status||"todo";break;case "priority":let j={urgent:0,high:1,medium:2,low:3,none:4};je=j[ae.priority]??4,qe=j[Le.priority]??4;break;default:return 0}return je<qe?I==="asc"?-1:1:je>qe?I==="asc"?1:-1:0}),O},[e,W,x,oe,k,I,Ae]),nt=react.useCallback((O,ae)=>{let Le=j=>{a.onTaskUpdate?.({...O,...j});},je=j=>j?O.customFields?.find(Me=>Me.fieldId===j)?.value:void 0,qe=(j,$)=>{if(!j)return;let ht=[...O.customFields||[]],le=ht.findIndex(He=>He.fieldId===j);le>=0?ht[le]={fieldId:j,value:$}:ht.push({fieldId:j,value:$}),Le({customFields:ht});};switch(ae.type){case "name":return null;case "status":return jsxRuntime.jsx(eu,{value:O.status||(O.progress===100?"completed":O.progress&&O.progress>0?"in-progress":"todo"),onChange:$=>{Le({status:$,progress:$==="completed"?100:$==="in-progress"?50:0});},isDark:N,locale:c,translations:D.status});case "priority":return jsxRuntime.jsx(au,{value:O.priority,onChange:$=>Le({priority:$}),isDark:N,locale:c});case "assignees":return jsxRuntime.jsx(ou,{value:O.assignees||[],availableUsers:l,onChange:$=>Le({assignees:$}),isDark:N,locale:c});case "startDate":return jsxRuntime.jsx(Fs,{value:O.startDate,onChange:$=>Le({startDate:$}),isDark:N,locale:c,dateField:"start",startDate:O.startDate,endDate:O.endDate});case "endDate":return jsxRuntime.jsx(Fs,{value:O.endDate,onChange:$=>Le({endDate:$}),isDark:N,locale:c,dateField:"end",startDate:O.startDate,endDate:O.endDate});case "progress":return jsxRuntime.jsx(cu,{value:O.progress||0,onChange:$=>{let Me=$===100?"completed":$>0?"in-progress":"todo";Le({progress:$,status:Me});},isDark:N});case "tags":return jsxRuntime.jsx(wu,{value:O.tags||[],isDark:N});case "text":return jsxRuntime.jsx(pu,{value:je(ae.customFieldId)||"",onChange:$=>qe(ae.customFieldId,$),isDark:N});case "number":return jsxRuntime.jsx(bu,{value:je(ae.customFieldId)||0,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "date":let j=je(ae.customFieldId);return jsxRuntime.jsx(Fs,{value:j?new Date(j):void 0,onChange:$=>qe(ae.customFieldId,$),isDark:N,locale:c});case "dropdown":return jsxRuntime.jsx(hu,{value:je(ae.customFieldId)||"",options:ae.options||[],onChange:$=>qe(ae.customFieldId,$),isDark:N});case "checkbox":return jsxRuntime.jsx(vu,{value:je(ae.customFieldId)||false,onChange:$=>qe(ae.customFieldId,$),isDark:N});case "estimatedTime":return jsxRuntime.jsx(ko,{value:O.estimatedTime,onChange:$=>Le({estimatedTime:$}),isDark:N,locale:c});case "quotedTime":return jsxRuntime.jsx(ko,{value:O.quotedTime,onChange:$=>Le({quotedTime:$}),isDark:N,locale:c});case "elapsedTime":return jsxRuntime.jsx(ko,{value:O.elapsedTime,onChange:$=>Le({elapsedTime:$}),isDark:N,locale:c});case "effortMinutes":return jsxRuntime.jsx(ko,{value:O.effortMinutes,onChange:$=>Le({effortMinutes:$}),isDark:N,locale:c});case "timeLoggedMinutes":return jsxRuntime.jsx(ko,{value:O.timeLoggedMinutes,onChange:a.onLogTime?$=>{a.onLogTime?.(O,$);}:void 0,isDark:N,locale:c,placeholder:c==="es"?"Agregar":"Add"});case "soldEffortMinutes":return jsxRuntime.jsx(ko,{value:O.soldEffortMinutes,onChange:$=>Le({soldEffortMinutes:$}),isDark:N,locale:c});default:return jsxRuntime.jsx("span",{className:u("text-sm",N?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,N,c,l,D]),Pt=react.useCallback(O=>{let Le={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[O.type]||O.label;return typeof Le=="string"?Le:String(Le||O.type)},[D,c]),$e=react.useMemo(()=>ut.reduce((O,ae)=>O+ae.width,0)+(w?48:0),[ut,w]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",N?"bg-[#0F1117]":"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",N?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"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",N?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Pe,className:u("flex-1 flex flex-col w-full h-full overflow-hidden",N?"bg-[#0F1117]":"bg-white",ie&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",N?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(_u,{value:x,hideCompleted:oe,onChange:te,onHideCompletedChange:ne,isDark:N,locale:c}),jsxRuntime.jsxs("div",{className:u("text-sm",N?"text-[#9CA3AF]":"text-gray-600"),children:[Ue.length," ",D.pagination.tasks]}),p&&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",N?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:W,onChange:O=>H(O.target.value),placeholder:D.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",N?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),h&&v&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:D.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:$e},children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",N?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[ut.map(O=>jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-3",N?"text-[#9CA3AF]":"text-gray-500"),style:{width:O.width,minWidth:O.minWidth},onContextMenu:ae=>Be(ae,void 0,O.id),children:[O.sortable?jsxRuntime.jsxs("button",{onClick:()=>Xe(O.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Pt(O),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",k===O.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:Pt(O)}),f&&O.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ie===O.id&&"bg-[#3B82F6]"),onMouseDown:ae=>X(ae,O.id)})]},O.id)),w&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:O=>{O.stopPropagation(),L(ae=>!ae);},className:u("p-1.5 rounded-lg transition-colors",N?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ie&&(N?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx($u,{isOpen:Ie,onClose:()=>L(false),columns:A,customFields:m,onColumnsChange:pt,onCreateCustomField:()=>{L(false),S(true);},isDark:N,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ue.map((O,ae)=>{let Le=rt.has(O.id),je=Math.min(ae*.01,.2);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:je},className:u("flex items-center border-b transition-colors",N?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(O),onDoubleClick:()=>a.onTaskDoubleClick?.(O),onContextMenu:qe=>Be(qe,O),children:[ut.map(qe=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:qe.width,minWidth:qe.minWidth},children:qe.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[g&&O.level>0&&jsxRuntime.jsx("div",{style:{width:`${O.level*24}px`},className:"flex-shrink-0"}),g&&O.hasChildren&&jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),It(O.id);},className:u("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/10":"hover:bg-gray-200"),children:Le?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",N?"text-[#9CA3AF]":"text-gray-400")})}),g&&!O.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("span",{className:u("truncate font-medium",N?"text-white":"text-gray-900",O.progress===100&&(N?"line-through text-[#6B7280]":"line-through text-gray-400")),children:O.name})]}):nt(O,qe)},qe.id)),w&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},O.id)})}),Ue.length===0&&W&&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",N?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(N?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsxRuntime.jsx(Mu,{state:K,onClose:B,isDark:N,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ce,onColumnSort:Ge,availableUsers:l}),jsxRuntime.jsx(Hu,{isOpen:U,onClose:()=>S(false),onSave:ge,isDark:N,locale:c})]})}var Ju=[{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:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],Zu=[{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"}],Qu=[{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 Bl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Rl={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"},Ol={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"},Is={dark:Bl,light:Rl,neutral:Ol};function ep(e){return Is[e]||Is.dark}var $l={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},zl={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Bs={en:$l,es:zl};function kn(e){return Bs[e]||Bs.en}function Rs(e,t){let a=kn(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 tp(e){let t=kn(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 ap(e,t=0,a=true){let r=kn(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 ip(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 Hl(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 lp({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:w,onTaskOpen:f,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:v,timerState:T,onLogTime:D,onUpdateEstimate:N,onStartTimer:E,onStopTimer:k,onDiscardTimer:R}){let{theme:I="dark",locale:C="en",customTranslations:W}=t,H=Rs(C,W),x=I==="dark",[te,oe]=react.useState(r||new Date),[ne,A]=react.useState(null),[ke,Ie]=react.useState(null),[L,U]=react.useState({}),S=4,K=3,[J,ie]=react.useState(null),[ue,ye]=react.useState(""),[Oe,Q]=react.useState(void 0),[Je,Pe]=react.useState(null),[rt,ut]=react.useState(false),[It,Xe]=react.useState(false),[pt,ce]=react.useState(null),[Ge,Be]=react.useState(false),[B,X]=react.useState(new Date),ge=react.useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()-1,1));},[te]),Ae=react.useCallback(()=>{oe(new Date(te.getFullYear(),te.getMonth()+1,1));},[te]),Ue=react.useCallback(()=>{oe(new Date);},[]),nt=react.useMemo(()=>{let O=te.getFullYear(),ae=te.getMonth(),Le=new Date(O,ae,1),je=new Date(O,ae+1,0),qe=Le.getDay(),j=je.getDate(),$=ip(e),Me=new Date;Me.setHours(0,0,0,0);let ht=[],le=qe,He=new Date(O,ae,0).getDate();for(let Re=le-1;Re>=0;Re--){let de=new Date(O,ae-1,He-Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Hl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}for(let Re=1;Re<=j;Re++){let de=new Date(O,ae,Re),Ve=de.getTime()===Me.getTime();ht.push({date:de,isCurrentMonth:true,isToday:Ve,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(V=>Hl(de,V)).map(V=>({id:V.id,title:V.name,start:V.startDate,end:V.endDate,task:V}))});}let De=42-ht.length;for(let Re=1;Re<=De;Re++){let de=new Date(O,ae+1,Re);ht.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:$.filter(Ve=>Hl(de,Ve)).map(Ve=>({id:Ve.id,title:Ve.name,start:Ve.startDate,end:Ve.endDate,task:Ve}))});}return ht},[te,e]),Pt=C==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$e=te.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,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-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[H.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,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",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"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",x?"bg-[#0F1117]":"bg-white",n),style:l,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-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:H.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:H.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:u("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:$e}),jsxRuntime.jsx("button",{onClick:Ue,className:u("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:H.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ge,className:u("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ae,className:u("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Pt.map(O=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:nt.map((O,ae)=>{let Le=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:u("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?Le?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Le?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let je=L[ae]||S,qe=O.events.slice(0,je),j=O.events.length-je;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[qe.map($=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{A($.task),a.onEventClick?.($),f?.($.task.id);},whileHover:{scale:1.02},className:u("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",$.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(lp,{task:$.task}),jsxRuntime.jsx("span",{className:"truncate",children:$.title})]})},$.id)),j>0&&jsxRuntime.jsxs("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:je+K}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",j," ",C==="es"?"M\xC1S":"MORE"]}),je>S&&O.events.length>S&&jsxRuntime.jsx("button",{onClick:$=>{$.stopPropagation(),U(Me=>({...Me,[ae]:S}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:C==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let je=ae>=28,qe=ae%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),J===ae?ie(null):(ie(ae),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false),X(O.date));},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",J===ae?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",J===ae&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J===ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),ye(""),Q(void 0),Pe(null),ce(null),ut(false),Xe(false),Be(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:je?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:je?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",je?"bottom-full mb-1":"top-full mt-1",qe?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>{j.stopPropagation(),ut(false),Xe(false),Be(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ue,onChange:j=>ye(j.target.value),placeholder:C==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:u("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:j=>{if(j.key==="Enter"&&ue.trim()){let $=t.availableUsers?.find(ht=>ht.id===Je),Me=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:Me,endDate:Me,priority:Oe,assignees:$?[$]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}j.key==="Escape"&&(ie(null),ye(""),Q(void 0),Pe(null),ce(null));}})}),jsxRuntime.jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"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(),ut(!rt),Xe(false);},className:u("p-1 rounded transition-colors",Oe?Oe==="urgent"||Oe==="high"?"text-red-400 bg-red-500/20":Oe==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>j.stopPropagation(),children:[{id:"urgent",label:C==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:C==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:C==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:C==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:C==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(j=>jsxRuntime.jsxs("button",{onClick:()=>{Q(j.id),ut(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Oe===j.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",j.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:j.label})]},j.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:j=>{j.stopPropagation(),Be(!Ge),ut(false),Xe(false),X(pt||O.date);},className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",pt?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(pt||O.date).toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] 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",x?"border-white/10":"border-gray-200"),children:(()=>{let j=new Date,$=new Date(j);$.setDate(j.getDate()+1);let Me=new Date(j);Me.setDate(j.getDate()+((6-j.getDay()+7)%7||7));let ht=new Date(j);ht.setDate(j.getDate()+((1-j.getDay()+7)%7||7));let le=new Date(j);le.setDate(j.getDate()+14);let He=new Date(j);return He.setDate(j.getDate()+28),[{label:C==="es"?"Hoy":"Today",date:j,display:j.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:C==="es"?"Este fin de semana":"This weekend",date:Me,display:C==="es"?"s\xE1b.":"sat."},{label:C==="es"?"Pr\xF3xima semana":"Next week",date:ht,display:C==="es"?"lun.":"mon."},{label:C==="es"?"2 semanas":"2 weeks",date:le,display:le.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:C==="es"?"4 semanas":"4 weeks",date:He,display:He.toLocaleDateString(C==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,de)=>jsxRuntime.jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ce(Re.date),Be(false);},children:[jsxRuntime.jsx("span",{children:Re.label}),jsxRuntime.jsx("span",{className:u("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},de))})()}),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",x?"text-white":"text-gray-900"),children:B.toLocaleDateString(C==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>X(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:C==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>X(new Date(B.getFullYear(),B.getMonth()-1)),className:u("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>X(new Date(B.getFullYear(),B.getMonth()+1)),className:u("p-0.5 rounded",x?"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:(C==="es"?["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]",x?"text-[#6B7280]":"text-gray-400"),children:j},j))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let j=B.getFullYear(),$=B.getMonth(),Me=new Date(j,$,1).getDay(),ht=new Date(j,$+1,0).getDate(),le=new Date(j,$,0).getDate(),He=new Date,De=[];for(let de=Me-1;de>=0;de--)De.push({dayNum:le-de,isCurrentMonth:false,date:new Date(j,$-1,le-de)});for(let de=1;de<=ht;de++)De.push({dayNum:de,isCurrentMonth:true,date:new Date(j,$,de)});let Re=42-De.length;for(let de=1;de<=Re;de++)De.push({dayNum:de,isCurrentMonth:false,date:new Date(j,$+1,de)});return De.map((de,Ve)=>{let V=de.date.toDateString()===He.toDateString(),q=(pt||O.date).toDateString()===de.date.toDateString();return jsxRuntime.jsx("button",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!de.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),de.isCurrentMonth&&(x?"text-white":"text-gray-900"),V&&"ring-1 ring-[#3B82F6]",q&&"bg-[#7C3AED] text-white",!q&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ce(de.date),Be(false);},children:de.dayNum},Ve)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:j=>{j.stopPropagation(),Xe(!It),ut(false);},className:u("p-1 rounded transition-colors",Je?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Je?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(j=>j.id===Je)?.color||"#7C3AED"},children:t.availableUsers?.find(j=>j.id===Je)?.initials||t.availableUsers?.find(j=>j.id===Je)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:It&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:j=>j.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{Pe(null),Xe(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!Je&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:C==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(j=>jsxRuntime.jsxs("button",{onClick:()=>{Pe(j.id),Xe(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Je===j.id&&(x?"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-medium",style:{backgroundColor:j.color||"#7C3AED"},children:j.initials||j.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:j.name})]},j.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:u("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:C==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ue.trim()){let j=t.availableUsers?.find(Me=>Me.id===Je),$=pt||O.date;a.onTaskCreate?.({name:ue.trim(),startDate:$,endDate:$,priority:Oe,assignees:j?[j]:void 0}),ye(""),Q(void 0),Pe(null),ce(null),ie(null);}},disabled:!ue.trim(),className:u("px-2.5 py-1 rounded text-xs font-medium transition-colors",ue.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:C==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:u("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},ae)})})]})}),jsxRuntime.jsx(Mr,{task:ne,isOpen:!!ne,onClose:()=>A(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),A(O);},theme:I==="dark"?"dark":"light",locale:C,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:ne?c?.get(ne.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ip(e).filter(O=>O.id!==ne?.id),comments:d?.filter(O=>O.taskId===ne?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:b,onUploadCommentAttachments:w,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:v,isTimerRunning:T?.isRunning,timerElapsedSeconds:T?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onTimerStart:E,onTimerStop:k,onTimerDiscard:R}),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/30 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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium",x?"text-white":"text-gray-900"),children:ke.date.toLocaleDateString(C==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:ke.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{Ie(null),A(O.task),f?.(O.task.id);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(lp,{task:O.task}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Wl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Gl={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"},Vl={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"},Os={dark:Wl,light:Gl,neutral:Vl};function mp(e){return Os[e]||Os.dark}function Px({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=c.length,b=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,w=c.map(y=>y.priority).filter(Boolean),f=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:g,uniqueAssignees:b,priorities:w,labels:f}},[c]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(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"]})]}),m&&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:c.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:c.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:b=>{b.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 pp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Cn(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 Tn(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 gp(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 fp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let m=react.useMemo(()=>({...pp,...n}),[n]),[i,c]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let T=v.timestamp.toISOString().split("T")[0],D=h.get(T);D?D.push(v):h.set(T,[v]);}),Array.from(h.entries()).sort((v,T)=>T[0].localeCompare(v[0])).map(([v,T])=>({date:new Date(v),events:T.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:g,uniqueTypes:b}=react.useMemo(()=>{let h=new Set,v=new Set;return e.forEach(T=>{h.add(T.userId),v.add(T.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),w=h=>{c(v=>{let T=new Set(v);return T.has(h)?T.delete(h):T.add(h),T});},f=h=>{let T=new Date().getTime()-h.getTime(),D=Math.floor(T/6e4),N=Math.floor(T/36e5),E=Math.floor(T/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:E<7?`${E}d ago`:h.toLocaleDateString()},y=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",l),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",m.compact&&"compact",l),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:h=>{let v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),b.map(h=>jsxRuntime.jsxs("option",{value:h,children:[Tn(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((v,T)=>{let D=i.has(v.id),N=s===v.id,E=gp(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:u("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Tn(v.type)})}),T<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),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:[m.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Cn(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?f(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),w(v.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,R])=>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(R.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},k)),v.metadata&&Object.keys(v.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(v.metadata).map(([k,R])=>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(R)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function hp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.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",i),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",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Tn(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Cn(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=>l(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,b)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",b===e.currentIndex&&"active"),style:{left:`${b/(e.totalEvents-1)*100}%`},onClick:()=>l(b),title:Cn(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:c.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>m(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",i),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 _l(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 jl(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 yp(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 vp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Bx(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let b=c.x-g.x,w=c.y-g.y,f=Math.sqrt(b*b+w*w)||1,y=o.chargeStrength*i/(f*f);c.vx+=b/f*y,c.vy+=w/f*y;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let g=p.x-d.x,b=p.y-d.y,w=Math.sqrt(g*g+b*b)||1,f=(w-o.linkDistance)/w*o.forceStrength*i;d.vx+=g*f,d.vy+=b*f,p.vx-=g*f,p.vy-=b*f;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function xp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:m}){let i=react.useRef(null),[c,d]=react.useState([]),[p,g]=react.useState(null),[b,w]=react.useState(null),[f,y]=react.useState(null),[h,v]=react.useState(1),[T,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let H=Bx(e,t,a.width,a.height,a,150);d(H);},[e,t,a]);let N=react.useCallback((H,x)=>{a.enableDragging&&(x.stopPropagation(),g(H));},[a.enableDragging]),E=react.useCallback(H=>{if(!p||!i.current)return;let te=i.current.getBoundingClientRect(),oe=(H.clientX-te.left-T.x)/h,ne=(H.clientY-te.top-T.y)/h;d(A=>A.map(ke=>ke.id===p?{...ke,x:oe,y:ne,fx:oe,fy:ne}:ke));},[p,h,T]),k=react.useCallback(()=>{g(null);},[]),R=react.useCallback((H,x)=>{x.stopPropagation(),l?.({type:"node-click",node:H,position:{x:x.clientX,y:x.clientY}});},[l]),I=react.useCallback((H,x)=>{x.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:x.clientX,y:x.clientY}});},[l]),C=react.useCallback(H=>{let x=c.find(te=>te.id===H);return x?{x:x.x,y:x.y}:{x:0,y:0}},[c]),W=react.useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let x=H.card.priority;return x==="URGENT"?"#ef4444":x==="HIGH"?"#f59e0b":x==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("relationships-graph-empty",m),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",m),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:()=>v(H=>Math.min(H+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:_l(H)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[yp(H)," ",jl(H)]})]},H))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${T.x}, ${T.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let x=C(typeof H.source=="string"?H.source:H.source.id),te=C(typeof H.target=="string"?H.target:H.target.id),oe=vp(H.type),ne=f===H.id,A=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",ne&&"hovered",A&&"critical"),onMouseEnter:()=>y(H.id),onMouseLeave:()=>y(null),onClick:ke=>I(H,ke),children:[jsxRuntime.jsx("line",{x1:x.x,y1:x.y,x2:te.x,y2:te.y,stroke:_l(H.type),strokeWidth:A?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ne?1:.6,markerEnd:oe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ne&&jsxRuntime.jsx("text",{x:(x.x+te.x)/2,y:(x.y+te.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:jl(H.type)})]},H.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(H=>{let x=b===H.id,te=H.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",x&&"hovered",te&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:oe=>N(H.id,oe),onMouseEnter:()=>w(H.id),onMouseLeave:()=>w(null),onClick:oe=>R(H,oe),children:[jsxRuntime.jsx("circle",{r:te?a.nodeSize*1.2:a.nodeSize,fill:W(H),stroke:te?"#fbbf24":"#ffffff",strokeWidth:te?3:2,opacity:x?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.id)})})]}),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 Cp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[l,m]=react.useState(false),[i,c]=react.useState(null),[d,p]=react.useState(null),g=react.useRef(null),b=l||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&!b&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,b]);let w=()=>{b||(n(""),c(null),p(null),t());},f=async()=>{if(!(!s.trim()||b)){m(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},y=()=>{d&&(a(d),w());};return e?jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),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:h=>h.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:w,disabled:b,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((h,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},v))})]}),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((h,v)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},v)),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:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:b}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,v)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:b,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:b&&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:w,disabled:b,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:f,disabled:!s.trim()||b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:b?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Kl={"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 Ox={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},$x={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 zx(e,t,a){let r=Kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Nn(e){return `$${e.toFixed(4)}`}var Yl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=zx(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),l=a.filter(d=>d.success),m=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=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)}},To=new Yl;function Dp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(To.getStats()),[s,n]=react.useState(To.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(To.getStats()),n(To.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let l=To.getRecentOperations(5);return jsxRuntime.jsxs(yt,{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:m=>m.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:Nn(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(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/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:m.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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Nn(c)})]})]}),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}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Nn(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 Pp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=react.useState(""),[m,i]=react.useState(""),[c,d]=react.useState(""),[p,g]=react.useState(false),[b,w]=react.useState(null),[f,y]=react.useState(null),[h,v]=react.useState(null),T=react.useRef(null),D=p||o;react.useEffect(()=>{e&&T.current&&T.current.focus();},[e]),react.useEffect(()=>{let I=C=>{C.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),w(null),y(null),v(null),t());},E=async()=>{if(!(!n.trim()||D)){g(true),w(null),y(null),v(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});y(I.tasks.tasks),v({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){w(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{f&&(a(f),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:I=>I.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:N,disabled:D,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:f?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:[h?.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"}),h?.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 (",R,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[f.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:f.map((I,C)=>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:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:T,value:n,onChange:I=>l(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:D}),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:m,onChange:I=>i(I.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:D})]}),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:c,onChange:I=>d(I.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:D})]})]}),b&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:b}),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((I,C)=>jsxRuntime.jsx("button",{onClick:()=>l(I),disabled:D,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:I},C))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&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:N,disabled:D,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"}),f?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:E,disabled:!n.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Us({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(f=>{t&&Bn(()=>Promise.resolve(t(f)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=react.useCallback(async(f,y,h)=>{r(v=>{let T=v.cards.find(I=>I.id===f);if(!T)return v;let D=T.columnId,N={...T,columnId:y,position:h},E=v.cards.map(I=>I.id===f?N:I),k=v.columns.map(I=>{if(I.id===D)return {...I,cardIds:I.cardIds.filter(C=>C!==f)};if(I.id===y){let C=E.filter(W=>W.columnId===y).sort((W,H)=>W.position-H.position);return {...I,cardIds:C.map(W=>W.id)}}return I}),R={...v,cards:E,columns:k};return o(R),R});},[o]),n=react.useCallback(async(f,y)=>{r(h=>{let v=h.cards.map(D=>D.id===f?{...D,...y}:D),T={...h,cards:v};return o(T),T});},[o]),l=react.useCallback(async f=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...f,id:y},T=h.columns.map(N=>N.id===f.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,v],columns:T};return o(D),D});},[o]),m=react.useCallback(async f=>{r(y=>{let h=y.cards.find(N=>N.id===f);if(!h)return y;let v=y.cards.filter(N=>N.id!==f),T=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(E=>E!==f)}:N),D={...y,cards:v,columns:T};return o(D),D});},[o]),i=react.useCallback(async f=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...f,id:y,cardIds:[]},T={...h,columns:[...h.columns,v]};return o(T),T});},[o]),c=react.useCallback(async(f,y)=>{r(h=>{let v=h.columns.map(D=>D.id===f?{...D,...y}:D),T={...h,columns:v};return o(T),T});},[o]),d=react.useCallback(async f=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==f),v=y.columns.filter(D=>D.id!==f),T={...y,cards:h,columns:v};return o(T),T});},[o]),p=react.useCallback(f=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(f),y},[l]),g=react.useCallback(f=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(f),y},[i]),b=react.useCallback(()=>{r(f=>{let y={...f,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:m,deleteColumn:d,clearBoard:b}}}function Fp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Us({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+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 Dn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Lp={by:"none",order:"asc"};function Ip({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Dn,...e}),[s,n]=react.useState({...Lp,...t}),l=react.useCallback(w=>{o(f=>({...f,...w}));},[]),m=react.useCallback(w=>{n(f=>({...f,...w}));},[]),i=react.useCallback(()=>{o(Dn),n(Lp);},[]),c=react.useCallback(()=>{a&&o({...Dn,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Dn,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...Dn,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]),b=react.useCallback(w=>{let f=[...w];if(r.search){let y=r.search.toLowerCase();f=f.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),v=String(y.getMonth()+1).padStart(2,"0"),T=String(y.getDate()).padStart(2,"0"),D=`${h}-${v}-${T}`;f=f.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let E=N.endDate||N.dueDate;if(!E)return false;let k;if(typeof E=="string")k=E.split("T")[0]||E;else {let R=E.getUTCFullYear(),I=String(E.getUTCMonth()+1).padStart(2,"0"),C=String(E.getUTCDate()).padStart(2,"0");k=`${R}-${I}-${C}`;}switch(r.dateFilter){case "overdue":return k<D;case "today":return k===D;case "this-week":let R=new Date(D+"T00:00:00"),I=new Date(k+"T00:00:00"),C=new Date(R);return C.setDate(C.getDate()+7),I>=R&&I<=C;case "custom":if(r.dateRange){let W=typeof E=="string"?new Date(E):E;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(f=f.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(f=f.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(f=f.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(f=f.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&f.sort((y,h)=>{let v=0;switch(s.by){case "created":let T=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;v=T-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=N[y.priority||"LOW"],k=N[h.priority||"LOW"];v=E-k;break;case "dueDate":let R=y.endDate||y.dueDate,I=h.endDate||h.dueDate;if(!R)return 1;if(!I)return -1;let C=typeof R=="string"?new Date(R).getTime():R.getTime(),W=typeof I=="string"?new Date(I).getTime():I.getTime();v=C-W;break;case "title":v=y.title.localeCompare(h.title);break;case "estimate":let H=y.estimatedTime||0,x=h.estimatedTime||0;v=H-x;break;default:v=0;}return s.order==="asc"?v:-v}),f},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,applyFilters:b,hasActiveFilters:g}}var Rp,Op;if(typeof window<"u")try{let e=An("ai");Rp=e.generateObject,Op=e.generateText;}catch{}function $p(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Rp&&Op&&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]),l=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]),m=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]),i=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]),c=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:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Xl(){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 zp(e){let{cards:t}=e,[a,r]=Xl(),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,b=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(b&&a.lastSelectedCardId){let w=t.find(y=>y.id===d),f=t.find(y=>y.id===a.lastSelectedCardId);if(w&&f&&w.columnId===f.columnId){let y=t.filter(k=>k.columnId===w.columnId).sort((k,R)=>k.position-R.position),h=y.findIndex(k=>k.id===a.lastSelectedCardId),v=y.findIndex(k=>k.id===d),[T,D]=h<v?[h,v]:[v,h],N=y.slice(T,D+1).map(k=>k.id),E=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:E,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]),l=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=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:l,selectAll:m,toggleCard:i,getSelectedCards:c}}var Up={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Hp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Up,...a}),[a]),[s,n]=react.useState([]),l=react.useCallback((w,f,y,h,v)=>{if(f.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let T={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:f,columnId:y,strategy:h,color:v,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,T]);},[o.minCardsPerStack,s]),m=react.useCallback(w=>{n(f=>f.filter(y=>y.id!==w));},[]),i=react.useCallback(w=>{n(f=>f.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),c=react.useCallback((w,f)=>{n(y=>y.map(h=>h.id===w&&!h.cardIds.includes(f)?{...h,cardIds:[...h.cardIds,f]}:h));},[]),d=react.useCallback((w,f)=>{n(y=>y.map(h=>{if(h.id===w){let v=h.cardIds.filter(T=>T!==f);return v.length<o.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=react.useCallback(w=>s.filter(f=>f.columnId===w).sort((f,y)=>f.position-y.position),[s]),g=react.useCallback(async w=>{let f=t.filter(D=>D.columnId===w);if(f.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;f.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(E=>E.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let v=new Map;f.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{v.has(N)||v.set(N,[]),v.get(N).push(D);});}),v.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(E=>E.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let T=new Map;if(f.forEach(D=>{D.priority&&(T.has(D.priority)||T.set(D.priority,[]),T.get(D.priority).push(D));}),T.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${E} ${N} Priority`,cardIds:D.map(k=>k.id),columnId:w,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of f){let E=(await r.findSimilar(D,f)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let k=[D.id,...E.map(I=>I.card.id)],R=E.reduce((I,C)=>I+C.similarity,0)/E.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:k,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),b=react.useCallback(w=>{l(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[l]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(f=>f.columnId)).forEach(async f=>{let y=await g(f),h=y[0];y.length>0&&h&&h.confidence>=.9&&b(h);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:b,config:o}}var Wp=react.createContext(null);function Gp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=An("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=An("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=An("@libxai/core");l=new m(t.board);}r.current=new core.BoardStore({board:l,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Wp.Provider,{value:{store:o},children:e})}function Hs(){let e=react.useContext(Wp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function En(){let e=Hs(),[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 l=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,v)=>{e.updateColumn(h,v);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),p=react.useCallback(h=>{e.addCard(h);},[e]),g=react.useCallback((h,v)=>{e.updateCard(h,v);},[e]),b=react.useCallback(h=>{e.deleteCard(h);},[e]),w=react.useCallback((h,v,T)=>{e.moveCard(h,v,T);},[e]),f=react.useCallback(h=>e.getCard(h),[e]),y=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:g,deleteCard:b,moveCard:w,getCard:f,getCardsByColumn:y}}function _p(e){let{cards:t}=En();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 jp(e="position",t="asc"){let{cards:a}=En();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Ws=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Pd.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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},a2=new Ws;function Yp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:p,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(b=>{let w=e[b.index];if(!w)return null;let f=m?m(w,b.index):b.index,y={position:"absolute",top:n?0:b.start,left:n?b.start:0,width:n?b.size:"100%",height:n?"100%":b.size};return jsxRuntime.jsx("div",{style:y,"data-index":b.index,children:r(w,b.index)},f)})})})}function qp(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 Jp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},b={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:g,className:s,children:jsxRuntime.jsx("div",{style:b,children:p.map(w=>{let f=e[w.index];if(!f)return null;let y=m?m(f,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":w.index,children:o(f,w.index)},y)})})})}function Zp(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 Qp(e,t=10){return e>t}var ed={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},td={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ad={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},rd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},od={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},nd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},sd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},id={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)"},ld={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)"},dd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},cd={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}},md={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}},Gs={spacing:ed,borderRadius:td,fontSize:ad,fontWeight:rd,lineHeight:od,zIndex:nd,duration:sd,easing:id,shadows:ld,opacity:dd,kanban:cd,gantt:md};function eg(e,t,a){return e[t]??a}function ud(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)?ud(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function n2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function pd(e="asakaa"){let t=ud(Gs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=n2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
404
404
|
${a.join(`
|
|
405
405
|
`)}
|
|
406
|
-
}`}function
|
|
406
|
+
}`}function Pn(e,t="asakaa"){let a=[],r=ud(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
407
407
|
${a.join(`
|
|
408
408
|
`)}
|
|
409
|
-
}`}var
|
|
409
|
+
}`}var Vs={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"}},gd={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"}},fd={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 bd(e=Vs,t="asakaa"){let a=pd(t),r=Pn(e,t);return `${a}
|
|
410
410
|
|
|
411
|
-
${r}`}function
|
|
411
|
+
${r}`}function tg(){return `/**
|
|
412
412
|
* ASAKAA Design Tokens
|
|
413
413
|
* Auto-generated from design-tokens.ts
|
|
414
414
|
* Do not edit this file directly
|
|
415
415
|
*/
|
|
416
416
|
|
|
417
|
-
${
|
|
417
|
+
${bd(Vs)}
|
|
418
418
|
|
|
419
419
|
/* Light theme */
|
|
420
420
|
[data-theme="light"] {
|
|
421
|
-
${
|
|
421
|
+
${Pn(gd,"asakaa").split(`
|
|
422
422
|
`).slice(1,-1).join(`
|
|
423
423
|
`)}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/* Neutral theme */
|
|
427
427
|
[data-theme="neutral"] {
|
|
428
|
-
${
|
|
428
|
+
${Pn(fd,"asakaa").split(`
|
|
429
429
|
`).slice(1,-1).join(`
|
|
430
430
|
`)}
|
|
431
431
|
}
|
|
432
|
-
`}var
|
|
433
|
-
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=
|
|
432
|
+
`}var s2=({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 ag({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Uo();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let m=n,i=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(s2,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},m)})})}
|
|
433
|
+
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=Dp;exports.AI_FEATURES=$x;exports.AI_MODELS=Kl;exports.AddCardButton=Ci;exports.AddColumnButton=wi;exports.AttachmentUploader=wr;exports.BoardProvider=Gp;exports.BulkOperationsToolbar=as;exports.BurnDownChart=Bi;exports.CUSTOM_FIELD_TYPES=Qu;exports.CalendarBoard=cp;exports.Card=Er;exports.CardDetailModal=Pi;exports.CardDetailModalV2=Ai;exports.CardHistoryReplay=hp;exports.CardHistoryTimeline=fp;exports.CardRelationshipsGraph=xp;exports.CardStack=Px;exports.CardTemplateSelector=Wi;exports.CircuitBreaker=Qs;exports.Column=Lo;exports.ColumnManager=ds;exports.CommandPalette=Di;exports.ConfigMenu=ji;exports.ContextMenu=Go;exports.DEFAULT_SHORTCUTS=mn;exports.DEFAULT_TABLE_COLUMNS=Ju;exports.DEFAULT_TEMPLATES=Hi;exports.DateRangePicker=Jo;exports.DependenciesSelector=Qo;exports.DependencyLine=bs;exports.DistributionCharts=Ri;exports.EditableColumnTitle=ii;exports.ErrorBoundary=Ro;exports.ExportImportModal=Vi;exports.FilterBar=_i;exports.GANTT_AI_SYSTEM_PROMPT=_m;exports.GanttAIAssistant=ks;exports.GanttBoard=Um;exports.GanttI18nContext=Wo;exports.GanttMilestone=ys;exports.GanttToolbar=ls;exports.GenerateGanttTasksDialog=Pp;exports.GeneratePlanModal=Cp;exports.GroupBySelector=zi;exports.HealthBar=gi;exports.KanbanBoard=_r;exports.KanbanToolbar=xi;exports.KanbanViewAdapter=ln;exports.KeyboardShortcutsHelp=Ui;exports.ListView=Xu;exports.MenuIcons=Ht;exports.PluginManager=Ws;exports.PrioritySelector=co;exports.ProfitabilityReport=fi;exports.RATE_LIMITS=Ox;exports.STANDARD_FIELDS=Zu;exports.SwimlaneBoardView=Oi;exports.TagBadge=di;exports.TagList=mc;exports.TagPicker=Gr;exports.TaskBar=gs;exports.TaskDetailModal=Mr;exports.TaskFormModal=Vm;exports.TaskGrid=us;exports.ThemeModal=Xi;exports.ThemeProvider=nm;exports.ThemeSwitcher=ag;exports.TimeInputPopover=fo;exports.TimePill=ci;exports.TimePopover=mi;exports.Timeline=xs;exports.UserAssignmentSelector=uo;exports.VelocityChart=Ii;exports.VirtualGrid=Jp;exports.VirtualList=Yp;exports.aiUsageTracker=To;exports.borderRadius=td;exports.calculatePosition=In;exports.calendarDarkTheme=Wl;exports.calendarEnTranslations=$l;exports.calendarEsTranslations=zl;exports.calendarLightTheme=Gl;exports.calendarNeutralTheme=Vl;exports.calendarThemes=Os;exports.calendarTranslations=Bs;exports.cardToGanttTask=Ts;exports.cardsToGanttTasks=Zm;exports.cn=u;exports.createKanbanView=$c;exports.createRetryWrapper=Dg;exports.darkTheme=Ki;exports.darkTokenTheme=Vs;exports.defaultTheme=os;exports.designTokens=Gs;exports.duration=sd;exports.easing=id;exports.exportTokensToCSS=tg;exports.findTaskByName=Br;exports.fontSize=ad;exports.fontWeight=rd;exports.formatCost=Nn;exports.ganttEnTranslations=ss;exports.ganttEsTranslations=im;exports.ganttTaskToCardUpdate=Jm;exports.ganttThemes=et;exports.ganttTokens=md;exports.ganttTranslations=Ji;exports.ganttUtils=xe;exports.generateCSSVariables=pd;exports.generateCompleteCSS=bd;exports.generateInitialPositions=wg;exports.generateTasksContext=jm;exports.generateThemeVariables=Pn;exports.getCalendarTheme=mp;exports.getCalendarTranslations=kn;exports.getListViewTheme=ep;exports.getListViewTranslations=Nl;exports.getMonthNames=tp;exports.getToken=eg;exports.getTranslations=lm;exports.getWeekdayNames=ap;exports.kanbanTokens=cd;exports.lightTheme=Yi;exports.lightTokenTheme=gd;exports.lineHeight=od;exports.listViewDarkTheme=Bl;exports.listViewEnTranslations=Cl;exports.listViewEsTranslations=Tl;exports.listViewLightTheme=Rl;exports.listViewNeutralTheme=Ol;exports.listViewThemes=Is;exports.listViewTranslations=Ns;exports.mergeCalendarTranslations=Rs;exports.mergeListViewTranslations=Ds;exports.mergeTranslations=Zi;exports.neutralTheme=qi;exports.neutralTokenTheme=fd;exports.opacity=dd;exports.parseLocalCommand=qm;exports.parseNaturalDate=xl;exports.parseNaturalDuration=kl;exports.parseProgress=wl;exports.parseStatus=Ym;exports.pluginManager=a2;exports.retrySyncOperation=Ng;exports.retryWithBackoff=Bn;exports.shadows=ld;exports.shouldVirtualizeGrid=Qp;exports.spacing=ed;exports.themes=yo;exports.useAI=$p;exports.useBoard=Fp;exports.useBoardCore=En;exports.useBoardStore=Hs;exports.useCardStacking=Hp;exports.useDragState=yi;exports.useFilteredCards=_p;exports.useFilters=Ip;exports.useGanttI18n=Xr;exports.useKanbanState=Us;exports.useKeyboardShortcuts=am;exports.useMultiSelect=zp;exports.useSelectionState=Xl;exports.useSortedCards=jp;exports.useTheme=Uo;exports.useVirtualGrid=Zp;exports.useVirtualList=qp;exports.validateAIResponse=Xm;exports.withErrorBoundary=Ti;exports.wouldCreateCircularDependency=On;exports.zIndex=nd;//# sourceMappingURL=index.cjs.map
|
|
434
434
|
//# sourceMappingURL=index.cjs.map
|