@libxai/board 0.17.381 → 0.17.401

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 CHANGED
@@ -1,8 +1,8 @@
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'),Sc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Ju=require('react-markdown'),Qu=require('remark-gfm'),Zu=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Sc__default=/*#__PURE__*/_interopDefault(Sc);var Ju__default=/*#__PURE__*/_interopDefault(Ju);var Qu__default=/*#__PURE__*/_interopDefault(Qu);var Zu__default=/*#__PURE__*/_interopDefault(Zu);var tn=(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 an=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 [an.Translate.toString(e),an.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function rn(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 cp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ds(e,t){return e.length===0?1e3:t===0?rn(null,e[0].position):t>=e.length?rn(e[e.length-1].position,null):rn(e[t-1].position,e[t].position)}function Pl(e,t=100){return e>t}var mp=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 pp(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 on(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=mp,onRetry:p}=t,m,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,u===a||!n(m,u))return {error:m,attempts:i,success:false};let h=pp(u,r,o,s);if(p)try{p(m,u,h);}catch(C){console.error("Error in retry callback:",C);}await new Promise(C=>setTimeout(C,h));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function up(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 gp(e,t={}){return async(...a)=>on(()=>e(...a),t)}var cs=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 Ml=(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))(Ml||{}),Or=class Or{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(p,o,m?n:"");break;case "INFO":console.info(p,o,m?n:"");break;case "WARN":console.warn(p,o,m?n:"");break;case "ERROR":console.error(p,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",...Or.globalOptions};}static configure(t){Or.globalOptions={...Or.globalOptions,...t};}child(t){return new Or({...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 nn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new nn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ml[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Or.globalOptions={};var ms=Or,nn=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}},Al=new ms;function hp(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 bp(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(p=>p.id===s.columnId);return [s.id,ps(s.title),ps(s.description||""),ps(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 yp(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 Sc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=n.toDataURL("image/png"),m=297,i=210,u=n.width/n.height,d=m-20,g=d/u;g>i-20&&(g=i-20,d=g*u);let h=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});h.setFontSize(16),h.setTextColor(255,255,255),h.setFillColor(10,10,10),h.rect(0,0,m,15,"F"),h.text(e.title||"Kanban Board",10,10);let C=(m-d)/2;return h.addImage(p,"PNG",C,20,d,g),h}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 p=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,p.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):p.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 u=o.splitTextToSize(m.description,160);o.text(u,25,s),s+=u.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 u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),i.push(u.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 ps(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Ll(e,t,a,r){switch(t){case "json":return hp(e,r);case "csv":return bp(e);case "pdf":return await yp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Il(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);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"},p=new Blob([e],{type:n[t]}),m=URL.createObjectURL(p),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function vp(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 xp(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=Bl(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Bl(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((h,C)=>{i[h]=p[C]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),g={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(g),d.cardIds.push(g.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.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 Bl(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 Rl(e,t){switch(t){case "json":return vp(e);case "csv":return xp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function $l(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 us=react.createContext(null);function Ol(){return react.useContext(us)}var zl=react.createContext(null);function Ul({children:e,themeName:t}){return jsxRuntime.jsx(zl.Provider,{value:{themeName:t},children:e})}function oo(){return react.useContext(zl)}function ct({children:e,container:t}){let[a,r]=react.useState(false),o=Ol(),s=oo();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:p,themeName:m}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.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 Vl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Ep="#BDC3C7",Pp=({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 zr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),i=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),C=window.innerHeight,T=window.innerWidth,c=160,b=220,v=4,l=h.right-c;l<10&&(l=h.left),l+c>T-10&&(l=T-c-10);let x=C-h.bottom,y=h.top,D;x>=b+v?D=h.bottom+v:y>=b+v?D=h.top-b-v:D=x>=y?h.bottom+v:Math.max(10,h.top-b-v),n({top:D,left:l}),o(true);};react.useEffect(()=>{let h=C=>{p.current&&!p.current.contains(C.target)&&!m.current?.contains(C.target)&&o(false);};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=C=>{C.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]);let u=h=>{t(h),o(false);},d=e?Vl[e]:null,g=d?.color||Ep;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?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}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:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:p,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(Vl).map(([h,C])=>jsxRuntime.jsxs("button",{onClick:()=>u(h),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:C.color,background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Pp,{color:C.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:C.label}),e===h&&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"})})]},h)),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:()=>u(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:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.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 Mp=[{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 No({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),g=(oo()?.themeName||"dark")==="dark",h=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),x=window.innerHeight,y=window.innerWidth,D=320,w=380,k=4,R=l.left;R+D>y-10&&(R=y-D-10),R<10&&(R=10);let A=x-l.bottom,N=l.top,I;A>=w+k?I=l.bottom+k:N>=w+k?I=l.top-w-k:I=A>=N?l.bottom+k:Math.max(10,l.top-w-k),p({top:I,left:R}),s(true);};react.useEffect(()=>{let l=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let C=l=>{let x=new Date,y=R=>{let A=R.getFullYear(),N=String(R.getMonth()+1).padStart(2,"0"),I=String(R.getDate()).padStart(2,"0");return `${A}-${N}-${I}`},D=y(x),w=new Date(x);w.setDate(w.getDate()+l);let k=y(w);a(D,k),s(false);},T=()=>{if(!e||!t)return "Set date";let l=w=>{if(w instanceof Date)return w;if(typeof w!="string"||!w.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=w.split("-").map(Number);if(k.length!==3||k.some(I=>isNaN(I)))return null;let R=k[0],A=k[1],N=k[2];return R===void 0||A===void 0||N===void 0?null:new Date(R,A-1,N)},x=l(e),y=l(t);if(!x||!y||isNaN(x.getTime())||isNaN(y.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[y.getMonth()]} ${y.getDate()}`},c=e&&t,v=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),l<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):h(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${T()}`:"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:T()})]}),o&&jsxRuntime.jsx(ct,{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:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"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:g?"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:g?"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:Mp.map(l=>jsxRuntime.jsx("button",{onClick:()=>C(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"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:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Hr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[p,m]=react.useState(""),[i,u]=react.useState({top:0,left:0}),d=react.useRef(null),g=react.useRef(null),h=()=>{if(!g.current)return;let v=g.current.getBoundingClientRect(),l=window.innerHeight,x=window.innerWidth,y=300,D=380,w=4,k=v.right-y;k<10&&(k=v.left),k+y>x-10&&(k=x-y-10);let R=l-v.bottom,A=v.top,N;R>=D+w?N=v.bottom+w:A>=D+w?N=v.top-D-w:N=R>=A?v.bottom+w:Math.max(10,v.top-D-w),u({top:N,left:k}),n(true);};react.useEffect(()=>{let v=l=>{d.current&&!d.current.contains(l.target)&&!g.current?.contains(l.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[s]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]);let C=v=>{let l=e.some(x=>x.id===v.id);a(l?e.filter(x=>x.id!==v.id):[...e,v]);},T=t.filter(v=>v.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),b=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>s?n(false):h(),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:[c.map(v=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(ct,{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:p,onChange:v=>m(v.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:T.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"}):T.map(v=>{let l=e.some(x=>x.id===v.id);return jsxRuntime.jsxs("button",{onClick:()=>C(v),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[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:v.color,color:"#fff"},children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.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:v.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},v.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 sn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;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,p=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let u of i){if(!s.has(u)&&p(u))return true;if(n.has(u))return true}}return n.delete(m),false};return p(a)}function So({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(t.length>0),[h,C]=react.useState({top:0,left:0}),[T,c]=react.useState(null),b=react.useRef(null),v=react.useRef(null),l=()=>{if(!v.current)return;let k=v.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,N=300,I=d?380:120,B=4,q=k.right-N;q<10&&(q=k.left),q+N>A-10&&(q=A-N-10);let ne=R-k.bottom,oe=k.top,re;ne>=I+B?re=k.bottom+B:oe>=I+B?re=k.top-I-B:re=ne>=oe?k.bottom+B:Math.max(10,k.top-I-B),C({top:re,left:q}),m(true);};react.useEffect(()=>{if(!p||!v.current)return;let k=v.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,N=300,I=d?380:120,B=4,q=k.right-N;q<10&&(q=k.left),q+N>A-10&&(q=A-N-10);let ne=R-k.bottom,oe=k.top,re;ne>=I+B?re=k.bottom+B:oe>=I+B?re=k.top-I-B:re=ne>=oe?k.bottom+B:Math.max(10,k.top-I-B),C({top:re,left:q});},[d,p]),react.useEffect(()=>{let k=R=>{b.current&&!b.current.contains(R.target)&&!v.current?.contains(R.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),react.useEffect(()=>{let k=R=>{R.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[p]);let x=k=>{let R=t.includes(k),A=a.find(N=>N.id===k);if(c(null),R){let N=t.filter(I=>I!==k);r(N),N.length===0&&g(false);}else {if(s&&sn(a,k,e)){let I=`Cannot add "${A?.title||k}" as dependency - would create circular reference`;c(I),n?.(k,A?.title||k),setTimeout(()=>c(null),3e3);return}r([...t,k]),g(true);}},y=()=>{let k=!d;g(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),w=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:v,onClick:()=>p?m(false):l(),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:w,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:w},children:t.length})]}),p&&jsxRuntime.jsx(ct,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${h.top}px`,left:`${h.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:[T&&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:T})]}),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:y,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=>u(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:D.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"}):D.map(k=>{let R=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.currentTarget.style.background="transparent";},children:[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([]),g(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 fr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:m=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:g,transition:h,isDragging:C}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),T={transform:an.Transform.toString(g),transition:h};if(t)return jsxRuntime.jsx("div",{ref:d,style:T,...i,...u,onClick:()=>a?.(e),children:t(e)});let c=p.filter(x=>e.assignedUserIds?.includes(x.id)),b=e.progress===100,v=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),l={...T,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:f("asakaa-card",C&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),v.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsxRuntime.jsx("img",{src:v[0].url,alt:v[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:v.slice(0,4).map((x,y)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),y===3&&v.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:["+",v.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(zr,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(No,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,y)=>n?.(e.id,{startDate:x,endDate:y})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Hr,{assignedUsers:c,availableUsers:p,onChange:x=>n?.(e.id,{assignedUserIds:x.map(y=>y.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(So,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),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)));fr.displayName="Card";var ln={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"}},td=({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 ad({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),m=react.useRef(null),i=react.useRef(null),u=[...Object.entries(ln).map(([c,b])=>({id:c,label:b.label,color:b.color,icon:b.icon})),...r.filter(c=>!Object.keys(ln).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=ln[e];if(c)return {...c,id:e};let b=r.find(v=>v.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ln.todo,id:"todo"}},g=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),b=window.innerHeight,v=window.innerWidth,l=180,x=280,y=4,D=c.right-l;D<10&&(D=c.left),D+l>v-10&&(D=v-l-10);let w=b-c.bottom,k=c.top,R;w>=x+y?R=c.bottom+y:k>=x+y?R=c.top-x-y:R=w>=k?c.bottom+y:Math.max(10,c.top-x-y),p({top:R,left:D}),s(true);};react.useEffect(()=>{let c=b=>{m.current&&!m.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=b=>{b.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let h=c=>{t(c),s(false);},C=d(),T=C.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):g(),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:`${T}10`,boxShadow:`0 0 0 2px ${T}30 inset`},title:C.label,children:jsxRuntime.jsx(td,{icon:C.icon,color:T})}),o&&jsxRuntime.jsx(ct,{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:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>h(c.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:c.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(td,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function rd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[p,m]=react.useState(false),[i,u]=react.useState(e),[d,g]=react.useState({top:0,left:0}),h=react.useRef(null),C=react.useRef(null),T=react.useRef(null);react.useEffect(()=>{if(s&&C.current){let l=C.current.getBoundingClientRect();g({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=x=>{h.current&&!h.current.contains(x.target)&&!C.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=x=>{x.key==="Escape"&&(n(false),m(false),u(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{p&&T.current&&(T.current.focus(),T.current.select());},[p]);let c=()=>{m(true),u(e);},b=()=>{let l=i.trim();l&&l!==e&&t(l),m(false),n(false),u(e);},v=l=>{l.key==="Enter"?b():l.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:C,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(ct,{children:jsxRuntime.jsx("div",{ref:h,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:p?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:T,type:"text",value:i,onChange:l=>u(l.target.value),onKeyDown:v,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:c,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 io=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:m,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:g,onToggleCollapse:h,onColumnRename:C,onColumnDelete:T,isDeletable:c=false,className:b})=>{let{setNodeRef:v,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),y=u??Pl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:y});if(a)return jsxRuntime.jsx("div",{ref:v,className:b,children:a(e,t)});let k=(()=>{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}})(),R=k.state==="exceeded",A=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:f("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",b),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:f(A()),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"})]})]}),(C||T)&&jsxRuntime.jsx(rd,{columnTitle:e.title,onRename:N=>C?.(e.id,N),onDelete:T?()=>T(e.id):void 0,isDeletable:c}),h&&jsxRuntime.jsx("button",{onClick:h,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:y?"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"})}):y?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(N=>{let I=t[N.index];return I?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsxRuntime.jsx(fr,{card:I,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i})},I.id):null})}):t.map(N=>jsxRuntime.jsx(fr,{card:N,render:r,onClick:n,onUpdate:p,availableUsers:m,allCards:i},N.id))})})]})});io.displayName="Column";function ys({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?m():u.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:m,onKeyDown:i,className:f("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:f("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var pn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function ir({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,m]=react.useState(false),[i,u]=react.useState(""),[d,g]=react.useState(false),[h,C]=react.useState(pn[10]||"#3B82F6"),[T,c]=react.useState({top:0,left:0}),b=react.useRef(null),v=react.useRef(null),l=react.useRef(null),x=react.useRef(null),y=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),D=t.some(N=>N.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(p&&v.current){let N=v.current.getBoundingClientRect();c({top:N.bottom+6,left:N.left});}},[p]),react.useEffect(()=>{let N=I=>{let B=I.target,q=b.current?.contains(B),ne=l.current?.contains(B);!q&&!ne&&(m(false),u(""),g(false));};if(p)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[p]),react.useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let w=N=>{let I=e.some(B=>B.id===N.id);a(I?e.filter(B=>B.id!==N.id):[...e,N]);},k=async()=>{if(!(!r||!i.trim())){g(true);try{let N=await r(i.trim(),h);N&&(a([...e,N]),u(""),C(pn[Math.floor(Math.random()*pn.length)]||"#3B82F6"));}finally{g(false);}}},R=(N,I)=>{I.stopPropagation(),a(e.filter(B=>B.id!==N));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:v,type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,disabled:s,children:[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:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,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:T.top,left:T.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:x,type:"text",value:i,onChange:N=>u(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()&&!D&&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(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:I=>R(N.id,I),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:y.length>0?y.map(N=>{let I=e.some(B=>B.id===N.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>w(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:I?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{I||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{I||(B.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}),I&&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()&&!D&&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:pn.map(N=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:h===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),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:h,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 xs({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 id({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(xs,{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 lr=[{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 pd(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 hu(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function _r({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:m=[],onCreateTag:i,attachments:u=[],onUploadAttachments:d,onDeleteAttachment:g,availableTasks:h=[],comments:C=[],onAddComment:T,currentUser:c}){let b=s==="dark",v={textTertiary:b?"#6B7280":"#9CA3AF",textSecondary:b?"#9CA3AF":"#6B7280",textPrimary:b?"#FFFFFF":"#111827",borderLight:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:b?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:b?"#1A1D25":"#FFFFFF",bgSecondary:b?"#0F1117":"#F9FAFB",hoverBg:b?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},l=e&&"title"in e&&!("name"in e),x=e,[y,D]=react.useState(e?pd(e,p):null),[w,k]=react.useState(false),[R,A]=react.useState(false),[N,I]=react.useState(false),[B,q]=react.useState(null),[ne,oe]=react.useState(new Date),[re,fe]=react.useState(false),[$,Z]=react.useState(false),[W,G]=react.useState(""),[F,te]=react.useState(false),[J,V]=react.useState(false),[Se,ue]=react.useState(false),[He,We]=react.useState(""),ot=react.useRef(null),[he,Ve]=react.useState(""),pt=react.useRef(null),[Ft,gt]=react.useState(""),[z,le]=react.useState(false);react.useEffect(()=>{if(e){let S=pd(e,p);D(S),We(S.description||""),Ve(S.name||"");}},[e?.id,p]),react.useEffect(()=>()=>{ot.current&&clearTimeout(ot.current),pt.current&&clearTimeout(pt.current);},[]);let xe=react.useCallback(S=>{D(S),l&&o&&x?o(hu(S,x)):r&&r(S);},[l,x,o,r]),Fe=react.useCallback(()=>{k(false),A(false),I(false),q(null),Z(false),G(""),te(false);},[]),Ye=react.useCallback((S,be)=>{if(!y)return;let Ge={...y,[S]:be};xe(Ge);},[y,xe]),Je=react.useCallback(S=>{We(S),ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{if(y){let be={...y,description:S};xe(be);}},800);},[y,xe]),Dt=react.useCallback(S=>{Ve(S),pt.current&&clearTimeout(pt.current),pt.current=setTimeout(()=>{if(y&&S.trim()){let be={...y,name:S.trim()};xe(be);}},800);},[y,xe]),Ae=react.useCallback(async()=>{if(!(!y||!Ft.trim()||!T)){le(true);try{await T(y.id,Ft.trim()),gt("");}finally{le(false);}}},[y,Ft,T]),sa=react.useCallback(S=>{let be=typeof S=="string"?new Date(S):S,ee=new Date().getTime()-be.getTime(),Ee=Math.floor(ee/6e4),Ce=Math.floor(ee/36e5),Me=Math.floor(ee/864e5);return Ee<1?n==="es"?"Ahora":"Just now":Ee<60?n==="es"?`Hace ${Ee} min`:`${Ee}m ago`:Ce<24?n==="es"?`Hace ${Ce}h`:`${Ce}h ago`:Me<7?n==="es"?`Hace ${Me}d`:`${Me}d ago`:be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Zt=react.useCallback(S=>{if(!y)return;let be=y.progress||0;S==="completed"?be=100:S==="in-progress"&&be===0?be=10:S==="todo"&&(be=0);let Ge={...y,status:S,progress:be};xe(Ge),k(false);},[y,xe]),xt=react.useCallback((S,be)=>{if(!y)return;let Ge={...y,startDate:S,endDate:be};xe(Ge);},[y,xe]),St=react.useCallback(()=>{let S=ne.getFullYear(),be=ne.getMonth(),Ge=new Date(S,be,1),Ee=new Date(S,be+1,0).getDate(),Ce=Ge.getDay(),Me=[],Oe=new Date(S,be,0).getDate();for(let O=Ce-1;O>=0;O--)Me.push({date:new Date(S,be-1,Oe-O),isCurrentMonth:false});for(let O=1;O<=Ee;O++)Me.push({date:new Date(S,be,O),isCurrentMonth:true});let qe=42-Me.length;for(let O=1;O<=qe;O++)Me.push({date:new Date(S,be+1,O),isCurrentMonth:false});return Me},[ne]),ea=react.useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),V(false),!y||!d)return;let be=Array.from(S.dataTransfer.files);if(be.length!==0){ue(true);try{await d(y.id,be);}finally{ue(false);}}},[y,d]),Xt=react.useCallback(async S=>{if(!y||!d||!S.target.files)return;let be=Array.from(S.target.files);if(be.length!==0){ue(true);try{await d(y.id,be);}finally{ue(false);}S.target.value="";}},[y,d]),Te=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),V(true);},[]),ze=react.useCallback(S=>{S.preventDefault(),S.stopPropagation(),V(false);},[]),ga=react.useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),_e=react.useCallback(S=>S.startsWith("image/")?lucideReact.Image:S.includes("pdf")||S.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!y?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&y&&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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",b?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",b?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",b?"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("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:f("p-1.5 rounded transition-colors",b?"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("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let S=y.progress===100?0:100,Ge={...y,progress:S,status:S===100?"completed":"todo"};xe(Ge);},className:f("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",y.progress===100?"bg-green-500 border-green-500":b?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:he,onChange:S=>Dt(S.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:f("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",y.progress===100?"line-through text-[#6B7280]":b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),k(!w);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?n==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>Zt(S.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.status===S.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),I(!N);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((S,be)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},be)),y.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&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:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(S=>{let be=y.assignees?.some(Ge=>Ge.name===S.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Ge=y.assignees||[],ee;be?ee=Ge.filter(Ee=>Ee.name!==S.name):ee=[...Ge,S],Ye("assignees",ee);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",be&&(b?"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:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1",b?"text-white":"text-gray-900"),children:S.name}),be&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{q(B?null:"start"),oe(y.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",b?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",b?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,be=new Date(S);be.setDate(S.getDate()+1);let Ge=new Date(S);Ge.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let ee=new Date(S);ee.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let Ee=new Date(S);Ee.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let Ce=new Date(S);Ce.setDate(S.getDate()+14);let Me=new Date(S);return Me.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:be,display:be.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ge,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ee,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ee,display:Ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Me,display:Me.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((qe,O)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(B==="start"){let j=y.endDate&&qe.date>y.endDate?qe.date:y.endDate;xt(qe.date,j),q("end");}else {let j=y.startDate&&qe.date<y.startDate?qe.date:y.startDate;xt(j,qe.date),q(null);}},children:[jsxRuntime.jsx("span",{children:qe.label}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:qe.display})]},O))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{xt(void 0,void 0),q(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",b?"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:f("text-xs mb-3 px-2 py-1 rounded",b?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:B==="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:f("font-medium",b?"text-white":"text-gray-900"),children:ne.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:f("p-1 rounded text-sm transition-colors",b?"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(ne.getFullYear(),ne.getMonth()-1)),className:f("p-1 rounded",b?"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(ne.getFullYear(),ne.getMonth()+1)),className:f("p-1 rounded",b?"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(S=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",b?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:St().map((S,be)=>{let Ge=S.date.toDateString()===new Date().toDateString(),ee=y.startDate?.toDateString()===S.date.toDateString(),Ee=y.endDate?.toDateString()===S.date.toDateString(),Ce=ee||Ee,Me=y.startDate&&y.endDate&&S.date>=y.startDate&&S.date<=y.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let Oe=new Date(S.date);if(B==="start"){let qe=y.endDate&&Oe>y.endDate?Oe:y.endDate;xt(Oe,qe),q("end");}else {let qe=y.startDate&&Oe<y.startDate?Oe:y.startDate;xt(qe,Oe),q(null);}},className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(b?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(b?"text-white":"text-gray-900"),Ge&&"ring-2 ring-[#3B82F6]",ee&&"bg-[#3B82F6] text-white",Ee&&!ee&&"bg-[#7C3AED] text-white",Me&&!Ce&&(b?"bg-[#7C3AED]/20":"bg-purple-100"),!Ce&&(b?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},be)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Fe(),A(!R);},className:f("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":b?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.priority?y.priority==="high"||y.priority==="urgent"?n==="es"?"Alta":"High":y.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>A(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{Ye("priority",S.id),A(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",y.priority===S.id&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",S.color)}),jsxRuntime.jsx("span",{className:b?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.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:f("w-4 h-4 rounded-full border-2",b?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[re?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:S=>{let be=parseInt(S.target.value),Ge=y.status;be===100?Ge="completed":be>0?Ge="in-progress":Ge="todo";let ee={...y,progress:be,status:Ge};xe(ee);},onBlur:()=>fe(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",b?"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:()=>fe(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",b?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(ir,{selectedTags:y.tags||[],availableTags:m,onChange:S=>{Ye("tags",S);},onCreateTag:i,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(S=>{let be=h.find(Ge=>Ge.id===S);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",b?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[be?.name||S.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let Ge=(y.dependencies||[]).filter(ee=>ee!==S);Ye("dependencies",Ge);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),Z(!$);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Z(false),G("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:W,onChange:S=>G(S.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",b?"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:h.length>0?h.filter(S=>S.id!==y.id).filter(S=>W===""||S.name.toLowerCase().includes(W.toLowerCase())).map(S=>{let be=y.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{onClick:()=>{let Ge=y.dependencies||[],ee;be?ee=Ge.filter(Ee=>Ee!==S.id):ee=[...Ge,S.id],Ye("dependencies",ee);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",b?"hover:bg-white/5":"hover:bg-gray-50",be&&(b?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",be?"bg-blue-500 border-blue-500":b?"border-white/30":"border-gray-300"),children:be&&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:f("block truncate",b?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",b?"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:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(),te(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",b?"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:y.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:lr.find(S=>S.value===y.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",b?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",b?"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:lr.map(S=>{let be=y.color===S.value;return jsxRuntime.jsx("button",{onClick:()=>{Ye("color",S.value),te(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",be&&"ring-2 ring-offset-2",b?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:be?S.value:void 0},title:S.name,children:be&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",b?"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:y.isMilestone||false,onChange:S=>Ye("isMilestone",S.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":b?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",b?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:He,onChange:S=>Je(S.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",b?"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("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",b?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),y.subtasks&&y.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(S=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",S.progress===100?"bg-green-500 border-green-500":b?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:S.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",S.progress===100?"line-through text-[#6B7280]":b?"text-white":"text-gray-900"),children:S.name})]},S.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"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:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",b?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",b?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",b?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",b?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(S=>{let be=_e(S.type),Ge=S.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",b?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ge&&S.thumbnailUrl?jsxRuntime.jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(be,{className:f("w-5 h-5",b?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",b?"text-white":"text-gray-900"),children:S.name}),jsxRuntime.jsx("p",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:ga(S.size)})]}),g&&jsxRuntime.jsx("button",{onClick:()=>g(S.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",b?"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"})})]},S.id)})}),jsxRuntime.jsxs("div",{onDragOver:Te,onDragLeave:ze,onDrop:ea,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",J?b?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":b?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Se&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Xt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Se}),Se?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:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",J?"text-blue-500":b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#9CA3AF]":"text-gray-500"),children:J?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:f("text-xs mt-1",b?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",b?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",b?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",C.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",b?"text-[#6B7280]":"text-gray-400"),children:["(",C.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:C.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:C.map(S=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.user?.color||"#8B5CF6"},children:S.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:f("text-sm font-medium",b?"text-white":"text-gray-900"),children:S.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:sa(S.createdAt)})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",b?"text-[#9CA3AF]":"text-gray-600"),children:S.content})]})]},S.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",b?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",b?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[c&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:c.color||"#8B5CF6"},children:c.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:Ft,onChange:S=>gt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),Ae());},placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",disabled:z||!T,className:f("flex-1 bg-transparent text-sm outline-none",b?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(z||!T)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:Ae,disabled:z||!Ft.trim()||!T,className:f("p-1.5 rounded transition-colors",Ft.trim()&&T?"bg-blue-500 text-white hover:bg-blue-600":b?"text-[#6B7280]":"text-gray-400",z&&"opacity-50 cursor-not-allowed"),children:z?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"})})]})]})})]})]})]})})}function Ns(){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 Er({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:m,error:i,children:u,availableTags:d=[],onCreateTag:g,attachmentsByCard:h,onUploadAttachments:C,onDeleteAttachment:T,comments:c,onAddComment:b,currentUser:v,onTaskOpen:l}){let[x,y]=Ns(),[D,w]=react.useState(null),k=o?.theme||"dark",R=k==="dark"||k==="neutral",A=R?"dark":"",N=react.useCallback((F,te)=>{t.onCardUpdate?.(F,te);},[t]),I=react.useCallback((F,te)=>{t.onColumnUpdate?.(F,{title:te});},[t]),B=react.useCallback(F=>{t.onColumnDelete?.(F);},[t]),q=["todo","in-progress","completed"],ne=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),oe=react.useMemo(()=>{let F=new Map;return e.columns.forEach(te=>{let J=te.cardIds.map(V=>e.cards.find(Se=>Se.id===V)).filter(V=>V!==void 0).sort((V,Se)=>V.position-Se.position);F.set(te.id,J);}),F},[e.cards,e.columns]),re=react.useMemo(()=>e.cards.map(F=>({id:F.id,name:F.title,startDate:F.startDate?new Date(F.startDate):void 0,endDate:F.endDate?new Date(F.endDate):void 0,progress:F.progress||0,status:F.columnId,priority:F.priority?.toLowerCase(),dependencies:Array.isArray(F.dependencies)?F.dependencies.map(te=>typeof te=="string"?te:te.taskId):[]})),[e.cards]),fe=react.useCallback(F=>{let{active:te}=F,J=e.cards.find(V=>V.id===te.id);J&&y({isDragging:true,draggedCardId:J.id,sourceColumnId:J.columnId,targetColumnId:J.columnId});},[e.cards,y]),$=react.useCallback(F=>{let{active:te,over:J}=F;if(!J||!e.cards.find(ue=>ue.id===te.id))return;let Se=null;J.data.current?.type==="column"?Se=J.id:J.data.current?.type==="card"&&(Se=e.cards.find(He=>He.id===J.id)?.columnId||null),Se&&Se!==x.targetColumnId&&y({...x,targetColumnId:Se});},[e.cards,x,y]),Z=react.useCallback(async F=>{let{active:te,over:J}=F;if(y({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!J)return;let V=e.cards.find(We=>We.id===te.id);if(!V)return;let Se,ue;if(J.data.current?.type==="column"){Se=J.id;let We=oe.get(Se)||[];ue=ds(We,0);}else {let We=e.cards.find(Ve=>Ve.id===J.id);if(!We)return;Se=We.columnId;let ot=oe.get(Se)||[],he=ot.findIndex(Ve=>Ve.id===J.id);ue=ds(ot,he);}let He=e.columns.find(We=>We.id===Se);if(He&&He.wipLimit&&He.wipLimitType==="hard"){let We=oe.get(Se)||[];if(V.columnId!==Se&&We.length>=He.wipLimit){t.onWipLimitExceeded?.(He,V);return}}(V.columnId!==Se||V.position!==ue)&&await t.onCardMove?.(V.id,Se,ue);},[e.cards,e.columns,oe,t,y]),W=react.useCallback(F=>{w(F),a?.(F),l?.(F.id);},[a,l]),G=react.useCallback(F=>{t.onCardUpdate?.(F.id,F),w(F);},[t]);return m?jsxRuntime.jsx("div",{className:f("asakaa-board",A,n),style:p,children:jsxRuntime.jsx(Eu,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:f("asakaa-board",A,n),style:p,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(Ul,{themeName:k,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ne,collisionDetection:core$1.closestCorners,onDragStart:fe,onDragOver:$,onDragEnd:Z,children:[jsxRuntime.jsxs("div",{className:f("asakaa-board",A,n),style:p,"data-theme":k,children:[e.columns.sort((F,te)=>F.position-te.position).map(F=>{let te=oe.get(F.id)||[],J=!q.includes(F.id);return jsxRuntime.jsx(io,{column:F,cards:te,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:W,onCardUpdate:N,onColumnRename:I,onColumnDelete:B,isDeletable:J,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},F.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:x.draggedCardId?jsxRuntime.jsx(fr,{card:e.cards.find(F=>F.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(_r,{task:D,isOpen:!!D,onClose:()=>w(null),onCardUpdate:G,theme:R?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:g,attachments:D?h?.get(D.id)||[]:[],onUploadAttachments:C,onDeleteAttachment:T,availableTasks:re,comments:c,onAddComment:b,currentUser:v})]})}function Eu({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 Lu={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)"},Iu={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)"},Bu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ru={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function $u({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let i=u=>{p.current&&!p.current.contains(u.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:p,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,u)=>i.position-u.position).map((i,u)=>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:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.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 Ou({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[p,m]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let h=C=>{i.current&&!i.current.contains(C.target)&&n(false);};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[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(h=>h.handler),g=async(h,C)=>{if(C){m(h);try{await C();}catch(T){console.error(`Export ${h} failed:`,T);}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((h,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(h.id,h.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:C<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===h.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"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function zu({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 Ss({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:m,translations:i}){let u=r==="dark"?Lu:Iu,d={...o==="es"?Bu:Ru,...i},g=n||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ou,{theme:u,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx($u,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(zu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ps({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[p,m]=react.useState(""),i=react.useCallback(()=>{let g=p.trim();g&&(e(g),m(""),n(false));},[p,e]),u=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),i()):g.key==="Escape"&&(m(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:f("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:p,onChange:g=>m(g.target.value),onKeyDown:u,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:!p.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:f("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 Ms({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:m="es"}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState([]),[b,v]=react.useState(""),[l,x]=react.useState(""),[y,D]=react.useState(""),[w,k]=react.useState(false),[R,A]=react.useState(false),[N,I]=react.useState(false),B=react.useRef(null),q=react.useRef(null),ne={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(()=>{C(""),c([]),v(""),x(""),D(""),k(false),A(false),I(false),u(false);},[]);react.useEffect(()=>{i&&B.current&&B.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let W=G=>{q.current&&!q.current.contains(G.target)&&(h.trim()||oe());};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[i,h,oe]);let re=react.useCallback(async()=>{let W=h.trim();if(!(!W||d)){g(true);try{await t({name:W,columnId:e,assigneeIds:T.length>0?T:void 0,startDate:b?new Date(b):void 0,endDate:l?new Date(l):void 0,priority:y||void 0}),C(""),c([]),v(""),x(""),D(""),k(!1),A(!1),I(!1),B.current?.focus();}catch(G){console.error("Error creating card:",G);}finally{g(false);}}},[h,e,T,b,l,y,t,d]),fe=react.useCallback(W=>{W.key==="Enter"&&!W.shiftKey?(W.preventDefault(),re()):W.key==="Escape"&&oe();},[re,oe]),$=react.useCallback(W=>{c(G=>G.includes(W)?G.filter(F=>F!==W):[...G,W]);},[]),Z=p==="dark";return i?jsxRuntime.jsxs("div",{ref:q,className:f("rounded-lg overflow-hidden shadow-lg",Z?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:B,type:"text",value:h,onChange:W=>C(W.target.value),onKeyDown:fe,placeholder:ne.placeholder,disabled:d,className:f("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Z?"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(!w),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",w||T.length>0?"bg-emerald-500/20 text-emerald-400":Z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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"})]}),T.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:T.length})]}),jsxRuntime.jsx("button",{onClick:()=>A(!R),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||b||l?"bg-blue-500/20 text-blue-400":Z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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:()=>I(!N),className:f("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||y?y==="urgent"?"bg-red-500/20 text-red-400":y==="high"?"bg-orange-500/20 text-orange-400":y==="medium"?"bg-yellow-500/20 text-yellow-400":y==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.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:re,disabled:!h.trim()||d,className:f("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"}):ne.save})]})]}),w&&a.length>0&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Z?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(W=>jsxRuntime.jsxs("button",{onClick:()=>$(W.id),className:f("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",T.includes(W.id)?"bg-emerald-500 text-white":Z?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[W.avatar?jsxRuntime.jsx("img",{src:W.avatar,alt:W.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",T.includes(W.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:W.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:W.name.split(" ")[0]})]},W.id))})}),R&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Z?"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:f("block text-[10px] uppercase tracking-wide mb-1",Z?"text-gray-500":"text-gray-400"),children:ne.startDate}),jsxRuntime.jsx("input",{type:"date",value:b,onChange:W=>v(W.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-[10px] uppercase tracking-wide mb-1",Z?"text-gray-500":"text-gray-400"),children:ne.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:W=>x(W.target.value),className:f("w-full px-2 py-1.5 rounded text-xs border",Z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsxRuntime.jsx("div",{className:f("px-3 pb-3 pt-0","border-t",Z?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(W=>jsxRuntime.jsx("button",{onClick:()=>D(y===W?"":W),className:f("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",y===W?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[W]} text-white`:Z?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ne[W]},W))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:n,className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Z?"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:ne.buttonLabel})]})}var Ao=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(Er,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Td(e={}){return new Ao(e)}var co=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 As(e,t){let a=r=>jsxRuntime.jsx(co,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ls({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:m,shortcut:i="k",className:u=""}){let[d,g]=react.useState(false),[h,C]=react.useState(""),[T,c]=react.useState("home"),[b,v]=react.useState(""),[l,x]=react.useState("");react.useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),g(A=>!A)),R.key==="Escape"&&(g(false),c("home"),C(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),react.useEffect(()=>{d||(c("home"),C(""),v(""),x(""));},[d]);let y=react.useCallback(()=>{g(false);},[]),D=react.useCallback(k=>{let[R,A]=k.split(":");switch(R){case "create-card":c("create-card");break;case "create-card-in":v(A||"");break;case "navigate":A?(a?.(A),y()):c("navigate");break;case "search":r?.(h),y();break;case "priority":c("priority");break;case "set-priority":l&&A&&(o?.(l,A),y());break;case "assign":c("assign");break;case "assign-user":l&&A&&(s?.(l,A),y());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),y();break;case "ai-predict-risks":p?.(),y();break;case "ai-usage":m?.(),y();break;case "back":c("home");break;}},[h,l,t,a,r,o,s,n,p,m,y]),w=react.useCallback(()=>{b&&h.trim()&&(t?.(b,h.trim()),y());},[b,h,t,y]);return d?jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:y,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:h,onValueChange:C,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:T==="create-card"&&b?"Type card title and press Enter...":T==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&T==="create-card"&&b&&w();}}),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."}),T==="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:D,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:D,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:D,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:D,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:D,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))})]}),T==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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))})]}),T==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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(A=>A.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:D,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(A=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:A},A))})]},k.id)})})]}),T==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,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:D,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:D,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:D,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 Sd(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
1
+ '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'),Rc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),cg=require('react-markdown'),mg=require('remark-gfm'),pg=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Rc__default=/*#__PURE__*/_interopDefault(Rc);var cg__default=/*#__PURE__*/_interopDefault(cg);var mg__default=/*#__PURE__*/_interopDefault(mg);var pg__default=/*#__PURE__*/_interopDefault(pg);var rn=(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 on=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 [on.Translate.toString(e),on.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function h(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function nn(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 vp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ps(e,t){return e.length===0?1e3:t===0?nn(null,e[0].position):t>=e.length?nn(e[e.length-1].position,null):nn(e[t-1].position,e[t].position)}function Fl(e,t=100){return e>t}var xp=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 kp(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 sn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=xp,onRetry:p}=t,u,i=0;for(let g=1;g<=a;g++){i=g;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(u=d,g===a||!n(u,g))return {error:u,attempts:i,success:false};let b=kp(g,r,o,s);if(p)try{p(u,g,b);}catch(T){console.error("Error in retry callback:",T);}await new Promise(T=>setTimeout(T,b));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function wp(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 Cp(e,t={}){return async(...a)=>sn(()=>e(...a),t)}var us=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 Il=(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))(Il||{}),Ur=class Ur{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,p=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(p,o,u?n:"");break;case "INFO":console.info(p,o,u?n:"");break;case "WARN":console.warn(p,o,u?n:"");break;case "ERROR":console.error(p,o,u?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",...Ur.globalOptions};}static configure(t){Ur.globalOptions={...Ur.globalOptions,...t};}child(t){return new Ur({...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 ln((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ln(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Il[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ur.globalOptions={};var gs=Ur,ln=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}},Ll=new gs;function Np(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 Dp(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(p=>p.id===s.columnId);return [s.id,fs(s.title),fs(s.description||""),fs(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 Sp(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 Rc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=n.toDataURL("image/png"),u=297,i=210,g=n.width/n.height,d=u-20,f=d/g;f>i-20&&(f=i-20,d=f*g);let b=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});b.setFontSize(16),b.setTextColor(255,255,255),b.setFillColor(10,10,10),b.rect(0,0,u,15,"F"),b.text(e.title||"Kanban Board",10,10);let T=(u-d)/2;return b.addImage(p,"PNG",T,20,d,f),b}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 p=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,p.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):p.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let g=o.splitTextToSize(u.description,160);o.text(g,25,s),s+=g.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let g=[];u.startDate&&g.push(`Start: ${u.startDate}`),u.endDate&&g.push(`End: ${u.endDate}`),i.push(g.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 fs(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Rl(e,t,a,r){switch(t){case "json":return Np(e,r);case "csv":return Dp(e);case "pdf":return await Sp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function $l(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let g=`${r}.pdf`;e.save(g);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"},p=new Blob([e],{type:n[t]}),u=URL.createObjectURL(p),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Ep(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 Pp(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=Ol(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let p=Ol(t[n]||"");if(p.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let i={};a.forEach((b,T)=>{i[b]=p[T]||"";});let g=i.Column||"Unnamed";o.has(g)||o.set(g,{id:`col-${o.size+1}`,title:g,position:o.size+1,cardIds:[]});let d=o.get(g),f={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(f),d.cardIds.push(f.id);}catch(p){s.push(`Line ${n+1}: ${p instanceof Error?p.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 Ol(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 zl(e,t){switch(t){case "json":return Ep(e);case "csv":return Pp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Ul(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 hs=react.createContext(null);function Hl(){return react.useContext(hs)}var Wl=react.createContext(null);function Gl({children:e,themeName:t}){return jsxRuntime.jsx(Wl.Provider,{value:{themeName:t},children:e})}function so(){return react.useContext(Wl)}function mt({children:e,container:t}){let[a,r]=react.useState(false),o=Hl(),s=so();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:p,themeName:u}=o,i={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":u,"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 Yl={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},$p="#BDC3C7",Op=({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 Hr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState({top:0,left:0}),p=react.useRef(null),u=react.useRef(null),i=()=>{if(!u.current)return;let b=u.current.getBoundingClientRect(),T=window.innerHeight,N=window.innerWidth,c=160,C=220,m=4,l=b.right-c;l<10&&(l=b.left),l+c>N-10&&(l=N-c-10);let v=T-b.bottom,S=b.top,y;v>=C+m?y=b.bottom+m:S>=C+m?y=b.top-C-m:y=v>=S?b.bottom+m:Math.max(10,b.top-C-m),n({top:y,left:l}),o(true);};react.useEffect(()=>{let b=T=>{p.current&&!p.current.contains(T.target)&&!u.current?.contains(T.target)&&o(false);};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=T=>{T.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]);let g=b=>{t(b),o(false);},d=e?Yl[e]:null,f=d?.color||$p;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${f}10`:"transparent",boxShadow:e?`0 0 0 2px ${f}30 inset`:"none"},title:d?.label||"Set priority",children: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:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:f,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:p,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(Yl).map(([b,T])=>jsxRuntime.jsxs("button",{onClick:()=>g(b),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:T.color,background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:N=>{N.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Op,{color:T.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:T.label}),e===b&&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"})})]},b)),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:()=>g(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("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 zp=[{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 Do({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),f=(so()?.themeName||"dark")==="dark",b=()=>{if(!i.current)return;let l=i.current.getBoundingClientRect(),v=window.innerHeight,S=window.innerWidth,y=320,w=380,x=4,B=l.left;B+y>S-10&&(B=S-y-10),B<10&&(B=10);let D=v-l.bottom,k=l.top,$;D>=w+x?$=l.bottom+x:k>=w+x?$=l.top-w-x:$=D>=k?l.bottom+x:Math.max(10,l.top-w-x),p({top:$,left:B}),s(true);};react.useEffect(()=>{let l=v=>{u.current&&!u.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[o]),react.useEffect(()=>{let l=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o]);let T=l=>{let v=new Date,S=B=>{let D=B.getFullYear(),k=String(B.getMonth()+1).padStart(2,"0"),$=String(B.getDate()).padStart(2,"0");return `${D}-${k}-${$}`},y=S(v),w=new Date(v);w.setDate(w.getDate()+l);let x=S(w);a(y,x),s(false);},N=()=>{if(!e||!t)return "Set date";let l=w=>{if(w instanceof Date)return w;if(typeof w!="string"||!w.match(/^\d{4}-\d{2}-\d{2}$/))return null;let x=w.split("-").map(Number);if(x.length!==3||x.some($=>isNaN($)))return null;let B=x[0],D=x[1],k=x[2];return B===void 0||D===void 0||k===void 0?null:new Date(B,D-1,k)},v=l(e),S=l(t);if(!v||!S||isNaN(v.getTime())||isNaN(S.getTime()))return "Set date";let y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${y[v.getMonth()]} ${v.getDate()} \u2013 ${y[S.getMonth()]} ${S.getDate()}`},c=e&&t,m=(()=>{if(!t)return false;let l=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),l<v})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o?s(false):b(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${m?"asakaa-date-overdue":"asakaa-date"}`,title:c?`${N()}`:"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:N()})]}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:f?"#1A1D25":"#FFFFFF",border:`1px solid ${f?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:f?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:f?"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:f?"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:zp.map(l=>jsxRuntime.jsx("button",{onClick:()=>T(l.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:l.label},l.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:f?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:l=>a(l.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:l=>a(e,l.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:f?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:f?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:f?"dark":"light"}})]}),(e||t)&&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:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:l=>{l.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Gr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=react.useState(false),[p,u]=react.useState(""),[i,g]=react.useState({top:0,left:0}),d=react.useRef(null),f=react.useRef(null),b=()=>{if(!f.current)return;let m=f.current.getBoundingClientRect(),l=window.innerHeight,v=window.innerWidth,S=300,y=380,w=4,x=m.right-S;x<10&&(x=m.left),x+S>v-10&&(x=v-S-10);let B=l-m.bottom,D=m.top,k;B>=y+w?k=m.bottom+w:D>=y+w?k=m.top-y-w:k=B>=D?m.bottom+w:Math.max(10,m.top-y-w),g({top:k,left:x}),n(true);};react.useEffect(()=>{let m=l=>{d.current&&!d.current.contains(l.target)&&!f.current?.contains(l.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),react.useEffect(()=>{let m=l=>{l.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[s]);let T=m=>{let l=e.some(v=>v.id===m.id);a(l?e.filter(v=>v.id!==m.id):[...e,m]);},N=t.filter(m=>m.name.toLowerCase().includes(p.toLowerCase())),c=e.slice(0,o),C=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:f,onClick:()=>s?n(false):b(),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:[c.map(m=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:m.name,children:m.avatar?jsxRuntime.jsx("img",{src:m.avatar,alt:m.name,className:"asakaa-avatar-img"}):m.initials},m.id)),C>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",C]})]}):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(mt,{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:p,onChange:m=>u(m.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:N.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"}):N.map(m=>{let l=e.some(v=>v.id===m.id);return jsxRuntime.jsxs("button",{onClick:()=>T(m),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:m.color,color:"#fff"},children:m.avatar?jsxRuntime.jsx("img",{src:m.avatar,alt:m.name,className:"w-full h-full rounded-full object-cover"}):m.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:m.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:l?"#3b82f6":"transparent"},children:l?"\u2713":""})]},m.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 dn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(g=>{if(typeof g=="string")return g;let d=g;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,p=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let g of i){if(!s.has(g)&&p(g))return true;if(n.has(g))return true}}return n.delete(u),false};return p(a)}function Eo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[p,u]=react.useState(false),[i,g]=react.useState(""),[d,f]=react.useState(t.length>0),[b,T]=react.useState({top:0,left:0}),[N,c]=react.useState(null),C=react.useRef(null),m=react.useRef(null),l=()=>{if(!m.current)return;let x=m.current.getBoundingClientRect(),B=window.innerHeight,D=window.innerWidth,k=300,$=d?380:120,R=4,j=x.right-k;j<10&&(j=x.left),j+k>D-10&&(j=D-k-10);let ee=B-x.bottom,ae=x.top,re;ee>=$+R?re=x.bottom+R:ae>=$+R?re=x.top-$-R:re=ee>=ae?x.bottom+R:Math.max(10,x.top-$-R),T({top:re,left:j}),u(true);};react.useEffect(()=>{if(!p||!m.current)return;let x=m.current.getBoundingClientRect(),B=window.innerHeight,D=window.innerWidth,k=300,$=d?380:120,R=4,j=x.right-k;j<10&&(j=x.left),j+k>D-10&&(j=D-k-10);let ee=B-x.bottom,ae=x.top,re;ee>=$+R?re=x.bottom+R:ae>=$+R?re=x.top-$-R:re=ee>=ae?x.bottom+R:Math.max(10,x.top-$-R),T({top:re,left:j});},[d,p]),react.useEffect(()=>{let x=B=>{C.current&&!C.current.contains(B.target)&&!m.current?.contains(B.target)&&(u(false),g(""));};if(p)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[p]),react.useEffect(()=>{let x=B=>{B.key==="Escape"&&(u(false),g(""));};if(p)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[p]);let v=x=>{let B=t.includes(x),D=a.find(k=>k.id===x);if(c(null),B){let k=t.filter($=>$!==x);r(k),k.length===0&&f(false);}else {if(s&&dn(a,x,e)){let $=`Cannot add "${D?.title||x}" as dependency - would create circular reference`;c($),n?.(x,D?.title||x),setTimeout(()=>c(null),3e3);return}r([...t,x]),f(true);}},S=()=>{let x=!d;f(x),x||r([]);},y=a.filter(x=>x.id!==e).filter(x=>x.title.toLowerCase().includes(i.toLowerCase())||x.id.toLowerCase().includes(i.toLowerCase())),w=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:m,onClick:()=>p?u(false):l(),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:w,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:w},children:t.length})]}),p&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:C,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${b.top}px`,left:`${b.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:[N&&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:N})]}),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:S,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:x=>g(x.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:y.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"}):y.map(x=>{let B=t.includes(x.id);return jsxRuntime.jsxs("button",{onClick:()=>v(x.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.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:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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:x.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:x.id})]})]},x.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),f(false),u(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 hr=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:p=[],allCards:u=[]})=>{let{attributes:i,listeners:g,setNodeRef:d,transform:f,transition:b,isDragging:T}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),N={transform:on.Transform.toString(f),transition:b};if(t)return jsxRuntime.jsx("div",{ref:d,style:N,...i,...g,onClick:()=>a?.(e),children:t(e)});let c=p.filter(v=>e.assignedUserIds?.includes(v.id)),C=e.progress===100,m=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),l={...N,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:l,className:h("asakaa-card",T&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...g,onClick:v=>{v.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:v=>{v.currentTarget.style.display="none";}})}),m.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:m.length===1&&m[0]?jsxRuntime.jsx("img",{src:m[0].url,alt:m[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:v=>{v.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:m.slice(0,4).map((v,S)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}),S===3&&m.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:["+",m.length-4]})})]},v.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:C?"line-through":"none",opacity:C?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Hr,{priority:e.priority,onChange:v=>n?.(e.id,{priority:v})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Do,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(v,S)=>n?.(e.id,{startDate:v,endDate:S})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Gr,{assignedUsers:c,availableUsers:p,onChange:v=>n?.(e.id,{assignedUserIds:v.map(S=>S.id)})})}),jsxRuntime.jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Eo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:u,onChange:v=>n?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsxRuntime.jsx("span",{className:"asakaa-label",children:v},v))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#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)));hr.displayName="Card";var cn={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"}},od=({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 nd({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[n,p]=react.useState({top:0,left:0}),u=react.useRef(null),i=react.useRef(null),g=[...Object.entries(cn).map(([c,C])=>({id:c,label:C.label,color:C.color,icon:C.icon})),...r.filter(c=>!Object.keys(cn).includes(c.id)).map(c=>({id:c.id,label:c.title,color:c.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let c=cn[e];if(c)return {...c,id:e};let C=r.find(m=>m.id===e);return C?{id:C.id,label:C.title,color:C.color||"#8B5CF6",icon:"circle-dot"}:{...cn.todo,id:"todo"}},f=()=>{if(!i.current)return;let c=i.current.getBoundingClientRect(),C=window.innerHeight,m=window.innerWidth,l=180,v=280,S=4,y=c.right-l;y<10&&(y=c.left),y+l>m-10&&(y=m-l-10);let w=C-c.bottom,x=c.top,B;w>=v+S?B=c.bottom+S:x>=v+S?B=c.top-v-S:B=w>=x?c.bottom+S:Math.max(10,c.top-v-S),p({top:B,left:y}),s(true);};react.useEffect(()=>{let c=C=>{u.current&&!u.current.contains(C.target)&&!i.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[o]),react.useEffect(()=>{let c=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o]);let b=c=>{t(c),s(false);},T=d(),N=T.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o?s(false):f(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${N}10`,boxShadow:`0 0 0 2px ${N}30 inset`},title:T.label,children:jsxRuntime.jsx(od,{icon:T.icon,color:N})}),o&&jsxRuntime.jsx(mt,{children:jsxRuntime.jsxs("div",{ref:u,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:g.map(c=>jsxRuntime.jsxs("button",{onClick:()=>b(c.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:c.color,background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:C=>{C.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(od,{icon:c.icon,color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:c.label}),e===c.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"})})]},c.id))})]})})]})}function sd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=react.useState(false),[p,u]=react.useState(false),[i,g]=react.useState(e),[d,f]=react.useState({top:0,left:0}),b=react.useRef(null),T=react.useRef(null),N=react.useRef(null);react.useEffect(()=>{if(s&&T.current){let l=T.current.getBoundingClientRect();f({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[s]),react.useEffect(()=>{let l=v=>{b.current&&!b.current.contains(v.target)&&!T.current?.contains(v.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]),react.useEffect(()=>{let l=v=>{v.key==="Escape"&&(n(false),u(false),g(e));};if(s)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[s,e]),react.useEffect(()=>{p&&N.current&&(N.current.focus(),N.current.select());},[p]);let c=()=>{u(true),g(e);},C=()=>{let l=i.trim();l&&l!==e&&t(l),u(false),n(false),g(e);},m=l=>{l.key==="Enter"?C():l.key==="Escape"&&(u(false),g(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:T,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(mt,{children:jsxRuntime.jsx("div",{ref:b,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:p?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:N,type:"text",value:i,onChange:l=>g(l.target.value),onKeyDown:m,onBlur:C,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:c,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 co=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:p,availableUsers:u,allCards:i,enableVirtualization:g,cardHeight:d=120,isCollapsed:f,onToggleCollapse:b,onColumnRename:T,onColumnDelete:N,isDeletable:c=false,className:C})=>{let{setNodeRef:m,isOver:l}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),v=react.useRef(null),S=g??Fl(t.length),y=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>d,enabled:S});if(a)return jsxRuntime.jsx("div",{ref:m,className:C,children:a(e,t)});let x=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let k=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:k}:k>=80?{state:"warning",percentage:k}:k>=60?{state:"approaching",percentage:k}:{state:"ok",percentage:k}})(),B=x.state==="exceeded",D=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:m,className:h("asakaa-column",l&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",C),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:h(D()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&x.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${x.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[x.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"})]}),x.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"})]}),x.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"})}),x.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"})]})]}),(T||N)&&jsxRuntime.jsx(sd,{columnTitle:e.title,onRename:k=>T?.(e.id,k),onDelete:N?()=>N(e.id):void 0,isDeletable:c}),b&&jsxRuntime.jsx("button",{onClick:b,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":f?"Expand column":"Collapse column",children:f?"\u25B6":"\u25BC"})]})]}),!f&&jsxRuntime.jsx("div",{ref:v,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(k=>k.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"})}):S?jsxRuntime.jsx("div",{style:{height:`${y.getTotalSize()}px`,position:"relative"},children:y.getVirtualItems().map(k=>{let $=t[k.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${k.start}px)`},children:jsxRuntime.jsx(hr,{card:$,render:r,onClick:n,onUpdate:p,availableUsers:u,allCards:i})},$.id):null})}):t.map(k=>jsxRuntime.jsx(hr,{card:k,render:r,onClick:n,onUpdate:p,availableUsers:u,allCards:i},k.id))})})]})});co.displayName="Column";function ks({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,n]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let u=()=>{let g=s.trim();g&&g!==e?t(g):n(e),o(false);},i=g=>{g.key==="Enter"?u():g.key==="Escape"&&(n(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:g=>n(g.target.value),onBlur:u,onKeyDown:i,className:h("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:h("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function tu(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 pd(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(p=>p.name.toLowerCase().replace(/\s+/g,"")===s||p.name.toLowerCase()===s);n&&!a.includes(n.id)&&a.push(n.id);}return a}function au(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ud({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:p="dark",locale:u="es",currentUser:i}){let g=p==="dark",[d,f]=react.useState(false),[b,T]=react.useState([]),[N,c]=react.useState(0),[C,m]=react.useState(null),l=react.useRef(null),v=react.useRef(null),S=react.useCallback((D,k)=>{let $=tu(D,k);if(m($),$){let R=r.filter(j=>j.name.toLowerCase().includes($.query)||j.email&&j.email.toLowerCase().includes($.query)).slice(0,5);T(R),f(R.length>0),c(0);}else f(false),T([]);},[r]),y=D=>{let k=D.target.value;t(k),S(k,D.target.selectionStart||0);},w=()=>{l.current&&S(e,l.current.selectionStart||0);},x=react.useCallback(D=>{if(!C||!l.current)return;let k=e.slice(0,C.start),$=e.slice(C.end),R=`@${D.name.replace(/\s+/g,"")} `,j=k+R+$;t(j),f(false),m(null),setTimeout(()=>{if(l.current){let ee=C.start+R.length;l.current.selectionStart=ee,l.current.selectionEnd=ee,l.current.focus();}},0);},[C,e,t]),B=D=>{if(d&&b.length>0)switch(D.key){case "ArrowDown":D.preventDefault(),c(k=>k<b.length-1?k+1:0);break;case "ArrowUp":D.preventDefault(),c(k=>k>0?k-1:b.length-1);break;case "Enter":{D.preventDefault();let k=b[N];k&&x(k);break}case "Tab":{D.preventDefault();let k=b[N];k&&x(k);break}case "Escape":D.preventDefault(),f(false);break}else D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),a());};return react.useEffect(()=>{let D=k=>{v.current&&!v.current.contains(k.target)&&l.current&&!l.current.contains(k.target)&&f(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]),react.useEffect(()=>{if(d&&v.current){let D=v.current.children[N];D&&D.scrollIntoView({block:"nearest"});}},[N,d]),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 relative"),children:[jsxRuntime.jsxs("div",{className:h("flex items-center gap-2 px-3 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{ref:l,type:"text",value:e,onChange:y,onSelect:w,onKeyDown:B,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:h("flex-1 bg-transparent text-sm outline-none",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e.trim()||s,className:h("p-1.5 rounded transition-colors",e.trim()&&!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:d&&b.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:h("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:b.map((D,k)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>x(D),className:h("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",k===N?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:D.color||"#8B5CF6"},children:au(D.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:h("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:D.name}),D.email&&jsxRuntime.jsx("p",{className:h("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:D.email})]})]},D.id))})})]})]})}function gd({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((p,u)=>p.type==="mention"?jsxRuntime.jsx("span",{className:h("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:p.value},u):jsxRuntime.jsx("span",{children:p.value},u))})}var fn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[p,u]=react.useState(false),[i,g]=react.useState(""),[d,f]=react.useState(false),[b,T]=react.useState(fn[10]||"#3B82F6"),[N,c]=react.useState({top:0,left:0}),C=react.useRef(null),m=react.useRef(null),l=react.useRef(null),v=react.useRef(null),S=t.filter(k=>k.name.toLowerCase().includes(i.toLowerCase())),y=t.some(k=>k.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(p&&m.current){let k=m.current.getBoundingClientRect();c({top:k.bottom+6,left:k.left});}},[p]),react.useEffect(()=>{let k=$=>{let R=$.target,j=C.current?.contains(R),ee=l.current?.contains(R);!j&&!ee&&(u(false),g(""),f(false));};if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),react.useEffect(()=>{p&&v.current&&v.current.focus();},[p]);let w=k=>{let $=e.some(R=>R.id===k.id);a($?e.filter(R=>R.id!==k.id):[...e,k]);},x=async()=>{if(!(!r||!i.trim())){f(true);try{let k=await r(i.trim(),b);k&&(a([...e,k]),g(""),T(fn[Math.floor(Math.random()*fn.length)]||"#3B82F6"));}finally{f(false);}}},B=(k,$)=>{$.stopPropagation(),a(e.filter(R=>R.id!==k));},D={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:C,className:"relative",children:[jsxRuntime.jsxs("button",{ref:m,type:"button",onClick:()=>!s&&u(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:D,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(k=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.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:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:l,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:N.top,left:N.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:v,type:"text",value:i,onChange:k=>g(k.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:k=>{k.key==="Enter"&&i.trim()&&!y&&r&&x();}})}),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(k=>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:`${k.color}20`,color:k.color},onClick:$=>B(k.id,$),children:[k.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},k.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:S.length>0?S.map(k=>{let $=e.some(R=>R.id===k.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>w(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:$?`${k.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{$||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{$||(R.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.name}),$&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:k.color}})]},k.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()&&!y&&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:fn.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>T(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:b===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),jsxRuntime.jsxs("button",{type:"button",onClick:x,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:b,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 Cs({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 hd({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(Cs,{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 dr=[{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 kd(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 Pu(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function jr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:p=[],availableTags:u=[],onCreateTag:i,attachments:g=[],onUploadAttachments:d,onDeleteAttachment:f,availableTasks:b=[],comments:T=[],onAddComment:N,currentUser:c,mentionableUsers:C=[]}){let m=s==="dark",l={textTertiary:m?"#6B7280":"#9CA3AF",textSecondary:m?"#9CA3AF":"#6B7280",textPrimary:m?"#FFFFFF":"#111827",borderLight:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:m?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:m?"#1A1D25":"#FFFFFF",bgSecondary:m?"#0F1117":"#F9FAFB",hoverBg:m?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},v=e&&"title"in e&&!("name"in e),S=e,[y,w]=react.useState(e?kd(e,p):null),[x,B]=react.useState(false),[D,k]=react.useState(false),[$,R]=react.useState(false),[j,ee]=react.useState(null),[ae,re]=react.useState(new Date),[fe,ge]=react.useState(false),[Me,I]=react.useState(false),[O,E]=react.useState(""),[Q,Y]=react.useState(false),[G,me]=react.useState(false),[pe,Fe]=react.useState(false),[Ve,dt]=react.useState(""),se=react.useRef(null),[_e,xt]=react.useState(""),zt=react.useRef(null),[ct,U]=react.useState(""),[ie,Pe]=react.useState(false);react.useEffect(()=>{if(e){let L=kd(e,p);w(L),dt(L.description||""),xt(L.name||"");}},[e?.id,p]),react.useEffect(()=>()=>{se.current&&clearTimeout(se.current),zt.current&&clearTimeout(zt.current);},[]);let Se=react.useCallback(L=>{w(L),v&&o&&S?o(Pu(L,S)):r&&r(L);},[v,S,o,r]),Xe=react.useCallback(()=>{B(false),k(false),R(false),ee(null),I(false),E(""),Y(false);},[]),Ge=react.useCallback((L,ke)=>{if(!y)return;let q={...y,[L]:ke};Se(q);},[y,Se]),Dt=react.useCallback(L=>{dt(L),se.current&&clearTimeout(se.current),se.current=setTimeout(()=>{if(y){let ke={...y,description:L};Se(ke);}},800);},[y,Se]),Ie=react.useCallback(L=>{xt(L),zt.current&&clearTimeout(zt.current),zt.current=setTimeout(()=>{if(y&&L.trim()){let ke={...y,name:L.trim()};Se(ke);}},800);},[y,Se]),sa=react.useCallback(async()=>{if(!(!y||!ct.trim()||!N)){Pe(true);try{let L=pd(ct,C);await N(y.id,ct.trim(),L.length>0?L:void 0),U("");}finally{Pe(false);}}},[y,ct,N,C]),Zt=react.useCallback(L=>{let ke=typeof L=="string"?new Date(L):L,ve=new Date().getTime()-ke.getTime(),ye=Math.floor(ve/6e4),Re=Math.floor(ve/36e5),Ae=Math.floor(ve/864e5);return ye<1?n==="es"?"Ahora":"Just now":ye<60?n==="es"?`Hace ${ye} min`:`${ye}m ago`:Re<24?n==="es"?`Hace ${Re}h`:`${Re}h ago`:Ae<7?n==="es"?`Hace ${Ae}d`:`${Ae}d ago`:ke.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),At=react.useCallback(L=>{if(!y)return;let ke=y.progress||0;L==="completed"?ke=100:L==="in-progress"&&ke===0?ke=10:L==="todo"&&(ke=0);let q={...y,status:L,progress:ke};Se(q),B(false);},[y,Se]),gt=react.useCallback((L,ke)=>{if(!y)return;let q={...y,startDate:L,endDate:ke};Se(q);},[y,Se]),ea=react.useCallback(()=>{let L=ae.getFullYear(),ke=ae.getMonth(),q=new Date(L,ke,1),ye=new Date(L,ke+1,0).getDate(),Re=q.getDay(),Ae=[],rt=new Date(L,ke,0).getDate();for(let _=Re-1;_>=0;_--)Ae.push({date:new Date(L,ke-1,rt-_),isCurrentMonth:false});for(let _=1;_<=ye;_++)Ae.push({date:new Date(L,ke,_),isCurrentMonth:true});let z=42-Ae.length;for(let _=1;_<=z;_++)Ae.push({date:new Date(L,ke+1,_),isCurrentMonth:false});return Ae},[ae]),Xt=react.useCallback(async L=>{if(L.preventDefault(),L.stopPropagation(),me(false),!y||!d)return;let ke=Array.from(L.dataTransfer.files);if(ke.length!==0){Fe(true);try{await d(y.id,ke);}finally{Fe(false);}}},[y,d]),Te=react.useCallback(async L=>{if(!y||!d||!L.target.files)return;let ke=Array.from(L.target.files);if(ke.length!==0){Fe(true);try{await d(y.id,ke);}finally{Fe(false);}L.target.value="";}},[y,d]),Ue=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),me(true);},[]),ga=react.useCallback(L=>{L.preventDefault(),L.stopPropagation(),me(false);},[]),je=react.useCallback(L=>L<1024?`${L} B`:L<1024*1024?`${(L/1024).toFixed(1)} KB`:`${(L/(1024*1024)).toFixed(1)} MB`,[]),He=react.useCallback(L=>L.startsWith("image/")?lucideReact.Image:L.includes("pdf")||L.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!y?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&y&&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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",m?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",m?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",m?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",m?"text-[#6B7280]":"text-gray-400"),children:y.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",m?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:a,className:h("p-1.5 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let L=y.progress===100?0:100,q={...y,progress:L,status:L===100?"completed":"todo"};Se(q);},className:h("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",y.progress===100?"bg-green-500 border-green-500":m?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:y.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:_e,onChange:L=>Ie(L.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:h("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",y.progress===100?"line-through text-[#6B7280]":m?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{Xe(),B(!x);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",y.progress===100||y.status==="completed"?"bg-green-500/20 text-green-400":y.progress&&y.progress>0||y.status==="in-progress"?"bg-blue-500/20 text-blue-400":m?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.progress===100||y.status==="completed"?n==="es"?"COMPLETADO":"DONE":y.progress&&y.progress>0||y.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>B(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(L=>jsxRuntime.jsxs("button",{onClick:()=>At(L.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",y.status===L.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:L.label})]},L.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Xe(),R(!$);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[y.assignees&&y.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[y.assignees.slice(0,3).map((L,ke)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:L.color||"#8B5CF6"},title:L.name,children:L.initials||L.name.slice(0,2).toUpperCase()},ke)),y.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:["+",y.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",m?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",m?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>R(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(L=>{let ke=y.assignees?.some(q=>q.name===L.name);return jsxRuntime.jsxs("button",{onClick:()=>{let q=y.assignees||[],ve;ke?ve=q.filter(ye=>ye.name!==L.name):ve=[...q,L],Ge("assignees",ve);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",ke&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:L.color||"#8B5CF6"},children:L.initials||L.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1",m?"text-white":"text-gray-900"),children:L.name}),ke&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},L.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{ee(j?null:"start"),re(y.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[y.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",m?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),y.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:j&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ee(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",m?"border-white/10":"border-gray-200"),children:[(()=>{let L=new Date,ke=new Date(L);ke.setDate(L.getDate()+1);let q=new Date(L);q.setDate(L.getDate()+((6-L.getDay()+7)%7||7));let ve=new Date(L);ve.setDate(L.getDate()+((1-L.getDay()+7)%7||7));let ye=new Date(L);ye.setDate(L.getDate()+(6-L.getDay()+7)%7+7);let Re=new Date(L);Re.setDate(L.getDate()+14);let Ae=new Date(L);return Ae.setDate(L.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ke,display:ke.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:q,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ve,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ye,display:ye.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Re,display:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ae,display:Ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((z,_)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(j==="start"){let he=y.endDate&&z.date>y.endDate?z.date:y.endDate;gt(z.date,he),ee("end");}else {let he=y.startDate&&z.date<y.startDate?z.date:y.startDate;gt(he,z.date),ee(null);}},children:[jsxRuntime.jsx("span",{children:z.label}),jsxRuntime.jsx("span",{className:h("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:z.display})]},_))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{gt(void 0,void 0),ee(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",m?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:h("text-xs mb-3 px-2 py-1 rounded",m?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:j==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:h("font-medium",m?"text-white":"text-gray-900"),children:ae.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:()=>re(new Date),className:h("p-1 rounded text-sm transition-colors",m?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>re(new Date(ae.getFullYear(),ae.getMonth()-1)),className:h("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>re(new Date(ae.getFullYear(),ae.getMonth()+1)),className:h("p-1 rounded",m?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(L=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",m?"text-[#6B7280]":"text-gray-400"),children:L},L))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ea().map((L,ke)=>{let q=L.date.toDateString()===new Date().toDateString(),ve=y.startDate?.toDateString()===L.date.toDateString(),ye=y.endDate?.toDateString()===L.date.toDateString(),Re=ve||ye,Ae=y.startDate&&y.endDate&&L.date>=y.startDate&&L.date<=y.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let rt=new Date(L.date);if(j==="start"){let z=y.endDate&&rt>y.endDate?rt:y.endDate;gt(rt,z),ee("end");}else {let z=y.startDate&&rt<y.startDate?rt:y.startDate;gt(z,rt),ee(null);}},className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!L.isCurrentMonth&&(m?"text-[#4B5563]":"text-gray-300"),L.isCurrentMonth&&(m?"text-white":"text-gray-900"),q&&"ring-2 ring-[#3B82F6]",ve&&"bg-[#3B82F6] text-white",ye&&!ve&&"bg-[#7C3AED] text-white",Ae&&!Re&&(m?"bg-[#7C3AED]/20":"bg-purple-100"),!Re&&(m?"hover:bg-white/10":"hover:bg-gray-100")),children:L.date.getDate()},ke)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{Xe(),k(!D);},className:h("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",y.priority==="high"||y.priority==="urgent"?"bg-red-500/20 text-red-400":y.priority==="medium"?"bg-yellow-500/20 text-yellow-400":y.priority==="low"?"bg-green-500/20 text-green-400":m?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:y.priority?y.priority==="high"||y.priority==="urgent"?n==="es"?"Alta":"High":y.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(L=>jsxRuntime.jsxs("button",{onClick:()=>{Ge("priority",L.id),k(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",y.priority===L.id&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",L.color)}),jsxRuntime.jsx("span",{className:m?"text-white":"text-gray-900",children:L.label})]},L.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",m?"text-white":"text-gray-900"),children:y.startDate&&y.endDate?`${Math.ceil((y.endDate.getTime()-y.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:h("w-4 h-4 rounded-full border-2",m?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[fe?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:y.progress||0,onChange:L=>{let ke=parseInt(L.target.value),q=y.status;ke===100?q="completed":ke>0?q="in-progress":q="todo";let ve={...y,progress:ke,status:q};Se(ve);},onBlur:()=>ge(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",m?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ge(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",m?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(lr,{selectedTags:y.tags||[],availableTags:u,onChange:L=>{Ge("tags",L);},onCreateTag:i,theme:l})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[y.dependencies&&y.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:y.dependencies.map(L=>{let ke=b.find(q=>q.id===L);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",m?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ke?.name||L.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let q=(y.dependencies||[]).filter(ve=>ve!==L);Ge("dependencies",q);},className:h("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},L)})}),jsxRuntime.jsxs("button",{onClick:()=>{Xe(),I(!Me);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:h("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{I(false),E("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:O,onChange:L=>E(L.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",m?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:b.length>0?b.filter(L=>L.id!==y.id).filter(L=>O===""||L.name.toLowerCase().includes(O.toLowerCase())).map(L=>{let ke=y.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{onClick:()=>{let q=y.dependencies||[],ve;ke?ve=q.filter(ye=>ye!==L.id):ve=[...q,L.id],Ge("dependencies",ve);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",m?"hover:bg-white/5":"hover:bg-gray-50",ke&&(m?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ke?"bg-blue-500 border-blue-500":m?"border-white/30":"border-gray-300"),children:ke&&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:h("block truncate",m?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("span",{className:h("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:L.id.slice(0,8)})]})]},L.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",m?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{Xe(),Y(!Q);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:y.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",m?"text-white":"text-gray-900"),children:dr.find(L=>L.value===y.color)?.name||(n==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",m?"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:()=>Y(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",m?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:dr.map(L=>{let ke=y.color===L.value;return jsxRuntime.jsx("button",{onClick:()=>{Ge("color",L.value),Y(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",ke&&"ring-2 ring-offset-2",m?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:L.value,outlineColor:ke?L.value:void 0},title:L.name,children:ke&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},L.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:y.isMilestone||false,onChange:L=>Ge("isMilestone",L.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",y.isMilestone?"bg-purple-500 border-purple-500":m?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",m?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",m?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:Ve,onChange:L=>Dt(L.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",m?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",m?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:n==="es"?"Subtareas":"Subtasks"}),y.subtasks&&y.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:y.subtasks.map(L=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",L.progress===100?"bg-green-500 border-green-500":m?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:L.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",L.progress===100?"line-through text-[#6B7280]":m?"text-white":"text-gray-900"),children:L.name})]},L.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",m?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",m?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",m?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",m?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",m?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",g.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",g.length,")"]})]}),g.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:g.map(L=>{let ke=He(L.type),q=L.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",m?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[q&&L.thumbnailUrl?jsxRuntime.jsx("img",{src:L.thumbnailUrl,alt:L.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",m?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ke,{className:h("w-5 h-5",m?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",className:h("text-sm font-medium truncate block hover:underline",m?"text-white":"text-gray-900"),children:L.name}),jsxRuntime.jsx("p",{className:h("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:je(L.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(L.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",m?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},L.id)})}),jsxRuntime.jsxs("div",{onDragOver:Ue,onDragLeave:ga,onDrop:Xt,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",G?m?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":m?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",pe&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Te,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||pe}),pe?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:h("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",G?"text-blue-500":m?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",m?"text-[#9CA3AF]":"text-gray-500"),children:G?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:h("text-xs mt-1",m?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",m?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",m?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",T.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",m?"text-[#6B7280]":"text-gray-400"),children:["(",T.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:T.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:T.map(L=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:L.user?.color||"#8B5CF6"},children:L.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:h("text-sm font-medium",m?"text-white":"text-gray-900"),children:L.user?.name||(n==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",m?"text-[#6B7280]":"text-gray-400"),children:Zt(L.createdAt)})]}),jsxRuntime.jsx("div",{className:h("text-sm",m?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(gd,{content:L.content,theme:s})})]})]},L.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",m?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",m?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",m?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(ud,{value:ct,onChange:U,onSubmit:sa,users:C,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!N,isSubmitting:ie,theme:s,locale:n,currentUser:c})})]})]})]})})}function Es(){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 Pr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:p,isLoading:u,error:i,children:g,availableTags:d=[],onCreateTag:f,attachmentsByCard:b,onUploadAttachments:T,onDeleteAttachment:N,comments:c,onAddComment:C,currentUser:m,onTaskOpen:l}){let[v,S]=Es(),[y,w]=react.useState(null),x=o?.theme||"dark",B=x==="dark"||x==="neutral",D=B?"dark":"",k=react.useCallback((E,Q)=>{t.onCardUpdate?.(E,Q);},[t]),$=react.useCallback((E,Q)=>{t.onColumnUpdate?.(E,{title:Q});},[t]),R=react.useCallback(E=>{t.onColumnDelete?.(E);},[t]),j=["todo","in-progress","completed"],ee=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),ae=react.useMemo(()=>{let E=new Map;return e.columns.forEach(Q=>{let Y=Q.cardIds.map(G=>e.cards.find(me=>me.id===G)).filter(G=>G!==void 0).sort((G,me)=>G.position-me.position);E.set(Q.id,Y);}),E},[e.cards,e.columns]),re=react.useMemo(()=>e.cards.map(E=>({id:E.id,name:E.title,startDate:E.startDate?new Date(E.startDate):void 0,endDate:E.endDate?new Date(E.endDate):void 0,progress:E.progress||0,status:E.columnId,priority:E.priority?.toLowerCase(),dependencies:Array.isArray(E.dependencies)?E.dependencies.map(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),fe=react.useCallback(E=>{let{active:Q}=E,Y=e.cards.find(G=>G.id===Q.id);Y&&S({isDragging:true,draggedCardId:Y.id,sourceColumnId:Y.columnId,targetColumnId:Y.columnId});},[e.cards,S]),ge=react.useCallback(E=>{let{active:Q,over:Y}=E;if(!Y||!e.cards.find(pe=>pe.id===Q.id))return;let me=null;Y.data.current?.type==="column"?me=Y.id:Y.data.current?.type==="card"&&(me=e.cards.find(Fe=>Fe.id===Y.id)?.columnId||null),me&&me!==v.targetColumnId&&S({...v,targetColumnId:me});},[e.cards,v,S]),Me=react.useCallback(async E=>{let{active:Q,over:Y}=E;if(S({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Y)return;let G=e.cards.find(Ve=>Ve.id===Q.id);if(!G)return;let me,pe;if(Y.data.current?.type==="column"){me=Y.id;let Ve=ae.get(me)||[];pe=ps(Ve,0);}else {let Ve=e.cards.find(_e=>_e.id===Y.id);if(!Ve)return;me=Ve.columnId;let dt=ae.get(me)||[],se=dt.findIndex(_e=>_e.id===Y.id);pe=ps(dt,se);}let Fe=e.columns.find(Ve=>Ve.id===me);if(Fe&&Fe.wipLimit&&Fe.wipLimitType==="hard"){let Ve=ae.get(me)||[];if(G.columnId!==me&&Ve.length>=Fe.wipLimit){t.onWipLimitExceeded?.(Fe,G);return}}(G.columnId!==me||G.position!==pe)&&await t.onCardMove?.(G.id,me,pe);},[e.cards,e.columns,ae,t,S]),I=react.useCallback(E=>{w(E),a?.(E),l?.(E.id);},[a,l]),O=react.useCallback(E=>{t.onCardUpdate?.(E.id,E),w(E);},[t]);return u?jsxRuntime.jsx("div",{className:h("asakaa-board",D,n),style:p,children:jsxRuntime.jsx(Hu,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:h("asakaa-board",D,n),style:p,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(Gl,{themeName:x,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ee,collisionDetection:core$1.closestCorners,onDragStart:fe,onDragOver:ge,onDragEnd:Me,children:[jsxRuntime.jsxs("div",{className:h("asakaa-board",D,n),style:p,"data-theme":x,children:[e.columns.sort((E,Q)=>E.position-Q.position).map(E=>{let Q=ae.get(E.id)||[],Y=!j.includes(E.id);return jsxRuntime.jsx(co,{column:E,cards:Q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:I,onCardUpdate:k,onColumnRename:$,onColumnDelete:R,isDeletable:Y,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},E.id)}),g]}),jsxRuntime.jsx(core$1.DragOverlay,{children:v.draggedCardId?jsxRuntime.jsx(hr,{card:e.cards.find(E=>E.id===v.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(jr,{task:y,isOpen:!!y,onClose:()=>w(null),onCardUpdate:O,theme:B?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:f,attachments:y?b?.get(y.id)||[]:[],onUploadAttachments:T,onDeleteAttachment:N,availableTasks:re,comments:c,onAddComment:C,currentUser:m})]})}function Hu({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 ju={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)"},Ku={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)"},Yu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},qu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Xu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let i=g=>{p.current&&!p.current.contains(g.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{ref:p,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,g)=>i.position-g.position).map((i,g)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:g<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.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 Ju({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=react.useState(false),[p,u]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let b=T=>{i.current&&!i.current.contains(T.target)&&n(false);};return s&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[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(b=>b.handler),f=async(b,T)=>{if(T){u(b);try{await T();}catch(N){console.error(`Export ${b} failed:`,N);}finally{u(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((b,T)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(b.id,b.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:T<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function Qu({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 Ms({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:p,onExportExcel:u,translations:i}){let g=r==="dark"?ju:Ku,d={...o==="es"?Yu:qu,...i},f=n||p||u;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:g.bgGrid,borderColor:g.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ju,{theme:g,t:d,onExportCSV:n,onExportJSON:p,onExportExcel:u}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:g.borderLight}})]}),t&&(s?jsxRuntime.jsx(Xu,{columns:e,onSelect:t,theme:g,t:d,createTaskLabel:a}):jsxRuntime.jsx(Qu,{onClick:()=>t(),label:a||d.newTask}))]})})}function Fs({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=react.useState(false),[p,u]=react.useState(""),i=react.useCallback(()=>{let f=p.trim();f&&(e(f),u(""),n(false));},[p,e]),g=react.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),i()):f.key==="Escape"&&(u(""),n(false));},[i]),d=react.useCallback(()=>{setTimeout(()=>{p.trim()||n(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:h("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:p,onChange:f=>u(f.target.value),onKeyDown:g,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:!p.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:()=>{u(""),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:h("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 Is({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:p="dark",locale:u="es"}){let[i,g]=react.useState(false),[d,f]=react.useState(false),[b,T]=react.useState(""),[N,c]=react.useState([]),[C,m]=react.useState(""),[l,v]=react.useState(""),[S,y]=react.useState(""),[w,x]=react.useState(false),[B,D]=react.useState(false),[k,$]=react.useState(false),R=react.useRef(null),j=react.useRef(null),ee={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},ae=react.useCallback(()=>{T(""),c([]),m(""),v(""),y(""),x(false),D(false),$(false),g(false);},[]);react.useEffect(()=>{i&&R.current&&R.current.focus();},[i]),react.useEffect(()=>{if(!i)return;let I=O=>{j.current&&!j.current.contains(O.target)&&(b.trim()||ae());};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[i,b,ae]);let re=react.useCallback(async()=>{let I=b.trim();if(!(!I||d)){f(true);try{await t({name:I,columnId:e,assigneeIds:N.length>0?N:void 0,startDate:C?new Date(C):void 0,endDate:l?new Date(l):void 0,priority:S||void 0}),T(""),c([]),m(""),v(""),y(""),x(!1),D(!1),$(!1),R.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{f(false);}}},[b,e,N,C,l,S,t,d]),fe=react.useCallback(I=>{I.key==="Enter"&&!I.shiftKey?(I.preventDefault(),re()):I.key==="Escape"&&ae();},[re,ae]),ge=react.useCallback(I=>{c(O=>O.includes(I)?O.filter(E=>E!==I):[...O,I]);},[]),Me=p==="dark";return i?jsxRuntime.jsxs("div",{ref:j,className:h("rounded-lg overflow-hidden shadow-lg",Me?"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:b,onChange:I=>T(I.target.value),onKeyDown:fe,placeholder:ee.placeholder,disabled:d,className:h("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Me?"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:()=>x(!w),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",w||N.length>0?"bg-emerald-500/20 text-emerald-400":Me?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.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"})]}),N.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:N.length})]}),jsxRuntime.jsx("button",{onClick:()=>D(!B),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||C||l?"bg-blue-500/20 text-blue-400":Me?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.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:()=>$(!k),className:h("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",k||S?S==="urgent"?"bg-red-500/20 text-red-400":S==="high"?"bg-orange-500/20 text-orange-400":S==="medium"?"bg-yellow-500/20 text-yellow-400":S==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Me?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.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:re,disabled:!b.trim()||d,className:h("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"}):ee.save})]})]}),w&&a.length>0&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Me?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(I=>jsxRuntime.jsxs("button",{onClick:()=>ge(I.id),className:h("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",N.includes(I.id)?"bg-emerald-500 text-white":Me?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[I.avatar?jsxRuntime.jsx("img",{src:I.avatar,alt:I.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",N.includes(I.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:I.name.split(" ")[0]})]},I.id))})}),B&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Me?"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:h("block text-[10px] uppercase tracking-wide mb-1",Me?"text-gray-500":"text-gray-400"),children:ee.startDate}),jsxRuntime.jsx("input",{type:"date",value:C,onChange:I=>m(I.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Me?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:h("block text-[10px] uppercase tracking-wide mb-1",Me?"text-gray-500":"text-gray-400"),children:ee.endDate}),jsxRuntime.jsx("input",{type:"date",value:l,onChange:I=>v(I.target.value),className:h("w-full px-2 py-1.5 rounded text-xs border",Me?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),k&&jsxRuntime.jsx("div",{className:h("px-3 pb-3 pt-0","border-t",Me?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(I=>jsxRuntime.jsx("button",{onClick:()=>y(S===I?"":I),className:h("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",S===I?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[I]} text-white`:Me?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ee[I]},I))})})]}):jsxRuntime.jsxs("button",{onClick:()=>g(true),disabled:n,className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Me?"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:ee.buttonLabel})]})}var Io=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(Pr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
5
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Id(e={}){return new Io(e)}var po=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 Ls(e,t){let a=r=>jsxRuntime.jsx(po,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Rs({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:p,onOpenAIUsage:u,shortcut:i="k",className:g=""}){let[d,f]=react.useState(false),[b,T]=react.useState(""),[N,c]=react.useState("home"),[C,m]=react.useState(""),[l,v]=react.useState("");react.useEffect(()=>{let x=B=>{(B.metaKey||B.ctrlKey)&&B.key===i&&(B.preventDefault(),f(D=>!D)),B.key==="Escape"&&(f(false),c("home"),T(""));};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[i]),react.useEffect(()=>{d||(c("home"),T(""),m(""),v(""));},[d]);let S=react.useCallback(()=>{f(false);},[]),y=react.useCallback(x=>{let[B,D]=x.split(":");switch(B){case "create-card":c("create-card");break;case "create-card-in":m(D||"");break;case "navigate":D?(a?.(D),S()):c("navigate");break;case "search":r?.(b),S();break;case "priority":c("priority");break;case "set-priority":l&&D&&(o?.(l,D),S());break;case "assign":c("assign");break;case "assign-user":l&&D&&(s?.(l,D),S());break;case "ai":c("ai");break;case "ai-generate-plan":n?.(),S();break;case "ai-predict-risks":p?.(),S();break;case "ai-usage":u?.(),S();break;case "back":c("home");break;}},[b,l,t,a,r,o,s,n,p,u,S]),w=react.useCallback(()=>{C&&b.trim()&&(t?.(C,b.trim()),S());},[C,b,t,S]);return d?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:S,children:jsxRuntime.jsx("div",{className:`command-palette ${g}`,onClick:x=>x.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:b,onValueChange:T,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:N==="create-card"&&C?"Type card title and press Enter...":N==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:x=>{x.key==="Enter"&&N==="create-card"&&C&&w();}}),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."}),N==="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:y,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:y,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:y,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:y,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(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:y,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:x.title}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},x.id))})]}),N==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(x=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${x.id}`,onSelect:y,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:x.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[x.cardIds.length," cards"]})]},x.id))})]}),N==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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(x=>{let B=e.columns.find(D=>D.id===x.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${x.id}`,onSelect:y,className:"command-palette-item",keywords:[x.title,x.description||"",...x.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:x.priority==="URGENT"?"#EF4444":x.priority==="HIGH"?"#F59E0B":x.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:x.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),x.labels&&x.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:x.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},x.id)})})]}),N==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:y,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:y,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:y,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:y,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 Rd(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
6
6
  position: fixed !important;
7
7
  inset: 0 !important;
8
8
  z-index: 2147483647 !important;
@@ -16,7 +16,7 @@
16
16
  max-height: 92vh !important;
17
17
  object-fit: contain !important;
18
18
  cursor: default !important;
19
- `,p.onclick=d=>d.stopPropagation();let m=document.createElement("div");m.className="attachment-lightbox-hint",m.textContent="Click anywhere or press ESC to close",m.style.cssText=`
19
+ `,p.onclick=d=>d.stopPropagation();let u=document.createElement("div");u.className="attachment-lightbox-hint",u.textContent="Click anywhere or press ESC to close",u.style.cssText=`
20
20
  position: absolute !important;
21
21
  bottom: 24px !important;
22
22
  left: 50% !important;
@@ -24,7 +24,7 @@
24
24
  font-size: 12px !important;
25
25
  color: rgba(255, 255, 255, 0.4) !important;
26
26
  pointer-events: none !important;
27
- `;let i=()=>{n.remove(),document.removeEventListener("keydown",u);},u=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let g=r>0?r-1:a.length-1;i(),o(g);}else if(d.key==="ArrowRight"&&a.length>1){let g=r<a.length-1?r+1:0;i(),o(g);}};if(n.onclick=i,document.addEventListener("keydown",u),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
27
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",g);},g=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let f=r>0?r-1:a.length-1;i(),o(f);}else if(d.key==="ArrowRight"&&a.length>1){let f=r<a.length-1?r+1:0;i(),o(f);}};if(n.onclick=i,document.addEventListener("keydown",g),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
28
28
  position: absolute !important;
29
29
  bottom: 48px !important;
30
30
  left: 50% !important;
@@ -34,15 +34,15 @@
34
34
  padding: 8px 12px !important;
35
35
  background: rgba(0, 0, 0, 0.4) !important;
36
36
  border-radius: 20px !important;
37
- `,d.onclick=C=>C.stopPropagation(),a.forEach((C,T)=>{let c=document.createElement("button");c.className=`attachment-lightbox-dot ${T===r?"active":""}`,c.style.cssText=`
37
+ `,d.onclick=T=>T.stopPropagation(),a.forEach((T,N)=>{let c=document.createElement("button");c.className=`attachment-lightbox-dot ${N===r?"active":""}`,c.style.cssText=`
38
38
  width: 8px !important;
39
39
  height: 8px !important;
40
40
  border-radius: 50% !important;
41
- background: ${T===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
41
+ background: ${N===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
42
42
  border: none !important;
43
43
  padding: 0 !important;
44
44
  cursor: pointer !important;
45
- `,c.onclick=b=>{b.stopPropagation(),i(),o(T);},d.appendChild(c);});let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",g.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>',g.style.cssText=`
45
+ `,c.onclick=C=>{C.stopPropagation(),i(),o(N);},d.appendChild(c);});let f=document.createElement("button");f.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",f.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f.style.cssText=`
46
46
  position: absolute !important;
47
47
  left: 0 !important;
48
48
  top: 0 !important;
@@ -55,7 +55,7 @@
55
55
  border: none !important;
56
56
  cursor: pointer !important;
57
57
  opacity: 0.5 !important;
58
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=C=>{C.stopPropagation();let T=r>0?r-1:a.length-1;i(),o(T);};let h=document.createElement("button");h.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",h.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>',h.style.cssText=`
58
+ `,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=T=>{T.stopPropagation();let N=r>0?r-1:a.length-1;i(),o(N);};let b=document.createElement("button");b.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",b.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>',b.style.cssText=`
59
59
  position: absolute !important;
60
60
  right: 0 !important;
61
61
  top: 0 !important;
@@ -68,7 +68,7 @@
68
68
  border: none !important;
69
69
  cursor: pointer !important;
70
70
  opacity: 0.5 !important;
71
- `,h.onmouseenter=()=>{h.style.opacity="1";},h.onmouseleave=()=>{h.style.opacity="0.5";},h.onclick=C=>{C.stopPropagation();let T=r<a.length-1?r+1:0;i(),o(T);},n.appendChild(d),n.appendChild(g),n.appendChild(h);}n.appendChild(p),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Vu(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 ju(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 Bs(e){return e.startsWith("image/")}function mr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(null),g=react.useRef(null),h=react.useRef(e);h.current=e;let C=react.useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let A=h.current.filter(B=>Bs(B.type)),N=A.findIndex(B=>B.id===k.id),I=B=>{let q=h.current.filter(oe=>Bs(oe.type)),ne=q[B];ne&&Sd(ne.url,ne.name,q,B,I);};Sd(k.url,k.name,A,N,I);},[]),T=react.useCallback(k=>{let R=[],A=[];return e.length+k.length>s?(A.push(`Maximum ${s} files allowed`),{valid:R,errors:A}):(k.forEach(N=>{if(N.size/1048576>r){A.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>N.type.match(B))){A.push(`${N.name} has invalid file type`);return}R.push(N);}),{valid:R,errors:A})},[e.length,s,r,o]),c=react.useCallback(async k=>{let{valid:R,errors:A}=T(k);if(A.length>0){d(A.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[T,t]),b=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(true);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);},[]),l=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);let R=Array.from(k.dataTransfer.files);c(R);},[c]),y=react.useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];c(R),g.current&&(g.current.value="");},[c]),D=react.useCallback(()=>{g.current?.click();},[]),w=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:b,onDragLeave:v,onDragOver:l,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:y,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"]})]})})]}),u&&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:u})]}),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:Bs(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>C(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:ju(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:Vu(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:()=>w(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 Rs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:m=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:g,onDeleteAttachment:h,onSuggestAssignee:C,onGenerateSubtasks:T,onEstimateEffort:c,currentUserId:b="user-1"}){let[v,l]=react.useState("details"),[x,y]=react.useState(false),[D,w]=react.useState({}),[k,R]=react.useState(""),[A,N]=react.useState(false),[I,B]=react.useState({});if(!t||!e)return null;let q=react.useCallback(()=>{y(false),w({}),l("details"),R(""),B({}),a();},[a]),ne=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),w({}),y(false));},[e.id,D,r]),oe=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),q());},[e.id,o,q]),re=react.useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),R(""));},[e.id,k,u]),fe=react.useCallback(async()=>{if(C){N(true);try{let F=await C(e);B(te=>({...te,assignees:F}));}catch(F){console.error("Failed to suggest assignee:",F);}finally{N(false);}}},[e,C]),$=react.useCallback(async()=>{if(T){N(true);try{let F=await T(e);B(te=>({...te,subtasks:F}));}catch(F){console.error("Failed to generate subtasks:",F);}finally{N(false);}}},[e,T]),Z=react.useCallback(async()=>{if(c){N(true);try{let F=await c(e);B(te=>({...te,effort:F}));}catch(F){console.error("Failed to estimate effort:",F);}finally{N(false);}}},[e,c]),W={...e,...D},G=s.filter(F=>W.assignedUserIds?.includes(F.id));return jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:q,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:F=>F.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:W.priority==="URGENT"?"#EF4444":W.priority==="HIGH"?"#F59E0B":W.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:D.title??W.title,onChange:F=>w({...D,title:F.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:W.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ne,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{y(false),w({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>y(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:q,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:()=>l("details"),className:`card-detail-tab ${v==="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:()=>l("comments"),className:`card-detail-tab ${v==="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:()=>l("activity"),className:`card-detail-tab ${v==="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",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${v==="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:()=>l("ai"),className:`card-detail-tab ${v==="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:[v==="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"}),x?jsxRuntime.jsx("textarea",{value:D.description??W.description??"",onChange:F=>w({...D,description:F.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:W.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??W.assignedUserIds??[],onChange:F=>{let te=Array.from(F.target.selectedOptions,J=>J.value);w({...D,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(F=>jsxRuntime.jsx("option",{value:F.id,children:F.name},F.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:G.length>0?G.map(F=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:F.color},children:F.initials}),jsxRuntime.jsx("span",{children:F.name})]},F.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"}),x?jsxRuntime.jsxs("select",{value:D.priority??W.priority??"",onChange:F=>w({...D,priority:F.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:W.priority==="URGENT"?"#EF4444":W.priority==="HIGH"?"#F59E0B":W.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:W.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:W.labels&&W.labels.length>0?W.labels.map(F=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:F},F)):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"}),x?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:W.startDate?new Date(W.startDate).toISOString().split("T")[0]:"",onChange:F=>w({...D,startDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:W.startDate?new Date(W.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:W.endDate?new Date(W.endDate).toISOString().split("T")[0]:"",onChange:F=>w({...D,endDate:F.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:W.endDate?new Date(W.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??W.estimatedTime??"",onChange:F=>w({...D,estimatedTime:F.target.value?parseFloat(F.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:W.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:W.dependencies&&W.dependencies.length>0?W.dependencies.map(F=>{let te=typeof F=="string"?F:F.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",te.slice(-4)]},te)}):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:W.createdAt?new Date(W.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:F=>R(F.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:re,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(F=>{let te=s.find(J=>J.id===F.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:[te&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:te?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(F.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(F.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:F.content})]},F.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"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(F=>{let te=s.find(J=>J.id===F.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[F.type.includes("CREATED")&&"\u2795",F.type.includes("UPDATED")&&"\u270F\uFE0F",F.type.includes("MOVED")&&"\u27A1\uFE0F",F.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",F.type.includes("COMMENT")&&"\u{1F4AC}",F.type.includes("ASSIGNED")&&"\u{1F464}",F.type.includes("PRIORITY")&&"\u{1F3AF}",F.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",F.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:te?.name||"Unknown"})," ",F.type.replace(/_/g," ").toLowerCase(),F.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:F.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(F.timestamp).toLocaleString()})]})]},F.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"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(mr,{cardId:e.id,attachments:i,onUpload:g?F=>g(e.id,F):void 0,onDelete:h,currentUserId:b,maxSizeMB:10,maxFiles:20})}),v==="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:fe,disabled:A||!C,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:$,disabled:A||!T,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:Z,disabled:A||!c,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"]})]}),I.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),I.assignees.map((F,te)=>{let J=s.find(V=>V.id===F.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:F.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(F.confidence*100).toFixed(0),"%"]})]})]},te)})]}),I.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),I.subtasks.map((F,te)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:F.title}),F.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:F.description}),F.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",F.estimatedTime,"h"]})]},te))]}),I.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:[I.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(I.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(F=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${F.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:F.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:F.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:F.description}),F.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",F.suggestedAction]})]},F.id))]}),!I.assignees&&!I.subtasks&&!I.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 Lo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,m]=react.useState({top:0,left:0}),i=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),g=window.innerHeight,h=window.innerWidth,C=4,T=d.left;T+o>h-10&&(T=h-o-10),T<10&&(T=10);let c=g-d.bottom,b=d.top,v;return c>=s+C?v=d.bottom+C:b>=s+C?v=d.top-s-C:c>=b?v=d.bottom+C:v=Math.max(10,d.top-s-C),{top:v,left:T}},[e,o,s]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=h=>{let C=h.target;i.current&&!i.current.contains(C)&&e.current&&!e.current.contains(C)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(ct,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.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 Qe={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 eg=["LOW","MEDIUM","HIGH","URGENT"],tg=["todo","in-progress","review","done"];function zs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:m,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:g,onAIFindSimilar:h,availableColumns:C=[],availableLabels:T=[],availableTags:c=[],onCreateTag:b,onUploadCoverImage:v,unsplashAccessKey:l,theme:x,onSubtasksChange:y,attachments:D=[],onUploadAttachments:w,onDeleteAttachment:k}){let R=oo(),A=x||R?.themeName||"dark",[N,I]=react.useState(e),[B,q]=react.useState(false),[ne,oe]=react.useState(e?.subtasks||[]),[re,fe]=react.useState(false),[$,Z]=react.useState(""),[W,G]=react.useState(""),[F,te]=react.useState("all"),[J,V]=react.useState(false),[Se,ue]=react.useState(false),[He,We]=react.useState(false),[ot,he]=react.useState(false),[Ve,pt]=react.useState(false),[Ft,gt]=react.useState(false),z=react.useRef(null),le=react.useRef(null),xe=react.useRef(null),Fe=react.useRef(null),Ye=react.useRef(null),Je=react.useRef(null),Dt=react.useRef(null),Ae=react.useRef(null),sa=react.useRef(null),Zt=react.useRef(null),xt=react.useRef(null),St=react.useRef(null);react.useEffect(()=>{e&&!N?(I({...e}),oe(e.subtasks||[])):e&&N&&e.id!==N.id&&(I({...e}),oe(e.subtasks||[]));},[e,N]),react.useEffect(()=>{let H=ie=>{let Re=ie.target;Fe.current&&!Fe.current.contains(Re)&&V(false),Ye.current&&!Ye.current.contains(Re)&&ue(false),Je.current&&!Je.current.contains(Re)&&We(false),Dt.current&&!Dt.current.contains(Re)&&he(false);};if(J||Se||He||ot)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[J,Se,He,ot]),react.useEffect(()=>{if(!t)return;let H=ie=>{let Re=ie.target,Et=Re.tagName==="INPUT"||Re.tagName==="TEXTAREA"||Re.isContentEditable;if(ie.key==="Escape"){ie.preventDefault(),J||Se||He||ot||Ve||Ft?(V(false),ue(false),We(false),he(false),pt(false),gt(false)):Et||a();return}if(Et&&ie.key!=="Escape")return;let tt=ie.metaKey||ie.ctrlKey;switch(ie.key.toLowerCase()){case "s":ie.preventDefault(),V(true);break;case "a":ie.preventDefault(),We(true);break;case "p":ie.preventDefault(),ue(true);break;case "l":ie.preventDefault(),he(true);break;case "d":tt||(ie.preventDefault(),pt(true),setTimeout(()=>Ae.current?.focus(),0));break;case "e":tt||(ie.preventDefault(),gt(true));break;case "i":ie.preventDefault(),q(true),setTimeout(()=>le.current?.focus(),0);break;case "t":ie.preventDefault(),fe(true);break;case "c":ie.preventDefault(),xe.current?.focus();break}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[t,a,J,Se,He,ot,Ve,Ft]);let ea=react.useCallback(H=>{let ie=H.currentTarget.textContent?.trim()||"";if(N&&ie!==N.title){let Re={...N,title:ie};I(Re),r?.(N.id,{title:ie});}},[N,r]),Xt=react.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),H.currentTarget.blur()),H.key==="Escape"&&(H.preventDefault(),H.currentTarget.textContent=N?.title||"",H.currentTarget.blur());},[N]),Te=react.useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),q(false);},[N,e,r]),ze=react.useCallback(H=>{if(N){let ie={...N,columnId:H};I(ie),r?.(N.id,{columnId:H}),V(false);}},[N,r]),ga=react.useCallback(H=>{if(N){let ie={...N,priority:H};I(ie),r?.(N.id,{priority:H}),ue(false);}},[N,r]),_e=react.useCallback(H=>{if(N){let ie=N.assignedUserIds||[],Re=ie.includes(H)?ie.filter(tt=>tt!==H):[...ie,H],Et={...N,assignedUserIds:Re};I(Et),r?.(N.id,{assignedUserIds:Re});}},[N,r]),S=react.useCallback(H=>{if(N){let ie=N.labels||[],Re=ie.includes(H)?ie.filter(tt=>tt!==H):[...ie,H],Et={...N,labels:Re};I(Et),r?.(N.id,{labels:Re});}},[N,r]),be=react.useCallback(H=>{if(N){let ie={...N,tags:H};I(ie),r?.(N.id,{tags:H});}},[N,r]),Ge=react.useCallback(H=>{if(N){let ie=H.target.value,Re={...N,endDate:ie};I(Re),r?.(N.id,{endDate:ie}),pt(false);}},[N,r]),ee=react.useCallback(H=>{if(N){let ie={...N,estimatedTime:parseFloat(H)||0};I(ie),r?.(N.id,{estimatedTime:parseFloat(H)||0});}},[N,r]),Ee=react.useCallback(()=>{if($.trim()&&N){let H={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},ie=[...ne,H];oe(ie),Z(""),fe(false),y?.(N.id,ie);}},[$,ne,N,y]),Ce=react.useCallback(H=>{let ie=ne.map(Re=>Re.id===H?{...Re,completed:!Re.completed,updatedAt:new Date}:Re);oe(ie),N&&y?.(N.id,ie);},[ne,N,y]),Me=react.useCallback(H=>{let ie=ne.filter(Re=>Re.id!==H);oe(ie),N&&y?.(N.id,ie);},[ne,N,y]),Oe=react.useCallback(()=>{W.trim()&&N&&m&&(m(N.id,W.trim()),G(""));},[W,N,m]),qe=react.useCallback(H=>{(H.metaKey||H.ctrlKey)&&H.key==="Enter"&&(H.preventDefault(),Oe());},[Oe]),O=H=>jsxRuntime.jsx(Ju__default.default,{remarkPlugins:[Qu__default.default],rehypePlugins:[Zu__default.default],components:{a:({node:ie,...Re})=>jsxRuntime.jsx("a",{...Re,target:"_blank",rel:"noopener noreferrer"})},children:H}),j=p.filter(H=>F==="comments"?H.type.includes("COMMENT"):F==="history"?!H.type.includes("COMMENT"):true);if(!t||!e)return null;let ve=N||e,Le=s.filter(H=>ve.assignedUserIds?.includes(H.id)),$e=ne.filter(H=>H.completed).length;return jsxRuntime.jsx(ct,{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:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:z,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ea,onKeyDown:Xt,children:ve.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:Fe,children:[jsxRuntime.jsxs("button",{ref:sa,className:"modal-v2-field",onClick:()=>V(!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:ve.columnId||"No status"})]}),jsxRuntime.jsx(Lo,{triggerRef:sa,isOpen:J,onClose:()=>V(false),width:250,estimatedHeight:200,children:(C.length>0?C:tg.map(H=>({id:H,title:H}))).map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ve.columnId===H.id?"active":""}`,onClick:()=>ze(H.id),children:H.title},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxRuntime.jsxs("button",{ref:Zt,className:"modal-v2-field",onClick:()=>We(!He),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(H=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},title:H.name,children:H.initials},H.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:Zt,isOpen:He,onClose:()=>We(false),width:280,estimatedHeight:300,children:s.map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.assignedUserIds?.includes(H.id)?"active":""}`,onClick:()=>_e(H.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:H.color},children:H.initials}),H.name,ve.assignedUserIds?.includes(H.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"})})]},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ye,children:[jsxRuntime.jsxs("button",{ref:xt,className:"modal-v2-field",onClick:()=>ue(!Se),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:ve.priority||"None"})]}),jsxRuntime.jsxs(Lo,{triggerRef:xt,isOpen:Se,onClose:()=>ue(false),width:180,estimatedHeight:220,children:[eg.map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${H.toLowerCase()} ${ve.priority===H?"active":""}`,onClick:()=>ga(H),children:H},H)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ga(""),children:"None"})]})]}),c.length>0||b?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(ir,{selectedTags:ve.tags||[],availableTags:c,onChange:be,onCreateTag:b,theme:Qe[A]||Qe.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Dt,children:[jsxRuntime.jsxs("button",{ref:St,className:"modal-v2-field",onClick:()=>he(!ot),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:ve.labels&&ve.labels.length>0?jsxRuntime.jsx("span",{children:ve.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Lo,{triggerRef:St,isOpen:ot,onClose:()=>he(false),width:220,estimatedHeight:200,children:(T.length>0?T:["Bug","Feature","Enhancement","Documentation"]).map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.labels?.includes(H)?"active":""}`,onClick:()=>S(H),children:[H,ve.labels?.includes(H)&&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"})})]},H))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{pt(!Ve),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:ve.endDate?new Date(ve.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ae,type:"date",value:typeof ve.endDate=="string"?ve.endDate.split("T")[0]:ve.endDate?(()=>{let H=new Date(ve.endDate),ie=H.getUTCFullYear(),Re=String(H.getUTCMonth()+1).padStart(2,"0"),Et=String(H.getUTCDate()).padStart(2,"0");return `${ie}-${Re}-${Et}`})():"",onChange:Ge,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>gt(!Ft),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:ve.estimatedTime?`${ve.estimatedTime}h`:"Not set"})]}),Ft&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ve.estimatedTime||"",onChange:H=>ee(H.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>gt(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"})]}),B?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ve.description||"",onChange:H=>{if(N){let ie={...N,description:H.target.value};I(ie);}},onBlur:Te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>q(true),children:ve.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:O(ve.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"}),ne.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[$e,"/",ne.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>fe(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:[ne.map(H=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${H.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ce(H.id),children:H.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:H.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Me(H.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"})]})})]},H.id)),re&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:H=>Z(H.target.value),onKeyDown:H=>{H.key==="Enter"&&Ee(),H.key==="Escape"&&(fe(false),Z(""));},onBlur:Ee,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(w||D.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"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(mr,{cardId:ve.id,attachments:D,onUpload:w?H=>w(ve.id,H):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 ${F==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${F==="history"?"active":""}`,onClick:()=>te("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:xe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:W,onChange:H=>G(H.target.value),onKeyDown:qe,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:Oe,disabled:!W.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[j.map(H=>{let ie=s.find(Et=>Et.id===H.userId);if(H.type.includes("COMMENT")){let Et=n.find(tt=>tt.id===H.metadata?.commentId);return Et?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ie&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ie.color},children:ie.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:ie?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:Et.content})]})]},H.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),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:ie?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)}),j.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 cg({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 Hs({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((p,m)=>p+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(cg,{})}),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,p)=>n+p.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,p)=>n+p.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,p)=>n+(p.planned||0),0)})]})]})]})}function vg({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 Ws({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,p=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=p;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(vg,{})}),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 Eg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Rd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Pg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=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:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function $d({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 Gs({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||Eg[m.name]||Rd[e.indexOf(m)%Rd.length]})),p=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?Pg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx($d,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let u=i.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.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($d,{})}),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:p[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 yn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=react.useState(false),[m,i]=react.useState(false),[u,d]=react.useState(false),[g,h]=react.useState(false);if(e.length===0)return null;let C=e.map(x=>x.id),T=x=>{r.onBulkUpdate?.(C,{priority:x}),p(false);},c=x=>{r.onBulkMove?.(C,x),i(false),a();},b=x=>{r.onBulkUpdate?.(C,{assignedUserIds:x}),d(false);},v=x=>{let y=new Set;e.forEach(w=>{w.labels?.forEach(k=>y.add(k));});let D=Array.from(new Set([...y,...x]));r.onBulkUpdate?.(C,{labels:D}),h(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(C),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:()=>p(!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(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>T(x),children:[jsxRuntime.jsx("span",{className:f("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&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(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>h(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});yn.displayName="BulkOperationsToolbar";function Ig(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,m,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(h=>{let C=a?.find(T=>T.id===h);n=`assignee-${h}`,p=C?.name||`User ${h}`,m=C?.color,i=C?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,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 g={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];p=g.title,m=g.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(h=>{n=`label-${h}`,p=h,m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:h,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:p,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 _s({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),p=react.useMemo(()=>Ig(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(i=>{n(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(Er,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:f("asakaa-swimlane-view",o),children:[p.map(i=>{let u=s.has(i.id),d=e.cards.filter(h=>i.cardIds.includes(h.id)),g={...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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Er,{board:g,callbacks:r,availableUsers:a})})]},i.id)}),p.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 Vs=[{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 js({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),p=Vs.find(i=>i.value===e)||Vs[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.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:f("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:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:f("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:Vs.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i.value),className:f("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[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 Io=[{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 $g(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,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&p&&m}function Wd(e={}){let{shortcuts:t=Io,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];},[]),p=react.useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return react.useEffect(()=>{function m(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if($g(i,d)){r&&i.preventDefault();let g=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function zg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ug(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 Hg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ug(e),r=t?zg(t):"";return a?`${a} + ${r}`:r}function Wg(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 Ks({shortcuts:e=Io,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=Wg(e);return jsxRuntime.jsxs("div",{className:f("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(([p,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"}),p]}),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:Hg(i)})]},i.action))})]},p))})}),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 Ys=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
71
+ `,b.onmouseenter=()=>{b.style.opacity="1";},b.onmouseleave=()=>{b.style.opacity="0.5";},b.onclick=T=>{T.stopPropagation();let N=r<a.length-1?r+1:0;i(),o(N);},n.appendChild(d),n.appendChild(f),n.appendChild(b);}n.appendChild(p),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function og(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 ng(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 Os(e){return e.startsWith("image/")}function pr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,p]=react.useState(false),[u,i]=react.useState(false),[g,d]=react.useState(null),f=react.useRef(null),b=react.useRef(e);b.current=e;let T=react.useCallback((x,B)=>{B.preventDefault(),B.stopPropagation();let D=b.current.filter(R=>Os(R.type)),k=D.findIndex(R=>R.id===x.id),$=R=>{let j=b.current.filter(ae=>Os(ae.type)),ee=j[R];ee&&Rd(ee.url,ee.name,j,R,$);};Rd(x.url,x.name,D,k,$);},[]),N=react.useCallback(x=>{let B=[],D=[];return e.length+x.length>s?(D.push(`Maximum ${s} files allowed`),{valid:B,errors:D}):(x.forEach(k=>{if(k.size/1048576>r){D.push(`${k.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>k.type.match(R))){D.push(`${k.name} has invalid file type`);return}B.push(k);}),{valid:B,errors:D})},[e.length,s,r,o]),c=react.useCallback(async x=>{let{valid:B,errors:D}=N(x);if(D.length>0){d(D.join(", ")),setTimeout(()=>d(null),5e3);return}if(B.length!==0){i(true),d(null);try{await t?.(B);}catch(k){d(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[N,t]),C=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(true);},[]),m=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);},[]),l=react.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),v=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);let B=Array.from(x.dataTransfer.files);c(B);},[c]),S=react.useCallback(x=>{let B=x.target.files?Array.from(x.target.files):[];c(B),f.current&&(f.current.value="");},[c]),y=react.useCallback(()=>{f.current?.click();},[]),w=react.useCallback(x=>{confirm("Are you sure you want to delete this attachment?")&&a?.(x);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:C,onDragLeave:m,onDragOver:l,onDrop:v,onClick:y,children:[jsxRuntime.jsx("input",{ref:f,type:"file",multiple:true,onChange:S,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:u?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"]})]})})]}),g&&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:g})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Os(x.type)&&x.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>T(x,B),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.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:ng(x.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:x.name,children:x.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:og(x.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(x.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>w(x.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"})})})]},x.id))})]})}function zs({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],aiInsights:u=[],attachments:i=[],onAddComment:g,onDeleteComment:d,onUploadAttachments:f,onDeleteAttachment:b,onSuggestAssignee:T,onGenerateSubtasks:N,onEstimateEffort:c,currentUserId:C="user-1"}){let[m,l]=react.useState("details"),[v,S]=react.useState(false),[y,w]=react.useState({}),[x,B]=react.useState(""),[D,k]=react.useState(false),[$,R]=react.useState({});if(!t||!e)return null;let j=react.useCallback(()=>{S(false),w({}),l("details"),B(""),R({}),a();},[a]),ee=react.useCallback(()=>{r&&Object.keys(y).length>0&&(r(e.id,y),w({}),S(false));},[e.id,y,r]),ae=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),j());},[e.id,o,j]),re=react.useCallback(()=>{g&&x.trim()&&(g(e.id,x.trim()),B(""));},[e.id,x,g]),fe=react.useCallback(async()=>{if(T){k(true);try{let E=await T(e);R(Q=>({...Q,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{k(false);}}},[e,T]),ge=react.useCallback(async()=>{if(N){k(true);try{let E=await N(e);R(Q=>({...Q,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{k(false);}}},[e,N]),Me=react.useCallback(async()=>{if(c){k(true);try{let E=await c(e);R(Q=>({...Q,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{k(false);}}},[e,c]),I={...e,...y},O=s.filter(E=>I.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:j,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:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),v?jsxRuntime.jsx("input",{type:"text",value:y.title??I.title,onChange:E=>w({...y,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:I.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[v?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:ee,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{S(false),w({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>S(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:ae,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:j,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:()=>l("details"),className:`card-detail-tab ${m==="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:()=>l("comments"),className:`card-detail-tab ${m==="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:()=>l("activity"),className:`card-detail-tab ${m==="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",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>l("attachments"),className:`card-detail-tab ${m==="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:()=>l("ai"),className:`card-detail-tab ${m==="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:[m==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),v?jsxRuntime.jsx("textarea",{value:y.description??I.description??"",onChange:E=>w({...y,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:I.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),v?jsxRuntime.jsx("select",{multiple:true,value:y.assignedUserIds??I.assignedUserIds??[],onChange:E=>{let Q=Array.from(E.target.selectedOptions,Y=>Y.value);w({...y,assignedUserIds:Q});},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:O.length>0?O.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"}),v?jsxRuntime.jsxs("select",{value:y.priority??I.priority??"",onChange:E=>w({...y,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:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:I.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:I.labels&&I.labels.length>0?I.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"}),v?jsxRuntime.jsx("input",{type:"date",value:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:I.startDate?new Date(I.startDate).toISOString().split("T")[0]:"",onChange:E=>w({...y,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:I.startDate?new Date(I.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),v?jsxRuntime.jsx("input",{type:"date",value:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:I.endDate?new Date(I.endDate).toISOString().split("T")[0]:"",onChange:E=>w({...y,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:I.endDate?new Date(I.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),v?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:y.estimatedTime??I.estimatedTime??"",onChange:E=>w({...y,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:I.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:I.dependencies&&I.dependencies.length>0?I.dependencies.map(E=>{let Q=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Q.slice(-4)]},Q)}):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:I.createdAt?new Date(I.createdAt).toLocaleString():"Unknown"})]})]}),m==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:x,onChange:E=>B(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:re,disabled:!x.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 Q=s.find(Y=>Y.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:[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-comment-author-name",children:Q?.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"})]})})]}),m==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(E=>{let Q=s.find(Y=>Y.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:Q?.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"})]})}),m==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(pr,{cardId:e.id,attachments:i,onUpload:f?E=>f(e.id,E):void 0,onDelete:b,currentUserId:C,maxSizeMB:10,maxFiles:20})}),m==="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:fe,disabled:D||!T,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:ge,disabled:D||!N,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:Me,disabled:D||!c,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"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((E,Q)=>{let Y=s.find(G=>G.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[Y&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Y.color},children:Y.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:Y?.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),"%"]})]})]},Q)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((E,Q)=>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"]})]},Q))]}),$.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:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),u.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))]}),!$.assignees&&!$.subtasks&&!$.effort&&u.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 Bo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[p,u]=react.useState({top:0,left:0}),i=react.useRef(null),g=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,T=4,N=d.left;N+o>b-10&&(N=b-o-10),N<10&&(N=10);let c=f-d.bottom,C=d.top,m;return c>=s+T?m=d.bottom+T:C>=s+T?m=d.top-s-T:c>=C?m=d.bottom+T:m=Math.max(10,d.top-s-T),{top:m,left:N}},[e,o,s]);return react.useEffect(()=>{t&&u(g());},[t,g]),react.useEffect(()=>{if(!t)return;let d=b=>{let T=b.target;i.current&&!i.current.contains(T)&&e.current&&!e.current.contains(T)&&a();},f=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(f),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(mt,{children:jsxRuntime.jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.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 Je={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 ug=["LOW","MEDIUM","HIGH","URGENT"],gg=["todo","in-progress","review","done"];function Ws({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:p=[],onAddComment:u,onDeleteComment:i,currentUser:g,onAIGenerateDescription:d,onAICreateSubtasks:f,onAIFindSimilar:b,availableColumns:T=[],availableLabels:N=[],availableTags:c=[],onCreateTag:C,onUploadCoverImage:m,unsplashAccessKey:l,theme:v,onSubtasksChange:S,attachments:y=[],onUploadAttachments:w,onDeleteAttachment:x}){let B=so(),D=v||B?.themeName||"dark",[k,$]=react.useState(e),[R,j]=react.useState(false),[ee,ae]=react.useState(e?.subtasks||[]),[re,fe]=react.useState(false),[ge,Me]=react.useState(""),[I,O]=react.useState(""),[E,Q]=react.useState("all"),[Y,G]=react.useState(false),[me,pe]=react.useState(false),[Fe,Ve]=react.useState(false),[dt,se]=react.useState(false),[_e,xt]=react.useState(false),[zt,ct]=react.useState(false),U=react.useRef(null),ie=react.useRef(null),Pe=react.useRef(null),Se=react.useRef(null),Xe=react.useRef(null),Ge=react.useRef(null),Dt=react.useRef(null),Ie=react.useRef(null),sa=react.useRef(null),Zt=react.useRef(null),At=react.useRef(null),gt=react.useRef(null);react.useEffect(()=>{e&&!k?($({...e}),ae(e.subtasks||[])):e&&k&&e.id!==k.id&&($({...e}),ae(e.subtasks||[]));},[e,k]),react.useEffect(()=>{let H=ne=>{let Oe=ne.target;Se.current&&!Se.current.contains(Oe)&&G(false),Xe.current&&!Xe.current.contains(Oe)&&pe(false),Ge.current&&!Ge.current.contains(Oe)&&Ve(false),Dt.current&&!Dt.current.contains(Oe)&&se(false);};if(Y||me||Fe||dt)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[Y,me,Fe,dt]),react.useEffect(()=>{if(!t)return;let H=ne=>{let Oe=ne.target,St=Oe.tagName==="INPUT"||Oe.tagName==="TEXTAREA"||Oe.isContentEditable;if(ne.key==="Escape"){ne.preventDefault(),Y||me||Fe||dt||_e||zt?(G(false),pe(false),Ve(false),se(false),xt(false),ct(false)):St||a();return}if(St&&ne.key!=="Escape")return;let et=ne.metaKey||ne.ctrlKey;switch(ne.key.toLowerCase()){case "s":ne.preventDefault(),G(true);break;case "a":ne.preventDefault(),Ve(true);break;case "p":ne.preventDefault(),pe(true);break;case "l":ne.preventDefault(),se(true);break;case "d":et||(ne.preventDefault(),xt(true),setTimeout(()=>Ie.current?.focus(),0));break;case "e":et||(ne.preventDefault(),ct(true));break;case "i":ne.preventDefault(),j(true),setTimeout(()=>ie.current?.focus(),0);break;case "t":ne.preventDefault(),fe(true);break;case "c":ne.preventDefault(),Pe.current?.focus();break}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[t,a,Y,me,Fe,dt,_e,zt]);let ea=react.useCallback(H=>{let ne=H.currentTarget.textContent?.trim()||"";if(k&&ne!==k.title){let Oe={...k,title:ne};$(Oe),r?.(k.id,{title:ne});}},[k,r]),Xt=react.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),H.currentTarget.blur()),H.key==="Escape"&&(H.preventDefault(),H.currentTarget.textContent=k?.title||"",H.currentTarget.blur());},[k]),Te=react.useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),j(false);},[k,e,r]),Ue=react.useCallback(H=>{if(k){let ne={...k,columnId:H};$(ne),r?.(k.id,{columnId:H}),G(false);}},[k,r]),ga=react.useCallback(H=>{if(k){let ne={...k,priority:H};$(ne),r?.(k.id,{priority:H}),pe(false);}},[k,r]),je=react.useCallback(H=>{if(k){let ne=k.assignedUserIds||[],Oe=ne.includes(H)?ne.filter(et=>et!==H):[...ne,H],St={...k,assignedUserIds:Oe};$(St),r?.(k.id,{assignedUserIds:Oe});}},[k,r]),He=react.useCallback(H=>{if(k){let ne=k.labels||[],Oe=ne.includes(H)?ne.filter(et=>et!==H):[...ne,H],St={...k,labels:Oe};$(St),r?.(k.id,{labels:Oe});}},[k,r]),L=react.useCallback(H=>{if(k){let ne={...k,tags:H};$(ne),r?.(k.id,{tags:H});}},[k,r]),ke=react.useCallback(H=>{if(k){let ne=H.target.value,Oe={...k,endDate:ne};$(Oe),r?.(k.id,{endDate:ne}),xt(false);}},[k,r]),q=react.useCallback(H=>{if(k){let ne={...k,estimatedTime:parseFloat(H)||0};$(ne),r?.(k.id,{estimatedTime:parseFloat(H)||0});}},[k,r]),ve=react.useCallback(()=>{if(ge.trim()&&k){let H={id:`subtask-${Date.now()}`,title:ge.trim(),completed:false,createdAt:new Date},ne=[...ee,H];ae(ne),Me(""),fe(false),S?.(k.id,ne);}},[ge,ee,k,S]),ye=react.useCallback(H=>{let ne=ee.map(Oe=>Oe.id===H?{...Oe,completed:!Oe.completed,updatedAt:new Date}:Oe);ae(ne),k&&S?.(k.id,ne);},[ee,k,S]),Re=react.useCallback(H=>{let ne=ee.filter(Oe=>Oe.id!==H);ae(ne),k&&S?.(k.id,ne);},[ee,k,S]),Ae=react.useCallback(()=>{I.trim()&&k&&u&&(u(k.id,I.trim()),O(""));},[I,k,u]),rt=react.useCallback(H=>{(H.metaKey||H.ctrlKey)&&H.key==="Enter"&&(H.preventDefault(),Ae());},[Ae]),z=H=>jsxRuntime.jsx(cg__default.default,{remarkPlugins:[mg__default.default],rehypePlugins:[pg__default.default],components:{a:({node:ne,...Oe})=>jsxRuntime.jsx("a",{...Oe,target:"_blank",rel:"noopener noreferrer"})},children:H}),_=p.filter(H=>E==="comments"?H.type.includes("COMMENT"):E==="history"?!H.type.includes("COMMENT"):true);if(!t||!e)return null;let he=k||e,Le=s.filter(H=>he.assignedUserIds?.includes(H.id)),ze=ee.filter(H=>H.completed).length;return jsxRuntime.jsx(mt,{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:H=>H.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":D,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:U,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ea,onKeyDown:Xt,children:he.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:Se,children:[jsxRuntime.jsxs("button",{ref:sa,className:"modal-v2-field",onClick:()=>G(!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("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:he.columnId||"No status"})]}),jsxRuntime.jsx(Bo,{triggerRef:sa,isOpen:Y,onClose:()=>G(false),width:250,estimatedHeight:200,children:(T.length>0?T:gg.map(H=>({id:H,title:H}))).map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${he.columnId===H.id?"active":""}`,onClick:()=>Ue(H.id),children:H.title},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ge,children:[jsxRuntime.jsxs("button",{ref:Zt,className:"modal-v2-field",onClick:()=>Ve(!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:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Le.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Le.map(H=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},title:H.name,children:H.initials},H.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Bo,{triggerRef:Zt,isOpen:Fe,onClose:()=>Ve(false),width:280,estimatedHeight:300,children:s.map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${he.assignedUserIds?.includes(H.id)?"active":""}`,onClick:()=>je(H.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:H.color},children:H.initials}),H.name,he.assignedUserIds?.includes(H.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"})})]},H.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Xe,children:[jsxRuntime.jsxs("button",{ref:At,className:"modal-v2-field",onClick:()=>pe(!me),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:he.priority||"None"})]}),jsxRuntime.jsxs(Bo,{triggerRef:At,isOpen:me,onClose:()=>pe(false),width:180,estimatedHeight:220,children:[ug.map(H=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${H.toLowerCase()} ${he.priority===H?"active":""}`,onClick:()=>ga(H),children:H},H)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>ga(""),children:"None"})]})]}),c.length>0||C?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(lr,{selectedTags:he.tags||[],availableTags:c,onChange:L,onCreateTag:C,theme:Je[D]||Je.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Dt,children:[jsxRuntime.jsxs("button",{ref:gt,className:"modal-v2-field",onClick:()=>se(!dt),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:he.labels&&he.labels.length>0?jsxRuntime.jsx("span",{children:he.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(Bo,{triggerRef:gt,isOpen:dt,onClose:()=>se(false),width:220,estimatedHeight:200,children:(N.length>0?N:["Bug","Feature","Enhancement","Documentation"]).map(H=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${he.labels?.includes(H)?"active":""}`,onClick:()=>He(H),children:[H,he.labels?.includes(H)&&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"})})]},H))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{xt(!_e),setTimeout(()=>Ie.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:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Ie,type:"date",value:typeof he.endDate=="string"?he.endDate.split("T")[0]:he.endDate?(()=>{let H=new Date(he.endDate),ne=H.getUTCFullYear(),Oe=String(H.getUTCMonth()+1).padStart(2,"0"),St=String(H.getUTCDate()).padStart(2,"0");return `${ne}-${Oe}-${St}`})():"",onChange:ke,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ct(!zt),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:he.estimatedTime?`${he.estimatedTime}h`:"Not set"})]}),zt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:he.estimatedTime||"",onChange:H=>q(H.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ct(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:he.description||"",onChange:H=>{if(k){let ne={...k,description:H.target.value};$(ne);}},onBlur:Te,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>j(true),children:he.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:z(he.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"}),ee.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ze,"/",ee.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>fe(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:[ee.map(H=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${H.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ye(H.id),children:H.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:H.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(H.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"})]})})]},H.id)),re&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ge,onChange:H=>Me(H.target.value),onKeyDown:H=>{H.key==="Enter"&&ve(),H.key==="Escape"&&(fe(false),Me(""));},onBlur:ve,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(w||y.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"}),y.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:y.length})]}),jsxRuntime.jsx(pr,{cardId:he.id,attachments:y,onUpload:w?H=>w(he.id,H):void 0,onDelete:x,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:()=>Q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>Q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[g&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:g.color},children:g.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Pe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:I,onChange:H=>O(H.target.value),onKeyDown:rt,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:Ae,disabled:!I.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[_.map(H=>{let ne=s.find(St=>St.id===H.userId);if(H.type.includes("COMMENT")){let St=n.find(et=>et.id===H.metadata?.commentId);return St?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ne&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ne.color},children:ne.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:ne?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:St.content})]})]},H.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),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:ne?.name||"Unknown"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:H.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.id)}),_.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 Cg({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 _s({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((p,u)=>p+u.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(Cg,{})}),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,p)=>n+p.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,p)=>n+p.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,p)=>n+(p.planned||0),0)})]})]})]})}function Fg({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 Vs({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,p=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=p;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(Fg,{})}),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:u>=50?"#10B981":"#F59E0B"},children:[u.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 Hg={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Vd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Wg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,p=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:p,y:u,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function jd({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 js({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||Hg[u.name]||Vd[e.indexOf(u)%Vd.length]})),p=n.map(u=>u.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?Wg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(jd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let g=i.payload,d=s>0?(g.value/s*100).toFixed(0):"0";return `${u} (${g.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(jd,{})}),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((u,i)=>jsxRuntime.jsx(recharts.Cell,{fill:p[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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var kn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,p]=react.useState(false),[u,i]=react.useState(false),[g,d]=react.useState(false),[f,b]=react.useState(false);if(e.length===0)return null;let T=e.map(v=>v.id),N=v=>{r.onBulkUpdate?.(T,{priority:v}),p(false);},c=v=>{r.onBulkMove?.(T,v),i(false),a();},C=v=>{r.onBulkUpdate?.(T,{assignedUserIds:v}),d(false);},m=v=>{let S=new Set;e.forEach(w=>{w.labels?.forEach(x=>S.add(x));});let y=Array.from(new Set([...S,...v]));r.onBulkUpdate?.(T,{labels:y}),b(false);},l=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(T),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:()=>p(!n),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>N(v),children:[jsxRuntime.jsx("span",{className:h("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>c(v.id),children:v.title},v.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!g),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>C([v.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>b(!f),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),f&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>m([v]),children:v},v))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:l,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"})})]})]})})});kn.displayName="BulkOperationsToolbar";function Kg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,p,u,i;switch(t){case "assignee":let g=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);g.length>0?g.forEach(b=>{let T=a?.find(N=>N.id===b);n=`assignee-${b}`,p=T?.name||`User ${b}`,u=T?.color,i=T?.avatar,r.has(n)||r.set(n,{id:n,title:p,groupValue:b,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",p="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let f={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];p=f.title,u=f.color,r.has(n)||r.set(n,{id:n,title:p,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(b=>{n=`label-${b}`,p=b,u="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:b,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",p="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:p,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ks({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=react.useState(new Set),p=react.useMemo(()=>Kg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=react.useCallback(i=>{n(g=>{let d=new Set(g);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(Pr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:h("asakaa-swimlane-view",o),children:[p.map(i=>{let g=s.has(i.id),d=e.cards.filter(b=>i.cardIds.includes(b.id)),f={...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&&u(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":g?"Expand lane":"Collapse lane",children:g?"\u25B6":"\u25BC"})]}),!g&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Pr,{board:f,callbacks:r,availableUsers:a})})]},i.id)}),p.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 Ys=[{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 qs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null),p=Ys.find(i=>i.value===e)||Ys[0];react.useEffect(()=>{function i(g){s.current&&!s.current.contains(g.target)&&n.current&&!n.current.contains(g.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{className:h("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:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:h("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:Ys.map(i=>jsxRuntime.jsxs("button",{onClick:()=>u(i.value),className:h("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 Ro=[{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 Xg(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,p=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&p&&u}function Jd(e={}){let{shortcuts:t=Ro,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(u=>{o.current=[...o.current,u];},[]),p=react.useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return react.useEffect(()=>{function u(i){if(!s.current)return;let g=i.target;if(!((g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Xg(i,d)){r&&i.preventDefault();let f=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(f);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:p,isEnabled:a}}function Qg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Zg(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 ef(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Zg(e),r=t?Qg(t):"";return a?`${a} + ${r}`:r}function tf(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 Xs({shortcuts:e=Ro,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function p(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let n=tf(e);return jsxRuntime.jsxs("div",{className:h("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(([p,u])=>u.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"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:u.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:ef(i)})]},i.action))})]},p))})}),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 Js=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
72
72
  1.
73
73
 
74
74
  **Expected behavior:**
@@ -108,48 +108,48 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function qs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("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:f("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,u])=>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:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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 Js({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[m,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Ll(e,m,T);Il(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await $l(c),v=c.name.endsWith(".json")?"json":"csv",l=Rl(b,v);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("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:()=>p("export"),className:f("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:()=>p("import"),className:f("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(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"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:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),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:h,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:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.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"})]})]}),u&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Kg=["URGENT","HIGH","MEDIUM","LOW"],Yg=[{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"}],qg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Qs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(D=>{a({search:D.target.value});},[a]),v=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),l=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),y=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 ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:T?"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"}),y&&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)"]})]}),!T&&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"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:D=>{let w=D.target.value;a({priorities:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Kg.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let w=D.target.value;a({assignees:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let w=D.target.value;a({labels:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:Yg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:D=>C(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),y&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Zs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(async()=>await p?.()),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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(()=>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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:()=>g(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:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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 ei={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ti={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ai={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"}},Kr={dark:ei,light:ti,neutral:ai},xn="dark";var kn=react.createContext(void 0),nf="asakaa-theme";function Vd({children:e,defaultTheme:t=xn,storageKey:a=nf}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${sf(u)}`,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(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsxRuntime.jsx(kn.Provider,{value:n,children:e})}function go(){let e=react.useContext(kn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function sf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ri({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:f("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(Kr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("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 jd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Qe[e]||Qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Qe[e].bgSecondary),bgGrid:r("--theme-bg-card",Qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Qe[e].bgWeekend),border:r("--theme-border-primary",Qe[e].border),borderLight:r("--theme-border-subtle",Qe[e].borderLight),textPrimary:r("--theme-text-primary",Qe[e].textPrimary),textSecondary:r("--theme-text-secondary",Qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Qe[e].textTertiary),accent:r("--theme-accent-primary",Qe[e].accent),accentHover:r("--theme-accent-hover",Qe[e].accentHover),accentLight:r("--theme-accent-primary",Qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Qe[e].dependency),dependencyHover:r("--theme-border-secondary",Qe[e].dependencyHover),criticalPath:r("--theme-error",Qe[e].criticalPath),criticalPathLight:r("--theme-error",Qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Qe[e].today):e==="neutral"?r("--theme-text-primary",Qe[e].today):r("--theme-error",Qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Qe[e].todayLight):e==="neutral"?r("--theme-text-primary",Qe[e].todayLight):r("--theme-error",Qe[e].todayLight),milestone:r("--theme-warning",Qe[e].milestone),milestoneLight:r("--theme-warning",Qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Qe[e].statusInProgress),statusCompleted:r("--theme-success",Qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Qe[e].hoverBg),focusRing:r("--theme-accent-primary",Qe[e].focusRing)}}var wn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},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"}},Kd={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},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"}},oi={en:wn,es:Kd};function Yd(e){return oi[e]||oi.en}function ni(e,t){let a=Yd(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 ho=react.createContext(wn);function bo(){return react.useContext(ho)}function Cf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{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(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(v){console.error(`Export ${c} failed:`,v);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.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:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function Tf({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 Nf({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 Df({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.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:p.map((i,u)=>{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:u<p.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:u*.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 Sf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function Tn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:x}){let y=bo(),D=T||c||b||v||l||x,w=[{value:"day",label:y.toolbar.day},{value:"week",label:y.toolbar.week},{value:"month",label:y.toolbar.month}],k=[{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(Nf,{options:w,value:t,onChange:R=>a(R),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(Df,{theme:e,value:p,onChange:m}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Sf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,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||y.toolbar.createTask})]}),(D||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:v,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Tf,{options:k,value:s,onChange:R=>n(R),theme:e})]})]})}function Nn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.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(ct,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,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(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.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:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u: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:`${p.x}px`,top:`${p.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(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.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 nc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(l=>{h.current=l;},[]),T=react.useCallback(l=>{let x=[],y=D=>{for(let w of D)x.push(w),w.subtasks&&w.subtasks.length>0&&w.isExpanded&&y(w.subtasks);};return y(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let y=T(e);if(y.length===0)return;let D=c();if(!D){a(y[0].id,false);return}let w=y.findIndex(A=>A.id===D.id);if(w===-1)return;let k=l==="up"?w-1:w+1;if(k<0||k>=y.length)return;let R=y[k];a(R.id,x);},[e,c,T,a]),v=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let w=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,k=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){k.length>0&&(l.preventDefault(),n(k,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){k.length>0&&(l.preventDefault(),p(k));return}if(l.key==="Tab"&&l.shiftKey){k.length>0&&(l.preventDefault(),m(k));return}if(l.key==="Enter"&&!l.shiftKey&&!w){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!w){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&w){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&w){k.length>0&&(l.preventDefault(),o(k));return}if(l.key==="d"&&w&&!l.shiftKey){k.length>0&&(l.preventDefault(),s(k));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[g,v]),{setIsEditing:C}}function ic(){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(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function lc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=lc(a.subtasks,t);if(r)return r}}return null}function mi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=mi(a.subtasks,t);if(r)return r}return null}function pi(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,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function ui(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=mi(a,r);if(!o)continue;let s=mi(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function gi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function fi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function hi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function dc(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"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function bi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:bi(r.subtasks,t,a)}:r)}function yi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:yi(a.subtasks,t)}:a)}function vi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function cc(e,t,a,r){if(t===a)return e;let o=lc(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.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 p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function En({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:v,onTaskCreate:l,onTaskRename:x,onCreateSubtask:y,onOpenTaskModal:D,onDeleteRequest:w,onTaskReparent:k}){let R=react.useContext(ho),[A,N]=react.useState(null),[I,B]=react.useState(null),[q,ne]=react.useState(""),oe=react.useRef(null),[re,fe]=react.useState(null),[$,Z]=react.useState(0),[W,G]=react.useState(0),[F,te]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,V]=react.useState(null),[Se,ue]=react.useState(null),[He,We]=react.useState(null),ot=react.useRef(0),he=5,Ve=react.useRef(false),[pt,Ft]=react.useState(null),[gt,z]=react.useState(false),[le,xe]=react.useState(null),[Fe,Ye]=react.useState(false),Je=react.useRef(null);react.useEffect(()=>{function O(j){Je.current&&!Je.current.contains(j.target)&&Ye(false);}if(Fe)return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[Fe]),react.useEffect(()=>{I&&oe.current&&(oe.current.focus(),oe.current.select());},[I]),react.useEffect(()=>{if(!re)return;let O=ve=>{let Le=ve.clientX-$,$e=W+Le;g?.(re,$e);},j=()=>{fe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",O),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[re,$,W,g]);let{selectedTaskIds:Dt,handleTaskClick:Ae,isTaskSelected:sa}=ic(),{setIsEditing:Zt}=nc({tasks:e,selectedTaskIds:Dt,onTaskSelect:(O,j)=>{let Le=vo(e).map($e=>$e.id);Ae(O,Le,j||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:O=>{let j=vo(e).find(ve=>ve.id===O);j&&ze(j);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:O=>{let j=vo(e).find(ve=>ve.id===O);j&&D&&D(j);},enableKeyboard:true}),xt=(O,j=0)=>{let ve=[];for(let Le of O)ve.push({task:Le,level:j}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&ve.push(...xt(Le.subtasks,j+1));return ve},St=xt(e),ea=48,Xt=Math.max(St.length*a,600-ea),Te=O=>!O.startDate||!O.endDate?"-":`${Math.ceil((O.endDate.getTime()-O.startDate.getTime())/(1e3*60*60*24))}d`,ze=O=>{B(O.id),ne(O.name),Zt(true);},ga=O=>{q.trim()&&q!==e.find(j=>j.id===O)?.name&&x?.(O,q.trim()),B(null),ne(""),Zt(false);},_e=()=>{B(null),ne(""),Zt(false);},S=(O,j)=>{j.stopPropagation(),y?.(O.id);},be=(O,j)=>{j.preventDefault(),ot.current=j.clientY,V(O),Ve.current=false,z(false),Ft({x:j.clientX,y:j.clientY});},Ge=O=>{if(!J||(Math.abs(O.clientY-ot.current)>he&&!Ve.current&&(Ve.current=true,z(true)),Ft({x:O.clientX,y:O.clientY}),!Ve.current))return;let ve=document.querySelectorAll("[data-task-row]"),Le=null,$e=null;ve.forEach(H=>{let ie=H.getBoundingClientRect(),Re=H.getAttribute("data-task-row");if(Re&&Re!==J&&O.clientY>=ie.top&&O.clientY<=ie.bottom){Le=Re;let Et=O.clientY-ie.top,tt=ie.height;Et<tt*.25?$e="above":Et>tt*.75?$e="below":$e="child";}}),ue(Le),We($e);},ee=()=>{if(Ve.current&&J&&Se&&He){if(He==="child")k?.(J,Se);else if(He==="above"||He==="below"){let O=(Le,$e,H=null)=>{for(let ie of Le){if(ie.id===$e)return H;if(ie.subtasks){let Re=O(ie.subtasks,$e,ie.id);if(Re!==void 0)return Re}}},j=O(e,Se,null),ve=(Le,$e)=>{let H=Le.findIndex(ie=>ie.id===$e);return He==="below"?H+1:H};if(j===null){let Le=ve(e,Se);k?.(J,null,Le);}else {let Le=St.find($e=>$e.task.id===j)?.task;if(Le?.subtasks){let $e=ve(Le.subtasks,Se);k?.(J,j,$e);}}}}V(null),ue(null),We(null),Ft(null),Ve.current=false,z(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",Ge),document.addEventListener("mouseup",ee),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ge),document.removeEventListener("mouseup",ee),document.body.style.cursor="",document.body.style.userSelect="";}},[J,Se,He]);let Ee=(O,j,ve)=>{switch(O.id){case "name":let Le=I===j.id,$e=A===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ve*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:$e?1:.3},onMouseDown:X=>be(j.id,X),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),j.subtasks&&j.subtasks.length>0?jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),m?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.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:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:oe,type:"text",value:q,onChange:X=>ne(X.target.value),onKeyDown:X=>{X.key==="Enter"?ga(j.id):X.key==="Escape"&&_e();},onBlur:()=>ga(j.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:X=>X.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:j.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:j.parentId?"13px":"14px",fontWeight:j.isMilestone?600:j.parentId?400:600,letterSpacing:j.parentId?"0":"-0.01em"},title:j.name,children:j.name}),$e&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:X=>S(j,X),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:X=>{X.stopPropagation(),ze(j);},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 ie=O.id==="startDate"?"startDate":"endDate",Re=j[ie],Et=le?.taskId===j.id&&le?.field===ie,tt=X=>X?(typeof X=="string"?new Date(X):X).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:X=>X.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:X=>{if(Et)xe(null);else {let Ie=X.currentTarget.getBoundingClientRect();xe({taskId:j.id,field:ie,month:Re?typeof Re=="string"?new Date(Re):Re:new Date,position:{top:Ie.bottom+4,left:Ie.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:tt(Re)})]}),Et&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>xe(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:le?.position.top,left:le?.position.left},onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let X=new Date,Ie=new Date(X);Ie.setDate(X.getDate()+1);let nt=new Date(X);nt.setDate(X.getDate()+7);let se=new Date(X);return se.setDate(X.getDate()+14),[{label:"Hoy",date:X},{label:"Ma\xF1ana",date:Ie},{label:"Pr\xF3xima semana",date:nt},{label:"2 semanas",date:se}].map((kt,Be)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Lt=>Lt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Lt=>Lt.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(j.id,{[ie]:kt.date}),xe(null);},children:kt.label},Be))})(),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:X=>X.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(j.id,{[ie]:void 0}),xe(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:()=>xe(X=>X?{...X,month:new Date(X.month.getFullYear(),X.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:le?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(X=>X?{...X,month:new Date(X.month.getFullYear(),X.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((X,Ie)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:X},Ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=le?.month||new Date,Ie=X.getFullYear(),nt=X.getMonth(),se=new Date(Ie,nt,1).getDay(),Ue=new Date(Ie,nt+1,0).getDate(),kt=new Date,Be=[];for(let it=se-1;it>=0;it--)Be.push({day:new Date(Ie,nt,-it).getDate(),date:new Date(Ie,nt-1,new Date(Ie,nt,-it).getDate()),isCurrentMonth:false});for(let it=1;it<=Ue;it++)Be.push({day:it,date:new Date(Ie,nt,it),isCurrentMonth:true});let Lt=42-Be.length;for(let it=1;it<=Lt;it++)Be.push({day:it,date:new Date(Ie,nt+1,it),isCurrentMonth:false});return Be.map((it,ya)=>{let Ut=it.date.toDateString()===kt.toDateString(),wt=(Re?typeof Re=="string"?new Date(Re):Re:null)?.toDateString()===it.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:it.isCurrentMonth?wt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:wt?"#3B82F6":"transparent",boxShadow:Ut&&!wt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(j.id,{[ie]:it.date}),xe(null);},children:it.day},ya)})})()})]})]})]}),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:Te(j)})});case "assignees":let fa=r.filter(X=>j.assignees?.some(Ie=>Ie.name===X.name||Ie.initials===X.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(Hr,{assignedUsers:fa,availableUsers:r,onChange:X=>{let Ie=X.map(nt=>({id:nt.id,name:nt.name,initials:nt.initials,color:nt.color}));h?.(j.id,{assignees:Ie.length>0?Ie:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(ad,{status:j.status||"todo",onChange:X=>{h?.(j.id,{status:X,progress:X==="completed"?100:j.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:`${j.progress}%`,backgroundColor:j.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:[j.progress,"%"]})]});case "priority":let ba={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ye=ba[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:X=>X.stopPropagation(),children:jsxRuntime.jsx(zr,{priority:ye,onChange:X=>{X&&h?.(j.id,{priority:E[X]||"medium"});}})});default:return null}},Ce=O=>[{id:"hide",label:"Hide Column",icon:Ot.Hide,onClick:()=>d(O),disabled:O==="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:()=>{}}],Me=O=>O.subtasks&&O.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{y?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{w?w(O.id,O.name):b?.([O.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{n?.(O);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{y?.(O.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{h?.(O.id,{status:"todo",progress:0});},disabled:O.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{h?.(O.id,{status:"in-progress"});},disabled:O.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{h?.(O.id,{status:"completed",progress:100});},disabled:O.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{w?w(O.id,O.name):b?.([O.id]);}}],Oe=u.filter(O=>O.visible),qe=Oe.reduce((O,j)=>O+j.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:qe},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ea}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:Oe.map((O,j)=>{let ve=j===Oe.length-1,Le=O.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${O.width}px`,minWidth:`${O.minWidth??(Le?200:60)}px`,maxWidth:`${O.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ve?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:$e=>{$e.preventDefault(),te({isOpen:true,x:$e.clientX,y:$e.clientY,type:"header",columnId:O.id});},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:$e=>{$e.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:O.label,children:O.label}),O.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:re===O.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:$e=>{$e.preventDefault(),$e.stopPropagation(),fe(O.id),Z($e.clientX),G(O.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"}})})]},O.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(Nn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ye(!Fe),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"})}),Fe&&jsxRuntime.jsxs("div",{ref:Je,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:O=>O.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:()=>Ye(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:Xt},children:St.map(({task:O,level:j},ve)=>{let Le=sa(O.id),$e=Se===O.id,H=$e&&He==="above",ie=$e&&He==="below",Re=$e&&He==="child",Et={};return Re&&(Et.backgroundColor=`${t.accent}15`,Et.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":O.id,className:`flex items-center cursor-pointer group ${J===O.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Re?`${t.accent}15`:ve%2===0?t.bgPrimary:t.bgGrid,...Et},onMouseEnter:()=>N(O.id),onMouseLeave:()=>N(null),onClick:tt=>{let ba=vo(e).map(X=>X.id),ye=navigator.platform.toUpperCase().indexOf("MAC")>=0?tt.metaKey:tt.ctrlKey;Ae(O.id,ba,ye,tt.shiftKey),s?.(O);},onDoubleClick:tt=>{tt.stopPropagation(),n?.(O);},onContextMenu:tt=>{tt.preventDefault(),te({isOpen:true,x:tt.clientX,y:tt.clientY,type:"task",task:O}),p?.(O,tt);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[H&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ie&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((tt,fa)=>{let ba=fa===Oe.length-1,E=tt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${tt.width}px`,minWidth:`${tt.minWidth??(E?200:60)}px`,maxWidth:`${tt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ba?"none":`1px solid ${A===O.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ee(tt,O,E?j:0)},`${O.id}-${tt.id}`)})]},O.id)})}),jsxRuntime.jsx(yo,{isOpen:F.isOpen,x:F.x,y:F.y,items:F.type==="header"&&F.columnId?Ce(F.columnId):F.type==="task"&&F.task?Me(F.task):[],onClose:()=>te({...F,isOpen:false}),theme:t}),gt&&pt&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:pt.x+12,top:pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let O=St.find(j=>j.task.id===J)?.task;return O?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:O.name})}):null})()}),document.body)]})}function fc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[m,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(0),[x,y]=react.useState(0),[D,w]=react.useState(null),[k,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:v,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:y,hoveredSegmentIndex:D,setHoveredSegmentIndex:w,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(q,ne)=>{r("none"),d(null),h(null),p(q),i(ne),y(0),b(null),l(0);}}}function Mn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=fc(t,r),b=react.useRef(null),v=react.useRef(null),l=react.useRef(null),{dragMode:x,setDragMode:y,dragOffset:D,setDragOffset:w,ghostX:k,setGhostX:R,ghostWidth:A,setGhostWidth:N,connectionLine:I,setConnectionLine:B,hoveredTaskId:q,setHoveredTaskId:ne,activeZone:oe,setActiveZone:re,draggedSegmentIndex:fe,setDraggedSegmentIndex:$,draggedSegmentStartX:Z,setDraggedSegmentStartX:W,segmentDragOffsetX:G,setSegmentDragOffsetX:F,hoveredSegmentIndex:te,setHoveredSegmentIndex:J,isHovered:V,setIsHovered:Se,isDragging:ue,isResizing:He,isConnecting:We,resetDragState:ot}=c,he=32,Ve=8,pt=e.endDate&&e.endDate<new Date&&e.progress<100,Ft=e.isCriticalPath,gt=o.name==="neutral"||o.today==="#1C1917",z=e.status==="completed"||e.progress===100,le={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Fe=e.isCriticalPath||pt?"#DC2626":e.color?e.color:e.priority&&le[e.priority]?le[e.priority]:o.taskBarPrimary,Je=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),Dt=r<50,Ae=r<40;react.useEffect(()=>{if(T)if(V&&!ue&&!e.segments){let ee=a<100;T({task:e,x:t,y:a,width:r,height:he,showBelow:ee});}else T(null);},[V,ue,e,t,a,r,he,T]);let sa=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Zt=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},xt=ee=>Math.round(ee/s)*s,St=ee=>{let Ee=Math.round(ee/s),Ce=new Date(n);return Ce.setDate(Ce.getDate()+Ee),Ce},ea=(ee,Ee)=>{for(let Ce of h){if(Ce.id===e.id)continue;let Me=5;if(ee>=Ce.x-Me&&ee<=Ce.x+Ce.width+Me&&Ee>=Ce.y-Me&&Ee<=Ce.y+Ce.height+Me)return Ce.id}return null},Xt=react.useCallback((ee,Ee,Ce)=>{ee.preventDefault(),ee.stopPropagation();let Me=b.current?.ownerSVGElement;if(!Me)return;let Oe=Me.createSVGPoint();Oe.x=ee.clientX,Oe.y=ee.clientY;let qe=Oe.matrixTransform(Me.getScreenCTM()?.inverse()),O=Ce!==void 0?Ce:t,j=Ee;if(!j){let ve=qe.x-O;ee.shiftKey?(j="connect",B({x:t+r,y:a+he/2})):ee.ctrlKey||ee.metaKey?j="move":ee.altKey?j=ve<r/2?"resize-start":"resize-end":Ae?ve<r/2?j="move":j="resize-end":Dt?ve<=Je/2?j="resize-start":ve>=r-Je/2?j="resize-end":j="move":ve<=Je?j="resize-start":ve>=r-Je?j="resize-end":j="move";}y(j),Se(false),re(null),j==="move"?w(qe.x-O):j==="connect"?B({x:t+r,y:a+he/2}):w(0),R(O),N(r);},[t,r,a,he]),Te=react.useCallback(ee=>{let Ee=b.current?.ownerSVGElement;if(!Ee)return;let Ce=Ee.closest(".gantt-timeline-scroll");if(!Ce)return;let Me=Ce.getBoundingClientRect(),Oe=60,qe=15,O=0;if(ee.clientX<Me.left+Oe){let j=Me.left+Oe-ee.clientX;O=-Math.min(qe,j/2);}else if(ee.clientX>Me.right-Oe){let j=ee.clientX-(Me.right-Oe);O=Math.min(qe,j/2);}return O!==0&&(Ce.scrollLeft+=O),O!==0},[]),ze=react.useCallback(ee=>{if(x==="none")return;l.current=ee;let Ee=b.current?.ownerSVGElement;if(!Ee)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let Oe=Te(ee);Oe&&!v.current?v.current=window.setInterval(()=>{l.current&&(Te(l.current),ze(l.current));},16):!Oe&&v.current&&(window.clearInterval(v.current),v.current=null);}let Ce=Ee.createSVGPoint();Ce.x=ee.clientX,Ce.y=ee.clientY;let Me=Ce.matrixTransform(Ee.getScreenCTM()?.inverse());if(x==="connect"){B({x:Me.x,y:Me.y});let Oe=ea(Me.x,Me.y);ne(Oe);}else if(x==="move"){let Oe=Me.x-D,qe=xt(Oe);R(qe),N(r);let O=Math.round((qe-t)/s);if(C?.(e.id,O,true),e.segments&&e.segments.length>0&&fe!==null){let j=qe-Z;F(j);}}else if(x==="resize-start"){let Oe=Me.x,qe=xt(Oe),O=t+r-qe;O>=s&&(R(qe),N(O));}else if(x==="resize-end"){let Oe=Me.x,O=xt(Oe)-t;O>=s&&N(O);}},[x,t,r,s,D,e,xt,fe,Z,ea,ne,B,R,N,F,C,Te]),ga=react.useCallback(()=>{if(v.current&&(window.clearInterval(v.current),v.current=null),l.current=null,x!=="none"){if(x==="connect")q&&g&&g(e,q),B(null),ne(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),Ee,Ce,Me=true;if(x==="move"){if(Ee=St(k),Ce=new Date(Ee.getTime()+ee),e.segments&&e.segments.length>0&&fe!==null){let Oe=Math.round(G/s),qe=e.segments.map((Le,$e)=>{if($e===fe){let H=new Date(Le.startDate),ie=new Date(Le.endDate);return H.setDate(H.getDate()+Oe),ie.setDate(ie.getDate()+Oe),{startDate:H,endDate:ie}}return Le}),O=qe.flatMap(Le=>[Le.startDate,Le.endDate]),j=new Date(Math.min(...O.map(Le=>Le.getTime()))),ve=new Date(Math.max(...O.map(Le=>Le.getTime())));d?.({...e,segments:qe},j,ve),ot(t,r);return}}else x==="resize-start"?(Ee=St(k),Ce=e.endDate,Ee>Ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),Me=false)):x==="resize-end"?(Ee=e.startDate,Ce=St(k+A),Ce<Ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),Me=false)):Me=false;Me&&Ee&&Ce&&(Ce.getTime()<Ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Ee,Ce));}C?.(e.id,0,false),ot(t,r);}},[x,k,A,e,d,q,g,t,r,s,St,G,fe,ot,C]);react.useEffect(()=>{if(x==="none")return;let ee=Ce=>{ze(Ce);},Ee=()=>{ga();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ee),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ee),v.current&&(window.clearInterval(v.current),v.current=null);}},[x,ze,ga]);let _e=ue&&!We?k:t,S=ue&&!We?A:r,be=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,"data-task-bar":"true",onClick:()=>!ue&&m?.(e),onDoubleClick:ee=>{ue||(ee.stopPropagation(),i?.(e));},onContextMenu:ee=>{ee.preventDefault(),u?.(e,ee);},onMouseEnter:()=>!ue&&Se(true),onMouseLeave:()=>{ue||(Se(false),re(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:he,fill:"transparent",style:{pointerEvents:"all"}}),V&&!ue&&!Dt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Je,height:he,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:ee=>Xt(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Je,y:a,width:r-Je*2,height:he,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:ee=>Xt(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-Je,y:a,width:Je,height:he,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:ee=>Xt(ee,"resize-end")})]}),V&&!ue&&Ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:he,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:ee=>Xt(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:he,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:ee=>Xt(ee,"resize-end")}),V&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+he-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ue&&!We&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:a,width:A,height:he,rx:Ve,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:_e,y:a,width:S,height:he,rx:Ve,fill:Fe,"data-task-class":be,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!We?.15:e.parentId?.6:V?.9:.8,scale:V&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>Xt(ee),style:{cursor:ue?We?"crosshair":He?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:_e,y:a,width:S*(e.progress/100),height:he,rx:Ve,fill:Fe,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,Ee)=>{let Ce=(ee.startDate.getTime()-n.getTime())/864e5*s,Oe=(ee.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ce+s,qe=ue&&x==="move"&&fe===Ee,O=te===Ee,j=qe?Ce+G:Ce;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ue&&J(Ee),onMouseLeave:()=>!ue&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:j,y:a,width:Oe,height:he,rx:Ve,fill:Fe,initial:{opacity:0,scale:.95},animate:{opacity:qe||e.parentId?.6:O?.9:.8,scale:O&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ve=>{ve.stopPropagation(),$(Ee),W(Ce),Xt(ve,void 0,Ce);},style:{cursor:ue?We?"crosshair":He?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:j,y:a,width:Oe*(e.progress/100),height:he,rx:Ve,fill:Fe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ee}`)}),gt&&(pt||Ft)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ft&&!pt&&jsxRuntime.jsx("rect",{x:_e,y:a,width:S,height:he,rx:Ve,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),pt&&jsxRuntime.jsx("rect",{x:_e,y:a,width:S,height:he,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),S>60&&!e.segments&&(()=>{let ee=p.taskLabel(e),Ee=typeof ee=="string"?ee:e.name,Ce=Ee.length>Math.floor(S/8)?`${Ee.substring(0,Math.floor(S/8))}...`:Ee;return jsxRuntime.jsx("text",{x:_e+12,y:a+he/2,dominantBaseline:"middle",fill:z?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:z?"line-through":"none"},children:Ce})})(),S>100&&e.progress>0&&e.progress<100&&!ue&&!e.segments&&jsxRuntime.jsxs("text",{x:_e+S-12,y:a+he/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&&S>80&&!ue&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:_e+S-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:_e+S-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(V||He)&&!We&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:_e-2,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-start"),onMouseLeave:()=>re(null),onMouseDown:ee=>{ee.stopPropagation(),Xt(ee,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:_e+4,y:a+8,width:3,height:he-16,rx:1.5,fill:oe==="resize-start"||x==="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:_e+S-14,y:a,width:16,height:he,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-end"),onMouseLeave:()=>re(null),onMouseDown:ee=>{ee.stopPropagation(),Xt(ee,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:_e+S-7,y:a+8,width:3,height:he-16,rx:1.5,fill:oe==="resize-end"||x==="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:V&&!ue&&!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+he/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>re("connect"),onMouseLeave:()=>re(null),onMouseDown:ee=>{ee.stopPropagation(),Xt(ee,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+he/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}})]})}),We&&I&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+he/2,x2:I.x,y2:I.y,stroke:q?o.statusCompleted:o.accent,strokeWidth:q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:q?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:I.x,cy:I.y,r:q?8:6,fill:q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),q&&jsxRuntime.jsx(framerMotion.motion.text,{x:I.x+15,y:I.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:I.x+10},animate:{opacity:1,x:I.x+15},transition:{duration:.2},children:"Connect"})]}),(V||ue)&&!We&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:_e-2,y:a-2,width:S+4,height:he+4,rx:Ve+2,fill:"none",stroke:ue?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ue?.6:.4,initial:{opacity:0},animate:{opacity:ue?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),He&&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+A,y1:0,x2:k+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!ue&&!e.segments&&!T&&(()=>{let Ce=a<100,Me=Ce?a+he+13:a-82-13,Oe=Ce?`M ${_e+S/2-6} ${a+he+3} L ${_e+S/2} ${a+he+13} L ${_e+S/2+6} ${a+he+3}`:`M ${_e+S/2-6} ${a-13} L ${_e+S/2} ${a-3} L ${_e+S/2+6} ${a-13}`,qe=Me+22,O=Me+40,j=Me+55,ve=Me+70,Le=Ce?Me+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Oe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:_e+S/2-120,y:Me,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:_e+S/2,y:qe,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:_e+S/2-110,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:_e+S/2-70,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:sa(e.startDate)}),jsxRuntime.jsx("text",{x:_e+S/2-110,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:_e+S/2-70,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:sa(e.endDate)}),jsxRuntime.jsx("text",{x:_e+S/2+10,y:O,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:_e+S/2+65,y:O,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Zt()}),jsxRuntime.jsx("text",{x:_e+S/2+10,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:_e+S/2+65,y:j,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:_e+S/2-110,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:_e+S/2-50,y:ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($e=>$e.name).join(", ").substring(0,30),e.assignees.map($e=>$e.name).join(", ").length>30?"...":""]})]}),!Ce&&jsxRuntime.jsx("text",{x:_e+S/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":Dt?"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 yc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`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}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-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:u,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:g,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:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,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:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Ln({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,v=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let oe=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+oe} ${t}, ${a-oe} ${r}, ${a} ${r}`;}else if(x=a-b,v){let re=e+15,fe=a-b,$=h?t+20:t-20;x=fe,n==="squared"?l=`M ${e} ${t} L ${re} ${t} L ${re} ${$} L ${fe} ${$} L ${fe} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${re-c} ${t} Q ${re} ${t} ${re} ${t+c} L ${re} ${$-c} Q ${re} ${$} ${re-c} ${$} L ${fe+c} ${$} Q ${fe} ${$} ${fe} ${$+c} L ${fe} ${r-c} Q ${fe} ${r} ${fe+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${re-c} ${t} Q ${re} ${t} ${re} ${t-c} L ${re} ${$+c} Q ${re} ${$} ${re-c} ${$} L ${fe+c} ${$} Q ${fe} ${$} ${fe} ${$-c} L ${fe} ${r+c} Q ${fe} ${r} ${fe+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let y=5,D=`M ${a} ${r} L ${a-y} ${r-y*.5} M ${a} ${r} L ${a-y} ${r+y*.5}`,w=o.dependency,k=o.dependencyHover||w,R="#f87171",A="rgba(248, 113, 113, 0.15)",N=x,I=(t+r)/2;if(u)if(C)N=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(v){let oe=e+15,re=a-b,fe=h?t+20:t-20,$=[[e,t,oe,t],[oe,t,oe,fe],[oe,fe,re,fe],[re,fe,re,r],[re,r,a,r]],Z=1/0,W={x:N,y:I};for(let G of $){let F=B(u.x,u.y,G[0],G[1],G[2],G[3]),te=Math.hypot(u.x-F.x,u.y-F.y);te<Z&&(Z=te,W=F);}N=W.x,I=W.y;}else {let oe=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],re=1/0,fe={x:N,y:I};for(let $ of oe){let Z=B(u.x,u.y,$[0],$[1],$[2],$[3]),W=Math.hypot(u.x-Z.x,u.y-Z.y);W<re&&(re=W,fe=Z);}N=fe.x,I=fe.y;}function B(oe,re,fe,$,Z,W){let G=Z-fe,F=W-$,te=G*G+F*F;if(te===0)return {x:fe,y:$};let J=((oe-fe)*G+(re-$)*F)/te;return J=Math.max(0,Math.min(1,J)),{x:fe+J*G,y:$+J*F}}let q=oe=>{let re=oe.currentTarget.ownerSVGElement;if(!re)return;let fe=re.getBoundingClientRect();d({x:oe.clientX-fe.left,y:oe.clientY-fe.top});},ne=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ne,onMouseMove:q,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:D,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:N,cy:I,r:9,fill:A,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:I-3,x2:N+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:I-3,x2:N-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ne,onMouseMove:q,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:m?k:w,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:D,fill:"none",stroke:m?k:w,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:w,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:N,cy:I,r:9,fill:A,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:N-3,y1:I-3,x2:N+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:N+3,y1:I-3,x2:N-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Bn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=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:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+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 pe={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(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.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=pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=pe.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=pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=pe.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=pe.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)=>pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=pe.findTaskById(e,t);return !a||!a.dependencies?[]:pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>pe.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=pe.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=>pe.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=pe.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"]],p=s.map(m=>{let i=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?pe.formatDate(m.startDate):"N/A",m.endDate?pe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:p,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=pe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?pe.formatDate(m.startDate):"","End Date":m.endDate?pe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.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 p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=pe.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=pe.getEarliestStartDate(e)||new Date,p=pe.getLatestEndDate(e)||new Date,m=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?pe.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
111
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Qs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(g){s.current&&!s.current.contains(g.target)&&n.current&&!n.current.contains(g.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},u=e.reduce((i,g)=>{let d=g.category||"Other";return i[d]||(i[d]=[]),i[d].push(g),i},{});return jsxRuntime.jsxs("div",{className:h("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:h("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(u).map(([i,g])=>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:g.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[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 ei({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[u,i]=react.useState("json"),[g,d]=react.useState(null),f=react.useRef(null);if(!t)return null;let b=async()=>{let N=o?.current||void 0,c=await Rl(e,u,N);$l(c,u);},T=async N=>{let c=N.target.files?.[0];if(c){try{let C=await Ul(c),m=c.name.endsWith(".json")?"json":"csv",l=zl(C,m);d(l),l.success&&r&&r(l,C);}catch(C){d({success:false,errors:[`Failed to read file: ${C instanceof Error?C.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxRuntime.jsxs("div",{className:h("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:()=>p("export"),className:h("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:()=>p("import"),className:h("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(N=>jsxRuntime.jsxs("button",{onClick:()=>i(N),className:h("p-4 rounded-lg border-2 transition-all text-center",u===N?"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:[N==="json"&&"\u{1F4C4}",N==="csv"&&"\u{1F4CA}",N==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:N})]},N))})]}),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:b,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:f,type:"file",accept:".json,.csv",onChange:T,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>f.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[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"})]})]}),g&&jsxRuntime.jsxs("div",{className:h("p-4 rounded-lg",g.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:h("font-semibold mb-2",g.success?"text-green-400":"text-red-400"),children:g.success?"\u2713 Import Successful":"\u2717 Import Failed"}),g.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",g.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",g.columnsImported]})]}),g.errors&&g.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:g.errors.map((N,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",N]},c))})]})]})]})]})]})}var sf=["URGENT","HIGH","MEDIUM","LOW"],lf=[{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"}],df=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ti({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:u=[],availableLabels:i=[],availableColumns:g=[],showQuickFilters:d=true,compact:f=false,groupBy:b="none",onGroupByChange:T}){let[N,c]=react.useState(true),C=react.useCallback(y=>{a({search:y.target.value});},[a]),m=react.useCallback(y=>{a({dateFilter:y.target.value});},[a]),l=react.useCallback(y=>{r({by:y.target.value});},[r]),v=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),S=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 ${f?"filter-bar--compact":""} ${N?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!N),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:N?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:N?"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"}),S&&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)"]})]}),!N&&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"}),p&&jsxRuntime.jsx("button",{onClick:p,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:C,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:m,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:y=>{let w=y.target.value;a({priorities:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),sf.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),u.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let w=y.target.value;a({assignees:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),u.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let w=y.target.value;a({labels:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:l,className:"filter-bar__select filter-bar__select--sm",children:lf.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),T&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:b,onChange:y=>T(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:df.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),S&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ai({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:u}){let[i,g]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let b=T=>{d.current&&!d.current.contains(T.target)&&g(false);};return i&&document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[i]);let f=b=>{b(),g(false);};return jsxRuntime.jsxs("div",{className:h("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>g(!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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",b.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",b.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:()=>f(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(async()=>await p?.()),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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(()=>u?.()),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:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:()=>f(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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 ri={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"}},oi={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ni={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},qr={dark:ri,light:oi,neutral:ni},Cn="dark";var Tn=react.createContext(void 0),vf="asakaa-theme";function ec({children:e,defaultTheme:t=Cn,storageKey:a=vf}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,u=qr[r];Object.entries(u.colors).forEach(([g,d])=>{d&&p.style.setProperty(`--theme-${xf(g)}`,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(([g,d])=>{let f=u.colors[g];f&&p.style.setProperty(d,f);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:qr};return jsxRuntime.jsx(Tn.Provider,{value:n,children:e})}function ho(){let e=react.useContext(Tn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function xf(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function si({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ho();return e?jsxRuntime.jsxs("div",{className:h("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(qr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:h("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 tc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Je[e]||Je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Je[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Je[e].bgSecondary),bgGrid:r("--theme-bg-card",Je[e].bgGrid),bgWeekend:r("--theme-bg-hover",Je[e].bgWeekend),border:r("--theme-border-primary",Je[e].border),borderLight:r("--theme-border-subtle",Je[e].borderLight),textPrimary:r("--theme-text-primary",Je[e].textPrimary),textSecondary:r("--theme-text-secondary",Je[e].textSecondary),textTertiary:r("--theme-text-tertiary",Je[e].textTertiary),accent:r("--theme-accent-primary",Je[e].accent),accentHover:r("--theme-accent-hover",Je[e].accentHover),accentLight:r("--theme-accent-primary",Je[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Je[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Je[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Je[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Je[e].dependency),dependencyHover:r("--theme-border-secondary",Je[e].dependencyHover),criticalPath:r("--theme-error",Je[e].criticalPath),criticalPathLight:r("--theme-error",Je[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Je[e].today):e==="neutral"?r("--theme-text-primary",Je[e].today):r("--theme-error",Je[e].today),todayLight:e==="light"?r("--theme-accent-primary",Je[e].todayLight):e==="neutral"?r("--theme-text-primary",Je[e].todayLight):r("--theme-error",Je[e].todayLight),milestone:r("--theme-warning",Je[e].milestone),milestoneLight:r("--theme-warning",Je[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Je[e].statusTodo),statusInProgress:r("--theme-accent-primary",Je[e].statusInProgress),statusCompleted:r("--theme-success",Je[e].statusCompleted),hoverBg:r("--theme-bg-hover",Je[e].hoverBg),focusRing:r("--theme-accent-primary",Je[e].focusRing)}}var Nn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},ac={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ii={en:Nn,es:ac};function rc(e){return ii[e]||ii.en}function li(e,t){let a=rc(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 yo=react.createContext(Nn);function Lr(){return react.useContext(yo)}function Rf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,u]=react.useState(false),[i,g]=react.useState(null),d=react.useRef(null),f=Lr();if(react.useEffect(()=>{let c=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let T=[{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(c=>c.handler),N=async(c,C)=>{if(C){g(c);try{await C();}catch(m){console.error(`Export ${c} failed:`,m);}finally{g(null),u(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#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:f.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&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:T.map((c,C)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>N(c.id,c.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:C<T.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.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:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function $f({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 Of({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 zf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=g=>{s.current&&!s.current.contains(g.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=p.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"}: ${u}`,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:p.map((i,g)=>{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:g<p.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:g*.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 Uf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Lr();react.useEffect(()=>{let i=g=>{s.current&&!s.current.contains(g.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],u=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:u||r?e.accentLight:e.bgSecondary,border:`1px solid ${u||r?e.accent:e.borderLight}`,color:u||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),u&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&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-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,g)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),u&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function Sn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:g=false,createTaskLabel:d,onCreateTask:f,taskFilter:b="all",onTaskFilterChange:T,onExportPNG:N,onExportPDF:c,onExportExcel:C,onExportCSV:m,onExportJSON:l,onExportMSProject:v}){let S=Lr(),y=N||c||C||m||l||v,w=[{value:"day",label:S.toolbar.day},{value:"week",label:S.toolbar.week},{value:"month",label:S.toolbar.month}],x=[{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(Of,{options:w,value:t,onChange:B=>a(B),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(zf,{theme:e,value:p,onChange:u}),T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Uf,{theme:e,value:b,onChange:T})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:f,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||S.toolbar.createTask})]}),(y||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rf,{theme:e,onExportPNG:N,onExportPDF:c,onExportExcel:C,onExportCSV:m,onExportJSON:l,onExportMSProject:v}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx($f,{options:x,value:s,onChange:B=>n(B),theme:e})]})]})}function En({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(!r)return;let g=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]);let i=e.filter(g=>g.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let g=u.current.getBoundingClientRect();n({x:g.left,y:g.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(mt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,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(g=>jsxRuntime.jsxs("button",{onClick:()=>{t(g.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:g.label}),g.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},g.id))]})})})})]})}function vo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,u]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let g=200,d=r.length*36+8,f=8,b=window.innerWidth,T=window.innerHeight,N=t,c=a;t+g+f>b&&(N=t-g,N<f&&(N=f)),a+d+f>T&&(c=T-d-f,c<f&&(c=f)),u({x:N,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let g=f=>{n.current&&!n.current.contains(f.target)&&o();},d=f=>{f.key==="Escape"&&o();};return document.addEventListener("mousedown",g),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=g=>g.startsWith("#")&&(g.length===7||g.length===4)?g: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:`${p.x}px`,top:`${p.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(g=>jsxRuntime.jsxs("div",{children:[g.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{g.disabled||(g.onClick(),o());},disabled:g.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:g.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:g.disabled?"not-allowed":"pointer",opacity:g.disabled?.5:1},onMouseEnter:d=>{g.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[g.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:g.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:g.label}),g.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},g.id))})})})}var $t={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 gc({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:g,onOpenTaskModal:d,enableKeyboard:f=true}){let b=react.useRef(false),T=react.useCallback(l=>{b.current=l;},[]),N=react.useCallback(l=>{let v=[],S=y=>{for(let w of y)v.push(w),w.subtasks&&w.subtasks.length>0&&w.isExpanded&&S(w.subtasks);};return S(l),v},[]),c=react.useCallback(()=>{let l=N(e);for(let v of l)if(t.has(v.id))return v;return null},[e,t,N]),C=react.useCallback((l,v)=>{let S=N(e);if(S.length===0)return;let y=c();if(!y){a(S[0].id,false);return}let w=S.findIndex(D=>D.id===y.id);if(w===-1)return;let x=l==="up"?w-1:w+1;if(x<0||x>=S.length)return;let B=S[x];a(B.id,v);},[e,c,N,a]),m=react.useCallback(l=>{if(!f)return;let v=l.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||b.current){l.key==="Escape"&&(v.blur(),b.current=false);return}let w=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,x=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),C("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),C("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&g(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){x.length>0&&(l.preventDefault(),n(x,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){x.length>0&&(l.preventDefault(),p(x));return}if(l.key==="Tab"&&l.shiftKey){x.length>0&&(l.preventDefault(),u(x));return}if(l.key==="Enter"&&!l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&w){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&w){x.length>0&&(l.preventDefault(),o(x));return}if(l.key==="d"&&w&&!l.shiftKey){x.length>0&&(l.preventDefault(),s(x));return}},[f,t,c,C,r,o,s,n,p,u,i,g,d]);return react.useEffect(()=>{if(f)return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[f,m]),{setIsEditing:T}}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(f=>{let b=new Set(f);return b.has(d)?b.delete(d):b.add(d),b}),r(d);},[]),n=react.useCallback((d,f)=>{if(!a){o(d);return}let b=f.indexOf(a),T=f.indexOf(d);if(b===-1||T===-1){o(d);return}let N=Math.min(b,T),c=Math.max(b,T),C=f.slice(N,c+1);t(new Set(C)),r(d);},[a,o]),p=react.useCallback((d,f,b,T)=>{T?n(d,f):b?s(d):o(d);},[o,s,n]),u=react.useCallback((d,f)=>{f?t(b=>{let T=new Set(b);return T.add(d),T}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),g=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:g}}function xo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function bc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=bc(a.subtasks,t);if(r)return r}}return null}function gi(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=gi(a.subtasks,t);if(r)return r}return null}function fi(e,t){if(t.length===0)return e;let a=xo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,f)=>{let b=[];return {tasks:d.filter(N=>{if(f.has(N.id))return b.push(N),false;if(N.subtasks){let c=n(N.subtasks,f);N.subtasks=c.tasks,b.push(...c.removed);}return true}),removed:b}},p=(d,f,b)=>d.map(T=>T.id===f?{...T,subtasks:[...T.subtasks||[],...b],isExpanded:true}:T.subtasks?{...T,subtasks:p(T.subtasks,f,b)}:T),u=new Set(t),{tasks:i,removed:g}=n(e,u);return p(i,s.id,g)}function hi(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=gi(a,r);if(!o)continue;let s=gi(a,o.id),n=(i,g,d)=>{for(let f=0;f<i.length;f++){let b=i[f];if(b.id===g&&b.subtasks){let T=b.subtasks.findIndex(N=>N.id===d);if(T!==-1){let[N]=b.subtasks.splice(T,1);return N}}if(b.subtasks){let T=n(b.subtasks,g,d);if(T)return T}}return null},p=(i,g,d)=>{let f=i.findIndex(b=>b.id===g);if(f!==-1)return i.splice(f+1,0,d),i;for(let b of i)b.subtasks&&p(b.subtasks,g,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?p(s.subtasks,o.id,u):p(a,o.id,u));}return a}function bi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,u)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,u))return true;return false}let g=u==="up"?i-1:i+1;return g<0||g>=n.length?false:([n[i],n[g]]=[n[g],n[i]],true)};return s(r,o,a),r}function yi(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 vi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(g=>g.id===r);if(p===-1){for(let g of n)if(g.subtasks&&o(g.subtasks))return true;return false}let u=n[p],i={...u,id:`${u.id}-copy-${Date.now()}`,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function yc(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"},p=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&p(d.subtasks))return true;return false}let g=a==="above"?i:i+1;return u.splice(g,0,n),true};return p(r),{tasks:r,newTask:n}}function xi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:xi(r.subtasks,t,a)}:r)}function ki(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ki(a.subtasks,t)}:a)}function wi(e,t){let a=g=>{for(let d of g){if(d.id===t)return d;if(d.subtasks){let f=a(d.subtasks);if(f)return f}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=g=>g.map(d=>{if(d.id===t){let f=d.subtasks||[];return {...d,subtasks:[...f,u],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:u}}function vc(e,t,a,r){if(t===a)return e;let o=bc(e,t);if(!o)return e;if(a){let p=(u,i)=>{if(!u.subtasks)return false;for(let g of u.subtasks)if(g.id===i||p(g,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(u=>u.id!==t).map(u=>u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=u=>u.map(i=>{if(i.id===a){let g=i.subtasks||[],d=r!==void 0?r:g.length,f=[...g];return f.splice(d,0,{...o,parentId:a}),{...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function An({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:u,scrollTop:i,columns:g,onToggleColumn:d,onColumnResize:f,onTaskUpdate:b,onTaskIndent:T,onTaskOutdent:N,onTaskMove:c,onMultiTaskDelete:C,onTaskDuplicate:m,onTaskCreate:l,onTaskRename:v,onCreateSubtask:S,onOpenTaskModal:y,onDeleteRequest:w,onTaskReparent:x}){let B=react.useContext(yo),[D,k]=react.useState(null),[$,R]=react.useState(null),[j,ee]=react.useState(""),ae=react.useRef(null),[re,fe]=react.useState(null),[ge,Me]=react.useState(0),[I,O]=react.useState(0),[E,Q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Y,G]=react.useState(null),[me,pe]=react.useState(null),[Fe,Ve]=react.useState(null),dt=react.useRef(0),se=5,_e=react.useRef(false),[xt,zt]=react.useState(null),[ct,U]=react.useState(false),[ie,Pe]=react.useState(null),[Se,Xe]=react.useState(false),Ge=react.useRef(null);react.useEffect(()=>{function z(_){Ge.current&&!Ge.current.contains(_.target)&&Xe(false);}if(Se)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[Se]),react.useEffect(()=>{$&&ae.current&&(ae.current.focus(),ae.current.select());},[$]),react.useEffect(()=>{if(!re)return;let z=he=>{let Le=he.clientX-ge,ze=I+Le;f?.(re,ze);},_=()=>{fe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",_),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",_),document.body.style.cursor="",document.body.style.userSelect="";}},[re,ge,I,f]);let{selectedTaskIds:Dt,handleTaskClick:Ie,isTaskSelected:sa}=hc(),{setIsEditing:Zt}=gc({tasks:e,selectedTaskIds:Dt,onTaskSelect:(z,_)=>{let Le=xo(e).map(ze=>ze.id);Ie(z,Le,_||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:C||(()=>{}),onTaskDuplicate:m||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:T||(()=>{}),onTaskOutdent:N||(()=>{}),onTaskRename:z=>{let _=xo(e).find(he=>he.id===z);_&&Ue(_);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:z=>{let _=xo(e).find(he=>he.id===z);_&&y&&y(_);},enableKeyboard:true}),At=(z,_=0)=>{let he=[];for(let Le of z)he.push({task:Le,level:_}),Le.subtasks&&Le.subtasks.length>0&&Le.isExpanded&&he.push(...At(Le.subtasks,_+1));return he},gt=At(e),ea=48,Xt=Math.max(gt.length*a,600-ea),Te=z=>!z.startDate||!z.endDate?"-":`${Math.ceil((z.endDate.getTime()-z.startDate.getTime())/(1e3*60*60*24))}d`,Ue=z=>{R(z.id),ee(z.name),Zt(true);},ga=z=>{j.trim()&&j!==e.find(_=>_.id===z)?.name&&v?.(z,j.trim()),R(null),ee(""),Zt(false);},je=()=>{R(null),ee(""),Zt(false);},He=(z,_)=>{_.stopPropagation(),S?.(z.id);},L=(z,_)=>{_.preventDefault(),dt.current=_.clientY,G(z),_e.current=false,U(false),zt({x:_.clientX,y:_.clientY});},ke=z=>{if(!Y||(Math.abs(z.clientY-dt.current)>se&&!_e.current&&(_e.current=true,U(true)),zt({x:z.clientX,y:z.clientY}),!_e.current))return;let he=document.querySelectorAll("[data-task-row]"),Le=null,ze=null;he.forEach(H=>{let ne=H.getBoundingClientRect(),Oe=H.getAttribute("data-task-row");if(Oe&&Oe!==Y&&z.clientY>=ne.top&&z.clientY<=ne.bottom){Le=Oe;let St=z.clientY-ne.top,et=ne.height;St<et*.25?ze="above":St>et*.75?ze="below":ze="child";}}),pe(Le),Ve(ze);},q=()=>{if(_e.current&&Y&&me&&Fe){if(Fe==="child")x?.(Y,me);else if(Fe==="above"||Fe==="below"){let z=(Le,ze,H=null)=>{for(let ne of Le){if(ne.id===ze)return H;if(ne.subtasks){let Oe=z(ne.subtasks,ze,ne.id);if(Oe!==void 0)return Oe}}},_=z(e,me,null),he=(Le,ze)=>{let H=Le.findIndex(ne=>ne.id===ze);return Fe==="below"?H+1:H};if(_===null){let Le=he(e,me);x?.(Y,null,Le);}else {let Le=gt.find(ze=>ze.task.id===_)?.task;if(Le?.subtasks){let ze=he(Le.subtasks,me);x?.(Y,_,ze);}}}}G(null),pe(null),Ve(null),zt(null),_e.current=false,U(false);};react.useEffect(()=>{if(Y)return document.addEventListener("mousemove",ke),document.addEventListener("mouseup",q),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,me,Fe]);let ve=(z,_,he)=>{switch(z.id){case "name":let Le=$===_.id,ze=D===_.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${he*20}px`},children:[x&&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:J=>L(_.id,J),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),_.subtasks&&_.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),u?.(_.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:_.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:_.color||"#3B82F6",opacity:_.parentId?.6:1,borderColor:_.isMilestone?t.accent:"transparent",borderWidth:_.isMilestone?"2px":"0px"},title:_.isMilestone?"Milestone":_.parentId?"Subtask":"Task"})}),Le?jsxRuntime.jsx("input",{ref:ae,type:"text",value:j,onChange:J=>ee(J.target.value),onKeyDown:J=>{J.key==="Enter"?ga(_.id):J.key==="Escape"&&je();},onBlur:()=>ga(_.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:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:_.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:_.parentId?"13px":"14px",fontWeight:_.isMilestone?600:_.parentId?400:600,letterSpacing:_.parentId?"0":"-0.01em"},title:_.name,children:_.name}),ze&&!Le&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>He(_,J),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:J=>{J.stopPropagation(),Ue(_);},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 ne=z.id==="startDate"?"startDate":"endDate",Oe=_[ne],St=ie?.taskId===_.id&&ie?.field===ne,et=J=>J?(typeof J=="string"?new Date(J):J).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:J=>J.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:J=>{if(St)Pe(null);else {let Be=J.currentTarget.getBoundingClientRect();Pe({taskId:_.id,field:ne,month:Oe?typeof Oe=="string"?new Date(Oe):Oe:new Date,position:{top:Be.bottom+4,left:Be.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:et(Oe)})]}),St&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Pe(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:ie?.position.top,left:ie?.position.left},onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let J=new Date,Be=new Date(J);Be.setDate(J.getDate()+1);let ot=new Date(J);ot.setDate(J.getDate()+7);let oe=new Date(J);return oe.setDate(J.getDate()+14),[{label:"Hoy",date:J},{label:"Ma\xF1ana",date:Be},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:oe}].map((kt,$e)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ft=>Ft.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ft=>Ft.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(_.id,{[ne]:kt.date}),Pe(null);},children:kt.label},$e))})(),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:J=>J.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{b?.(_.id,{[ne]:void 0}),Pe(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:()=>Pe(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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:ie?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Pe(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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((J,Be)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:J},Be))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=ie?.month||new Date,Be=J.getFullYear(),ot=J.getMonth(),oe=new Date(Be,ot,1).getDay(),We=new Date(Be,ot+1,0).getDate(),kt=new Date,$e=[];for(let st=oe-1;st>=0;st--)$e.push({day:new Date(Be,ot,-st).getDate(),date:new Date(Be,ot-1,new Date(Be,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=We;st++)$e.push({day:st,date:new Date(Be,ot,st),isCurrentMonth:true});let Ft=42-$e.length;for(let st=1;st<=Ft;st++)$e.push({day:st,date:new Date(Be,ot+1,st),isCurrentMonth:false});return $e.map((st,ya)=>{let Ut=st.date.toDateString()===kt.toDateString(),wt=(Oe?typeof Oe=="string"?new Date(Oe):Oe:null)?.toDateString()===st.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:st.isCurrentMonth?wt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:wt?"#3B82F6":"transparent",boxShadow:Ut&&!wt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{b?.(_.id,{[ne]:st.date}),Pe(null);},children:st.day},ya)})})()})]})]})]}),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:Te(_)})});case "assignees":let fa=r.filter(J=>_.assignees?.some(Be=>Be.name===J.name||Be.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Gr,{assignedUsers:fa,availableUsers:r,onChange:J=>{let Be=J.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));b?.(_.id,{assignees:Be.length>0?Be:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(nd,{status:_.status||"todo",onChange:J=>{b?.(_.id,{status:J,progress:J==="completed"?100:_.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:`${_.progress}%`,backgroundColor:_.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:[_.progress,"%"]})]});case "priority":let ba={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},P={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},xe=ba[_.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Hr,{priority:xe,onChange:J=>{J&&b?.(_.id,{priority:P[J]||"medium"});}})});default:return null}},ye=z=>[{id:"hide",label:"Hide Column",icon:$t.Hide,onClick:()=>d(z),disabled:z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:$t.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:$t.SortDesc,onClick:()=>{}}],Re=z=>z.subtasks&&z.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{S?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{w?w(z.id,z.name):C?.([z.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{n?.(z);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{S?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{b?.(z.id,{status:"todo",progress:0});},disabled:z.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{b?.(z.id,{status:"in-progress"});},disabled:z.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{b?.(z.id,{status:"completed",progress:100});},disabled:z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{w?w(z.id,z.name):C?.([z.id]);}}],Ae=g.filter(z=>z.visible),rt=Ae.reduce((z,_)=>z+_.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ea}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:Ae.map((z,_)=>{let he=_===Ae.length-1,Le=z.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Le?"":"justify-center"}`,style:{width:`${z.width}px`,minWidth:`${z.minWidth??(Le?200:60)}px`,maxWidth:`${z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:he?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),Q({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:z.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:z.label,children:z.label}),z.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:re===z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),fe(z.id),Me(ze.clientX),O(z.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"}})})]},z.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(En,{columns:g,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Xe(!Se),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"})}),Se&&jsxRuntime.jsxs("div",{ref:Ge,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:z=>z.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:()=>Xe(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:Xt},children:gt.map(({task:z,level:_},he)=>{let Le=sa(z.id),ze=me===z.id,H=ze&&Fe==="above",ne=ze&&Fe==="below",Oe=ze&&Fe==="child",St={};return Oe&&(St.backgroundColor=`${t.accent}15`,St.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":z.id,className:`flex items-center cursor-pointer group ${Y===z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Le?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Le?t.accentLight:Oe?`${t.accent}15`:he%2===0?t.bgPrimary:t.bgGrid,...St},onMouseEnter:()=>k(z.id),onMouseLeave:()=>k(null),onClick:et=>{let ba=xo(e).map(J=>J.id),xe=navigator.platform.toUpperCase().indexOf("MAC")>=0?et.metaKey:et.ctrlKey;Ie(z.id,ba,xe,et.shiftKey),s?.(z);},onDoubleClick:et=>{et.stopPropagation(),n?.(z);},onContextMenu:et=>{et.preventDefault(),Q({isOpen:true,x:et.clientX,y:et.clientY,type:"task",task:z}),p?.(z,et);},whileHover:{backgroundColor:Le?t.accentLight:t.hoverBg},children:[H&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ne&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((et,fa)=>{let ba=fa===Ae.length-1,P=et.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${et.width}px`,minWidth:`${et.minWidth??(P?200:60)}px`,maxWidth:`${et.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ba?"none":`1px solid ${D===z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ve(et,z,P?_:0)},`${z.id}-${et.id}`)})]},z.id)})}),jsxRuntime.jsx(vo,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?ye(E.columnId):E.type==="task"&&E.task?Re(E.task):[],onClose:()=>Q({...E,isOpen:false}),theme:t}),ct&&xt&&Y&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:xt.x+12,top:xt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let z=gt.find(_=>_.task.id===Y)?.task;return z?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:z.name})}):null})()}),document.body)]})}function Tc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[u,i]=react.useState(t),[g,d]=react.useState(null),[f,b]=react.useState(null),[T,N]=react.useState(null),[c,C]=react.useState(null),[m,l]=react.useState(0),[v,S]=react.useState(0),[y,w]=react.useState(null),[x,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:u,setGhostWidth:i,connectionLine:g,setConnectionLine:d,hoveredTaskId:f,setHoveredTaskId:b,activeZone:T,setActiveZone:N,draggedSegmentIndex:c,setDraggedSegmentIndex:C,draggedSegmentStartX:m,setDraggedSegmentStartX:l,segmentDragOffsetX:v,setSegmentDragOffsetX:S,hoveredSegmentIndex:y,setHoveredSegmentIndex:w,isHovered:x,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(j,ee)=>{r("none"),d(null),b(null),p(j),i(ee),S(0),C(null),l(0);}}}function In({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:u,onDoubleClick:i,onContextMenu:g,onDateChange:d,onDependencyCreate:f,allTaskPositions:b=[],onDragMove:T,onHoverChange:N}){let c=Tc(t,r),C=react.useRef(null),m=react.useRef(null),l=react.useRef(null),{dragMode:v,setDragMode:S,dragOffset:y,setDragOffset:w,ghostX:x,setGhostX:B,ghostWidth:D,setGhostWidth:k,connectionLine:$,setConnectionLine:R,hoveredTaskId:j,setHoveredTaskId:ee,activeZone:ae,setActiveZone:re,draggedSegmentIndex:fe,setDraggedSegmentIndex:ge,draggedSegmentStartX:Me,setDraggedSegmentStartX:I,segmentDragOffsetX:O,setSegmentDragOffsetX:E,hoveredSegmentIndex:Q,setHoveredSegmentIndex:Y,isHovered:G,setIsHovered:me,isDragging:pe,isResizing:Fe,isConnecting:Ve,resetDragState:dt}=c,se=32,_e=8,xt=e.endDate&&e.endDate<new Date&&e.progress<100,zt=e.isCriticalPath,ct=o.name==="neutral"||o.today==="#1C1917",U=e.status==="completed"||e.progress===100,ie={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Se=e.isCriticalPath||xt?"#DC2626":e.color?e.color:e.priority&&ie[e.priority]?ie[e.priority]:o.taskBarPrimary,Ge=(q=>q>=80?20:q>=60?15:q>=50?12:10)(r),Dt=r<50,Ie=r<40;react.useEffect(()=>{if(N)if(G&&!pe&&!e.segments){let q=a<100;N({task:e,x:t,y:a,width:r,height:se,showBelow:q});}else N(null);},[G,pe,e,t,a,r,se,N]);let sa=q=>q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Zt=()=>{let q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${q} day${q!==1?"s":""}`},At=q=>Math.round(q/s)*s,gt=q=>{let ve=Math.round(q/s),ye=new Date(n);return ye.setDate(ye.getDate()+ve),ye},ea=(q,ve)=>{for(let ye of b){if(ye.id===e.id)continue;let Re=5;if(q>=ye.x-Re&&q<=ye.x+ye.width+Re&&ve>=ye.y-Re&&ve<=ye.y+ye.height+Re)return ye.id}return null},Xt=react.useCallback((q,ve,ye)=>{q.preventDefault(),q.stopPropagation();let Re=C.current?.ownerSVGElement;if(!Re)return;let Ae=Re.createSVGPoint();Ae.x=q.clientX,Ae.y=q.clientY;let rt=Ae.matrixTransform(Re.getScreenCTM()?.inverse()),z=ye!==void 0?ye:t,_=ve;if(!_){let he=rt.x-z;q.shiftKey?(_="connect",R({x:t+r,y:a+se/2})):q.ctrlKey||q.metaKey?_="move":q.altKey?_=he<r/2?"resize-start":"resize-end":Ie?he<r/2?_="move":_="resize-end":Dt?he<=Ge/2?_="resize-start":he>=r-Ge/2?_="resize-end":_="move":he<=Ge?_="resize-start":he>=r-Ge?_="resize-end":_="move";}S(_),me(false),re(null),_==="move"?w(rt.x-z):_==="connect"?R({x:t+r,y:a+se/2}):w(0),B(z),k(r);},[t,r,a,se]),Te=react.useCallback(q=>{let ve=C.current?.ownerSVGElement;if(!ve)return;let ye=ve.closest(".gantt-timeline-scroll");if(!ye)return;let Re=ye.getBoundingClientRect(),Ae=60,rt=15,z=0;if(q.clientX<Re.left+Ae){let _=Re.left+Ae-q.clientX;z=-Math.min(rt,_/2);}else if(q.clientX>Re.right-Ae){let _=q.clientX-(Re.right-Ae);z=Math.min(rt,_/2);}return z!==0&&(ye.scrollLeft+=z),z!==0},[]),Ue=react.useCallback(q=>{if(v==="none")return;l.current=q;let ve=C.current?.ownerSVGElement;if(!ve)return;if(v==="move"||v==="resize-start"||v==="resize-end"){let Ae=Te(q);Ae&&!m.current?m.current=window.setInterval(()=>{l.current&&(Te(l.current),Ue(l.current));},16):!Ae&&m.current&&(window.clearInterval(m.current),m.current=null);}let ye=ve.createSVGPoint();ye.x=q.clientX,ye.y=q.clientY;let Re=ye.matrixTransform(ve.getScreenCTM()?.inverse());if(v==="connect"){R({x:Re.x,y:Re.y});let Ae=ea(Re.x,Re.y);ee(Ae);}else if(v==="move"){let Ae=Re.x-y,rt=At(Ae);B(rt),k(r);let z=Math.round((rt-t)/s);if(T?.(e.id,z,true),e.segments&&e.segments.length>0&&fe!==null){let _=rt-Me;E(_);}}else if(v==="resize-start"){let Ae=Re.x,rt=At(Ae),z=t+r-rt;z>=s&&(B(rt),k(z));}else if(v==="resize-end"){let Ae=Re.x,z=At(Ae)-t;z>=s&&k(z);}},[v,t,r,s,y,e,At,fe,Me,ea,ee,R,B,k,E,T,Te]),ga=react.useCallback(()=>{if(m.current&&(window.clearInterval(m.current),m.current=null),l.current=null,v!=="none"){if(v==="connect")j&&f&&f(e,j),R(null),ee(null);else {let q=e.endDate.getTime()-e.startDate.getTime(),ve,ye,Re=true;if(v==="move"){if(ve=gt(x),ye=new Date(ve.getTime()+q),e.segments&&e.segments.length>0&&fe!==null){let Ae=Math.round(O/s),rt=e.segments.map((Le,ze)=>{if(ze===fe){let H=new Date(Le.startDate),ne=new Date(Le.endDate);return H.setDate(H.getDate()+Ae),ne.setDate(ne.getDate()+Ae),{startDate:H,endDate:ne}}return Le}),z=rt.flatMap(Le=>[Le.startDate,Le.endDate]),_=new Date(Math.min(...z.map(Le=>Le.getTime()))),he=new Date(Math.max(...z.map(Le=>Le.getTime())));d?.({...e,segments:rt},_,he),dt(t,r);return}}else v==="resize-start"?(ve=gt(x),ye=e.endDate,ve>ye&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):v==="resize-end"?(ve=e.startDate,ye=gt(x+D),ye<ve&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&ve&&ye&&(ye.getTime()<ve.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ve,ye));}T?.(e.id,0,false),dt(t,r);}},[v,x,D,e,d,j,f,t,r,s,gt,O,fe,dt,T]);react.useEffect(()=>{if(v==="none")return;let q=ye=>{Ue(ye);},ve=()=>{ga();};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",ve),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",ve),m.current&&(window.clearInterval(m.current),m.current=null);}},[v,Ue,ga]);let je=pe&&!Ve?x:t,He=pe&&!Ve?D:r,L=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:C,"data-task-bar":"true",onClick:()=>!pe&&u?.(e),onDoubleClick:q=>{pe||(q.stopPropagation(),i?.(e));},onContextMenu:q=>{q.preventDefault(),g?.(e,q);},onMouseEnter:()=>!pe&&me(true),onMouseLeave:()=>{pe||(me(false),re(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:se,fill:"transparent",style:{pointerEvents:"all"}}),G&&!pe&&!Dt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ge,height:se,fill:ae==="resize-start"?o.accent:"transparent",opacity:ae==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-start"),onMouseDown:q=>Xt(q,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ge,y:a,width:r-Ge*2,height:se,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:q=>Xt(q,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ge,y:a,width:Ge,height:se,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:q=>Xt(q,"resize-end")})]}),G&&!pe&&Ie&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:se,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>re("move"),onMouseDown:q=>Xt(q,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:se,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>re("resize-end"),onMouseDown:q=>Xt(q,"resize-end")}),G&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+se-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!Ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x,y:a,width:D,height:se,rx:_e,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:je,y:a,width:He,height:se,rx:_e,fill:Se,"data-task-class":L,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!Ve?.15:e.parentId?.6:G?.9:.8,scale:G&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>Xt(q),style:{cursor:pe?Ve?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:je,y:a,width:He*(e.progress/100),height:se,rx:_e,fill:Se,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((q,ve)=>{let ye=(q.startDate.getTime()-n.getTime())/864e5*s,Ae=(q.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-ye+s,rt=pe&&v==="move"&&fe===ve,z=Q===ve,_=rt?ye+O:ye;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!pe&&Y(ve),onMouseLeave:()=>!pe&&Y(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:_,y:a,width:Ae,height:se,rx:_e,fill:Se,initial:{opacity:0,scale:.95},animate:{opacity:rt||e.parentId?.6:z?.9:.8,scale:z&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:he=>{he.stopPropagation(),ge(ve),I(ye),Xt(he,void 0,ye);},style:{cursor:pe?Ve?"crosshair":Fe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:_,y:a,width:Ae*(e.progress/100),height:se,rx:_e,fill:Se,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ve}`)}),ct&&(xt||zt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[zt&&!xt&&jsxRuntime.jsx("rect",{x:je,y:a,width:He,height:se,rx:_e,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),xt&&jsxRuntime.jsx("rect",{x:je,y:a,width:He,height:se,rx:_e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),He>60&&!e.segments&&(()=>{let q=p.taskLabel(e),ve=typeof q=="string"?q:e.name,ye=ve.length>Math.floor(He/8)?`${ve.substring(0,Math.floor(He/8))}...`:ve;return jsxRuntime.jsx("text",{x:je+12,y:a+se/2,dominantBaseline:"middle",fill:U?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:U?"line-through":"none"},children:ye})})(),He>100&&e.progress>0&&e.progress<100&&!pe&&!e.segments&&jsxRuntime.jsxs("text",{x:je+He-12,y:a+se/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&&He>80&&!pe&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:je+He-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:je+He-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(G||Fe)&&!Ve&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:je-2,y:a,width:16,height:se,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-start"),onMouseLeave:()=>re(null),onMouseDown:q=>{q.stopPropagation(),Xt(q,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je+4,y:a+8,width:3,height:se-16,rx:1.5,fill:ae==="resize-start"||v==="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:je+He-14,y:a,width:16,height:se,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>re("resize-end"),onMouseLeave:()=>re(null),onMouseDown:q=>{q.stopPropagation(),Xt(q,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:je+He-7,y:a+8,width:3,height:se-16,rx:1.5,fill:ae==="resize-end"||v==="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:G&&!pe&&!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+se/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>re("connect"),onMouseLeave:()=>re(null),onMouseDown:q=>{q.stopPropagation(),Xt(q,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+se/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ae==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Ve&&$&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+se/2,x2:$.x,y2:$.y,stroke:j?o.statusCompleted:o.accent,strokeWidth:j?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:j?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:$.x,cy:$.y,r:j?8:6,fill:j?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),j&&jsxRuntime.jsx(framerMotion.motion.text,{x:$.x+15,y:$.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:$.x+10},animate:{opacity:1,x:$.x+15},transition:{duration:.2},children:"Connect"})]}),(G||pe)&&!Ve&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:je-2,y:a-2,width:He+4,height:se+4,rx:_e+2,fill:"none",stroke:pe?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:pe?.6:.4,initial:{opacity:0},animate:{opacity:pe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Fe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:x,y1:0,x2:x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:x+D,y1:0,x2:x+D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&!pe&&!e.segments&&!N&&(()=>{let ye=a<100,Re=ye?a+se+13:a-82-13,Ae=ye?`M ${je+He/2-6} ${a+se+3} L ${je+He/2} ${a+se+13} L ${je+He/2+6} ${a+se+3}`:`M ${je+He/2-6} ${a-13} L ${je+He/2} ${a-3} L ${je+He/2+6} ${a-13}`,rt=Re+22,z=Re+40,_=Re+55,he=Re+70,Le=ye?Re+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ye?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ye?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ae,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:je+He/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:je+He/2,y:rt,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:je+He/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:je+He/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:sa(e.startDate)}),jsxRuntime.jsx("text",{x:je+He/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:je+He/2-70,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:sa(e.endDate)}),jsxRuntime.jsx("text",{x:je+He/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:je+He/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Zt()}),jsxRuntime.jsx("text",{x:je+He/2+10,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:je+He/2+65,y:_,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:je+He/2-110,y:he,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:je+He/2-50,y:he,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?"...":""]})]}),!ye&&jsxRuntime.jsx("text",{x:je+He/2,y:Le,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ie?"Left: move \u2022 Right: resize":Dt?"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 Sc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,u=82,i=13,g=p?o+n+i:o-u-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,f=g+22,b=g+40,T=g+55,N=g+70,c=v=>v.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=()=>{if(!a.startDate||!a.endDate)return "N/A";let v=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${v} day${v!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-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:g,width:240,height:u,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:f,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:T,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:N,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:N,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(v=>v.name).join(", ").substring(0,30),a.assignees.map(v=>v.name).join(", ").length>30?"...":""]})]})]})})}function Rn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[u,i]=react.useState(false),[g,d]=react.useState(null),f=r-t,b=f>0,T=Math.abs(f)<5,c=5,C=20,m=!T&&a<=e,l,v;if(T)if(v=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let ae=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+ae} ${t}, ${a-ae} ${r}, ${a} ${r}`;}else if(v=a-C,m){let re=e+15,fe=a-C,ge=b?t+20:t-20;v=fe,n==="squared"?l=`M ${e} ${t} L ${re} ${t} L ${re} ${ge} L ${fe} ${ge} L ${fe} ${r} L ${a} ${r}`:b?l=`M ${e} ${t} L ${re-c} ${t} Q ${re} ${t} ${re} ${t+c} L ${re} ${ge-c} Q ${re} ${ge} ${re-c} ${ge} L ${fe+c} ${ge} Q ${fe} ${ge} ${fe} ${ge+c} L ${fe} ${r-c} Q ${fe} ${r} ${fe+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${re-c} ${t} Q ${re} ${t} ${re} ${t-c} L ${re} ${ge+c} Q ${re} ${ge} ${re-c} ${ge} L ${fe+c} ${ge} Q ${fe} ${ge} ${fe} ${ge-c} L ${fe} ${r+c} Q ${fe} ${r} ${fe+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${v} ${t} L ${v} ${r} L ${a} ${r}`:b?l=`M ${e} ${t} L ${v-c} ${t} Q ${v} ${t} ${v} ${t+c} L ${v} ${r-c} Q ${v} ${r} ${v+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${v-c} ${t} Q ${v} ${t} ${v} ${t-c} L ${v} ${r+c} Q ${v} ${r} ${v+c} ${r} L ${a} ${r}`;let S=5,y=`M ${a} ${r} L ${a-S} ${r-S*.5} M ${a} ${r} L ${a-S} ${r+S*.5}`,w=o.dependency,x=o.dependencyHover||w,B="#f87171",D="rgba(248, 113, 113, 0.15)",k=v,$=(t+r)/2;if(g)if(T)k=Math.max(e+10,Math.min(a-10,g.x)),$=t;else if(m){let ae=e+15,re=a-C,fe=b?t+20:t-20,ge=[[e,t,ae,t],[ae,t,ae,fe],[ae,fe,re,fe],[re,fe,re,r],[re,r,a,r]],Me=1/0,I={x:k,y:$};for(let O of ge){let E=R(g.x,g.y,O[0],O[1],O[2],O[3]),Q=Math.hypot(g.x-E.x,g.y-E.y);Q<Me&&(Me=Q,I=E);}k=I.x,$=I.y;}else {let ae=[[e,t,v,t],[v,t,v,r],[v,r,a,r]],re=1/0,fe={x:k,y:$};for(let ge of ae){let Me=R(g.x,g.y,ge[0],ge[1],ge[2],ge[3]),I=Math.hypot(g.x-Me.x,g.y-Me.y);I<re&&(re=I,fe=Me);}k=fe.x,$=fe.y;}function R(ae,re,fe,ge,Me,I){let O=Me-fe,E=I-ge,Q=O*O+E*E;if(Q===0)return {x:fe,y:ge};let Y=((ae-fe)*O+(re-ge)*E)/Q;return Y=Math.max(0,Math.min(1,Y)),{x:fe+Y*O,y:ge+Y*E}}let j=ae=>{let re=ae.currentTarget.ownerSVGElement;if(!re)return;let fe=re.getBoundingClientRect();d({x:ae.clientX-fe.left,y:ae.clientY-fe.top});},ee=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ee,onMouseMove:j,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:x,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:x,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:y,fill:"none",stroke:x,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:x,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:ae=>{ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:k,cy:$,r:9,fill:D,stroke:B,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:k-3,y1:$-3,x2:k+3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:k+3,y1:$-3,x2:k-3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ee,onMouseMove:j,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:u?x:w,strokeWidth:u?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:y,fill:"none",stroke:u?x:w,strokeWidth:u?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:u?4:3,fill:u?x:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),u&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ae=>{ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:k,cy:$,r:9,fill:D,stroke:B,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:k-3,y1:$-3,x2:k+3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:k+3,y1:$-3,x2:k-3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function On({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=16,u=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:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,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-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+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:u(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 ue={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(g=>{g.dependencies&&r.set(g.id,g.dependencies),g.subtasks&&o(g.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,u=i=>{if(!n.has(i)){n.add(i),p.add(i);let g=r.get(i)||[];for(let d of g){if(!n.has(d)&&u(d))return true;if(p.has(d))return true}}return p.delete(i),false};return u(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=ue.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ue.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ue.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=ue.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
112
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ue.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=ue.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)=>ue.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ue.findTaskById(e,t);return !a||!a.dependencies?[]:ue.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ue.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ue.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=ue.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=>ue.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=ue.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"]],p=s.map(u=>{let i=u.startDate&&u.endDate?ue.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?ue.formatDate(u.startDate):"N/A",u.endDate?ue.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:p,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=ue.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?ue.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?ue.formatDate(u.startDate):"","End Date":u.endDate?ue.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(g=>g.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.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 p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ue.flattenTasks(e),o=new Map;r.forEach((f,b)=>{o.set(f.id,b+1);});let s=f=>f.toISOString().replace("Z",""),n=ue.getEarliestStartDate(e)||new Date,p=ue.getLatestEndDate(e)||new Date,u=r.map((f,b)=>{let T=o.get(f.id),N=f.startDate&&f.endDate?ue.calculateDuration(f.startDate,f.endDate):0,c=(f.dependencies||[]).filter(C=>o.has(C)).map(C=>`
113
113
  <PredecessorLink>
114
- <PredecessorUID>${o.get(b)}</PredecessorUID>
114
+ <PredecessorUID>${o.get(C)}</PredecessorUID>
115
115
  <Type>1</Type>
116
116
  <CrossProject>0</CrossProject>
117
117
  <LinkLag>0</LinkLag>
118
118
  <LagFormat>7</LagFormat>
119
119
  </PredecessorLink>`).join("");return `
120
120
  <Task>
121
- <UID>${C}</UID>
122
- <ID>${h+1}</ID>
123
- <Name>${g.name.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
121
+ <UID>${T}</UID>
122
+ <ID>${b+1}</ID>
123
+ <Name>${f.name.replace(/[<>&'"]/g,C=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[C]||C)}</Name>
124
124
  <Type>0</Type>
125
125
  <IsNull>0</IsNull>
126
126
  <CreateDate>${s(new Date)}</CreateDate>
127
- <WBS>${h+1}</WBS>
128
- <OutlineNumber>${h+1}</OutlineNumber>
129
- <OutlineLevel>${g.level||0}</OutlineLevel>
127
+ <WBS>${b+1}</WBS>
128
+ <OutlineNumber>${b+1}</OutlineNumber>
129
+ <OutlineLevel>${f.level||0}</OutlineLevel>
130
130
  <Priority>500</Priority>
131
- <Start>${g.startDate?s(g.startDate):""}</Start>
132
- <Finish>${g.endDate?s(g.endDate):""}</Finish>
133
- <Duration>PT${T*8}H0M0S</Duration>
131
+ <Start>${f.startDate?s(f.startDate):""}</Start>
132
+ <Finish>${f.endDate?s(f.endDate):""}</Finish>
133
+ <Duration>PT${N*8}H0M0S</Duration>
134
134
  <DurationFormat>7</DurationFormat>
135
- <Work>PT${T*8}H0M0S</Work>
136
- <Stop>${g.endDate?s(g.endDate):""}</Stop>
137
- <Resume>${g.startDate?s(g.startDate):""}</Resume>
135
+ <Work>PT${N*8}H0M0S</Work>
136
+ <Stop>${f.endDate?s(f.endDate):""}</Stop>
137
+ <Resume>${f.startDate?s(f.startDate):""}</Resume>
138
138
  <ResumeValid>0</ResumeValid>
139
139
  <EffortDriven>1</EffortDriven>
140
140
  <Recurring>0</Recurring>
141
141
  <OverAllocated>0</OverAllocated>
142
142
  <Estimated>0</Estimated>
143
- <Milestone>${g.isMilestone?"1":"0"}</Milestone>
144
- <Summary>${g.subtasks&&g.subtasks.length>0?"1":"0"}</Summary>
145
- <Critical>${g.isCriticalPath?"1":"0"}</Critical>
143
+ <Milestone>${f.isMilestone?"1":"0"}</Milestone>
144
+ <Summary>${f.subtasks&&f.subtasks.length>0?"1":"0"}</Summary>
145
+ <Critical>${f.isCriticalPath?"1":"0"}</Critical>
146
146
  <IsSubproject>0</IsSubproject>
147
147
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
148
148
  <ExternalTask>0</ExternalTask>
149
- <EarlyStart>${g.startDate?s(g.startDate):""}</EarlyStart>
150
- <EarlyFinish>${g.endDate?s(g.endDate):""}</EarlyFinish>
151
- <LateStart>${g.startDate?s(g.startDate):""}</LateStart>
152
- <LateFinish>${g.endDate?s(g.endDate):""}</LateFinish>
149
+ <EarlyStart>${f.startDate?s(f.startDate):""}</EarlyStart>
150
+ <EarlyFinish>${f.endDate?s(f.endDate):""}</EarlyFinish>
151
+ <LateStart>${f.startDate?s(f.startDate):""}</LateStart>
152
+ <LateFinish>${f.endDate?s(f.endDate):""}</LateFinish>
153
153
  <StartVariance>0</StartVariance>
154
154
  <FinishVariance>0</FinishVariance>
155
155
  <WorkVariance>0</WorkVariance>
@@ -157,22 +157,22 @@
157
157
  <TotalSlack>0</TotalSlack>
158
158
  <FixedCost>0</FixedCost>
159
159
  <FixedCostAccrual>3</FixedCostAccrual>
160
- <PercentComplete>${g.progress}</PercentComplete>
161
- <PercentWorkComplete>${g.progress}</PercentWorkComplete>
160
+ <PercentComplete>${f.progress}</PercentComplete>
161
+ <PercentWorkComplete>${f.progress}</PercentWorkComplete>
162
162
  <Cost>0</Cost>
163
163
  <OvertimeCost>0</OvertimeCost>
164
164
  <OvertimeWork>PT0H0M0S</OvertimeWork>
165
- <ActualStart>${g.progress>0&&g.startDate?s(g.startDate):""}</ActualStart>
166
- <ActualFinish>${g.progress===100&&g.endDate?s(g.endDate):""}</ActualFinish>
167
- <ActualDuration>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualDuration>
165
+ <ActualStart>${f.progress>0&&f.startDate?s(f.startDate):""}</ActualStart>
166
+ <ActualFinish>${f.progress===100&&f.endDate?s(f.endDate):""}</ActualFinish>
167
+ <ActualDuration>PT${Math.round(N*f.progress/100)*8}H0M0S</ActualDuration>
168
168
  <ActualCost>0</ActualCost>
169
169
  <ActualOvertimeCost>0</ActualOvertimeCost>
170
- <ActualWork>PT${Math.round(T*g.progress/100)*8}H0M0S</ActualWork>
170
+ <ActualWork>PT${Math.round(N*f.progress/100)*8}H0M0S</ActualWork>
171
171
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
172
- <RegularWork>PT${T*8}H0M0S</RegularWork>
173
- <RemainingDuration>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingDuration>
172
+ <RegularWork>PT${N*8}H0M0S</RegularWork>
173
+ <RemainingDuration>PT${Math.round(N*(100-f.progress)/100)*8}H0M0S</RemainingDuration>
174
174
  <RemainingCost>0</RemainingCost>
175
- <RemainingWork>PT${Math.round(T*(100-g.progress)/100)*8}H0M0S</RemainingWork>
175
+ <RemainingWork>PT${Math.round(N*(100-f.progress)/100)*8}H0M0S</RemainingWork>
176
176
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
177
177
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
178
178
  <ACWP>0</ACWP>
@@ -195,8 +195,8 @@
195
195
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
196
196
  <Project xmlns="http://schemas.microsoft.com/project">
197
197
  <SaveVersion>14</SaveVersion>
198
- <Name>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Name>
199
- <Title>${t.replace(/[<>&'"]/g,g=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[g]||g)}</Title>
198
+ <Name>${t.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Name>
199
+ <Title>${t.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Title>
200
200
  <CreationDate>${s(new Date)}</CreationDate>
201
201
  <LastSaved>${s(new Date)}</LastSaved>
202
202
  <ScheduleFromStart>1</ScheduleFromStart>
@@ -337,11 +337,11 @@
337
337
  </WeekDays>
338
338
  </Calendar>
339
339
  </Calendars>
340
- <Tasks>${m}
340
+ <Tasks>${u}
341
341
  </Tasks>
342
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=pe.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 u=i.startDate&&i.endDate?pe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?pe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(pe.calculateCriticalPath(e).includes(t))return 0;let o=pe.getDependentTasks(e,t);if(o.length===0){let p=pe.getLatestEndDate(e);if(!p)return null;let m=pe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=pe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=pe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=pe.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=pe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=pe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=pe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=pe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let v=r.findIndex(N=>N.id===b.id);if(v===-1)continue;let l=b.startDate.getTime(),y=(b.endDate.getTime()-l)/u,w=(l-i)/u*s,k=w+C*s,R=Math.max(y*s,s),A=p+v*n+12;m.push({taskId:b.id,taskName:b.name,originalX:w,previewX:k,width:R,y:A,rowIndex:v,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=pe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function $n({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[v,l]=react.useState(null),x=react.useCallback($=>{l($);},[]),y=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),D=r==="day"?60:r==="week"?20:8,w=y*D*n,k=$=>{let Z=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),W=Z.getUTCDay()||7;Z.setUTCDate(Z.getUTCDate()+4-W);let G=new Date(Date.UTC(Z.getUTCFullYear(),0,1));return Math.ceil(((Z.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let Z=$.getDay();return Z===0||Z===6},A=react.useCallback($=>{let Z=Math.round($/(D*n)),W=new Date(o);return W.setDate(W.getDate()+Z),W},[o,D,n]),N=react.useCallback(($,Z)=>{if(Z.startDate&&Z.endDate)return;let W=$.currentTarget.ownerSVGElement;if(!W)return;let G=W.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let F=G.matrixTransform(W.getScreenCTM()?.inverse()),te=A(F.x),J=new Date(te);J.setDate(J.getDate()+1),g?.(Z,te,J);},[A,g]),I=react.useMemo(()=>{let $=F=>F.map(te=>{if(te.subtasks&&te.subtasks.length>0){let J=$(te.subtasks),V=J.filter(Se=>Se.startDate&&Se.endDate);if(V.length>0){let Se=V.map(ot=>ot.startDate.getTime()),ue=V.map(ot=>ot.endDate.getTime()),He=new Date(Math.min(...Se)),We=new Date(Math.max(...ue));return {...te,subtasks:J,startDate:He,endDate:We}}return {...te,subtasks:J}}return te}),Z=(F,te=[])=>{for(let J of F)te.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&Z(J.subtasks,te);return te},W=$(e);return Z(W)},[e]),B=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let Z=$.startDate.getTime(),W=$.endDate.getTime(),G=o.getTime(),F=(Z-G)/(1e3*60*60*24),te=(W-Z)/(1e3*60*60*24),J=F*D*n,V=Math.max(D*n,40),Se=Math.max(te*D*n,V);return {x:J,width:Se}},[o,D,n]),q=react.useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:Z,width:W}=B($),F=I.findIndex(te=>te.id===$.id)*a+12;return {id:$.id,x:Z,y:F,width:W,height:32}}),[I,B]),ne=react.useCallback(($,Z,W)=>{if(!W||Z===0){b([]);return}let G=pe.calculateCascadePreview(e,$,Z,I,o,D*n,a,48);b(G);},[e,I,o,D,n,a,48]),oe=react.useMemo(()=>{let $=[],Z=new Date(o);for(;Z<=s;){let F=(Z.getTime()-o.getTime())/864e5*D*n;if(r==="day")$.push({date:new Date(Z),label:Z.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:F}),Z.setDate(Z.getDate()+1);else if(r==="week"){let te=k(Z);$.push({date:new Date(Z),label:`Week ${te}`,x:F}),Z.setDate(Z.getDate()+7);}else $.push({date:new Date(Z),label:Z.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:F}),Z.setMonth(Z.getMonth()+1);}return $},[o,s,r,D,n]),re=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*D*n,[o,D,n]),fe=Math.max(I.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(w,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(w,1e3),height:48,fill:t.bgGrid}),oe.map(($,Z)=>jsxRuntime.jsxs("g",{children:[Z>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${Z}`)),re>=0&&re<=w&&jsxRuntime.jsx("circle",{cx:re,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(w,1e3),height:fe,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(w,1e3),height:fe,fill:t.bgPrimary}),oe.map(($,Z)=>{let W=oe[Z+1]?.x||w,G=R($.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:W-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),Z>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},Z)}),I.map(($,Z)=>{let W=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:Z*a,width:w,height:a,fill:Z%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:Z*a,width:w,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>N(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:re>0?re:100,y:Z*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,Z)=>{if(!$.startDate||!$.endDate)return null;let{x:W,width:G}=B($),F=Z*a+12,te=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(Bn,{task:$,x:W+G/2,y:F+16,theme:t,onClick:i},$.id):te?jsxRuntime.jsxs("g",{onClick:()=>i?.($),onContextMenu:J=>{J.preventDefault(),J.stopPropagation(),d?.($,J);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:W,y:F,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:W,y1:F,x2:W+G,y2:F,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:F,x2:W,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W+G,y1:F,x2:W+G,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:W,y1:F+32,x2:W+G,y2:F+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:W+12,y:F+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(Mn,{task:$,x:W,y:F,width:G,theme:t,dayWidth:D*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:q,onDragMove:ne,onHoverChange:x},$.id)}),I.map(($,Z)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(W=>{let G=I.find(We=>We.id===W);if(!G||!G.startDate||!G.endDate)return null;let F=I.findIndex(We=>We.id===W),te=B(G),J=B($),V=te.x+te.width,Se=F*a+28,ue=J.x,He=Z*a+28;return jsxRuntime.jsx(Ln,{x1:V,y1:Se,x2:ue,y2:He,theme:t,lineStyle:m,onDelete:()=>C?.($.id,W)},`dep-${W}-${$.id}`)})),c.map($=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsxRuntime.jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),re>=0&&re<=w&&jsxRuntime.jsx("line",{x1:re,y1:0,x2:re,y2:fe,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),v&&jsxRuntime.jsx(yc,{tooltipData:v,theme:t})]})]})}var h0=['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"'],wc=()=>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"})]}),b0=()=>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"})}),y0=()=>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"})}),v0=()=>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"})}),x0=()=>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 On({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,c]=react.useState(""),[b,v]=react.useState(false),[l,x]=react.useState(true),y=react.useRef(null),D=react.useRef(null),w=react.useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:N,suggestions:I=h0,maxHistory:B=50,persistHistory:q}=a,ne=q?.storageKey||"gantt-ai-history",oe=q?.maxMessages??5;react.useEffect(()=>{if(q?.enabled)try{let G=localStorage.getItem(ne);if(G){let te=JSON.parse(G).map(J=>({...J,timestamp:new Date(J.timestamp)}));C(te.slice(-oe));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[q?.enabled,ne,oe]),react.useEffect(()=>{if(q?.enabled&&h.length>0)try{let G=h.filter(F=>!F.isLoading).slice(-oe);localStorage.setItem(ne,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,q?.enabled,ne,oe]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&y.current&&setTimeout(()=>y.current?.focus(),100);},[i,d]);let re=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),fe=react.useCallback(async G=>{if(!G.trim()||b)return;let F={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(J=>[...J.slice(-(B-1)),F]),c(""),x(false),v(true);let te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(J=>[...J,te]);try{if(N){let J=await N(G,e);C(V=>{let Se=V.filter(He=>!He.isLoading),ue={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...Se,ue]}),re(J);}else C(J=>[...J.filter(Se=>!Se.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){C(V=>[...V.filter(ue=>!ue.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[b,B,N,e,re]),$=G=>{G.preventDefault(),fe(T);},Z=G=>{c(G),y.current?.focus();};if(react.useEffect(()=>{let G=F=>{(F.metaKey||F.ctrlKey)&&F.key==="k"&&(F.preventDefault(),u(te=>!te),i||g(false)),F.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=te=>{let J=te.target;w.current&&!w.current.contains(J)&&u(false);},F=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(F),document.removeEventListener("mousedown",G);}},[i]),!k)return null;let W={"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(ct,{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 ${W[A]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(wc,{}),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:w,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 ${W[A]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[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(wc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(v0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(y0,{})})]})]}),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:[h.length===0&&l&&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:I.slice(0,4).map((G,F)=>jsxRuntime.jsx("button",{onClick:()=>Z(G),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:G.length>30?G.slice(0,30)+"...":G},F))})]}),h.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(x0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:$,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:y,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(b0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Cc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=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:u,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Tc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&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 T0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${pe.formatDate(e.startDate)} - ${pe.formatDate(e.endDate)}`);let a=pe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Nc(e){return {...T0,...e}}var F0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Ec=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:v,onCreateTask:l,taskFilter:x,onTaskFilterChange:y,onThemeChange:D,onTaskClick:w,onTaskDblClick:k,onTaskContextMenu:R,onTaskUpdate:A,onProgressChange:N,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:q,onTaskSetInProgress:ne,onDependencyCreate:oe,onDependencyDelete:re,onBeforeTaskAdd:fe,onAfterTaskAdd:$,onBeforeTaskUpdate:Z,onAfterTaskUpdate:W,onBeforeTaskDelete:G,onAfterTaskDelete:F}=a,J=react.useContext(kn)?.theme,[V,Se]=react.useState(J||s||"dark"),[ue,He]=react.useState(n),[We,ot]=react.useState(p),[he,Ve]=react.useState(1),[pt,Ft]=react.useState("all"),gt=x??pt,z=y??Ft,[le,xe]=react.useState(0),[Fe,Ye]=react.useState(false),[Je,Dt]=react.useState(null),[Ae,sa]=react.useState({isOpen:false,x:0,y:0,task:null}),[Zt,xt]=react.useState(null),[St,ea]=react.useState(null);react.useEffect(()=>{J&&J!==V&&Se(J);},[J]),react.useEffect(()=>{s&&s!==V&&Se(s);},[s]);let Xt=react.useCallback(M=>{Se(M),D?.(M);},[D]),{state:Te,setState:ze,undo:ga,redo:_e,canUndo:S,canRedo:be,clearHistory:Ge}=Cc(t,50),ee=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Ee=react.useRef(new Map),Ce=react.useRef(false);if(!Ce.current&&h){Ce.current=true;let M=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(M);if(L){let _=JSON.parse(L);Array.isArray(_)&&(Ee.current=new Map(_));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Me=react.useCallback(()=>{let M=ee();if(M)try{let L=Array.from(Ee.current.entries());localStorage.setItem(M,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[ee]);react.useEffect(()=>{let M=L=>L.map(_=>{let ae=Ee.current.get(_.id),ce=ae!==void 0?{..._,isExpanded:ae}:_;return ce.subtasks?.length?{...ce,subtasks:M(ce.subtasks)}:ce});Ee.current.size>0?ze(M(t)):ze(t);},[t,ze]);let Oe=react.useRef(t),qe=react.useRef(true);react.useEffect(()=>{if(qe.current){qe.current=false,Oe.current=Te;return}if(!r)return;let M=JSON.stringify(Oe.current),L=JSON.stringify(Te);M!==L&&(Oe.current=Te,r(Te));},[Te,r]);let O=react.useMemo(()=>ni(T,c),[T,c]),j=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}],[]),[ve,Le]=react.useState(()=>j(O));react.useEffect(()=>{Le(M=>M.map(L=>({...L,label:O.columns[L.id==="name"?"taskName":L.id]||L.label})));},[O]);let $e=react.useMemo(()=>ve.filter(L=>L.visible).reduce((L,_)=>L+_.width,0),[ve]),H=react.useRef(ve.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=ve.filter(ae=>ae.visible),L=M.map(ae=>ae.id).join(","),_=H.current;if(L!==_){let ae=M.some(Ne=>Ne.id!=="name"),ce=_.includes(",");ae?!ce&&ae&&Dt(null):Dt(null),H.current=L;}},[ve]);let ie=60,Re=.6,Et=react.useMemo(()=>{let L=$e+ie,_=typeof window<"u"?window.innerWidth*Re:800,ae=Math.max(L,_);return Je!==null?Math.max(200,Math.min(Je,ae)):Math.max(200,L)},[Je,$e]),tt=react.useRef(null),fa=react.useRef(null),ba=react.useRef(null),E=react.useMemo(()=>jd(V),[V]),ye=react.useMemo(()=>({theme:E,themeName:V}),[E,V]),X=react.useMemo(()=>Nc(d),[d]),Ie=react.useMemo(()=>{if(!g)return Te;let M=pe.calculateCriticalPath(Te),L=_=>_.map(ae=>({...ae,isCriticalPath:M.includes(ae.id),subtasks:ae.subtasks?L(ae.subtasks):void 0}));return L(Te)},[Te,g]),nt=react.useMemo(()=>{if(gt==="all")return Ie;let M=L=>{let _=[];for(let ae of L){let ce=ae.subtasks?.length?M(ae.subtasks):void 0,Ne=false;switch(gt){case "incomplete":Ne=ae.progress<100;break;case "in_progress":Ne=ae.progress>0&&ae.progress<100;break;case "completed":Ne=ae.progress===100;break}(Ne||ce&&ce.length>0)&&_.push({...ae,subtasks:ce});}return _};return M(Ie)},[Ie,gt]),se=F0(We);Tc({undo:ga,redo:_e,canUndo:S,canRedo:be,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>pe.findTaskById(Te,M),addTask:(M,L)=>{ze(_=>{if(!L)return [..._,{...M,level:0}];let ae=ce=>ce.map(Ne=>Ne.id===L?{...Ne,subtasks:[...Ne.subtasks||[],{...M,parentId:L,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:ae(Ne.subtasks)}:Ne);return ae(_)});},updateTask:(M,L)=>{ze(_=>{let ae=ce=>ce.map(Ne=>Ne.id===M?{...Ne,...L}:Ne.subtasks?{...Ne,subtasks:ae(Ne.subtasks)}:Ne);return ae(_)});},deleteTask:M=>{ze(L=>{let _=ae=>ae.filter(ce=>ce.id===M?false:(ce.subtasks&&(ce.subtasks=_(ce.subtasks)),true));return _(L)});},deleteTasks:M=>{ze(L=>fi(L,M));},duplicateTask:M=>{ze(L=>hi(L,[M]));},splitTask:(M,L,_=3)=>{ze(ae=>pe.splitTask(ae,M,L,_));},calculateEndDate:pe.calculateEndDate,calculateDuration:pe.calculateDuration,validateDependency:(M,L)=>!pe.validateDependencies(Te,M,L),getAllTasks:()=>pe.flattenTasks(Te),getTasksByStatus:M=>pe.flattenTasks(Te).filter(L=>L.status===M),getTasksByParent:M=>M?pe.findTaskById(Te,M)?.subtasks||[]:Te.filter(_=>!_.parentId),getCriticalPath:()=>pe.flattenTasks(Te).filter(M=>M.isCriticalPath),indentTask:M=>{ze(L=>pi(L,[M]));},outdentTask:M=>{ze(L=>ui(L,[M]));},moveTask:(M,L)=>{ze(_=>gi(_,[M],L));},createSubtask:async M=>{let{tasks:L,newTask:_}=vi(Te,M);if(fe){let ae=fe({..._,parentId:M});if((ae instanceof Promise?await ae:ae)===false)return}ze(L),$&&$({..._,parentId:M});},scrollToTask:M=>{let _=pe.flattenTasks(Te).findIndex(ae=>ae.id===M);if(_!==-1&&tt.current){let ae=_*se;tt.current.scrollTo({top:ae,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(M,L=2e3)=>{},expandTask:M=>{ze(L=>{let _=ae=>ae.map(ce=>ce.id===M?{...ce,isExpanded:true}:ce.subtasks?{...ce,subtasks:_(ce.subtasks)}:ce);return _(L)});},collapseTask:M=>{ze(L=>{let _=ae=>ae.map(ce=>ce.id===M?{...ce,isExpanded:false}:ce.subtasks?{...ce,subtasks:_(ce.subtasks)}:ce);return _(L)});},expandAll:()=>{ze(M=>{let L=_=>_.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?L(ae.subtasks):void 0}));return L(M)});},collapseAll:()=>{ze(M=>{let L=_=>_.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?L(ae.subtasks):void 0}));return L(M)});},undo:ga,redo:_e,canUndo:()=>S,canRedo:()=>be,clearHistory:Ge,exportToPNG:async()=>{if(!ba.current||!tt.current||!fa.current)throw new Error("Gantt container not found");let M=ba.current,L=tt.current.querySelector(".gantt-grid-scroll"),_=fa.current,ae=L?.scrollTop||0,ce=_.scrollTop,Ne=M.style.overflow,Pt=M.style.height;try{let lt=L?.querySelector(".gantt-taskgrid-content"),Gt=_.querySelector("svg"),va=lt?.scrollHeight||L?.scrollHeight||600,Ca=Gt?.getBoundingClientRect().height||_.scrollHeight,Rr=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(va,Ca)+20;L&&(L.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let sr=await Sc__default.default(M,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{sr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=Ne,M.style.height=Pt,L&&(L.scrollTop=ae),_.scrollTop=ce;}},exportToPDF:async M=>{await pe.exportToPDF(Te,M);},exportToExcel:async M=>{await pe.exportToExcel(Te,M);},exportToJSON:()=>pe.exportToJSON(Te),exportToCSV:()=>pe.exportToCSV(Te),importFromJSON:M=>{let L=pe.importFromJSON(M);ze(L);},getTasks:()=>Te,refresh:()=>{ze(M=>[...M]);},clearAll:()=>{ze([]);}}),[Te,ga,_e,S,be,Ge,E,se]);let Ue=react.useCallback(M=>{Le(L=>L.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),kt=react.useCallback((M,L)=>{Le(_=>_.map(ae=>{if(ae.id!==M)return ae;let ce=ae.minWidth??100,Ne=ae.maxWidth??800,Pt=Math.max(ce,Math.min(Ne,L));return {...ae,width:Pt}}));},[]),Be=react.useCallback(M=>{ze(L=>{let _=yi(L,M),ae=ce=>{for(let Ne of ce){if(Ne.id===M){Ee.current.set(M,Ne.isExpanded??true);return}Ne.subtasks?.length&&ae(Ne.subtasks);}};return ae(_),Me(),_}),a.onTaskToggleExpand?.(M);},[a,Me]),Lt=react.useCallback((M,L)=>{if(Z&&Z(M,L)===false)return;let ae=pe.findTaskById(Te,M)?.progress,ce=Pt=>Pt.map(lt=>lt.id===M?{...lt,...L}:lt.subtasks?{...lt,subtasks:ce(lt.subtasks)}:lt);ze(ce(Te));let Ne=pe.findTaskById(ce(Te),M);Ne&&(A?.(Ne),W?.(Ne),L.progress!==void 0&&ae!==void 0&&L.progress!==ae&&N?.(M,ae,L.progress));},[Te,A,Z,W,N]),it=react.useCallback(M=>{M.length!==0&&(ze(L=>pi(L,M)),a.onTaskIndent?.(M[0]));},[a]),ya=react.useCallback(M=>{M.length!==0&&(ze(L=>ui(L,M)),a.onTaskOutdent?.(M[0]));},[a]),Ut=react.useCallback((M,L,_)=>{ze(ae=>cc(ae,M,L,_)),a.onTaskReparent?.(M,L,_);},[a]),Xe=react.useCallback((M,L)=>{M.length!==0&&(ze(_=>gi(_,M,L)),a.onTaskMove?.(M[0],L));},[a]),wt=react.useCallback(async M=>{let L=[];for(let _ of M)G&&await Promise.resolve(G(_))===false||L.push(_);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ze(_=>fi(_,L)),L.forEach(_=>a.onTaskDelete?.(_))),F&&L.forEach(_=>F(_)));},[a,G,F]),ca=react.useCallback(M=>{ze(L=>hi(L,M)),M.forEach(L=>a.onTaskDuplicate?.(L));},[a]),xr=react.useCallback((M,L)=>{ze(_=>{let{tasks:ae,newTask:ce}=dc(_,M,L);return fe&&fe(ce)===false?_:(a.onTaskCreate?.(ce.parentId,ce.position||0),$?.(ce),ae)});},[a,fe,$]),Km=react.useCallback((M,L)=>{ze(_=>bi(_,M,L)),a.onTaskRename?.(M,L);},[a]),as=react.useCallback(M=>{ze(L=>{let{tasks:_}=vi(L,M);return a.onTaskCreate?.(M,0),_});},[a]),Ym=react.useCallback((M,L,_)=>{let ae=M.startDate?Math.round((L.getTime()-M.startDate.getTime())/864e5):0,ce=lt=>lt.map(Gt=>Gt.id===M.id?{...Gt,startDate:L,endDate:_,...M.segments&&{segments:M.segments}}:Gt.subtasks?{...Gt,subtasks:ce(Gt.subtasks)}:Gt),Ne=ce(Te);Ne=pe.autoScheduleDependents(Ne,M.id,ae),ze(Ne);let Pt={...M,startDate:L,endDate:_};A?.(Pt);},[Te,A]),qm=react.useCallback((M,L)=>{R?.(M,L),sa({isOpen:true,x:L.clientX,y:L.clientY,task:M});},[R]),Xm=react.useCallback((M,L)=>{let _=pe.splitTask(Te,M.id,L);ze(_),sa({isOpen:false,x:0,y:0,task:null});},[Te]),xl=react.useCallback(M=>{let L=pe.findTaskById(Te,M.id)||M;k?.(L),I||xt(L);},[Te,k,I]),kl=react.useCallback((M,L,_)=>{let ae=new Map,ce=va=>{va.forEach(Ca=>{Ca.dependencies&&ae.set(Ca.id,Ca.dependencies),Ca.subtasks&&ce(Ca.subtasks);});};ce(_);let Ne=ae.get(L)||[];ae.set(L,[...Ne,M]);let Pt=new Set,lt=new Set,Gt=va=>{if(!Pt.has(va)){Pt.add(va),lt.add(va);let Ca=ae.get(va)||[];for(let kr of Ca){if(!Pt.has(kr)&&Gt(kr))return true;if(lt.has(kr))return true}}return lt.delete(va),false};return Gt(L)},[]),wl=react.useCallback((M,L)=>{if(kl(M.id,L,Te)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
342
+ </Project>`,g=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(g),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ue.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 g=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let b of i.dependencies){let T=t.find(N=>N.id===b);if(T){o(T);let N=r.get(b)?.ef||0;d=Math.max(d,N);}}let f=d+g;r.set(i.id,{es:d,ef:f});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let g=i.startDate&&i.endDate?ue.calculateDuration(i.startDate,i.endDate):0,d=t.filter(T=>T.dependencies&&T.dependencies.includes(i.id)),f=s;if(d.length>0)for(let T of d){p(T);let N=n.get(T.id)?.ls||0;f=Math.min(f,N);}let b=f-g;n.set(i.id,{ls:b,lf:f});};a.forEach(p);let u=[];for(let i of a){let g=r.get(i.id),d=n.get(i.id);if(g&&d){let f=d.ls-g.es;Math.abs(f)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=ue.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ue.calculateCriticalPath(e).includes(t))return 0;let o=ue.getDependentTasks(e,t);if(o.length===0){let p=ue.getLatestEndDate(e);if(!p)return null;let u=ue.calculateDuration(a.endDate,p);return Math.max(0,u)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,u)=>p-u)[0];if(!s)return null;let n=ue.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ue.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ue.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ue.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=ue.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=ue.calculateEndDate(u,p),g=d=>d.map(f=>f.id===n.id?{...f,startDate:u,endDate:i}:f.subtasks?{...f,subtasks:g(f.subtasks)}:f);s=g(s),s=ue.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let u=[],i=o.getTime(),g=1e3*60*60*24,d=ue.findTaskById(e,t);if(!d||!d.endDate)return [];let f=(b,T,N=new Set)=>{if(N.has(b))return;N.add(b);let c=ue.getDependentTasks(e,b);for(let C of c){if(!C.startDate||!C.endDate)continue;let m=r.findIndex(k=>k.id===C.id);if(m===-1)continue;let l=C.startDate.getTime(),S=(C.endDate.getTime()-l)/g,w=(l-i)/g*s,x=w+T*s,B=Math.max(S*s,s),D=p+m*n+12;u.push({taskId:C.id,taskName:C.name,originalX:w,previewX:x,width:B,y:D,rowIndex:m,daysDelta:T,color:C.color}),f(C.id,T,N);}};return f(t,a),u},splitTask:(e,t,a,r=3)=>{let o=ue.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 p=new Date(o.endDate);p.setDate(p.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=g=>g.map(d=>d.id===o.id?{...d,endDate:p,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Un({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:p="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:g,onTaskDblClick:d,onTaskContextMenu:f,onTaskDateChange:b,onDependencyCreate:T,onDependencyDelete:N}){let C=Lr(),[m,l]=react.useState([]),[v,S]=react.useState(null),y=react.useCallback(I=>{S(I);},[]),w=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),x=r==="day"?60:r==="week"?20:8,B=w*x*n,D=I=>{let O=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),E=O.getUTCDay()||7;O.setUTCDate(O.getUTCDate()+4-E);let Q=new Date(Date.UTC(O.getUTCFullYear(),0,1));return Math.ceil(((O.getTime()-Q.getTime())/864e5+1)/7)},k=I=>{let O=I.getDay();return O===0||O===6},$=react.useCallback(I=>{let O=Math.round(I/(x*n)),E=new Date(o);return E.setDate(E.getDate()+O),E},[o,x,n]),R=react.useCallback((I,O)=>{if(O.startDate&&O.endDate)return;let E=I.currentTarget.ownerSVGElement;if(!E)return;let Q=E.createSVGPoint();Q.x=I.clientX,Q.y=I.clientY;let Y=Q.matrixTransform(E.getScreenCTM()?.inverse()),G=$(Y.x),me=new Date(G);me.setDate(me.getDate()+1),b?.(O,G,me);},[$,b]),j=react.useMemo(()=>{let I=Y=>Y.map(G=>{if(G.subtasks&&G.subtasks.length>0){let me=I(G.subtasks),pe=me.filter(Fe=>Fe.startDate&&Fe.endDate);if(pe.length>0){let Fe=pe.map(_e=>_e.startDate.getTime()),Ve=pe.map(_e=>_e.endDate.getTime()),dt=new Date(Math.min(...Fe)),se=new Date(Math.max(...Ve));return {...G,subtasks:me,startDate:dt,endDate:se}}return {...G,subtasks:me}}return G}),O=(Y,G=[])=>{for(let me of Y)G.push(me),me.subtasks&&me.subtasks.length>0&&(me.isExpanded===void 0||me.isExpanded)&&O(me.subtasks,G);return G},E=I(e);return O(E)},[e]),ee=react.useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let O=I.startDate.getTime(),E=I.endDate.getTime(),Q=o.getTime(),Y=(O-Q)/(1e3*60*60*24),G=(E-O)/(1e3*60*60*24),me=Y*x*n,pe=Math.max(x*n,40),Fe=Math.max(G*x*n,pe);return {x:me,width:Fe}},[o,x,n]),ae=react.useMemo(()=>j.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:O,width:E}=ee(I),Y=j.findIndex(G=>G.id===I.id)*a+12;return {id:I.id,x:O,y:Y,width:E,height:32}}),[j,ee]),re=react.useCallback((I,O,E)=>{if(!E||O===0){l([]);return}let Q=ue.calculateCascadePreview(e,I,O,j,o,x*n,a,48);l(Q);},[e,j,o,x,n,a,48]),fe=react.useMemo(()=>{let I=[],O=new Date(o);for(;O<=s;){let Y=(O.getTime()-o.getTime())/864e5*x*n;if(r==="day")I.push({date:new Date(O),label:O.toLocaleDateString(p,{day:"numeric",month:"short"}),x:Y}),O.setDate(O.getDate()+1);else if(r==="week"){let G=D(O);I.push({date:new Date(O),label:`${C.labels.week} ${G}`,x:Y}),O.setDate(O.getDate()+7);}else I.push({date:new Date(O),label:O.toLocaleDateString(p,{month:"short",year:"numeric"}),x:Y}),O.setMonth(O.getMonth()+1);}return I},[o,s,r,x,n,p,C.labels.week]),ge=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*x*n,[o,x,n]),Me=Math.max(j.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(B,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(B,1e3),height:48,fill:t.bgGrid}),fe.map((I,O)=>jsxRuntime.jsxs("g",{children:[O>0&&jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:I.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${O}`)),ge>=0&&ge<=B&&jsxRuntime.jsx("circle",{cx:ge,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(B,1e3),height:Me,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(B,1e3),height:Me,fill:t.bgPrimary}),fe.map((I,O)=>{let E=fe[O+1]?.x||B,Q=k(I.date);return jsxRuntime.jsxs("g",{children:[Q&&jsxRuntime.jsx("rect",{x:I.x,y:0,width:E-I.x,height:j.length*a,fill:t.bgWeekend,opacity:1}),O>0&&jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:j.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},O)}),j.map((I,O)=>{let E=I.startDate&&I.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:B,height:a,fill:O%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${I.id}`),!E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:O*a,width:B,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Q=>R(Q,I),onMouseEnter:Q=>{Q.currentTarget.setAttribute("fill",t.accentLight),Q.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:Q=>{Q.currentTarget.setAttribute("fill","transparent"),Q.currentTarget.setAttribute("opacity","1");}},`clickable-${I.id}`),jsxRuntime.jsx("text",{x:ge>0?ge:100,y:O*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:C.labels.clickToSetDates},`placeholder-${I.id}`)]})]},`row-group-${I.id}`)}),j.map((I,O)=>{if(!I.startDate||!I.endDate)return null;let{x:E,width:Q}=ee(I),Y=O*a+12,G=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;return I.isMilestone?jsxRuntime.jsx(On,{task:I,x:E+Q/2,y:Y+16,theme:t,onClick:g},I.id):G?jsxRuntime.jsxs("g",{onClick:()=>g?.(I),onContextMenu:me=>{me.preventDefault(),me.stopPropagation(),f?.(I,me);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:E,y:Y,width:Q,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:E,y1:Y,x2:E+Q,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:Y,x2:E,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E+Q,y1:Y,x2:E+Q,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:E,y1:Y+32,x2:E+Q,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),Q>60&&jsxRuntime.jsx("text",{x:E+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:I.name})]},I.id):jsxRuntime.jsx(In,{task:I,x:E,y:Y,width:Q,theme:t,dayWidth:x*n,startDate:o,templates:u,onClick:g,onDoubleClick:d,onContextMenu:f,onDateChange:b,onDependencyCreate:T,allTaskPositions:ae,onDragMove:re,onHoverChange:y},I.id)}),j.map((I,O)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(E=>{let Q=j.find(se=>se.id===E);if(!Q||!Q.startDate||!Q.endDate)return null;let Y=j.findIndex(se=>se.id===E),G=ee(Q),me=ee(I),pe=G.x+G.width,Fe=Y*a+28,Ve=me.x,dt=O*a+28;return jsxRuntime.jsx(Rn,{x1:pe,y1:Fe,x2:Ve,y2:dt,theme:t,lineStyle:i,onDelete:()=>N?.(I.id,E)},`dep-${E}-${I.id}`)})),m.map(I=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:I.previewX,y:I.y-48,width:I.width,height:32,rx:8,fill:I.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(I.daysDelta)>0&&jsxRuntime.jsx("text",{x:I.previewX+I.width/2,y:I.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:I.daysDelta>0?`+${I.daysDelta}d`:`${I.daysDelta}d`})]},`cascade-preview-${I.taskId}`)),ge>=0&&ge<=B&&jsxRuntime.jsx("line",{x1:ge,y1:0,x2:ge,y2:Me,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),v&&jsxRuntime.jsx(Sc,{tooltipData:v,theme:t})]})]})}var P0=['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"'],Ac=()=>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"})]}),M0=()=>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"})}),A0=()=>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"})}),F0=()=>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"})}),I0=()=>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 Hn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:u}){let[i,g]=react.useState(false),[d,f]=react.useState(false),[b,T]=react.useState([]),[N,c]=react.useState(""),[C,m]=react.useState(false),[l,v]=react.useState(true),S=react.useRef(null),y=react.useRef(null),w=react.useRef(null),{enabled:x=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:D="bottom-right",onCommand:k,suggestions:$=P0,maxHistory:R=50,persistHistory:j}=a,ee=j?.storageKey||"gantt-ai-history",ae=j?.maxMessages??5;react.useEffect(()=>{if(j?.enabled)try{let O=localStorage.getItem(ee);if(O){let Q=JSON.parse(O).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));T(Q.slice(-ae));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[j?.enabled,ee,ae]),react.useEffect(()=>{if(j?.enabled&&b.length>0)try{let O=b.filter(E=>!E.isLoading).slice(-ae);localStorage.setItem(ee,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[b,j?.enabled,ee,ae]),react.useEffect(()=>{y.current&&y.current.scrollIntoView({behavior:"smooth"});},[b]),react.useEffect(()=>{i&&!d&&S.current&&setTimeout(()=>S.current?.focus(),100);},[i,d]);let re=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&n?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&p?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&u?.(O.taskId,O.dependencyFrom);break}},[o,s,n,p,u]),fe=react.useCallback(async O=>{if(!O.trim()||C)return;let E={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};T(Y=>[...Y.slice(-(R-1)),E]),c(""),v(false),m(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};T(Y=>[...Y,Q]);try{if(k){let Y=await k(O,e);T(G=>{let me=G.filter(Fe=>!Fe.isLoading),pe={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...me,pe]}),re(Y);}else T(Y=>[...Y.filter(me=>!me.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(Y){T(G=>[...G.filter(pe=>!pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{m(false);}},[C,R,k,e,re]),ge=O=>{O.preventDefault(),fe(N);},Me=O=>{c(O),S.current?.focus();};if(react.useEffect(()=>{let O=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),g(Q=>!Q),i||f(false)),E.key==="Escape"&&i&&g(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=Q=>{let Y=Q.target;w.current&&!w.current.contains(Y)&&g(false);},E=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",O);}},[i]),!x)return null;let I={"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(mt,{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 ${I[D]} 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:()=>g(true),children:[jsxRuntime.jsx(Ac,{}),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:w,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 ${I[D]} 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(Ac,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>f(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(F0,{})}),jsxRuntime.jsx("button",{onClick:()=>g(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(A0,{})})]})]}),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:[b.length===0&&l&&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:$.slice(0,4).map((O,E)=>jsxRuntime.jsx("button",{onClick:()=>Me(O),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:O.length>30?O.slice(0,30)+"...":O},E))})]}),b.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(I0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:y})]}),jsxRuntime.jsxs("form",{onSubmit:ge,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:S,type:"text",value:N,onChange:O=>c(O.target.value),placeholder:B,disabled:C,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!N.trim()||C,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:N.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:N.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(M0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Fc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,g=true)=>{r(d=>{let f=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:f};if(!g)return {...d,present:f};let b=[...d.past,d.present];return b.length>t&&b.shift(),{past:b,present:f,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let g=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:g,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let g=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:g,future:d}});},[]),u=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function Ic({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=p?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&u&&n.key==="y"){n.preventDefault(),t();return}if(p&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var $0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ue.formatDate(e.startDate)} - ${ue.formatDate(e.endDate)}`);let a=ue.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=>ue.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Lc(e){return {...$0,...e}}var V0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},$c=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:g=[],templates:d,enableAutoCriticalPath:f=true,persistExpandedState:b,aiAssistant:T,locale:N="en",customTranslations:c,showCreateTaskButton:C=false,createTaskLabel:m,onCreateTask:l,taskFilter:v,onTaskFilterChange:S,onThemeChange:y,onTaskClick:w,onTaskDblClick:x,onTaskContextMenu:B,onTaskUpdate:D,onProgressChange:k,onTaskEdit:$,onTaskAddSubtask:R,onTaskMarkIncomplete:j,onTaskSetInProgress:ee,onDependencyCreate:ae,onDependencyDelete:re,onBeforeTaskAdd:fe,onAfterTaskAdd:ge,onBeforeTaskUpdate:Me,onAfterTaskUpdate:I,onBeforeTaskDelete:O,onAfterTaskDelete:E}=a,Y=react.useContext(Tn)?.theme,[G,me]=react.useState(Y||s||"dark"),[pe,Fe]=react.useState(n),[Ve,dt]=react.useState(p),[se,_e]=react.useState(1),[xt,zt]=react.useState("all"),ct=v??xt,U=S??zt,[ie,Pe]=react.useState(0),[Se,Xe]=react.useState(false),[Ge,Dt]=react.useState(null),[Ie,sa]=react.useState({isOpen:false,x:0,y:0,task:null}),[Zt,At]=react.useState(null),[gt,ea]=react.useState(null);react.useEffect(()=>{Y&&Y!==G&&me(Y);},[Y]),react.useEffect(()=>{s&&s!==G&&me(s);},[s]);let Xt=react.useCallback(A=>{me(A),y?.(A);},[y]),{state:Te,setState:Ue,undo:ga,redo:je,canUndo:He,canRedo:L,clearHistory:ke}=Fc(t,50),q=react.useCallback(()=>b?typeof b=="string"?b:"gantt-expanded-tasks":null,[b]),ve=react.useRef(new Map),ye=react.useRef(false);if(!ye.current&&b){ye.current=true;let A=typeof b=="string"?b:"gantt-expanded-tasks";try{let F=localStorage.getItem(A);if(F){let V=JSON.parse(F);Array.isArray(V)&&(ve.current=new Map(V));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Re=react.useCallback(()=>{let A=q();if(A)try{let F=Array.from(ve.current.entries());localStorage.setItem(A,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[q]);react.useEffect(()=>{let A=F=>F.map(V=>{let te=ve.current.get(V.id),de=te!==void 0?{...V,isExpanded:te}:V;return de.subtasks?.length?{...de,subtasks:A(de.subtasks)}:de});ve.current.size>0?Ue(A(t)):Ue(t);},[t,Ue]);let Ae=react.useRef(t),rt=react.useRef(true);react.useEffect(()=>{if(rt.current){rt.current=false,Ae.current=Te;return}if(!r)return;let A=JSON.stringify(Ae.current),F=JSON.stringify(Te);A!==F&&(Ae.current=Te,r(Te));},[Te,r]);let z=react.useMemo(()=>li(N,c),[N,c]),_=react.useCallback(A=>[{id:"name",label:A.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:A.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:A.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:A.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:A.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:A.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:A.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:A.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[he,Le]=react.useState(()=>_(z));react.useEffect(()=>{Le(A=>A.map(F=>({...F,label:z.columns[F.id==="name"?"taskName":F.id]||F.label})));},[z]);let ze=react.useMemo(()=>he.filter(F=>F.visible).reduce((F,V)=>F+V.width,0),[he]),H=react.useRef(he.filter(A=>A.visible).map(A=>A.id).join(","));react.useEffect(()=>{let A=he.filter(te=>te.visible),F=A.map(te=>te.id).join(","),V=H.current;if(F!==V){let te=A.some(Ne=>Ne.id!=="name"),de=V.includes(",");te?!de&&te&&Dt(null):Dt(null),H.current=F;}},[he]);let ne=60,Oe=.6,St=react.useMemo(()=>{let F=ze+ne,V=typeof window<"u"?window.innerWidth*Oe:800,te=Math.max(F,V);return Ge!==null?Math.max(200,Math.min(Ge,te)):Math.max(200,F)},[Ge,ze]),et=react.useRef(null),fa=react.useRef(null),ba=react.useRef(null),P=react.useMemo(()=>tc(G),[G]),xe=react.useMemo(()=>({theme:P,themeName:G}),[P,G]),J=react.useMemo(()=>Lc(d),[d]),Be=react.useMemo(()=>{if(!f)return Te;let A=ue.calculateCriticalPath(Te),F=V=>V.map(te=>({...te,isCriticalPath:A.includes(te.id),subtasks:te.subtasks?F(te.subtasks):void 0}));return F(Te)},[Te,f]),ot=react.useMemo(()=>{if(ct==="all")return Be;let A=F=>{let V=[];for(let te of F){let de=te.subtasks?.length?A(te.subtasks):void 0,Ne=false;switch(ct){case "incomplete":Ne=te.progress<100;break;case "in_progress":Ne=te.progress>0&&te.progress<100;break;case "completed":Ne=te.progress===100;break}(Ne||de&&de.length>0)&&V.push({...te,subtasks:de});}return V};return A(Be)},[Be,ct]),oe=V0(Ve);Ic({undo:ga,redo:je,canUndo:He,canRedo:L,enabled:true}),react.useImperativeHandle(o,()=>({getTask:A=>ue.findTaskById(Te,A),addTask:(A,F)=>{Ue(V=>{if(!F)return [...V,{...A,level:0}];let te=de=>de.map(Ne=>Ne.id===F?{...Ne,subtasks:[...Ne.subtasks||[],{...A,parentId:F,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:te(Ne.subtasks)}:Ne);return te(V)});},updateTask:(A,F)=>{Ue(V=>{let te=de=>de.map(Ne=>Ne.id===A?{...Ne,...F}:Ne.subtasks?{...Ne,subtasks:te(Ne.subtasks)}:Ne);return te(V)});},deleteTask:A=>{Ue(F=>{let V=te=>te.filter(de=>de.id===A?false:(de.subtasks&&(de.subtasks=V(de.subtasks)),true));return V(F)});},deleteTasks:A=>{Ue(F=>yi(F,A));},duplicateTask:A=>{Ue(F=>vi(F,[A]));},splitTask:(A,F,V=3)=>{Ue(te=>ue.splitTask(te,A,F,V));},calculateEndDate:ue.calculateEndDate,calculateDuration:ue.calculateDuration,validateDependency:(A,F)=>!ue.validateDependencies(Te,A,F),getAllTasks:()=>ue.flattenTasks(Te),getTasksByStatus:A=>ue.flattenTasks(Te).filter(F=>F.status===A),getTasksByParent:A=>A?ue.findTaskById(Te,A)?.subtasks||[]:Te.filter(V=>!V.parentId),getCriticalPath:()=>ue.flattenTasks(Te).filter(A=>A.isCriticalPath),indentTask:A=>{Ue(F=>fi(F,[A]));},outdentTask:A=>{Ue(F=>hi(F,[A]));},moveTask:(A,F)=>{Ue(V=>bi(V,[A],F));},createSubtask:async A=>{let{tasks:F,newTask:V}=wi(Te,A);if(fe){let te=fe({...V,parentId:A});if((te instanceof Promise?await te:te)===false)return}Ue(F),ge&&ge({...V,parentId:A});},scrollToTask:A=>{let V=ue.flattenTasks(Te).findIndex(te=>te.id===A);if(V!==-1&&et.current){let te=V*oe;et.current.scrollTo({top:te,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:te,behavior:"smooth"});}},highlightTask:(A,F=2e3)=>{},expandTask:A=>{Ue(F=>{let V=te=>te.map(de=>de.id===A?{...de,isExpanded:true}:de.subtasks?{...de,subtasks:V(de.subtasks)}:de);return V(F)});},collapseTask:A=>{Ue(F=>{let V=te=>te.map(de=>de.id===A?{...de,isExpanded:false}:de.subtasks?{...de,subtasks:V(de.subtasks)}:de);return V(F)});},expandAll:()=>{Ue(A=>{let F=V=>V.map(te=>({...te,isExpanded:true,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(A)});},collapseAll:()=>{Ue(A=>{let F=V=>V.map(te=>({...te,isExpanded:false,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(A)});},undo:ga,redo:je,canUndo:()=>He,canRedo:()=>L,clearHistory:ke,exportToPNG:async()=>{if(!ba.current||!et.current||!fa.current)throw new Error("Gantt container not found");let A=ba.current,F=et.current.querySelector(".gantt-grid-scroll"),V=fa.current,te=F?.scrollTop||0,de=V.scrollTop,Ne=A.style.overflow,Et=A.style.height;try{let it=F?.querySelector(".gantt-taskgrid-content"),Gt=V.querySelector("svg"),va=it?.scrollHeight||F?.scrollHeight||600,Ca=Gt?.getBoundingClientRect().height||V.scrollHeight,Or=(A.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(va,Ca)+20;F&&(F.scrollTop=0),V.scrollTop=0,A.style.overflow="visible",A.style.height=`${Or}px`,await new Promise(Cr=>setTimeout(Cr,100));let ir=await Rc__default.default(A,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Cr=>{let no=window.getComputedStyle(Cr),zr=parseInt(no.zIndex,10);return !isNaN(zr)&&zr>=50||no.position==="fixed"}});return new Promise((Cr,no)=>{ir.toBlob(zr=>{zr?Cr(zr):no(new Error("Failed to create blob from canvas"));},"image/png");})}finally{A.style.overflow=Ne,A.style.height=Et,F&&(F.scrollTop=te),V.scrollTop=de;}},exportToPDF:async A=>{await ue.exportToPDF(Te,A);},exportToExcel:async A=>{await ue.exportToExcel(Te,A);},exportToJSON:()=>ue.exportToJSON(Te),exportToCSV:()=>ue.exportToCSV(Te),importFromJSON:A=>{let F=ue.importFromJSON(A);Ue(F);},getTasks:()=>Te,refresh:()=>{Ue(A=>[...A]);},clearAll:()=>{Ue([]);}}),[Te,ga,je,He,L,ke,P,oe]);let We=react.useCallback(A=>{Le(F=>F.map(V=>V.id===A?{...V,visible:!V.visible}:V));},[]),kt=react.useCallback((A,F)=>{Le(V=>V.map(te=>{if(te.id!==A)return te;let de=te.minWidth??100,Ne=te.maxWidth??800,Et=Math.max(de,Math.min(Ne,F));return {...te,width:Et}}));},[]),$e=react.useCallback(A=>{Ue(F=>{let V=ki(F,A),te=de=>{for(let Ne of de){if(Ne.id===A){ve.current.set(A,Ne.isExpanded??true);return}Ne.subtasks?.length&&te(Ne.subtasks);}};return te(V),Re(),V}),a.onTaskToggleExpand?.(A);},[a,Re]),Ft=react.useCallback((A,F)=>{if(Me&&Me(A,F)===false)return;let te=ue.findTaskById(Te,A)?.progress,de=Et=>Et.map(it=>it.id===A?{...it,...F}:it.subtasks?{...it,subtasks:de(it.subtasks)}:it);Ue(de(Te));let Ne=ue.findTaskById(de(Te),A);Ne&&(D?.(Ne),I?.(Ne),F.progress!==void 0&&te!==void 0&&F.progress!==te&&k?.(A,te,F.progress));},[Te,D,Me,I,k]),st=react.useCallback(A=>{A.length!==0&&(Ue(F=>fi(F,A)),a.onTaskIndent?.(A[0]));},[a]),ya=react.useCallback(A=>{A.length!==0&&(Ue(F=>hi(F,A)),a.onTaskOutdent?.(A[0]));},[a]),Ut=react.useCallback((A,F,V)=>{Ue(te=>vc(te,A,F,V)),a.onTaskReparent?.(A,F,V);},[a]),qe=react.useCallback((A,F)=>{A.length!==0&&(Ue(V=>bi(V,A,F)),a.onTaskMove?.(A[0],F));},[a]),wt=react.useCallback(async A=>{let F=[];for(let V of A)O&&await Promise.resolve(O(V))===false||F.push(V);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Ue(V=>yi(V,F)),F.forEach(V=>a.onTaskDelete?.(V))),E&&F.forEach(V=>E(V)));},[a,O,E]),ca=react.useCallback(A=>{Ue(F=>vi(F,A)),A.forEach(F=>a.onTaskDuplicate?.(F));},[a]),kr=react.useCallback((A,F)=>{Ue(V=>{let{tasks:te,newTask:de}=yc(V,A,F);return fe&&fe(de)===false?V:(a.onTaskCreate?.(de.parentId,de.position||0),ge?.(de),te)});},[a,fe,ge]),ap=react.useCallback((A,F)=>{Ue(V=>xi(V,A,F)),a.onTaskRename?.(A,F);},[a]),ns=react.useCallback(A=>{Ue(F=>{let{tasks:V}=wi(F,A);return a.onTaskCreate?.(A,0),V});},[a]),rp=react.useCallback((A,F,V)=>{let te=A.startDate?Math.round((F.getTime()-A.startDate.getTime())/864e5):0,de=it=>it.map(Gt=>Gt.id===A.id?{...Gt,startDate:F,endDate:V,...A.segments&&{segments:A.segments}}:Gt.subtasks?{...Gt,subtasks:de(Gt.subtasks)}:Gt),Ne=de(Te);Ne=ue.autoScheduleDependents(Ne,A.id,te),Ue(Ne);let Et={...A,startDate:F,endDate:V};D?.(Et);},[Te,D]),op=react.useCallback((A,F)=>{B?.(A,F),sa({isOpen:true,x:F.clientX,y:F.clientY,task:A});},[B]),np=react.useCallback((A,F)=>{let V=ue.splitTask(Te,A.id,F);Ue(V),sa({isOpen:false,x:0,y:0,task:null});},[Te]),Cl=react.useCallback(A=>{let F=ue.findTaskById(Te,A.id)||A;x?.(F),$||At(F);},[Te,x,$]),Tl=react.useCallback((A,F,V)=>{let te=new Map,de=va=>{va.forEach(Ca=>{Ca.dependencies&&te.set(Ca.id,Ca.dependencies),Ca.subtasks&&de(Ca.subtasks);});};de(V);let Ne=te.get(F)||[];te.set(F,[...Ne,A]);let Et=new Set,it=new Set,Gt=va=>{if(!Et.has(va)){Et.add(va),it.add(va);let Ca=te.get(va)||[];for(let wr of Ca){if(!Et.has(wr)&&Gt(wr))return true;if(it.has(wr))return true}}return it.delete(va),false};return Gt(F)},[]),Nl=react.useCallback((A,F)=>{if(Tl(A.id,F,Te)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
343
343
 
344
- Task dependencies must flow in one direction only.`);return}let _=ae=>ae.map(ce=>{if(ce.id===L){let Ne=ce.dependencies||[];if(!Ne.includes(M.id))return {...ce,dependencies:[...Ne,M.id]}}return ce.subtasks?{...ce,subtasks:_(ce.subtasks)}:ce});ze(_(Te)),oe?.(M.id,L);},[Te,oe,kl]),Cl=react.useCallback((M,L)=>{let _=ae=>ae.map(ce=>{if(ce.id===M&&ce.dependencies){let Ne=ce.dependencies.filter(Pt=>Pt!==L);return {...ce,dependencies:Ne}}return ce.subtasks?{...ce,subtasks:_(ce.subtasks)}:ce});ze(_(Te)),re?.(M,L);},[Te,re]),{startDate:Zo,endDate:Jm}=react.useMemo(()=>{let M=Te.filter(Ne=>Ne.startDate&&Ne.endDate);if(M.length===0){let Ne=new Date,Pt=new Date(Ne);Pt.setDate(Pt.getDate()-30);let lt=new Date(Ne);return lt.setDate(lt.getDate()+60),{startDate:Pt,endDate:lt}}let L=M.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),_=new Date(Math.min(...L.map(Ne=>Ne.getTime()))),ae=new Date(Math.max(...L.map(Ne=>Ne.getTime()))),ce=ue==="day"?7:ue==="week"?14:30;return _.setDate(_.getDate()-ce),ae.setDate(ae.getDate()+ce),{startDate:_,endDate:ae}},[Te,ue]),Qm=react.useCallback(async()=>{if(!ba.current||!tt.current||!fa.current)return;await new Promise(Rr=>setTimeout(Rr,200));let M=ba.current,L=tt.current.querySelector(".gantt-grid-scroll"),_=fa.current,ae=L?.scrollTop||0,ce=L?.scrollLeft||0,Ne=_.scrollTop,Pt=_.scrollLeft,lt=M.style.overflow,Gt=M.style.height,va=L?.style.overflow||"",Ca=_.style.overflow,kr=M.style.width,en=_.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),sr=_.querySelector("svg"),wr=sr?.getAttribute("height")?parseInt(sr.getAttribute("height"),10):sr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,_.scrollHeight),Dl=sr?.getAttribute("width")?parseInt(sr.getAttribute("width"),10):sr?.getBoundingClientRect().width||_.scrollWidth,sp=M.querySelector('[class*="h-12"]')?.offsetHeight||48,os=Math.max(ro,$r,wr),ns=sp+os+50,ss=(L?.offsetWidth||300)+Dl+10;L&&(L.scrollTop=0,L.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,M.style.overflow="visible",M.style.height=`${ns}px`,M.style.width=`${ss}px`,L&&(L.style.overflow="visible",L.style.height=`${os+50}px`),_.style.overflow="visible",_.style.height=`${os+50}px`,_.style.width=`${Dl+10}px`,await new Promise(ls=>setTimeout(ls,150));let ip=await Sc__default.default(M,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ss,height:ns,windowWidth:ss+100,windowHeight:ns+100,scrollX:0,scrollY:0,ignoreElements:ls=>{let Sl=window.getComputedStyle(ls),El=parseInt(Sl.zIndex,10);return !isNaN(El)&&El>=50||Sl.position==="fixed"}}),is=document.createElement("a");is.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,is.href=ip.toDataURL("image/png"),is.click();}finally{M.style.overflow=lt,M.style.height=Gt,M.style.width=kr,L&&(L.style.overflow=va,L.style.height="",L.scrollTop=ae,L.scrollLeft=ce),_.style.overflow=Ca,_.style.height="",_.style.width=en,_.scrollTop=Ne,_.scrollLeft=Pt;}},[E]),Zm=react.useCallback(async()=>{await pe.exportToPDF(Te);},[Te]),ep=react.useCallback(async()=>{await pe.exportToExcel(Te);},[Te]),tp=react.useCallback(()=>{let M=pe.exportToCSV(Te),L=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(L),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[Te]),ap=react.useCallback(()=>{let M=pe.exportToJSON(Te),L=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(L),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[Te]),rp=react.useCallback(()=>{pe.exportToMSProject(Te,"Gantt Project","project.xml");},[Te]),op=M=>{M.preventDefault(),Ye(true);},ao=react.useRef(false),[rs,Tl]=react.useState(false),To=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=fa.current,L=tt.current?.querySelector(".gantt-grid-scroll");if(!M||!L)return;let _=()=>{if(ao.current)return;ao.current=true;let lt=M.scrollTop;xe(lt),L.scrollTop=lt,requestAnimationFrame(()=>{ao.current=false;});},ae=()=>{if(ao.current)return;ao.current=true;let lt=L.scrollTop;xe(lt),M.scrollTop=lt,requestAnimationFrame(()=>{ao.current=false;});},ce=lt=>{if(Fe&&L){let va=L.parentElement?.getBoundingClientRect()?.left||0,Ca=lt.clientX-va,kr=200,en=$e+ie,Rr=window.innerWidth*Re,sr=Math.max(en,Rr);Ca>=kr&&Ca<=sr&&Dt(Ca);}if(rs&&M){let Gt=lt.clientX-To.current.x,va=lt.clientY-To.current.y;M.scrollLeft=To.current.scrollLeft-Gt,M.scrollTop=To.current.scrollTop-va;}},Ne=()=>{Ye(false),Tl(false);},Pt=lt=>{if(lt.button!==0)return;let Gt=lt.target;Gt.closest("[data-task-bar]")||Gt.closest("[data-dependency-line]")||Gt.closest("button")||Gt.closest('[role="button"]')||Gt.tagName==="rect"&&Gt.getAttribute("data-clickable")==="true"||(Tl(true),To.current={x:lt.clientX,y:lt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},lt.preventDefault());};return M.addEventListener("scroll",_),L.addEventListener("scroll",ae),M.addEventListener("mousedown",Pt),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Ne),()=>{M.removeEventListener("scroll",_),L.removeEventListener("scroll",ae),M.removeEventListener("mousedown",Pt),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Ne);}},[Fe,rs,$e]);let Nl=react.useRef(false),np=react.useRef(null);return react.useLayoutEffect(()=>{if(Nl.current||Te.length===0||!fa.current)return;Nl.current=true,np.current=Zo;let M=fa.current,L=new Date,_=ue==="day"?60:ue==="week"?20:8,ae=(L.getTime()-Zo.getTime())/(1e3*60*60*24),ce=M.clientWidth,Pt=ae*_*he-ce/2;ae>=0&&ce>0&&(M.scrollLeft=Math.max(0,Pt));},[Te.length,Zo,ue,he]),jsxRuntime.jsx(ho.Provider,{value:O,children:jsxRuntime.jsx(us.Provider,{value:ye,children:jsxRuntime.jsxs("div",{ref:ba,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Tn,{theme:E,timeScale:ue,onTimeScaleChange:He,zoom:he,onZoomChange:Ve,currentTheme:V,onThemeChange:Xt,rowDensity:We,onRowDensityChange:ot,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:v,onCreateTask:l,taskFilter:gt,onTaskFilterChange:z,onExportPNG:i?Qm:void 0,onExportPDF:i?Zm:void 0,onExportExcel:i?ep:void 0,onExportCSV:i?tp:void 0,onExportJSON:i?ap:void 0,onExportMSProject:i?rp:void 0}),jsxRuntime.jsxs("div",{ref:tt,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:Et,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(En,{tasks:nt,theme:E,rowHeight:se,availableUsers:u,templates:X,onTaskClick:w,onTaskDblClick:xl,onTaskContextMenu:R,onTaskToggle:Be,scrollTop:le,columns:ve,onToggleColumn:Ue,onColumnResize:kt,onTaskUpdate:Lt,onTaskIndent:it,onTaskOutdent:ya,onTaskMove:Xe,onMultiTaskDelete:wt,onTaskDuplicate:ca,onTaskCreate:xr,onTaskRename:Km,onCreateSubtask:as,onOpenTaskModal:w?M=>w(M):void 0,onDeleteRequest:(M,L)=>ea({taskId:M,taskName:L}),onTaskReparent:Ut})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:op}),jsxRuntime.jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:rs?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx($n,{tasks:nt,theme:E,rowHeight:se,timeScale:ue,startDate:Zo,endDate:Jm,zoom:he,templates:X,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:xl,onTaskContextMenu:qm,onTaskDateChange:Ym,onDependencyCreate:wl,onDependencyDelete:Cl})})]}),Ae.task&&jsxRuntime.jsx(yo,{isOpen:Ae.isOpen,x:Ae.x,y:Ae.y,theme:E,onClose:()=>sa({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Ae.task;if(!M)return [];let L=pe.findTaskById(Te,M.id)||M;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:O.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{B?B(L):as(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:O.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ea({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:O.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{I?I(L):xt(L);}},{id:"addSubtask",label:O.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{B?B(L):as(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:O.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{q?q(L):Lt(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:O.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{ne?ne(L):Lt(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:O.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{Lt(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:O.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let ae=L.startDate.getTime(),ce=L.endDate.getTime(),Ne=ae+(ce-ae)/2,Pt=new Date(Ne);Xm(L,Pt);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:O.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ea({taskId:L.id,taskName:L.name});}}]})()}),jsxRuntime.jsx(_r,{task:Zt,isOpen:!!Zt,onClose:()=>xt(null),onTaskUpdate:M=>{Zt&&(Lt(Zt.id,M),xt(null));},theme:V==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:St&&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:()=>ea(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:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.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:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[O.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="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:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',St.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ea(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{wt([St.taskId]),ea(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"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(On,{tasks:Te,theme:E,config:C,onTasksUpdate:ze,onTaskUpdate:Lt,onTaskCreate:M=>{ze(L=>[...L,M]);},onTaskDelete:M=>{wt([M]);},onDependencyCreate:(M,L)=>{let _=pe.findTaskById(Te,M);_&&wl(_,L);},onDependencyDelete:Cl})]})})})});var Ni=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Di=[{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 Ac({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...Ni,...i.filter(z=>!Ni.some(le=>le.id===z.id))],c=Qe[m]||Qe.dark,[b,v]=react.useState(false),[l,x]=react.useState(false),[y,D]=react.useState(false),[w,k]=react.useState(false),[R,A]=react.useState({top:0,left:0}),[N,I]=react.useState(null),[B,q]=react.useState(new Date),[ne,oe]=react.useState({top:0,left:0}),[re,fe]=react.useState(false),[$,Z]=react.useState([]),W=react.useRef(null),G=react.useRef(null),F=react.useRef(null),te=react.useRef(null),J=react.useRef(null),[V,Se]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ue,He]=react.useState({});react.useEffect(()=>{a?(Se({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)&&fe(true)):(Se({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),fe(false),Z([]));},[a,e]),react.useEffect(()=>{let z=le=>{W.current&&!W.current.contains(le.target)&&v(false),G.current&&!G.current.contains(le.target)&&x(false),F.current&&!F.current.contains(le.target)&&D(false),te.current&&!te.current.contains(le.target)&&k(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let We=()=>{let z={};return V.name.trim()||(z.name="El nombre es requerido"),V.startDate&&V.endDate&&V.startDate>V.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),He(z),Object.keys(z).length===0},ot=async z=>{if(z.preventDefault(),!!We())try{let le=p==="create"&&$.length>0?{...V,pendingFiles:$}:V;await s(le),Z([]),t();}catch(le){console.error("Error submitting task:",le);}},he=(z,le)=>{Se(xe=>{let Fe={...xe,[z]:le};if(z==="status"){let Ye=le;Ye==="todo"?Fe.progress=0:Ye==="in-progress"?(xe.progress===0||xe.progress===100)&&(Fe.progress=50):Ye==="completed"||Ye==="closed"?Fe.progress=100:(Ye==="in-review"||Ye==="review")&&(Fe.progress=75);}if(z==="progress"){let Ye=typeof le=="number"?le:parseInt(le,10);Ye===100&&xe.status!=="completed"?Fe.status="completed":Ye>0&&Ye<100&&xe.status==="todo"?Fe.status="in-progress":Ye===0&&xe.status!=="todo"&&(Fe.status="todo");}return Fe}),ue[z]&&He(xe=>{let Fe={...xe};return delete Fe[z],Fe});},Ve=T.find(z=>z.id===V.status)??Ni[0],pt=Di.find(z=>z.id===V.priority)??Di[1],Ft=lr.find(z=>z.value===V.color)??lr[0],gt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.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:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Ve.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=c.hoverBg,z.currentTarget.style.color=c.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:ot,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:z=>he("name",z.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.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:z=>he("description",z.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:W,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...gt,borderColor:Ve.color,backgroundColor:`${Ve.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Ve.color}}),jsxRuntime.jsx("span",{style:{color:Ve.color},children:Ve.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Ve.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(z=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{he("status",z.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,V.status===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsxRuntime.jsx("span",{children:pt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:Di.map(z=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{he("priority",z.id),x(false);},children:[jsxRuntime.jsx("span",{children:z.icon}),z.label,V.priority===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:F,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&D(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,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((z,le)=>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:z.color||c.accent,borderColor:c.bgSecondary},children:z.initials},le))}),V.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",V.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),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-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(z=>{let le=V.assignees?.some(xe=>xe.name===z.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:c.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=le?(V.assignees||[]).filter(Fe=>Fe.name!==z.name):[...V.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(Fe=>Fe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];he("assignees",xe);},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:c.accent},children:z.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:z.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:le&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},z.id)})})})]}),jsxRuntime.jsxs("div",{ref:te,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)k(false);else {if(te.current){let z=te.current.getBoundingClientRect(),le=window.innerHeight,xe=120,Ye=le-z.bottom<xe?z.top-xe-8:z.bottom+8;A({top:Ye,left:z.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:V.color}}),jsxRuntime.jsx("span",{children:Ft.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(ct,{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:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:z=>z.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:lr.slice(0,18).map(z=>{let le=V.color===z.value;return jsxRuntime.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),he("color",z.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:z.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:le?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(ir,{selectedTags:V.tags||[],availableTags:u,onChange:z=>he("tags",z),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:J,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="start")I(null);else {if(J.current){let z=J.current.getBoundingClientRect(),le=window.innerHeight,xe=320,Ye=le-z.bottom<xe?z.top-xe-8:z.bottom+8;oe({top:Ye,left:z.left});}I("start"),q(V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...gt,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:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="end")I(null);else {if(J.current){let z=J.current.getBoundingClientRect(),le=window.innerHeight,xe=320,Ye=le-z.bottom<xe?z.top-xe-8:z.bottom+8;oe({top:Ye,left:z.left});}I("end"),q(V.endDate||V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...gt,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(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:`${ne.top}px`,left:`${ne.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let z=new Date,le=new Date(z);le.setDate(z.getDate()+1);let xe=new Date(z);xe.setDate(z.getDate()+7);let Fe=new Date(z);return Fe.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:le},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:Fe}].map((Je,Dt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Ae=>Ae.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Ae=>Ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(he("startDate",Je.date),(!V.endDate||Je.date>V.endDate)&&he("endDate",Je.date),I("end")):(he("endDate",Je.date),(!V.startDate||Je.date<V.startDate)&&he("startDate",Je.date),I(null));},children:Je.label},Dt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.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:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{he("startDate",void 0),he("endDate",void 0),I(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:()=>q(new Date(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>q(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((z,le)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:z},le))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=B.getFullYear(),le=B.getMonth(),xe=new Date(z,le,1).getDay(),Fe=new Date(z,le+1,0).getDate(),Ye=new Date,Je=[];for(let Ae=xe-1;Ae>=0;Ae--)Je.push({day:new Date(z,le,-Ae).getDate(),date:new Date(z,le-1,new Date(z,le,-Ae).getDate()),isCurrentMonth:false});for(let Ae=1;Ae<=Fe;Ae++)Je.push({day:Ae,date:new Date(z,le,Ae),isCurrentMonth:true});let Dt=42-Je.length;for(let Ae=1;Ae<=Dt;Ae++)Je.push({day:Ae,date:new Date(z,le+1,Ae),isCurrentMonth:false});return Je.map((Ae,sa)=>{let Zt=Ae.date.toDateString()===Ye.toDateString(),xt=V.startDate?.toDateString()===Ae.date.toDateString(),St=V.endDate?.toDateString()===Ae.date.toDateString(),ea=V.startDate&&V.endDate&&Ae.date>=V.startDate&&Ae.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:Ae.isCurrentMonth?xt||St?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:xt?"#3B82F6":St?"#7C3AED":ea?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Zt&&!xt&&!St?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(he("startDate",Ae.date),V.endDate&&Ae.date>V.endDate&&he("endDate",Ae.date),I("end")):(he("endDate",Ae.date),V.startDate&&Ae.date<V.startDate&&he("startDate",Ae.date),I(null));},children:Ae.day},sa)})})()})]})]})]})})]}),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:c.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:z=>he("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.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:()=>fe(!re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="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:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?$.length>0&&`(${$.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsxRuntime.jsx(mr,{cardId:"pending",attachments:$.map((z,le)=>({id:`pending-${le}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>Z(le=>[...le,...z]),onDelete:z=>{let le=parseInt(z.replace("pending-",""),10);Z(xe=>xe.filter((Fe,Ye)=>Ye!==le));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(mr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?z=>h(a.id,z):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&$.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$.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:z=>he("isMilestone",z.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(z=>z.id!==a?.id).map(z=>{let le=V.dependencies?.includes(z.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=le?(V.dependencies||[]).filter(Fe=>Fe!==z.id):[...V.dependencies||[],z.id];he("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:le?`${c.accent}30`:c.bgPrimary,color:le?c.accent:c.textSecondary,border:`1px solid ${le?c.accent:c.borderLight}`},disabled:n,children:z.name},z.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.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:c.accent,color:"#FFF"},onMouseEnter:z=>!n&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!n&&(z.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:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Fc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
344
+ Task dependencies must flow in one direction only.`);return}let V=te=>te.map(de=>{if(de.id===F){let Ne=de.dependencies||[];if(!Ne.includes(A.id))return {...de,dependencies:[...Ne,A.id]}}return de.subtasks?{...de,subtasks:V(de.subtasks)}:de});Ue(V(Te)),ae?.(A.id,F);},[Te,ae,Tl]),Dl=react.useCallback((A,F)=>{let V=te=>te.map(de=>{if(de.id===A&&de.dependencies){let Ne=de.dependencies.filter(Et=>Et!==F);return {...de,dependencies:Ne}}return de.subtasks?{...de,subtasks:V(de.subtasks)}:de});Ue(V(Te)),re?.(A,F);},[Te,re]),{startDate:tn,endDate:sp}=react.useMemo(()=>{let A=Te.filter(Ne=>Ne.startDate&&Ne.endDate);if(A.length===0){let Ne=new Date,Et=new Date(Ne);Et.setDate(Et.getDate()-30);let it=new Date(Ne);return it.setDate(it.getDate()+60),{startDate:Et,endDate:it}}let F=A.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...F.map(Ne=>Ne.getTime()))),te=new Date(Math.max(...F.map(Ne=>Ne.getTime()))),de=pe==="day"?7:pe==="week"?14:30;return V.setDate(V.getDate()-de),te.setDate(te.getDate()+de),{startDate:V,endDate:te}},[Te,pe]),ip=react.useCallback(async()=>{if(!ba.current||!et.current||!fa.current)return;await new Promise(Or=>setTimeout(Or,200));let A=ba.current,F=et.current.querySelector(".gantt-grid-scroll"),V=fa.current,te=F?.scrollTop||0,de=F?.scrollLeft||0,Ne=V.scrollTop,Et=V.scrollLeft,it=A.style.overflow,Gt=A.style.height,va=F?.style.overflow||"",Ca=V.style.overflow,wr=A.style.width,an=V.style.width;try{let Or=F?.querySelector(".gantt-taskgrid-content"),ir=V.querySelector("svg"),Cr=ir?.getAttribute("height")?parseInt(ir.getAttribute("height"),10):ir?.getBoundingClientRect().height||0,no=Or?.scrollHeight||F?.scrollHeight||600,zr=Math.max(Cr,V.scrollHeight),Pl=ir?.getAttribute("width")?parseInt(ir.getAttribute("width"),10):ir?.getBoundingClientRect().width||V.scrollWidth,fp=A.querySelector('[class*="h-12"]')?.offsetHeight||48,is=Math.max(no,zr,Cr),ls=fp+is+50,ds=(F?.offsetWidth||300)+Pl+10;F&&(F.scrollTop=0,F.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,A.style.overflow="visible",A.style.height=`${ls}px`,A.style.width=`${ds}px`,F&&(F.style.overflow="visible",F.style.height=`${is+50}px`),V.style.overflow="visible",V.style.height=`${is+50}px`,V.style.width=`${Pl+10}px`,await new Promise(ms=>setTimeout(ms,150));let hp=await Rc__default.default(A,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ds,height:ls,windowWidth:ds+100,windowHeight:ls+100,scrollX:0,scrollY:0,ignoreElements:ms=>{let Ml=window.getComputedStyle(ms),Al=parseInt(Ml.zIndex,10);return !isNaN(Al)&&Al>=50||Ml.position==="fixed"}}),cs=document.createElement("a");cs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,cs.href=hp.toDataURL("image/png"),cs.click();}finally{A.style.overflow=it,A.style.height=Gt,A.style.width=wr,F&&(F.style.overflow=va,F.style.height="",F.scrollTop=te,F.scrollLeft=de),V.style.overflow=Ca,V.style.height="",V.style.width=an,V.scrollTop=Ne,V.scrollLeft=Et;}},[P]),lp=react.useCallback(async()=>{await ue.exportToPDF(Te);},[Te]),dp=react.useCallback(async()=>{await ue.exportToExcel(Te);},[Te]),cp=react.useCallback(()=>{let A=ue.exportToCSV(Te),F=new Blob([A],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(F),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[Te]),mp=react.useCallback(()=>{let A=ue.exportToJSON(Te),F=new Blob([A],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(F),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[Te]),pp=react.useCallback(()=>{ue.exportToMSProject(Te,"Gantt Project","project.xml");},[Te]),up=A=>{A.preventDefault(),Xe(true);},oo=react.useRef(false),[ss,Sl]=react.useState(false),No=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let A=fa.current,F=et.current?.querySelector(".gantt-grid-scroll");if(!A||!F)return;let V=()=>{if(oo.current)return;oo.current=true;let it=A.scrollTop;Pe(it),F.scrollTop=it,requestAnimationFrame(()=>{oo.current=false;});},te=()=>{if(oo.current)return;oo.current=true;let it=F.scrollTop;Pe(it),A.scrollTop=it,requestAnimationFrame(()=>{oo.current=false;});},de=it=>{if(Se&&F){let va=F.parentElement?.getBoundingClientRect()?.left||0,Ca=it.clientX-va,wr=200,an=ze+ne,Or=window.innerWidth*Oe,ir=Math.max(an,Or);Ca>=wr&&Ca<=ir&&Dt(Ca);}if(ss&&A){let Gt=it.clientX-No.current.x,va=it.clientY-No.current.y;A.scrollLeft=No.current.scrollLeft-Gt,A.scrollTop=No.current.scrollTop-va;}},Ne=()=>{Xe(false),Sl(false);},Et=it=>{if(it.button!==0)return;let Gt=it.target;Gt.closest("[data-task-bar]")||Gt.closest("[data-dependency-line]")||Gt.closest("button")||Gt.closest('[role="button"]')||Gt.tagName==="rect"&&Gt.getAttribute("data-clickable")==="true"||(Sl(true),No.current={x:it.clientX,y:it.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},it.preventDefault());};return A.addEventListener("scroll",V),F.addEventListener("scroll",te),A.addEventListener("mousedown",Et),document.addEventListener("mousemove",de),document.addEventListener("mouseup",Ne),()=>{A.removeEventListener("scroll",V),F.removeEventListener("scroll",te),A.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",Ne);}},[Se,ss,ze]);let El=react.useRef(false),gp=react.useRef(null);return react.useLayoutEffect(()=>{if(El.current||Te.length===0||!fa.current)return;El.current=true,gp.current=tn;let A=fa.current,F=new Date,V=pe==="day"?60:pe==="week"?20:8,te=(F.getTime()-tn.getTime())/(1e3*60*60*24),de=A.clientWidth,Et=te*V*se-de/2;te>=0&&de>0&&(A.scrollLeft=Math.max(0,Et));},[Te.length,tn,pe,se]),jsxRuntime.jsx(yo.Provider,{value:z,children:jsxRuntime.jsx(hs.Provider,{value:xe,children:jsxRuntime.jsxs("div",{ref:ba,className:"flex flex-col h-full w-full",style:{backgroundColor:P.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Sn,{theme:P,timeScale:pe,onTimeScaleChange:Fe,zoom:se,onZoomChange:_e,currentTheme:G,onThemeChange:Xt,rowDensity:Ve,onRowDensityChange:dt,showThemeSelector:u,showCreateTaskButton:C,createTaskLabel:m,onCreateTask:l,taskFilter:ct,onTaskFilterChange:U,onExportPNG:i?ip:void 0,onExportPDF:i?lp:void 0,onExportExcel:i?dp:void 0,onExportCSV:i?cp:void 0,onExportJSON:i?mp:void 0,onExportMSProject:i?pp:void 0}),jsxRuntime.jsxs("div",{ref:et,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:St,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(An,{tasks:ot,theme:P,rowHeight:oe,availableUsers:g,templates:J,onTaskClick:w,onTaskDblClick:Cl,onTaskContextMenu:B,onTaskToggle:$e,scrollTop:ie,columns:he,onToggleColumn:We,onColumnResize:kt,onTaskUpdate:Ft,onTaskIndent:st,onTaskOutdent:ya,onTaskMove:qe,onMultiTaskDelete:wt,onTaskDuplicate:ca,onTaskCreate:kr,onTaskRename:ap,onCreateSubtask:ns,onOpenTaskModal:w?A=>w(A):void 0,onDeleteRequest:(A,F)=>ea({taskId:A,taskName:F}),onTaskReparent:Ut})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:P.border,zIndex:15},onMouseDown:up}),jsxRuntime.jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ss?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Un,{tasks:ot,theme:P,rowHeight:oe,timeScale:pe,startDate:tn,endDate:sp,zoom:se,locale:N,templates:J,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:Cl,onTaskContextMenu:op,onTaskDateChange:rp,onDependencyCreate:Nl,onDependencyDelete:Dl})})]}),Ie.task&&jsxRuntime.jsx(vo,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:P,onClose:()=>sa({isOpen:false,x:0,y:0,task:null}),items:(()=>{let A=Ie.task;if(!A)return [];let F=ue.findTaskById(Te,A.id)||A;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:z.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{R?R(F):ns(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:z.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{ea({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:z.contextMenu?.editTask||"Edit Task",icon:$t.Pencil,onClick:()=>{$?$(F):At(F);}},{id:"addSubtask",label:z.contextMenu?.addSubtask||"Add Subtask",icon:$t.Add,onClick:()=>{R?R(F):ns(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:z.contextMenu?.markIncomplete||"Mark Incomplete",icon:$t.MarkIncomplete,onClick:()=>{j?j(F):Ft(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:z.contextMenu?.setInProgress||"Set In Progress",icon:$t.SetInProgress,onClick:()=>{ee?ee(F):Ft(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:z.contextMenu?.markComplete||"Mark Complete",icon:$t.MarkComplete,onClick:()=>{Ft(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:z.contextMenu?.splitTask||"Split Task",icon:$t.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let te=F.startDate.getTime(),de=F.endDate.getTime(),Ne=te+(de-te)/2,Et=new Date(Ne);np(F,Et);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:z.contextMenu?.deleteTask||"Delete Task",icon:$t.Delete,onClick:()=>{ea({taskId:F.id,taskName:F.name});}}]})()}),jsxRuntime.jsx(jr,{task:Zt,isOpen:!!Zt,onClose:()=>At(null),onTaskUpdate:A=>{Zt&&(Ft(Zt.id,A),At(null));},theme:G==="light"?"light":"dark",locale:N==="es"?"es":"en",availableUsers:g,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:gt&&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:()=>ea(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:A=>A.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:P.bgSecondary,border:`1px solid ${P.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${P.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:P.textPrimary,fontFamily:"Inter, sans-serif"},children:[z.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},children:N==="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:P.textSecondary,fontFamily:"Inter, sans-serif"},children:[N==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:P.textPrimary},children:['"',gt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:P.bgPrimary,borderTop:`1px solid ${P.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ea(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=P.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:N==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{wt([gt.taskId]),ea(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:A=>{A.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),N==="es"?"Eliminar":"Delete"]})]})]})})}),T?.enabled&&jsxRuntime.jsx(Hn,{tasks:Te,theme:P,config:T,onTasksUpdate:Ue,onTaskUpdate:Ft,onTaskCreate:A=>{Ue(F=>[...F,A]);},onTaskDelete:A=>{wt([A]);},onDependencyCreate:(A,F)=>{let V=ue.findTaskById(Te,A);V&&Nl(V,F);},onDependencyDelete:Dl})]})})})});var Ei=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Pi=[{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 Uc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:g=[],onCreateTag:d,attachments:f=[],onUploadAttachments:b,onDeleteAttachment:T}){let N=[...Ei,...i.filter(U=>!Ei.some(ie=>ie.id===U.id))],c=Je[u]||Je.dark,[C,m]=react.useState(false),[l,v]=react.useState(false),[S,y]=react.useState(false),[w,x]=react.useState(false),[B,D]=react.useState({top:0,left:0}),[k,$]=react.useState(null),[R,j]=react.useState(new Date),[ee,ae]=react.useState({top:0,left:0}),[re,fe]=react.useState(false),[ge,Me]=react.useState([]),I=react.useRef(null),O=react.useRef(null),E=react.useRef(null),Q=react.useRef(null),Y=react.useRef(null),[G,me]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[pe,Fe]=react.useState({});react.useEffect(()=>{a?(me({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)&&fe(true)):(me({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),fe(false),Me([]));},[a,e]),react.useEffect(()=>{let U=ie=>{I.current&&!I.current.contains(ie.target)&&m(false),O.current&&!O.current.contains(ie.target)&&v(false),E.current&&!E.current.contains(ie.target)&&y(false),Q.current&&!Q.current.contains(ie.target)&&x(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let Ve=()=>{let U={};return G.name.trim()||(U.name="El nombre es requerido"),G.startDate&&G.endDate&&G.startDate>G.endDate&&(U.endDate="La fecha de fin debe ser posterior a la de inicio"),Fe(U),Object.keys(U).length===0},dt=async U=>{if(U.preventDefault(),!!Ve())try{let ie=p==="create"&&ge.length>0?{...G,pendingFiles:ge}:G;await s(ie),Me([]),t();}catch(ie){console.error("Error submitting task:",ie);}},se=(U,ie)=>{me(Pe=>{let Se={...Pe,[U]:ie};if(U==="status"){let Xe=ie;Xe==="todo"?Se.progress=0:Xe==="in-progress"?(Pe.progress===0||Pe.progress===100)&&(Se.progress=50):Xe==="completed"||Xe==="closed"?Se.progress=100:(Xe==="in-review"||Xe==="review")&&(Se.progress=75);}if(U==="progress"){let Xe=typeof ie=="number"?ie:parseInt(ie,10);Xe===100&&Pe.status!=="completed"?Se.status="completed":Xe>0&&Xe<100&&Pe.status==="todo"?Se.status="in-progress":Xe===0&&Pe.status!=="todo"&&(Se.status="todo");}return Se}),pe[U]&&Fe(Pe=>{let Se={...Pe};return delete Se[U],Se});},_e=N.find(U=>U.id===G.status)??Ei[0],xt=Pi.find(U=>U.id===G.priority)??Pi[1],zt=dr.find(U=>U.value===G.color)??dr[0],ct={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.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":u,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:_e.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:U=>{U.currentTarget.style.backgroundColor=c.hoverBg,U.currentTarget.style.color=c.textPrimary;},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="transparent",U.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:dt,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:G.name,onChange:U=>se("name",U.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.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:G.description||"",onChange:U=>se("description",U.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:I,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&m(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ct,borderColor:_e.color,backgroundColor:`${_e.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:_e.color}}),jsxRuntime.jsx("span",{style:{color:_e.color},children:_e.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:_e.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:N.map(U=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("status",U.id),m(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:U.color}}),U.title,G.status===U.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},U.id))})})]}),jsxRuntime.jsxs("div",{ref:O,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&v(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{children:xt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:Pi.map(U=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("priority",U.id),v(false);},children:[jsxRuntime.jsx("span",{children:U.icon}),U.label,G.priority===U.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},U.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:E,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&y(!S),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:n,children:[G.assignees&&G.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:G.assignees.slice(0,3).map((U,ie)=>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:U.color||c.accent,borderColor:c.bgSecondary},children:U.initials},ie))}),G.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",G.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:S&&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:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(U=>{let ie=G.assignees?.some(Pe=>Pe.name===U.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:c.textPrimary},onMouseEnter:Pe=>Pe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Pe=>Pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Pe=ie?(G.assignees||[]).filter(Se=>Se.name!==U.name):[...G.assignees||[],{name:U.name,avatar:U.avatar,initials:U.name.split(" ").map(Se=>Se[0]).join("").toUpperCase().slice(0,2),color:c.accent}];se("assignees",Pe);},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:c.accent},children:U.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:U.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ie&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},U.id)})})})]}),jsxRuntime.jsxs("div",{ref:Q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)x(false);else {if(Q.current){let U=Q.current.getBoundingClientRect(),ie=window.innerHeight,Pe=120,Xe=ie-U.bottom<Pe?U.top-Pe-8:U.bottom+8;D({top:Xe,left:U.left});}x(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ct,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:G.color}}),jsxRuntime.jsx("span",{children:zt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>x(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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:U=>U.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:dr.slice(0,18).map(U=>{let ie=G.color===U.value;return jsxRuntime.jsx("button",{type:"button",onClick:Pe=>{Pe.preventDefault(),Pe.stopPropagation(),se("color",U.value),x(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:U.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:U.value,outline:ie?`2px solid ${U.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},U.value)})})})})]})})]}),g.length>0||d?jsxRuntime.jsx(lr,{selectedTags:G.tags||[],availableTags:g,onChange:U=>se("tags",U),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:Y,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!G.isMilestone)if(k==="start")$(null);else {if(Y.current){let U=Y.current.getBoundingClientRect(),ie=window.innerHeight,Pe=320,Xe=ie-U.bottom<Pe?U.top-Pe-8:U.bottom+8;ae({top:Xe,left:U.left});}$("start"),j(G.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:G.isMilestone?.5:1,cursor:G.isMilestone?"not-allowed":"pointer"},disabled:n||G.isMilestone,children:G.startDate?G.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!G.isMilestone)if(k==="end")$(null);else {if(Y.current){let U=Y.current.getBoundingClientRect(),ie=window.innerHeight,Pe=320,Xe=ie-U.bottom<Pe?U.top-Pe-8:U.bottom+8;ae({top:Xe,left:U.left});}$("end"),j(G.endDate||G.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ct,opacity:G.isMilestone?.5:1,cursor:G.isMilestone?"not-allowed":"pointer"},disabled:n||G.isMilestone,children:G.endDate?G.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(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:`${ee.top}px`,left:`${ee.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let U=new Date,ie=new Date(U);ie.setDate(U.getDate()+1);let Pe=new Date(U);Pe.setDate(U.getDate()+7);let Se=new Date(U);return Se.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:Pe},{label:"2 semanas",date:Se}].map((Ge,Dt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Ie=>Ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Ie=>Ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{k==="start"?(se("startDate",Ge.date),(!G.endDate||Ge.date>G.endDate)&&se("endDate",Ge.date),$("end")):(se("endDate",Ge.date),(!G.startDate||Ge.date<G.startDate)&&se("startDate",Ge.date),$(null));},children:Ge.label},Dt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.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:U=>U.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{se("startDate",void 0),se("endDate",void 0),$(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:()=>j(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:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>j(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:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((U,ie)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:U},ie))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let U=R.getFullYear(),ie=R.getMonth(),Pe=new Date(U,ie,1).getDay(),Se=new Date(U,ie+1,0).getDate(),Xe=new Date,Ge=[];for(let Ie=Pe-1;Ie>=0;Ie--)Ge.push({day:new Date(U,ie,-Ie).getDate(),date:new Date(U,ie-1,new Date(U,ie,-Ie).getDate()),isCurrentMonth:false});for(let Ie=1;Ie<=Se;Ie++)Ge.push({day:Ie,date:new Date(U,ie,Ie),isCurrentMonth:true});let Dt=42-Ge.length;for(let Ie=1;Ie<=Dt;Ie++)Ge.push({day:Ie,date:new Date(U,ie+1,Ie),isCurrentMonth:false});return Ge.map((Ie,sa)=>{let Zt=Ie.date.toDateString()===Xe.toDateString(),At=G.startDate?.toDateString()===Ie.date.toDateString(),gt=G.endDate?.toDateString()===Ie.date.toDateString(),ea=G.startDate&&G.endDate&&Ie.date>=G.startDate&&Ie.date<=G.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:Ie.isCurrentMonth?At||gt?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:At?"#3B82F6":gt?"#7C3AED":ea?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Zt&&!At&&!gt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{k==="start"?(se("startDate",Ie.date),G.endDate&&Ie.date>G.endDate&&se("endDate",Ie.date),$("end")):(se("endDate",Ie.date),G.startDate&&Ie.date<G.startDate&&se("startDate",Ie.date),$(null));},children:Ie.day},sa)})})()})]})]})]})})]}),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:c.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:G.progress,onChange:U=>se("progress",parseInt(U.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:G.progress<30?"#EF4444":G.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:`${G.progress<30?"#EF4444":G.progress<70?"#F59E0B":"#10B981"}20`,color:G.progress<30?"#EF4444":G.progress<70?"#F59E0B":"#10B981"},children:[G.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>fe(!re),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${re?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:re&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(b||f.length>0||p==="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:c.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:c.textTertiary},children:["Adjuntos ",p==="create"?ge.length>0&&`(${ge.length})`:f.length>0&&`(${f.length})`]})]}),p==="create"?jsxRuntime.jsx(pr,{cardId:"pending",attachments:ge.map((U,ie)=>({id:`pending-${ie}`,cardId:"pending",name:U.name,size:U.size,type:U.type,url:URL.createObjectURL(U),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:U=>Me(ie=>[...ie,...U]),onDelete:U=>{let ie=parseInt(U.replace("pending-",""),10);Me(Pe=>Pe.filter((Se,Xe)=>Xe!==ie));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(pr,{cardId:a?.id||"new",attachments:f,onUpload:b&&a?.id?U=>b(a.id,U):void 0,onDelete:T,maxSizeMB:10,maxFiles:20}),p==="create"&&ge.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[ge.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:G.isMilestone,onChange:U=>se("isMilestone",U.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(U=>U.id!==a?.id).map(U=>{let ie=G.dependencies?.includes(U.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Pe=ie?(G.dependencies||[]).filter(Se=>Se!==U.id):[...G.dependencies||[],U.id];se("dependencies",Pe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ie?`${c.accent}30`:c.bgPrimary,color:ie?c.accent:c.textSecondary,border:`1px solid ${ie?c.accent:c.borderLight}`},disabled:n,children:U.name},U.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:U=>U.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:c.accent,color:"#FFF"},onMouseEnter:U=>!n&&(U.currentTarget.style.opacity="0.9"),onMouseLeave:U=>!n&&(U.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:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Hc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345
 
346
346
  AVAILABLE COMMANDS:
347
347
  1. move_task - Move a task to a different date
@@ -382,39 +382,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
382
382
 
383
383
  Always try to match task names case-insensitively and handle partial matches.
384
384
  If you can't find a task by name, search through the provided task list.
385
- If ambiguous, ask for clarification in the message field.`;function Lc(e){return `CURRENT TASKS:
386
- ${Ic(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(`
385
+ If ambiguous, ask for clarification in the message field.`;function Wc(e){return `CURRENT TASKS:
386
+ ${Gc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Ic(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function vr(e,t){let a=Ic(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return n.every(i=>m.includes(i))})}function Si(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}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 h={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(h!==void 0){let C=new Date(r),T=C.getDay(),c=h-T;return c<=0&&(c+=7),C.setDate(C.getDate()+c),C}}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 g=parseInt(s[1],10),h=s[2].toLowerCase(),C=new Date(r);return h==="day"||h==="d\xEDa"||h==="dias"?C.setDate(C.getDate()+g):h==="week"||h==="semana"||h==="semanas"?C.setDate(C.getDate()+g*7):(h==="month"||h==="mes"||h==="meses")&&C.setMonth(C.getMonth()+g),C}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let g=parseInt(p[1],10),h=parseInt(p[2],10)-1,C=parseInt(p[3],10);return new Date(C,h,g)}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 g=parseInt(i[1],10),h=m[i[2].toLowerCase()],C=i[3]?parseInt(i[3],10):r.getFullYear();if(h!==void 0)return new Date(C,h,g)}let u={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 g=u[d[1].toLowerCase()],h=parseInt(d[2],10),C=d[3]?parseInt(d[3],10):r.getFullYear();if(g!==void 0)return new Date(C,g,h)}return null}function Ei(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 Pi(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 Bc(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 Rc(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(),u=r[2].trim(),d=vr(t,i),g=Si(u);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(!g)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let h=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,C=new Date(g);return C.setDate(C.getDate()+h),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:g,endDate:C},message:`Moved "${d.name}" to ${g.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(),u=o[2].trim(),d=vr(t,i),g=Ei(u);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!g||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let h=new Date(d.endDate);return h.setDate(h.getDate()+g),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:h},message:`Extended "${d.name}" by ${g} days. New end date: ${h.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(),u=s[2].trim(),d=vr(t,i),g=Pi(u);return d?g===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:g},message:`Set "${d.name}" progress to ${g}%.`,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(),u=n[2].trim(),d=vr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),u=p[2].trim(),d=vr(t,i),g=vr(t,u);return d?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:d.id,dependencyTo:g.id,message:`Linked "${d.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,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(),u=vr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 $c(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 G0(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 _0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Un(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(g=>g.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Un(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},p=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:G0(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 Oc(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:_0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function zc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Un(r,e,t))}var Mi={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Ai={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Hn={en:Mi,es:Ai};function Fi(e){return Hn[e]||Hn.en}function Wn(e,t){let a=Fi(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}function Gc(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(...Gc(r.subtasks,t+1));return a}function th({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 _c({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:m="en",customTranslations:i,showSearch:u=true,showHierarchy:d=true}=t,g=Wn(m,i),h=p==="dark",[C,T]=react.useState(new Set),[c,b]=react.useState("startDate"),[v,l]=react.useState("asc"),[x,y]=react.useState("");react.useMemo(()=>{let A=new Set;function N(I){for(let B of I)B.subtasks?.length&&(A.add(B.id),N(B.subtasks));}N(e),T(A);},[e]);let D=react.useCallback(A=>{T(N=>{let I=new Set(N);return I.has(A)?I.delete(A):I.add(A),I}),a.onTaskToggleExpand?.(A);},[a]),w=react.useCallback(A=>{c===A?l(N=>N==="asc"?"desc":"asc"):(b(A),l("asc")),a.onSortChange?.({column:A,direction:v==="asc"?"desc":"asc"});},[c,v,a]),k=react.useMemo(()=>{let A=Gc(e);if(x.trim()){let I=x.toLowerCase();A=A.filter(B=>B.name.toLowerCase().includes(I));}let N=[];for(let I of A){let B=I.level===0;I.level>0&&(B=true),(B||x.trim())&&N.push(I);}return x.trim()&&N.sort((I,B)=>{let q,ne;switch(c){case "name":q=I.name.toLowerCase(),ne=B.name.toLowerCase();break;case "startDate":q=I.startDate?.getTime()||0,ne=B.startDate?.getTime()||0;break;case "endDate":q=I.endDate?.getTime()||0,ne=B.endDate?.getTime()||0;break;case "progress":q=I.progress||0,ne=B.progress||0;break;case "status":q=I.status||"todo",ne=B.status||"todo";break;default:return 0}return q<ne?v==="asc"?-1:1:q>ne?v==="asc"?1:-1:0}),N},[e,x,c,v]),R=A=>A?(A instanceof Date?A:new Date(A)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"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:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"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:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",h?"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:f("text-lg font-semibold mb-2",h?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-hidden",h?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",h?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:A=>y(A.target.value),placeholder:g.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",h?"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.jsxs("div",{className:f("text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:f("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",h?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>w("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k.map((A,N)=>{let I=C.has(A.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:N*.02},className:f("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",h?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+A.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(A),onDoubleClick:()=>a.onTaskDoubleClick?.(A),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&A.hasChildren&&jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),D(A.id);},className:f("p-0.5 rounded",h?"hover:bg-white/10":"hover:bg-gray-200"),children:I?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-400")})}),d&&!A.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:B=>{B.stopPropagation(),a.onTaskUpdate?.({...A,progress:A.progress===100?0:100,status:A.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(th,{status:A.status,progress:A.progress})}),jsxRuntime.jsx("span",{className:f("truncate",h?"text-white":"text-gray-900",A.progress===100&&(h?"line-through text-[#6B7280]":"line-through text-gray-400")),children:A.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:f("px-2 py-1 rounded-full text-xs font-medium",A.progress===100||A.status==="completed"?"bg-green-500/10 text-green-500":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/10 text-blue-500":h?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:A.progress===100||A.status==="completed"?g.status.completed:A.progress&&A.progress>0||A.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),R(A.startDate)]}),jsxRuntime.jsxs("div",{className:f("col-span-2 flex items-center gap-1 text-sm",h?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),R(A.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:f("flex-1 h-1.5 rounded-full overflow-hidden",h?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8",h?"text-[#9CA3AF]":"text-gray-500"),children:[A.progress||0,"%"]})]})})]},A.id)})}),k.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",h?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(h?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var Li={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"},Ii={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"},Bi={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"},_n={dark:Li,light:Ii,neutral:Bi};function Vc(e){return _n[e]||_n.dark}var Ri={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"}},$i={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"}},Vn={en:Ri,es:$i};function Go(e){return Vn[e]||Vn.en}function jn(e,t){let a=Go(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 jc(e){let t=Go(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 Kc(e,t=0,a=true){let r=Go(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 xh(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 Gi(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 Qc({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 em({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:m=[],onCreateTag:i,attachmentsByTask:u,comments:d,onAddComment:g,currentUser:h,onTaskOpen:C}){let{theme:T="dark",locale:c="en",customTranslations:b}=t,v=jn(c,b),l=T==="dark",x={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[y,D]=react.useState(r||new Date),[w,k]=react.useState(null),[R,A]=react.useState(null),[N,I]=react.useState(null),[B,q]=react.useState(new Date),[ne,oe]=react.useState({}),re=4,fe=3,[$,Z]=react.useState(false),[W,G]=react.useState(false),[F,te]=react.useState(false),[J,V]=react.useState(false),[Se,ue]=react.useState(null),[He,We]=react.useState(""),[ot,he]=react.useState(void 0),[Ve,pt]=react.useState(null),[Ft,gt]=react.useState(false),[z,le]=react.useState(false),[xe,Fe]=react.useState(null),[Ye,Je]=react.useState(false),[Dt,Ae]=react.useState(new Date),[sa,Zt]=react.useState(false),[xt,St]=react.useState(false),[ea,Xt]=react.useState(false),[Te,ze]=react.useState(""),[ga,_e]=react.useState(false),[S,be]=react.useState(""),[Ge,ee]=react.useState(false),Ee=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()-1,1));},[y]),Ce=react.useCallback(()=>{D(new Date(y.getFullYear(),y.getMonth()+1,1));},[y]),Me=react.useCallback(()=>{D(new Date);},[]),Oe=react.useMemo(()=>{let E=y.getFullYear(),ye=y.getMonth(),X=new Date(E,ye,1),Ie=new Date(E,ye+1,0),nt=X.getDay(),se=Ie.getDate(),Ue=xh(e),kt=new Date;kt.setHours(0,0,0,0);let Be=[],Lt=nt,it=new Date(E,ye,0).getDate();for(let Ut=Lt-1;Ut>=0;Ut--){let Xe=new Date(E,ye-1,it-Ut);Be.push({date:Xe,isCurrentMonth:false,isToday:false,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:Ue.filter(wt=>Gi(Xe,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ut=1;Ut<=se;Ut++){let Xe=new Date(E,ye,Ut),wt=Xe.getTime()===kt.getTime();Be.push({date:Xe,isCurrentMonth:true,isToday:wt,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:Ue.filter(ca=>Gi(Xe,ca)).map(ca=>({id:ca.id,title:ca.name,start:ca.startDate,end:ca.endDate,task:ca}))});}let ya=42-Be.length;for(let Ut=1;Ut<=ya;Ut++){let Xe=new Date(E,ye+1,Ut);Be.push({date:Xe,isCurrentMonth:false,isToday:false,isWeekend:Xe.getDay()===0||Xe.getDay()===6,events:Ue.filter(wt=>Gi(Xe,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return Be},[y,e]),qe=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],O=y.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),j=react.useCallback((E,ye)=>{if(!w)return;let X={...w,[E]:ye};k(X),a.onTaskUpdate?.(X);},[w,a]),ve=react.useCallback(E=>{if(!w)return;let ye=w.progress||0;E==="completed"?ye=100:E==="todo"&&(ye=0);let X={...w,status:E,progress:ye};k(X),a.onTaskUpdate?.(X),Z(false);},[w,a]),Le=react.useCallback((E,ye)=>{if(!w)return;let X={...w,startDate:E,endDate:ye};k(X),a.onTaskUpdate?.(X);},[w,a]),$e=react.useCallback(()=>{Z(false),G(false),te(false),I(null),Xt(false),ze(""),_e(false);},[]),H=react.useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),Zt(false),!w||!a.onUploadAttachments)return;let ye=Array.from(E.dataTransfer.files);if(ye.length!==0){St(true);try{await a.onUploadAttachments(w.id,ye);}finally{St(false);}}},[w,a]),ie=react.useCallback(async E=>{if(!w||!a.onUploadAttachments||!E.target.files)return;let ye=Array.from(E.target.files);if(ye.length!==0){St(true);try{await a.onUploadAttachments(w.id,ye);}finally{St(false);}E.target.value="";}},[w,a]),Re=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Zt(true);},[]),Et=react.useCallback(E=>{E.preventDefault(),E.stopPropagation(),Zt(false);},[]),tt=react.useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),fa=react.useCallback(E=>E.startsWith("image/")?lucideReact.Image:E.includes("pdf")||E.includes("document")?lucideReact.FileText:lucideReact.File,[]),ba=react.useMemo(()=>!w||!u?[]:u.get(w.id)||[],[w,u]);return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[v.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:f("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:v.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:v.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",l?"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:f("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:O}),jsxRuntime.jsx("button",{onClick:Me,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:v.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ee,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ce,className:f("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",l?"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:qe.map(E=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:E},E))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:Oe.map((E,ye)=>{let X=E.date.getDay()===0||E.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?X?"bg-[#1C1F26]":E.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":X?"bg-gray-100":E.isCurrentMonth?"bg-white":"bg-gray-50",E.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ie=ne[ye]||re,nt=E.events.slice(0,Ie),se=E.events.length-Ie;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[nt.map(Ue=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{k(Ue.task),a.onEventClick?.(Ue),C?.(Ue.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ue.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Qc,{task:Ue.task}),jsxRuntime.jsx("span",{className:"truncate",children:Ue.title})]})},Ue.id)),se>0&&jsxRuntime.jsxs("button",{onClick:Ue=>{Ue.stopPropagation(),oe(kt=>({...kt,[ye]:Ie+fe}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",se," ",c==="es"?"M\xC1S":"MORE"]}),Ie>re&&E.events.length>re&&jsxRuntime.jsx("button",{onClick:Ue=>{Ue.stopPropagation(),oe(kt=>({...kt,[ye]:re}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"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 Ie=ye>=28,nt=ye%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),Se===ye?ue(null):(ue(ye),We(""),he(void 0),pt(null),Fe(null),gt(false),le(false),Je(false),Ae(E.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",Se===ye?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",Se===ye&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se===ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ue(null),We(""),he(void 0),pt(null),Fe(null),gt(false),le(false),Je(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Ie?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ie?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",Ie?"bottom-full mb-1":"top-full mt-1",nt?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:se=>{se.stopPropagation(),gt(false),le(false),Je(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:He,onChange:se=>We(se.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:se=>{if(se.key==="Enter"&&He.trim()){let Ue=t.availableUsers?.find(Be=>Be.id===Ve),kt=xe||E.date;a.onTaskCreate?.({name:He.trim(),startDate:kt,endDate:kt,priority:ot,assignees:Ue?[Ue]:void 0}),We(""),he(void 0),pt(null),Fe(null),ue(null);}se.key==="Escape"&&(ue(null),We(""),he(void 0),pt(null),Fe(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",l?"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:se=>{se.stopPropagation(),gt(!Ft),le(false);},className:f("p-1 rounded transition-colors",ot?ot==="urgent"||ot==="high"?"text-red-400 bg-red-500/20":ot==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"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:Ft&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:se=>se.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(se=>jsxRuntime.jsxs("button",{onClick:()=>{he(se.id),gt(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ot===se.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",se.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:se.label})]},se.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:se=>{se.stopPropagation(),Je(!Ye),gt(false),le(false),Ae(xe||E.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",xe?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"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"}),(xe||E.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ye&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let se=new Date,Ue=new Date(se);Ue.setDate(se.getDate()+1);let kt=new Date(se);kt.setDate(se.getDate()+((6-se.getDay()+7)%7||7));let Be=new Date(se);Be.setDate(se.getDate()+((1-se.getDay()+7)%7||7));let Lt=new Date(se);Lt.setDate(se.getDate()+14);let it=new Date(se);return it.setDate(se.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:se,display:se.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:Ue,display:Ue.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:kt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Be,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:Lt,display:Lt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:it,display:it.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ut,Xe)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Fe(Ut.date),Je(false);},children:[jsxRuntime.jsx("span",{children:Ut.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Ut.display})]},Xe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",l?"text-white":"text-gray-900"),children:Dt.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:()=>Ae(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ae(new Date(Dt.getFullYear(),Dt.getMonth()-1)),className:f("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ae(new Date(Dt.getFullYear(),Dt.getMonth()+1)),className:f("p-0.5 rounded",l?"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(se=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:se},se))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=Dt.getFullYear(),Ue=Dt.getMonth(),kt=new Date(se,Ue,1).getDay(),Be=new Date(se,Ue+1,0).getDate(),Lt=new Date(se,Ue,0).getDate(),it=new Date,ya=[];for(let Xe=kt-1;Xe>=0;Xe--)ya.push({dayNum:Lt-Xe,isCurrentMonth:false,date:new Date(se,Ue-1,Lt-Xe)});for(let Xe=1;Xe<=Be;Xe++)ya.push({dayNum:Xe,isCurrentMonth:true,date:new Date(se,Ue,Xe)});let Ut=42-ya.length;for(let Xe=1;Xe<=Ut;Xe++)ya.push({dayNum:Xe,isCurrentMonth:false,date:new Date(se,Ue+1,Xe)});return ya.map((Xe,wt)=>{let ca=Xe.date.toDateString()===it.toDateString(),xr=(xe||E.date).toDateString()===Xe.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Xe.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Xe.isCurrentMonth&&(l?"text-white":"text-gray-900"),ca&&"ring-1 ring-[#3B82F6]",xr&&"bg-[#7C3AED] text-white",!xr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Fe(Xe.date),Je(false);},children:Xe.dayNum},wt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),le(!z),gt(false);},className:f("p-1 rounded transition-colors",Ve?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Ve?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(se=>se.id===Ve)?.color||"#7C3AED"},children:t.availableUsers?.find(se=>se.id===Ve)?.initials||t.availableUsers?.find(se=>se.id===Ve)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{pt(null),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!Ve&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(se=>jsxRuntime.jsxs("button",{onClick:()=>{pt(se.id),le(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",Ve===se.id&&(l?"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:se.color||"#7C3AED"},children:se.initials||se.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:se.name})]},se.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(He.trim()){let se=t.availableUsers?.find(kt=>kt.id===Ve),Ue=xe||E.date;a.onTaskCreate?.({name:He.trim(),startDate:Ue,endDate:Ue,priority:ot,assignees:se?[se]:void 0}),We(""),he(void 0),pt(null),Fe(null),ue(null);}},disabled:!He.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",He.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",E.isToday?"text-[#3B82F6]":E.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:E.date.getDate()})]})]},ye)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{k(null),be("");},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:f("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:f("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:f("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:f("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:f("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"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("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:f("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{k(null),be("");},className:f("p-1.5 rounded transition-colors",l?"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("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let E=w.progress===100?0:100,X={...w,progress:E,status:E===100?"completed":"todo"};k(X),a.onTaskUpdate?.(X);},className:f("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",w.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:f("text-xl font-semibold flex-1",w.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:w.name})]})}),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:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{$e(),Z(!$);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?c==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Z(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(E=>jsxRuntime.jsxs("button",{onClick:()=>ve(E.id),className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(w.status===E.id||E.id==="completed"&&w.progress===100||E.id==="in-progress"&&w.progress&&w.progress>0&&w.progress<100||E.id==="todo"&&(!w.progress||w.progress===0)&&w.status!=="in-progress"&&w.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.id==="completed"?"bg-green-500":E.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Z(false),G(false),I(null),te(!F);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[w.assignees&&w.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((E,ye)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},ye)),w.assignees.length>3&&jsxRuntime.jsxs("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:F&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(E=>{let ye=w.assignees?.some(X=>X.name===E.name);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.assignees||[],Ie;ye?Ie=X.filter(nt=>nt.name!==E.name):Ie=[...X,{name:E.name,avatar:E.avatar,initials:E.initials||E.name.slice(0,2).toUpperCase(),color:E.color||"#8B5CF6"}],j("assignees",Ie);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",ye&&(l?"bg-white/5":"bg-gray-50")),children:[E.avatar?jsxRuntime.jsx("img",{src:E.avatar,alt:E.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left",l?"text-white":"text-gray-900"),children:E.name}),ye&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},E.id||E.name)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{I(N?null:"start"),q(w.startDate||new Date);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[w.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:f("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(w.startDate||w.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:E=>{E.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:f("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:f("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,ye=new Date(E);ye.setDate(E.getDate()+1);let X=new Date(E);X.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let Ie=new Date(E);Ie.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let nt=new Date(E);nt.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let se=new Date(E);se.setDate(E.getDate()+14);let Ue=new Date(E);return Ue.setDate(E.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:ye,display:ye.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:X,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Ie,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:nt,display:nt.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:se,display:se.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Be,Lt)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(N==="start"){let it=w.endDate&&Be.date>w.endDate?Be.date:w.endDate;Le(Be.date,it),I("end");}else {let it=w.startDate&&Be.date<w.startDate?Be.date:w.startDate;Le(it,Be.date),I(null);}},children:[jsxRuntime.jsx("span",{children:Be.label}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:Be.display})]},Lt))})(),jsxRuntime.jsx("div",{className:f("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Le(void 0,void 0),I(null);},className:f("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="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:f("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:f("font-medium",l?"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-1",children:[jsxRuntime.jsx("button",{onClick:()=>q(new Date),className:f("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>q(new Date(B.getFullYear(),B.getMonth()-1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>q(new Date(B.getFullYear(),B.getMonth()+1)),className:f("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsxRuntime.jsx("div",{className:f("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let E=B.getFullYear(),ye=B.getMonth(),X=new Date(E,ye,1).getDay(),Ie=new Date(E,ye+1,0).getDate(),nt=new Date(E,ye,0).getDate(),se=new Date,Ue=[];for(let Be=X-1;Be>=0;Be--)Ue.push({day:nt-Be,isCurrentMonth:false,date:new Date(E,ye-1,nt-Be)});for(let Be=1;Be<=Ie;Be++)Ue.push({day:Be,isCurrentMonth:true,date:new Date(E,ye,Be)});let kt=42-Ue.length;for(let Be=1;Be<=kt;Be++)Ue.push({day:Be,isCurrentMonth:false,date:new Date(E,ye+1,Be)});return Ue.map((Be,Lt)=>{let it=Be.date.toDateString()===se.toDateString(),ya=w.startDate?.toDateString()===Be.date.toDateString(),Ut=w.endDate?.toDateString()===Be.date.toDateString(),Xe=ya||Ut,wt=w.startDate&&w.endDate&&Be.date>=w.startDate&&Be.date<=w.endDate;return jsxRuntime.jsx("button",{className:f("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Be.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),Be.isCurrentMonth&&(l?"text-white":"text-gray-900"),it&&"ring-2 ring-[#3B82F6]",ya&&"bg-[#3B82F6] text-white",Ut&&!ya&&"bg-[#7C3AED] text-white",wt&&!Xe&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!Xe&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ca=new Date(Be.date);if(N==="start"){let xr=w.endDate&&ca>w.endDate?ca:w.endDate;Le(ca,xr),I("end");}else {let xr=w.startDate&&ca<w.startDate?ca:w.startDate;Le(xr,ca),I(null);}},children:Be.day},Lt)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{$e(),G(!W);},className:f("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:w.priority?w.priority==="high"||w.priority==="urgent"?c==="es"?"Urgente":"Urgent":w.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),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(E=>jsxRuntime.jsxs("button",{onClick:()=>{j("priority",E.id),G(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",w.priority===E.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",E.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[J?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:E=>{let ye=parseInt(E.target.value),X=w.status;ye===100?X="completed":ye>0?X="in-progress":X="todo";let Ie={...w,progress:ye,status:X};k(Ie),a.onTaskUpdate?.(Ie);},onBlur:()=>V(false),className:f("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>V(true),className:f("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(ir,{selectedTags:w.tags||[],availableTags:m,onChange:E=>{j("tags",E);},onCreateTag:i,theme:x})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:f("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(E=>{let ye=e.find(X=>X.id===E);return jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ye?.name||E.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let X=(w.dependencies||[]).filter(Ie=>Ie!==E);j("dependencies",X);},className:f("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},E)})}),jsxRuntime.jsxs("button",{onClick:()=>{$e(),Xt(!ea);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ea&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Xt(false),ze("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Te,onChange:E=>ze(E.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:f("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(E=>E.id!==w.id).filter(E=>Te===""||E.name.toLowerCase().includes(Te.toLowerCase())).map(E=>{let ye=w.dependencies?.includes(E.id);return jsxRuntime.jsxs("button",{onClick:()=>{let X=w.dependencies||[],Ie;ye?Ie=X.filter(nt=>nt!==E.id):Ie=[...X,E.id],j("dependencies",Ie);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",ye&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ye?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:ye&&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:f("block truncate",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsxRuntime.jsx("div",{className:f("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{$e(),_e(!ga);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:w.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:lr.find(E=>E.value===w.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ga&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_e(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"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:lr.map(E=>{let ye=w.color===E.value;return jsxRuntime.jsx("button",{onClick:()=>{j("color",E.value),_e(false);},className:f("w-7 h-7 rounded-full flex items-center justify-center transition-all",ye&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:ye?E.value:void 0},title:E.name,children:ye&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:w.isMilestone||false,onChange:E=>j("isMilestone",E.target.checked),className:f("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:f("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:f("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:w.description||"",onChange:E=>j("description",E.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:f("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:f("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),w.subtasks&&w.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(E=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:f("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",E.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:E.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:f("text-sm",E.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:E.name})]},E.id))}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:f("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:f("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ba.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ba.length,")"]})]}),ba.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:ba.map(E=>{let ye=fa(E.type),X=E.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:f("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[X&&E.thumbnailUrl?jsxRuntime.jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:f("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ye,{className:f("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:f("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:E.name}),jsxRuntime.jsx("p",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:tt(E.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(E.id),className:f("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},E.id)})}),jsxRuntime.jsxs("div",{onDragOver:Re,onDragLeave:Et,onDrop:H,className:f("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",sa?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",xt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ie,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||xt}),xt?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:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:f("w-6 h-6 mx-auto mb-2",sa?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:sa?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:f("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:f("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:f("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:f("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(E=>{let ye=(()=>{let X=new Date,Ie=new Date(E.createdAt),nt=X.getTime()-Ie.getTime(),se=Math.floor(nt/6e4),Ue=Math.floor(se/60),kt=Math.floor(Ue/24);return se<1?c==="es"?"ahora":"now":se<60?c==="es"?`hace ${se}m`:`${se}m ago`:Ue<24?c==="es"?`hace ${Ue}h`:`${Ue}h ago`:c==="es"?`hace ${kt}d`:`${kt}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:E.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:f("text-sm font-medium",l?"text-white":"text-gray-900"),children:E.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:f("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:ye})]}),jsxRuntime.jsx("p",{className:f("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:E.content})]})]},E.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:f("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:f("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:f("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[h&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:h.color||"#8B5CF6"},children:h.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:f("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:S,onChange:E=>be(E.target.value),onKeyDown:async E=>{if(E.key==="Enter"&&!E.shiftKey&&w&&S.trim()&&g){E.preventDefault(),ee(true);try{await g(w.id,S.trim()),be("");}finally{ee(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:Ge||!g,className:f("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(Ge||!g)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(w&&S.trim()&&g){ee(true);try{await g(w.id,S.trim()),be("");}finally{ee(false);}}},disabled:Ge||!S.trim()||!g,className:f("p-1.5 rounded transition-colors",S.trim()&&g?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",Ge&&"opacity-50 cursor-not-allowed"),children:Ge?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:R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>A(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:f("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",l?"text-white":"text-gray-900"),children:R.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>A(null),className:f("p-1 rounded",l?"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:R.events.map(E=>jsxRuntime.jsxs("button",{onClick:()=>{A(null),k(E.task),C?.(E.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Qc,{task:E.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:E.title}),E.task.priority==="high"||E.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},E.id))})]})]})})]})}var _i={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"},Vi={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"},ji={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"},Yn={dark:_i,light:Vi,neutral:ji};function tm(e){return Yn[e]||Yn.dark}function wh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[m,i]=react.useState(false),u=react.useMemo(()=>t.filter(h=>e.cardIds.includes(h.id)),[t,e.cardIds]),d=react.useMemo(()=>{let h=u.length,C=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,T=u.map(b=>b.priority).filter(Boolean),c=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:h,uniqueAssignees:C,priorities:T,labels:c}},[u]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,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:f("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:h=>{h.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:u.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:u.map(h=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(h),children:a(h)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(h),children:[jsxRuntime.jsx("h4",{children:h.title}),h.description&&jsxRuntime.jsxs("p",{children:[h.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:C=>{C.stopPropagation(),s?.(e.id,h.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"})]})})]},h.id))})})]})}var rm={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function jo(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 Ko(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 om(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 nm({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let m=react.useMemo(()=>({...rm,...n}),[n]),[i,u]=react.useState(new Set),d=react.useRef(null),g=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(l=>{let x=l.timestamp.toISOString().split("T")[0],y=v.get(x);y?y.push(l):v.set(x,[l]);}),Array.from(v.entries()).sort((l,x)=>x[0].localeCompare(l[0])).map(([l,x])=>({date:new Date(l),events:x.sort((y,D)=>D.timestamp.getTime()-y.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:h,uniqueTypes:C}=react.useMemo(()=>{let v=new Set,l=new Set;return e.forEach(x=>{v.add(x.userId),l.add(x.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(l)}},[e]),T=v=>{u(l=>{let x=new Set(l);return x.has(v)?x.delete(v):x.add(v),x});},c=v=>{let x=new Date().getTime()-v.getTime(),y=Math.floor(x/6e4),D=Math.floor(x/36e5),w=Math.floor(x/864e5);return y<1?"just now":y<60?`${y}m ago`:D<24?`${D}h ago`:w<7?`${w}d ago`:v.toLocaleDateString()},b=react.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return react.useEffect(()=>{if(s&&d.current){let v=d.current.querySelector(`[data-event-id="${s}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",p),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:f("history-timeline",m.compact&&"compact",p),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:v=>{let l=v.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),C.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Ko(v)," ",v.replace("_"," ")]},v))]}),h.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let l=v.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),h.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:g.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((l,x)=>{let y=i.has(l.id),D=s===l.id,w=om(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:f("history-timeline-event",y&&"expanded",D&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:w},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ko(l.type)})}),x<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:w}})]}),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&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:jo(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),T(l.id);},children:[y?"\u25BC":"\u25B6"," Show changes"]}),y&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.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)),l.metadata&&Object.keys(l.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(l.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))]})]})]})]},l.id)})})]},v.date?.toISOString()||"all"))})]})}function im({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:m,className:i}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("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:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Ko(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&jo(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:h=>p(parseInt(h.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((h,C)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",C===e.currentIndex&&"active"),style:{left:`${C/(e.totalEvents-1)*100}%`},onClick:()=>p(C),title:jo(h)},h.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:u.map(h=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===h&&"active"),onClick:()=>m(h),children:[h,"x"]},h))})]}),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(h=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:h},h))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("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 Ki(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 Yi(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 lm(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 dm(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Eh(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})),p=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(u=>{let d=a/2,g=r/2;u.vx+=(d-u.x)*o.centerForce*i,u.vy+=(g-u.y)*o.centerForce*i,n.forEach(h=>{if(u.id===h.id)return;let C=u.x-h.x,T=u.y-h.y,c=Math.sqrt(C*C+T*T)||1,b=o.chargeStrength*i/(c*c);u.vx+=C/c*b,u.vy+=T/c*b;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),g=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!g)return;let h=g.x-d.x,C=g.y-d.y,T=Math.sqrt(h*h+C*C)||1,c=(T-o.linkDistance)/T*o.forceStrength*i;d.vx+=h*c,d.vy+=C*c,g.vx-=h*c,g.vy-=C*c;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function cm({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:m}){let i=react.useRef(null),[u,d]=react.useState([]),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(1),[x,y]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let B=Eh(e,t,a.width,a.height,a,150);d(B);},[e,t,a]);let D=react.useCallback((B,q)=>{a.enableDragging&&(q.stopPropagation(),h(B));},[a.enableDragging]),w=react.useCallback(B=>{if(!g||!i.current)return;let ne=i.current.getBoundingClientRect(),oe=(B.clientX-ne.left-x.x)/v,re=(B.clientY-ne.top-x.y)/v;d(fe=>fe.map($=>$.id===g?{...$,x:oe,y:re,fx:oe,fy:re}:$));},[g,v,x]),k=react.useCallback(()=>{h(null);},[]),R=react.useCallback((B,q)=>{q.stopPropagation(),p?.({type:"node-click",node:B,position:{x:q.clientX,y:q.clientY}});},[p]),A=react.useCallback((B,q)=>{q.stopPropagation(),p?.({type:"edge-click",edge:B,position:{x:q.clientX,y:q.clientY}});},[p]),N=react.useCallback(B=>{let q=u.find(ne=>ne.id===B);return q?{x:q.x,y:q.y}:{x:0,y:0}},[u]),I=react.useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let q=B.card.priority;return q==="URGENT"?"#ef4444":q==="HIGH"?"#f59e0b":q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("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:f("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:()=>l(B=>Math.min(B+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),y({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Ki(B)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[lm(B)," ",Yi(B)]})]},B))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:w,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let q=N(typeof B.source=="string"?B.source:B.source.id),ne=N(typeof B.target=="string"?B.target:B.target.id),oe=dm(B.type),re=c===B.id,fe=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",re&&"hovered",fe&&"critical"),onMouseEnter:()=>b(B.id),onMouseLeave:()=>b(null),onClick:$=>A(B,$),children:[jsxRuntime.jsx("line",{x1:q.x,y1:q.y,x2:ne.x,y2:ne.y,stroke:Ki(B.type),strokeWidth:fe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:re?1:.6,markerEnd:oe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&re&&jsxRuntime.jsx("text",{x:(q.x+ne.x)/2,y:(q.y+ne.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Yi(B.type)})]},B.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(B=>{let q=C===B.id,ne=B.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",q&&"hovered",ne&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:oe=>D(B.id,oe),onMouseEnter:()=>T(B.id),onMouseLeave:()=>T(null),onClick:oe=>R(B,oe),children:[jsxRuntime.jsx("circle",{r:ne?a.nodeSize*1.2:a.nodeSize,fill:I(B),stroke:ne?"#fbbf24":"#ffffff",strokeWidth:ne?3:2,opacity:q?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.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 um({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[p,m]=react.useState(false),[i,u]=react.useState(null),[d,g]=react.useState(null),h=react.useRef(null),C=p||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let v=l=>{l.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,C]);let T=()=>{C||(n(""),u(null),g(null),t());},c=async()=>{if(!(!s.trim()||C)){m(true),u(null),g(null);try{let v=await r(s.trim());g(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),T());};return e?jsxRuntime.jsxs(ct,{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-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:v=>v.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:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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((v,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},l))})]}),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((v,l)=>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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},l)),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:h,value:s,onChange:v=>n(v.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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((v,l)=>jsxRuntime.jsx("button",{onClick:()=>n(v),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:v},l))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:c,disabled:!s.trim()||C,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:C?"Generating...":"Generate Plan"})]})]})]})})]}):null}var qi={"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 Mh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Ah={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 Fh(e,t,a){let r=qi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Yo(e){return `$${e.toFixed(4)}`}var Xi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Fh(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,g)=>d+g.cost,0),s=a.reduce((d,g)=>d+g.inputTokens,0),n=a.reduce((d,g)=>d+g.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,g)=>d+g.duration,0),i={},u={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.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 p=this.operations.filter(u=>u.timestamp>=n).length,m=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:i,isExceeded:p>=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)}},Qr=new Xi;function hm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Qr.getStats()),[s,n]=react.useState(Qr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Qr.getStats()),n(Qr.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 p=Qr.getRecentOperations(5);return jsxRuntime.jsxs(ct,{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:Yo(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 u=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:Yo(u)})]})]}),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"}),p.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:p.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:Yo(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 vm({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=react.useState(""),[m,i]=react.useState(""),[u,d]=react.useState(""),[g,h]=react.useState(false),[C,T]=react.useState(null),[c,b]=react.useState(null),[v,l]=react.useState(null),x=react.useRef(null),y=g||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let A=N=>{N.key==="Escape"&&!y&&D();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,y]);let D=()=>{y||(p(""),i(""),d(""),T(null),b(null),l(null),t());},w=async()=>{if(!(!n.trim()||y)){h(true),T(null),b(null),l(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});b(A.tasks.tasks),l({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){T(A instanceof Error?A.message:"Failed to generate tasks");}finally{h(false);}}},k=()=>{c&&(a(c),D());};if(!e)return null;let R=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ct,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),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:A=>A.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:D,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:c?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:[v?.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"}),v?.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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((A,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:A.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"})]}),A.start," \u2192 ",A.end]}),jsxRuntime.jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.id))})]})}):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:x,value:n,onChange:A=>p(A.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled: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."})]}),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:A=>i(A.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]}),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:u,onChange:A=>d(A.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:y})]})]}),C&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:C}),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((A,N)=>jsxRuntime.jsx("button",{onClick:()=>p(A),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:A},N))})]})]})}),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:D,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"}),c?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:w,disabled:!n.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 Tasks"})]})]})]})})]})}function Jn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&on(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,v,l)=>{console.warn(`Retry attempt ${v} after ${l}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(c,b,v)=>{r(l=>{let x=l.cards.find(A=>A.id===c);if(!x)return l;let y=x.columnId,D={...x,columnId:b,position:v},w=l.cards.map(A=>A.id===c?D:A),k=l.columns.map(A=>{if(A.id===y)return {...A,cardIds:A.cardIds.filter(N=>N!==c)};if(A.id===b){let N=w.filter(I=>I.columnId===b).sort((I,B)=>I.position-B.position);return {...A,cardIds:N.map(I=>I.id)}}return A}),R={...l,cards:w,columns:k};return o(R),R});},[o]),n=react.useCallback(async(c,b)=>{r(v=>{let l=v.cards.map(y=>y.id===c?{...y,...b}:y),x={...v,cards:l};return o(x),x});},[o]),p=react.useCallback(async c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b},x=v.columns.map(D=>D.id===c.columnId?{...D,cardIds:[...D.cardIds,b]}:D),y={...v,cards:[...v.cards,l],columns:x};return o(y),y});},[o]),m=react.useCallback(async c=>{r(b=>{let v=b.cards.find(D=>D.id===c);if(!v)return b;let l=b.cards.filter(D=>D.id!==c),x=b.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(w=>w!==c)}:D),y={...b,cards:l,columns:x};return o(y),y});},[o]),i=react.useCallback(async c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let l={...c,id:b,cardIds:[]},x={...v,columns:[...v.columns,l]};return o(x),x});},[o]),u=react.useCallback(async(c,b)=>{r(v=>{let l=v.columns.map(y=>y.id===c?{...y,...b}:y),x={...v,columns:l};return o(x),x});},[o]),d=react.useCallback(async c=>{r(b=>{let v=b.cards.filter(y=>y.columnId!==c),l=b.columns.filter(y=>y.id!==c),x={...b,cards:v,columns:l};return o(x),x});},[o]),g=react.useCallback(c=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),b},[p]),h=react.useCallback(c=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),b},[i]),C=react.useCallback(()=>{r(c=>{let b={...c,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:m,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:g,addColumn:h,deleteCard:m,deleteColumn:d,clearBoard:C}}}function km({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Jn({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,u={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??u+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 qo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Cm={by:"none",order:"asc"};function Tm({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...qo,...e}),[s,n]=react.useState({...Cm,...t}),p=react.useCallback(T=>{o(c=>({...c,...T}));},[]),m=react.useCallback(T=>{n(c=>({...c,...T}));},[]),i=react.useCallback(()=>{o(qo),n(Cm);},[]),u=react.useCallback(()=>{a&&o({...qo,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...qo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...qo,priorities:["HIGH","URGENT"]});},[]),h=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]),C=react.useCallback(T=>{let c=[...T];if(r.search){let b=r.search.toLowerCase();c=c.filter(v=>v.title.toLowerCase().includes(b)||v.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,v=b.getFullYear(),l=String(b.getMonth()+1).padStart(2,"0"),x=String(b.getDate()).padStart(2,"0"),y=`${v}-${l}-${x}`;c=c.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let w=D.endDate||D.dueDate;if(!w)return false;let k;if(typeof w=="string")k=w.split("T")[0]||w;else {let R=w.getUTCFullYear(),A=String(w.getUTCMonth()+1).padStart(2,"0"),N=String(w.getUTCDate()).padStart(2,"0");k=`${R}-${A}-${N}`;}switch(r.dateFilter){case "overdue":return k<y;case "today":return k===y;case "this-week":let R=new Date(y+"T00:00:00"),A=new Date(k+"T00:00:00"),N=new Date(R);return N.setDate(N.getDate()+7),A>=R&&A<=N;case "custom":if(r.dateRange){let I=typeof w=="string"?new Date(w):w;return I>=r.dateRange.start&&I<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(c=c.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(b=>b.labels&&b.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(c=c.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&c.sort((b,v)=>{let l=0;switch(s.by){case "created":let x=b.createdAt?new Date(b.createdAt).getTime():0,y=v.createdAt?new Date(v.createdAt).getTime():0;l=x-y;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},w=D[b.priority||"LOW"],k=D[v.priority||"LOW"];l=w-k;break;case "dueDate":let R=b.endDate||b.dueDate,A=v.endDate||v.dueDate;if(!R)return 1;if(!A)return -1;let N=typeof R=="string"?new Date(R).getTime():R.getTime(),I=typeof A=="string"?new Date(A).getTime():A.getTime();l=N-I;break;case "title":l=b.title.localeCompare(v.title);break;case "estimate":let B=b.estimatedTime||0,q=v.estimatedTime||0;l=B-q;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:g,applyFilters:C,hasActiveFilters:h}}var Dm,Sm;if(typeof window<"u")try{let e=tn("ai");Dm=e.generateObject,Sm=e.generateText;}catch{}function Em(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Dm&&Sm&&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(g){let h=g instanceof Error?g:new Error("Failed to generate plan");throw o(h),h}finally{a(false);}},[s]),p=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(g){let h=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(h),h}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(g){let h=g instanceof Error?g:new Error("Failed to predict risks");throw o(h),h}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(g){let h=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(h),h}finally{a(false);}},[s]),u=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(g){let h=g instanceof Error?g:new Error("Failed to estimate effort");throw o(h),h}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Qi(){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 Pm(e){let{cards:t}=e,[a,r]=Qi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,g)=>{if(!g){r({selectedCardIds:[d],lastSelectedCardId:d});return}let h=g.ctrlKey||g.metaKey,C=g.shiftKey;if(h)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(T=>T!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(C&&a.lastSelectedCardId){let T=t.find(b=>b.id===d),c=t.find(b=>b.id===a.lastSelectedCardId);if(T&&c&&T.columnId===c.columnId){let b=t.filter(k=>k.columnId===T.columnId).sort((k,R)=>k.position-R.position),v=b.findIndex(k=>k.id===a.lastSelectedCardId),l=b.findIndex(k=>k.id===d),[x,y]=v<l?[v,l]:[l,v],D=b.slice(x,y+1).map(k=>k.id),w=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:w,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(g=>g!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=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]),u=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:p,selectAll:m,toggleCard:i,getSelectedCards:u}}var Mm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Am(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Mm,...a}),[a]),[s,n]=react.useState([]),p=react.useCallback((T,c,b,v,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:T,cardIds:c,columnId:b,strategy:v,color:l,isExpanded:true,position:s.filter(y=>y.columnId===b).length,createdAt:new Date};n(y=>[...y,x]);},[o.minCardsPerStack,s]),m=react.useCallback(T=>{n(c=>c.filter(b=>b.id!==T));},[]),i=react.useCallback(T=>{n(c=>c.map(b=>b.id===T?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((T,c)=>{n(b=>b.map(v=>v.id===T&&!v.cardIds.includes(c)?{...v,cardIds:[...v.cardIds,c]}:v));},[]),d=react.useCallback((T,c)=>{n(b=>b.map(v=>{if(v.id===T){let l=v.cardIds.filter(x=>x!==c);return l.length<o.minCardsPerStack?null:{...v,cardIds:l}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),g=react.useCallback(T=>s.filter(c=>c.columnId===T).sort((c,b)=>c.position-b.position),[s]),h=react.useCallback(async T=>{let c=t.filter(y=>y.columnId===T);if(c.length<o.minCardsPerStack*2)return [];let b=[],v=new Map;c.forEach(y=>{y.labels&&y.labels.length>0&&y.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(y);});}),v.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:y.map(w=>w.id),columnId:T,strategy:"labels",color:"#3b82f6"},reason:`${y.length} cards with label "${D}"`,confidence:.85});});let l=new Map;c.forEach(y=>{y.assignedUserIds&&y.assignedUserIds.length>0&&y.assignedUserIds.forEach(D=>{l.has(D)||l.set(D,[]),l.get(D).push(y);});}),l.forEach((y,D)=>{y.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:y.map(w=>w.id),columnId:T,strategy:"assignee",color:"#8b5cf6"},reason:`${y.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(c.forEach(y=>{y.priority&&(x.has(y.priority)||x.set(y.priority,[]),x.get(y.priority).push(y));}),x.forEach((y,D)=>{if(y.length>=o.minCardsPerStack){let w={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${w} ${D} Priority`,cardIds:y.map(k=>k.id),columnId:T,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${y.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let y of c){let w=(await r.findSimilar(y,c)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(w.length>=o.minCardsPerStack-1){let k=[y.id,...w.map(A=>A.card.id)],R=w.reduce((A,N)=>A+N.similarity,0)/w.length;b.push({stack:{title:`\u2728 Similar to "${y.title.substring(0,30)}${y.title.length>30?"...":""}"`,cardIds:k,columnId:T,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${w.length+1} similar tasks`,confidence:R});}}return b.filter(y=>y.confidence>=o.autoStackConfidenceThreshold).sort((y,D)=>D.confidence-y.confidence).slice(0,5)},[t,o,r]),C=react.useCallback(T=>{p(T.stack.title,T.stack.cardIds,T.stack.columnId,T.stack.strategy,T.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let b=await h(c),v=b[0];b.length>0&&v&&v.confidence>=.9&&C(v);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:g,getSuggestions:h,applySuggestion:C,config:o}}var Fm=react.createContext(null);function Lm({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}=tn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=tn("@libxai/core");n.set(m.id,new i(m));});let p=null;if(t?.board){let{Board:m}=tn("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Fm.Provider,{value:{store:o},children:e})}function Qn(){let e=react.useContext(Fm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Jo(){let e=Qn(),[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 p=react.useCallback(v=>{e.updateBoard(v);},[e]),m=react.useCallback(v=>{e.addColumn(v);},[e]),i=react.useCallback((v,l)=>{e.updateColumn(v,l);},[e]),u=react.useCallback(v=>{e.deleteColumn(v);},[e]),d=react.useCallback(v=>e.getColumn(v),[e]),g=react.useCallback(v=>{e.addCard(v);},[e]),h=react.useCallback((v,l)=>{e.updateCard(v,l);},[e]),C=react.useCallback(v=>{e.deleteCard(v);},[e]),T=react.useCallback((v,l,x)=>{e.moveCard(v,l,x);},[e]),c=react.useCallback(v=>e.getCard(v),[e]),b=react.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:i,deleteColumn:u,getColumn:d,addCard:g,updateCard:h,deleteCard:C,moveCard:T,getCard:c,getCardsByColumn:b}}function Bm(e){let{cards:t}=Jo();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 Rm(e="position",t="asc"){let{cards:a}=Jo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,i=s.priority?p[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 Zn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Al.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 p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{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);}},qh=new Zn;function Om({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:m}){let i=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=u.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},h=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:g,className:o,children:jsxRuntime.jsx("div",{style:h,children:d.map(C=>{let T=e[C.index];if(!T)return null;let c=m?m(T,C.index):C.index,b={position:"absolute",top:n?0:C.start,left:n?C.start:0,width:n?C.size:"100%",height:n?"100%":C.size};return jsxRuntime.jsx("div",{style:b,"data-index":C.index,children:r(T,C.index)},c)})})})}function zm(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 Hm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:m,horizontal:i=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:p}),g=d.getVirtualItems(),h={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},C={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:h,className:s,children:jsxRuntime.jsx("div",{style:C,children:g.map(T=>{let c=e[T.index];if(!c)return null;let b=m?m(c,T.index):T.index,v={position:"absolute",top:0,left:T.start,width:T.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":T.index,children:o(c,T.index)},b)})})})}function Wm(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 Gm(e,t=10){return e>t}var al={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},rl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ol={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},nl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},sl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},il={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ll={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},dl={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)"},cl={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)"},ml={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},pl={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}},es={spacing:al,borderRadius:rl,fontSize:ol,fontWeight:nl,lineHeight:sl,zIndex:il,duration:ll,easing:dl,shadows:cl,opacity:ml,kanban:pl,gantt:ul};function _m(e,t,a){return e[t]??a}function gl(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)?gl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Qh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function fl(e="asakaa"){let t=gl(es),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Qh(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Gc(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=Gc(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(p=>{let u=p.name.toLowerCase();return n.every(i=>u.includes(i))})}function Mi(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let f=new Date(r);return f.setDate(f.getDate()+1),f}if(a==="yesterday"||a==="ayer"){let f=new Date(r);return f.setDate(f.getDate()-1),f}if(a==="next week"||a==="la pr\xF3xima semana"){let f=new Date(r);return f.setDate(f.getDate()+7),f}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let b={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(b!==void 0){let T=new Date(r),N=T.getDay(),c=b-N;return c<=0&&(c+=7),T.setDate(T.getDate()+c),T}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let f=parseInt(s[1],10),b=s[2].toLowerCase(),T=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?T.setDate(T.getDate()+f):b==="week"||b==="semana"||b==="semanas"?T.setDate(T.getDate()+f*7):(b==="month"||b==="mes"||b==="meses")&&T.setMonth(T.getMonth()+f),T}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let f=parseInt(p[1],10),b=parseInt(p[2],10)-1,T=parseInt(p[3],10);return new Date(T,b,f)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let f=parseInt(i[1],10),b=u[i[2].toLowerCase()],T=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(T,b,f)}let g={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let f=g[d[1].toLowerCase()],b=parseInt(d[2],10),T=d[3]?parseInt(d[3],10):r.getFullYear();if(f!==void 0)return new Date(T,f,b)}return null}function Ai(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 Fi(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 _c(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 Vc(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(),g=r[2].trim(),d=xr(t,i),f=Mi(g);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!f)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${g}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,T=new Date(f);return T.setDate(T.getDate()+b),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:f,endDate:T},message:`Moved "${d.name}" to ${f.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),g=o[2].trim(),d=xr(t,i),f=Ai(g);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!f||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${g}".`,success:false,error:"Invalid duration"};let b=new Date(d.endDate);return b.setDate(b.getDate()+f),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:b},message:`Extended "${d.name}" by ${f} days. New end date: ${b.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(),g=s[2].trim(),d=xr(t,i),f=Fi(g);return d?f===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${g}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:f},message:`Set "${d.name}" progress to ${f}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),g=n[2].trim(),d=xr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:g},message:`Renamed "${d.name}" to "${g}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let i=p[1].trim(),g=p[2].trim(),d=xr(t,i),f=xr(t,g);return d?f?{type:"link_tasks",taskId:f.id,taskName:f.name,dependencyFrom:d.id,dependencyTo:f.id,message:`Linked "${d.name}" \u2192 "${f.name}".`,success:true}:{type:"link_tasks",taskName:g,message:`Could not find a task named "${g}".`,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 u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),g=xr(t,i);return g?{type:"delete_task",taskId:g.id,taskName:g.name,message:`Deleted "${g.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 jc(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 ah(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 rh(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Gn(e,t=[],a=[]){let r=e.assignedUserIds?.map(g=>{let d=a.find(f=>f.id===g);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(g=>g!==null),o=t.filter(g=>g.metadata?.parentCardId===e.id).map(g=>Gn(g,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(g=>g.type==="finish-to-start").map(g=>g.taskId));let n=g=>{if(g)return typeof g=="string"?new Date(g):g},p=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||p&&u&&Math.abs(u.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:u,progress:e.progress||0,status:ah(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 Kc(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:rh(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Yc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Gn(r,e,t))}var Ii={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Li={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},_n={en:Ii,es:Li};function Bi(e){return _n[e]||_n.en}function Vn(e,t){let a=Bi(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}function Qc(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(...Qc(r.subtasks,t+1));return a}function gh({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 Zc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n}){let{theme:p="dark",locale:u="en",customTranslations:i,showSearch:g=true,showHierarchy:d=true}=t,f=Vn(u,i),b=p==="dark",[T,N]=react.useState(new Set),[c,C]=react.useState("startDate"),[m,l]=react.useState("asc"),[v,S]=react.useState("");react.useMemo(()=>{let D=new Set;function k($){for(let R of $)R.subtasks?.length&&(D.add(R.id),k(R.subtasks));}k(e),N(D);},[e]);let y=react.useCallback(D=>{N(k=>{let $=new Set(k);return $.has(D)?$.delete(D):$.add(D),$}),a.onTaskToggleExpand?.(D);},[a]),w=react.useCallback(D=>{c===D?l(k=>k==="asc"?"desc":"asc"):(C(D),l("asc")),a.onSortChange?.({column:D,direction:m==="asc"?"desc":"asc"});},[c,m,a]),x=react.useMemo(()=>{let D=Qc(e);if(v.trim()){let $=v.toLowerCase();D=D.filter(R=>R.name.toLowerCase().includes($));}let k=[];for(let $ of D){let R=$.level===0;$.level>0&&(R=true),(R||v.trim())&&k.push($);}return v.trim()&&k.sort(($,R)=>{let j,ee;switch(c){case "name":j=$.name.toLowerCase(),ee=R.name.toLowerCase();break;case "startDate":j=$.startDate?.getTime()||0,ee=R.startDate?.getTime()||0;break;case "endDate":j=$.endDate?.getTime()||0,ee=R.endDate?.getTime()||0;break;case "progress":j=$.progress||0,ee=R.progress||0;break;case "status":j=$.status||"todo",ee=R.status||"todo";break;default:return 0}return j<ee?m==="asc"?-1:1:j>ee?m==="asc"?1:-1:0}),k},[e,v,c,m]),B=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(u==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",b?"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:h("text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:[f.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",b?"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:h("text-lg font-semibold mb-2",b?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",b?"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:h("text-lg font-semibold mb-2",b?"text-white":"text-gray-900"),children:f.empty.noTasks}),jsxRuntime.jsx("p",{className:h("text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:f.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-hidden",b?"bg-[#0F1117]":"bg-white",s),style:n,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",b?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:h("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",b?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:v,onChange:D=>S(D.target.value),placeholder:f.toolbar.searchPlaceholder,className:h("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",b?"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.jsxs("div",{className:h("text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:[x.length," ",f.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:h("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",b?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>w("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[f.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[f.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[f.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[f.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>w("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x.map((D,k)=>{let $=T.has(D.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:h("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",b?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+D.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&D.hasChildren&&jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),y(D.id);},className:h("p-0.5 rounded",b?"hover:bg-white/10":"hover:bg-gray-200"),children:$?jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(gh,{status:D.status,progress:D.progress})}),jsxRuntime.jsx("span",{className:h("truncate",b?"text-white":"text-gray-900",D.progress===100&&(b?"line-through text-[#6B7280]":"line-through text-gray-400")),children:D.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:h("px-2 py-1 rounded-full text-xs font-medium",D.progress===100||D.status==="completed"?"bg-green-500/10 text-green-500":D.progress&&D.progress>0||D.status==="in-progress"?"bg-blue-500/10 text-blue-500":b?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D.progress===100||D.status==="completed"?f.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?f.status.inProgress:f.status.todo})}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(D.startDate)]}),jsxRuntime.jsxs("div",{className:h("col-span-2 flex items-center gap-1 text-sm",b?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(D.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:h("flex-1 h-1.5 rounded-full overflow-hidden",b?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-xs w-8",b?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),x.length===0&&v&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:h("w-12 h-12 mx-auto mb-4",b?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h(b?"text-[#9CA3AF]":"text-gray-600"),children:f.empty.noResults})]})})]})]})}var Ri={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"},$i={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"},Oi={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"},Kn={dark:Ri,light:$i,neutral:Oi};function em(e){return Kn[e]||Kn.dark}var zi={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"}},Ui={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"}},Yn={en:zi,es:Ui};function Vo(e){return Yn[e]||Yn.en}function qn(e,t){let a=Vo(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 tm(e){let t=Vo(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 am(e,t=0,a=true){let r=Vo(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 Ih(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 ji(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 im({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 dm({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:p,availableTags:u=[],onCreateTag:i,attachmentsByTask:g,comments:d,onAddComment:f,currentUser:b,onTaskOpen:T}){let{theme:N="dark",locale:c="en",customTranslations:C}=t,m=qn(c,C),l=N==="dark",v={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[S,y]=react.useState(r||new Date),[w,x]=react.useState(null),[B,D]=react.useState(null),[k,$]=react.useState(null),[R,j]=react.useState(new Date),[ee,ae]=react.useState({}),re=4,fe=3,[ge,Me]=react.useState(false),[I,O]=react.useState(false),[E,Q]=react.useState(false),[Y,G]=react.useState(false),[me,pe]=react.useState(null),[Fe,Ve]=react.useState(""),[dt,se]=react.useState(void 0),[_e,xt]=react.useState(null),[zt,ct]=react.useState(false),[U,ie]=react.useState(false),[Pe,Se]=react.useState(null),[Xe,Ge]=react.useState(false),[Dt,Ie]=react.useState(new Date),[sa,Zt]=react.useState(false),[At,gt]=react.useState(false),[ea,Xt]=react.useState(false),[Te,Ue]=react.useState(""),[ga,je]=react.useState(false),[He,L]=react.useState(""),[ke,q]=react.useState(false),ve=react.useCallback(()=>{y(new Date(S.getFullYear(),S.getMonth()-1,1));},[S]),ye=react.useCallback(()=>{y(new Date(S.getFullYear(),S.getMonth()+1,1));},[S]),Re=react.useCallback(()=>{y(new Date);},[]),Ae=react.useMemo(()=>{let P=S.getFullYear(),xe=S.getMonth(),J=new Date(P,xe,1),Be=new Date(P,xe+1,0),ot=J.getDay(),oe=Be.getDate(),We=Ih(e),kt=new Date;kt.setHours(0,0,0,0);let $e=[],Ft=ot,st=new Date(P,xe,0).getDate();for(let Ut=Ft-1;Ut>=0;Ut--){let qe=new Date(P,xe-1,st-Ut);$e.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:We.filter(wt=>ji(qe,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ut=1;Ut<=oe;Ut++){let qe=new Date(P,xe,Ut),wt=qe.getTime()===kt.getTime();$e.push({date:qe,isCurrentMonth:true,isToday:wt,isWeekend:qe.getDay()===0||qe.getDay()===6,events:We.filter(ca=>ji(qe,ca)).map(ca=>({id:ca.id,title:ca.name,start:ca.startDate,end:ca.endDate,task:ca}))});}let ya=42-$e.length;for(let Ut=1;Ut<=ya;Ut++){let qe=new Date(P,xe+1,Ut);$e.push({date:qe,isCurrentMonth:false,isToday:false,isWeekend:qe.getDay()===0||qe.getDay()===6,events:We.filter(wt=>ji(qe,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return $e},[S,e]),rt=c==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],z=S.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),_=react.useCallback((P,xe)=>{if(!w)return;let J={...w,[P]:xe};x(J),a.onTaskUpdate?.(J);},[w,a]),he=react.useCallback(P=>{if(!w)return;let xe=w.progress||0;P==="completed"?xe=100:P==="todo"&&(xe=0);let J={...w,status:P,progress:xe};x(J),a.onTaskUpdate?.(J),Me(false);},[w,a]),Le=react.useCallback((P,xe)=>{if(!w)return;let J={...w,startDate:P,endDate:xe};x(J),a.onTaskUpdate?.(J);},[w,a]),ze=react.useCallback(()=>{Me(false),O(false),Q(false),$(null),Xt(false),Ue(""),je(false);},[]),H=react.useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),Zt(false),!w||!a.onUploadAttachments)return;let xe=Array.from(P.dataTransfer.files);if(xe.length!==0){gt(true);try{await a.onUploadAttachments(w.id,xe);}finally{gt(false);}}},[w,a]),ne=react.useCallback(async P=>{if(!w||!a.onUploadAttachments||!P.target.files)return;let xe=Array.from(P.target.files);if(xe.length!==0){gt(true);try{await a.onUploadAttachments(w.id,xe);}finally{gt(false);}P.target.value="";}},[w,a]),Oe=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Zt(true);},[]),St=react.useCallback(P=>{P.preventDefault(),P.stopPropagation(),Zt(false);},[]),et=react.useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),fa=react.useCallback(P=>P.startsWith("image/")?lucideReact.Image:P.includes("pdf")||P.includes("document")?lucideReact.FileText:lucideReact.File,[]),ba=react.useMemo(()=>!w||!g?[]:g.get(w.id)||[],[w,g]);return o?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[m.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:h("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",n),style:p,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:h("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:m.labels.noEvents}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:m.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:h("flex-1 flex flex-col w-full h-full overflow-auto",l?"bg-[#0F1117]":"bg-white",n),style:p,children:[jsxRuntime.jsx("div",{className:h("flex-shrink-0 px-6 py-4 border-b",l?"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:h("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:z}),jsxRuntime.jsx("button",{onClick:Re,className:h("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:m.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ve,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:h("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ye,className:h("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:h("w-5 h-5",l?"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:rt.map(P=>jsxRuntime.jsx("div",{className:h("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:P},P))}),jsxRuntime.jsx("div",{className:h("grid grid-cols-7 auto-rows-min gap-px rounded-lg",l?"bg-[#2D2D2D]":"bg-gray-300"),children:Ae.map((P,xe)=>{let J=P.date.getDay()===0||P.date.getDay()===6;return jsxRuntime.jsxs("div",{className:h("min-h-[120px] p-2 transition-colors flex flex-col relative group",l?J?"bg-[#1C1F26]":P.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":J?"bg-gray-100":P.isCurrentMonth?"bg-white":"bg-gray-50",P.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Be=ee[xe]||re,ot=P.events.slice(0,Be),oe=P.events.length-Be;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ot.map(We=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(We.task),a.onEventClick?.(We),T?.(We.task.id);},whileHover:{scale:1.02},className:h("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",We.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(im,{task:We.task}),jsxRuntime.jsx("span",{className:"truncate",children:We.title})]})},We.id)),oe>0&&jsxRuntime.jsxs("button",{onClick:We=>{We.stopPropagation(),ae(kt=>({...kt,[xe]:Be+fe}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",oe," ",c==="es"?"M\xC1S":"MORE"]}),Be>re&&P.events.length>re&&jsxRuntime.jsx("button",{onClick:We=>{We.stopPropagation(),ae(kt=>({...kt,[xe]:re}));},className:h("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",l?"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 Be=xe>=28,ot=xe%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),me===xe?pe(null):(pe(xe),Ve(""),se(void 0),xt(null),Se(null),ct(false),ie(false),Ge(false),Ie(P.date));},className:h("w-5 h-5 rounded flex items-center justify-center transition-all",me===xe?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",l?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:h("w-3.5 h-3.5 transition-transform",me===xe&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me===xe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{pe(null),Ve(""),se(void 0),xt(null),Se(null),ct(false),ie(false),Ge(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:h("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"bottom-full mb-1":"top-full mt-1",ot?"right-0":"left-0",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>{oe.stopPropagation(),ct(false),ie(false),Ge(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Fe,onChange:oe=>Ve(oe.target.value),placeholder:c==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:h("w-full bg-transparent text-sm outline-none placeholder:opacity-40",l?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:oe=>{if(oe.key==="Enter"&&Fe.trim()){let We=t.availableUsers?.find($e=>$e.id===_e),kt=Pe||P.date;a.onTaskCreate?.({name:Fe.trim(),startDate:kt,endDate:kt,priority:dt,assignees:We?[We]:void 0}),Ve(""),se(void 0),xt(null),Se(null),pe(null);}oe.key==="Escape"&&(pe(null),Ve(""),se(void 0),xt(null),Se(null));}})}),jsxRuntime.jsxs("div",{className:h("px-2.5 py-2 flex items-center justify-between border-t",l?"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:oe=>{oe.stopPropagation(),ct(!zt),ie(false);},className:h("p-1 rounded transition-colors",dt?dt==="urgent"||dt==="high"?"text-red-400 bg-red-500/20":dt==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":l?"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:zt&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.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(oe=>jsxRuntime.jsxs("button",{onClick:()=>{se(oe.id),ct(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",dt===oe.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",oe.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:oe.label})]},oe.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:oe=>{oe.stopPropagation(),Ge(!Xe),ct(false),ie(false),Ie(Pe||P.date);},className:h("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Pe?"bg-[#7C3AED]/20 text-[#7C3AED]":l?"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"}),(Pe||P.date).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Xe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsx("div",{className:h("w-40 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let oe=new Date,We=new Date(oe);We.setDate(oe.getDate()+1);let kt=new Date(oe);kt.setDate(oe.getDate()+((6-oe.getDay()+7)%7||7));let $e=new Date(oe);$e.setDate(oe.getDate()+((1-oe.getDay()+7)%7||7));let Ft=new Date(oe);Ft.setDate(oe.getDate()+14);let st=new Date(oe);return st.setDate(oe.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:oe,display:oe.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:We,display:We.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:kt,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:$e,display:c==="es"?"lun.":"mon."},{label:c==="es"?"2 semanas":"2 weeks",date:Ft,display:Ft.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:st,display:st.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ut,qe)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Se(Ut.date),Ge(false);},children:[jsxRuntime.jsx("span",{children:Ut.label}),jsxRuntime.jsx("span",{className:h("text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:Ut.display})]},qe))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:h("text-xs font-medium",l?"text-white":"text-gray-900"),children:Dt.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:()=>Ie(new Date),className:h("px-1.5 py-0.5 rounded text-[10px] transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ie(new Date(Dt.getFullYear(),Dt.getMonth()-1)),className:h("p-0.5 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ie(new Date(Dt.getFullYear(),Dt.getMonth()+1)),className:h("p-0.5 rounded",l?"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(oe=>jsxRuntime.jsx("div",{className:h("w-6 h-6 flex items-center justify-center text-[10px]",l?"text-[#6B7280]":"text-gray-400"),children:oe},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let oe=Dt.getFullYear(),We=Dt.getMonth(),kt=new Date(oe,We,1).getDay(),$e=new Date(oe,We+1,0).getDate(),Ft=new Date(oe,We,0).getDate(),st=new Date,ya=[];for(let qe=kt-1;qe>=0;qe--)ya.push({dayNum:Ft-qe,isCurrentMonth:false,date:new Date(oe,We-1,Ft-qe)});for(let qe=1;qe<=$e;qe++)ya.push({dayNum:qe,isCurrentMonth:true,date:new Date(oe,We,qe)});let Ut=42-ya.length;for(let qe=1;qe<=Ut;qe++)ya.push({dayNum:qe,isCurrentMonth:false,date:new Date(oe,We+1,qe)});return ya.map((qe,wt)=>{let ca=qe.date.toDateString()===st.toDateString(),kr=(Pe||P.date).toDateString()===qe.date.toDateString();return jsxRuntime.jsx("button",{className:h("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!qe.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),qe.isCurrentMonth&&(l?"text-white":"text-gray-900"),ca&&"ring-1 ring-[#3B82F6]",kr&&"bg-[#7C3AED] text-white",!kr&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Se(qe.date),Ge(false);},children:qe.dayNum},wt)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:oe=>{oe.stopPropagation(),ie(!U),ct(false);},className:h("p-1 rounded transition-colors",_e?"text-[#7C3AED] bg-[#7C3AED]/20":l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:_e?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(oe=>oe.id===_e)?.color||"#7C3AED"},children:t.availableUsers?.find(oe=>oe.id===_e)?.initials||t.availableUsers?.find(oe=>oe.id===_e)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:oe=>oe.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{xt(null),ie(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",!_e&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-5 h-5 rounded-full flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:l?"text-[#9CA3AF]":"text-gray-500",children:c==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(oe=>jsxRuntime.jsxs("button",{onClick:()=>{xt(oe.id),ie(false);},className:h("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",_e===oe.id&&(l?"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:oe.color||"#7C3AED"},children:oe.initials||oe.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:oe.name})]},oe.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:h("px-3 py-2 text-xs",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Fe.trim()){let oe=t.availableUsers?.find(kt=>kt.id===_e),We=Pe||P.date;a.onTaskCreate?.({name:Fe.trim(),startDate:We,endDate:We,priority:dt,assignees:oe?[oe]:void 0}),Ve(""),se(void 0),xt(null),Se(null),pe(null);}},disabled:!Fe.trim(),className:h("px-2.5 py-1 rounded text-xs font-medium transition-colors",Fe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":l?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:c==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:h("text-sm font-medium",P.isToday?"text-[#3B82F6]":P.isCurrentMonth?l?"text-white":"text-gray-900":l?"text-[#6B7280]":"text-gray-400"),children:P.date.getDate()})]})]},xe)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>{x(null),L("");},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:h("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:h("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:h("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:h("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[c==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:h("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:w.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"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("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:h("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>{x(null),L("");},className:h("p-1.5 rounded transition-colors",l?"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("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let P=w.progress===100?0:100,J={...w,progress:P,status:P===100?"completed":"todo"};x(J),a.onTaskUpdate?.(J);},className:h("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",w.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:w.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:h("text-xl font-semibold flex-1",w.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:w.name})]})}),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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),Me(!ge);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.progress===100||w.status==="completed"?"bg-green-500/20 text-green-400":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:w.progress===100||w.status==="completed"?c==="es"?"COMPLETADO":"DONE":w.progress&&w.progress>0||w.status==="in-progress"?c==="es"?"EN PROGRESO":"IN PROGRESS":c==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Me(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:c==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:c==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:c==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(P=>jsxRuntime.jsxs("button",{onClick:()=>he(P.id),className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",(w.status===P.id||P.id==="completed"&&w.progress===100||P.id==="in-progress"&&w.progress&&w.progress>0&&w.progress<100||P.id==="todo"&&(!w.progress||w.progress===0)&&w.status!=="in-progress"&&w.status!=="completed")&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.id==="completed"?"bg-green-500":P.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{Me(false),O(false),$(null),Q(!E);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[w.assignees&&w.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[w.assignees.slice(0,3).map((P,xe)=>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()},xe)),w.assignees.length>3&&jsxRuntime.jsxs("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",w.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Q(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(P=>{let xe=w.assignees?.some(J=>J.name===P.name);return jsxRuntime.jsxs("button",{onClick:()=>{let J=w.assignees||[],Be;xe?Be=J.filter(ot=>ot.name!==P.name):Be=[...J,{name:P.name,avatar:P.avatar,initials:P.initials||P.name.slice(0,2).toUpperCase(),color:P.color||"#8B5CF6"}],_("assignees",Be);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50",xe&&(l?"bg-white/5":"bg-gray-50")),children:[P.avatar?jsxRuntime.jsx("img",{src:P.avatar,alt:P.name,className:"w-6 h-6 rounded-full object-cover"}):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"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:h("flex-1 text-left",l?"text-white":"text-gray-900"),children:P.name}),xe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},P.id||P.name)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$(k?null:"start"),j(w.startDate||new Date);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[w.startDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:h("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),w.endDate?.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(c==="es"?"Fin":"End"),(w.startDate||w.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:P=>{P.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:h("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:h("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,xe=new Date(P);xe.setDate(P.getDate()+1);let J=new Date(P);J.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Be=new Date(P);Be.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let ot=new Date(P);ot.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let oe=new Date(P);oe.setDate(P.getDate()+14);let We=new Date(P);return We.setDate(P.getDate()+28),[{label:c==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Ma\xF1ana":"Tomorrow",date:xe,display:xe.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:c==="es"?"Este fin de semana":"This weekend",date:J,display:c==="es"?"s\xE1b.":"sat."},{label:c==="es"?"Pr\xF3xima semana":"Next week",date:Be,display:c==="es"?"lun.":"mon."},{label:c==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ot,display:ot.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"2 semanas":"2 weeks",date:oe,display:oe.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:c==="es"?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map(($e,Ft)=>jsxRuntime.jsxs("button",{className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(k==="start"){let st=w.endDate&&$e.date>w.endDate?$e.date:w.endDate;Le($e.date,st),$("end");}else {let st=w.startDate&&$e.date<w.startDate?$e.date:w.startDate;Le(st,$e.date),$(null);}},children:[jsxRuntime.jsx("span",{children:$e.label}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:$e.display})]},Ft))})(),jsxRuntime.jsx("div",{className:h("border-t mt-2 pt-2",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{Le(void 0,void 0),$(null);},className:h("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:c==="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:h("text-xs mb-3 px-2 py-1 rounded",l?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:k==="start"?c==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":c==="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:h("font-medium",l?"text-white":"text-gray-900"),children:R.toLocaleDateString(c==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>j(new Date),className:h("p-1 rounded text-sm transition-colors",l?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:c==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>j(new Date(R.getFullYear(),R.getMonth()-1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>j(new Date(R.getFullYear(),R.getMonth()+1)),className:h("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(c==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsxRuntime.jsx("div",{className:h("w-8 h-8 flex items-center justify-center text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=R.getFullYear(),xe=R.getMonth(),J=new Date(P,xe,1).getDay(),Be=new Date(P,xe+1,0).getDate(),ot=new Date(P,xe,0).getDate(),oe=new Date,We=[];for(let $e=J-1;$e>=0;$e--)We.push({day:ot-$e,isCurrentMonth:false,date:new Date(P,xe-1,ot-$e)});for(let $e=1;$e<=Be;$e++)We.push({day:$e,isCurrentMonth:true,date:new Date(P,xe,$e)});let kt=42-We.length;for(let $e=1;$e<=kt;$e++)We.push({day:$e,isCurrentMonth:false,date:new Date(P,xe+1,$e)});return We.map(($e,Ft)=>{let st=$e.date.toDateString()===oe.toDateString(),ya=w.startDate?.toDateString()===$e.date.toDateString(),Ut=w.endDate?.toDateString()===$e.date.toDateString(),qe=ya||Ut,wt=w.startDate&&w.endDate&&$e.date>=w.startDate&&$e.date<=w.endDate;return jsxRuntime.jsx("button",{className:h("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!$e.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),$e.isCurrentMonth&&(l?"text-white":"text-gray-900"),st&&"ring-2 ring-[#3B82F6]",ya&&"bg-[#3B82F6] text-white",Ut&&!ya&&"bg-[#7C3AED] text-white",wt&&!qe&&(l?"bg-[#7C3AED]/20":"bg-purple-100"),!qe&&(l?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ca=new Date($e.date);if(k==="start"){let kr=w.endDate&&ca>w.endDate?ca:w.endDate;Le(ca,kr),$("end");}else {let kr=w.startDate&&ca<w.startDate?ca:w.startDate;Le(kr,ca),$(null);}},children:$e.day},Ft)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ze(),O(!I);},className:h("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",w.priority==="high"||w.priority==="urgent"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":w.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:w.priority?w.priority==="high"||w.priority==="urgent"?c==="es"?"Urgente":"Urgent":w.priority==="medium"?c==="es"?"Media":"Medium":c==="es"?"Baja":"Low":c==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&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:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(P=>jsxRuntime.jsxs("button",{onClick:()=>{_("priority",P.id),O(false);},className:h("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",w.priority===P.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:h("w-2 h-2 rounded-full",P.color)}),jsxRuntime.jsx("span",{className:l?"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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:w.startDate&&w.endDate?`${Math.ceil((w.endDate.getTime()-w.startDate.getTime())/(1e3*60*60*24))} ${c==="es"?"d\xEDas":"days"}`:c==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Y?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:w.progress||0,onChange:P=>{let xe=parseInt(P.target.value),J=w.status;xe===100?J="completed":xe>0?J="in-progress":J="todo";let Be={...w,progress:xe,status:J};x(Be),a.onTaskUpdate?.(Be);},onBlur:()=>G(false),className:h("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>G(true),className:h("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:h("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:h("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[w.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(lr,{selectedTags:w.tags||[],availableTags:u,onChange:P=>{_("tags",P);},onCreateTag:i,theme:v})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:h("w-4 h-4 mt-1.5",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24 mt-1",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[w.dependencies&&w.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:w.dependencies.map(P=>{let xe=e.find(J=>J.id===P);return jsxRuntime.jsxs("span",{className:h("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",l?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[xe?.name||P.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let J=(w.dependencies||[]).filter(Be=>Be!==P);_("dependencies",J);},className:h("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:()=>{ze(),Xt(!ea);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ea&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Xt(false),Ue("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:h("p-2 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:Te,onChange:P=>Ue(P.target.value),placeholder:c==="es"?"Buscar tarea...":"Search task...",className:h("w-full px-3 py-2 rounded-md text-sm outline-none",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:e.length>0?e.filter(P=>P.id!==w.id).filter(P=>Te===""||P.name.toLowerCase().includes(Te.toLowerCase())).map(P=>{let xe=w.dependencies?.includes(P.id);return jsxRuntime.jsxs("button",{onClick:()=>{let J=w.dependencies||[],Be;xe?Be=J.filter(ot=>ot!==P.id):Be=[...J,P.id],_("dependencies",Be);},className:h("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",xe&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",xe?"bg-blue-500 border-blue-500":l?"border-white/30":"border-gray-300"),children:xe&&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:h("block truncate",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsxRuntime.jsx("div",{className:h("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{ze(),je(!ga);},className:h("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:w.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:dr.find(P=>P.value===w.color)?.name||(c==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:h("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ga&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>je(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:h("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:dr.map(P=>{let xe=w.color===P.value;return jsxRuntime.jsx("button",{onClick:()=>{_("color",P.value),je(false);},className:h("w-7 h-7 rounded-full flex items-center justify-center transition-all",xe&&"ring-2 ring-offset-2",l?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:xe?P.value:void 0},title:P.name,children:xe&&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:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:h("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:w.isMilestone||false,onChange:P=>_("isMilestone",P.target.checked),className:h("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",w.isMilestone?"bg-purple-500 border-purple-500":l?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:h("text-sm",l?"text-white":"text-gray-900"),children:c==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:h("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:w.description||"",onChange:P=>_("description",P.target.value),placeholder:c==="es"?"Agregar descripci\xF3n...":"Add description...",className:h("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",l?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:h("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),c==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:c==="es"?"Agregar subtarea":"Add subtask"}),w.subtasks&&w.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:w.subtasks.map(P=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:h("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",P.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:h("text-sm",P.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:P.name})]},P.id))}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),c==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:c==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:h("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),c==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:h("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:[c==="es"?"Adjuntos":"Attachments",ba.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",ba.length,")"]})]}),ba.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:ba.map(P=>{let xe=fa(P.type),J=P.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:h("flex items-center gap-3 p-2 rounded-lg group transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[J&&P.thumbnailUrl?jsxRuntime.jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:h("w-10 h-10 rounded flex items-center justify-center",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(xe,{className:h("w-5 h-5",l?"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:h("text-sm font-medium truncate block hover:underline",l?"text-white":"text-gray-900"),children:P.name}),jsxRuntime.jsx("p",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:et(P.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(P.id),className:h("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",l?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:c==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxRuntime.jsxs("div",{onDragOver:Oe,onDragLeave:St,onDrop:H,className:h("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",sa?l?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",At&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:ne,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||At}),At?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:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:c==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:h("w-6 h-6 mx-auto mb-2",sa?"text-blue-500":l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:sa?c==="es"?"Suelta los archivos aqu\xED":"Drop files here":c==="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"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:h("text-xs mt-1",l?"text-[#6B7280]":"text-gray-400"),children:c==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:h("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:h("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("h3",{className:h("text-sm font-semibold",l?"text-white":"text-gray-900"),children:[c==="es"?"Actividad":"Activity",d&&d.length>0&&jsxRuntime.jsxs("span",{className:h("ml-2 text-xs font-normal",l?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:d&&d.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:d.map(P=>{let xe=(()=>{let J=new Date,Be=new Date(P.createdAt),ot=J.getTime()-Be.getTime(),oe=Math.floor(ot/6e4),We=Math.floor(oe/60),kt=Math.floor(We/24);return oe<1?c==="es"?"ahora":"now":oe<60?c==="es"?`hace ${oe}m`:`${oe}m ago`:We<24?c==="es"?`hace ${We}h`:`${We}h ago`:c==="es"?`hace ${kt}d`:`${kt}d ago`})();return jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),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:h("text-sm font-medium",l?"text-white":"text-gray-900"),children:P.user?.name||(c==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:h("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:xe})]}),jsxRuntime.jsx("p",{className:h("text-sm break-words",l?"text-[#9CA3AF]":"text-gray-600"),children:P.content})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:h("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:h("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:c==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:h("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[b&&jsxRuntime.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:b.color||"#8B5CF6"},children:b.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:h("flex-1 flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",value:He,onChange:P=>L(P.target.value),onKeyDown:async P=>{if(P.key==="Enter"&&!P.shiftKey&&w&&He.trim()&&f){P.preventDefault(),q(true);try{await f(w.id,He.trim()),L("");}finally{q(false);}}},placeholder:c==="es"?"Escribe un comentario...":"Write a comment...",disabled:ke||!f,className:h("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(ke||!f)&&"opacity-50")}),jsxRuntime.jsx("button",{onClick:async()=>{if(w&&He.trim()&&f){q(true);try{await f(w.id,He.trim()),L("");}finally{q(false);}}},disabled:ke||!He.trim()||!f,className:h("p-1.5 rounded transition-colors",He.trim()&&f?"bg-blue-500 text-white hover:bg-blue-600":l?"text-[#6B7280]":"text-gray-400",ke&&"opacity-50 cursor-not-allowed"),children:ke?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})]})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(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:h("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",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:h("px-4 py-3 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:h("font-medium",l?"text-white":"text-gray-900"),children:B.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>D(null),className:h("p-1 rounded",l?"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:B.events.map(P=>jsxRuntime.jsxs("button",{onClick:()=>{D(null),x(P.task),T?.(P.task.id);},className:h("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",l?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(im,{task:P.task}),jsxRuntime.jsx("span",{className:h("text-sm truncate flex-1",l?"text-white":"text-gray-900"),children:P.title}),P.task.priority==="high"||P.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},P.id))})]})]})})]})}var Ki={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"},Yi={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"},qi={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"},Jn={dark:Ki,light:Yi,neutral:qi};function cm(e){return Jn[e]||Jn.dark}function Bh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:p}){let[u,i]=react.useState(false),g=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),d=react.useMemo(()=>{let b=g.length,T=new Set(g.flatMap(C=>C.assignedUserIds||[])).size,N=g.map(C=>C.priority).filter(Boolean),c=new Set(g.flatMap(C=>C.labels||[])).size;return {totalCards:b,uniqueAssignees:T,priorities:N,labels:c}},[g]),f=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:h("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:f,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:h("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"]})]}),u&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.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:g.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:g.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:T=>{T.stopPropagation(),s?.(e.id,b.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"})]})})]},b.id))})})]})}var pm={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Yo(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 qo(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 um(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 gm({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:p}){let u=react.useMemo(()=>({...pm,...n}),[n]),[i,g]=react.useState(new Set),d=react.useRef(null),f=react.useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let m=new Map;return e.forEach(l=>{let v=l.timestamp.toISOString().split("T")[0],S=m.get(v);S?S.push(l):m.set(v,[l]);}),Array.from(m.entries()).sort((l,v)=>v[0].localeCompare(l[0])).map(([l,v])=>({date:new Date(l),events:v.sort((S,y)=>y.timestamp.getTime()-S.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:b,uniqueTypes:T}=react.useMemo(()=>{let m=new Set,l=new Set;return e.forEach(v=>{m.add(v.userId),l.add(v.type);}),{uniqueUsers:Array.from(m),uniqueTypes:Array.from(l)}},[e]),N=m=>{g(l=>{let v=new Set(l);return v.has(m)?v.delete(m):v.add(m),v});},c=m=>{let v=new Date().getTime()-m.getTime(),S=Math.floor(v/6e4),y=Math.floor(v/36e5),w=Math.floor(v/864e5);return S<1?"just now":S<60?`${S}m ago`:y<24?`${y}h ago`:w<7?`${w}d ago`:m.toLocaleDateString()},C=react.useMemo(()=>{let m=0;return t.types&&t.types.length>0&&m++,t.users&&t.users.length>0&&m++,t.dateRange&&m++,t.searchTerm&&m++,m},[t]);return react.useEffect(()=>{if(s&&d.current){let m=d.current.querySelector(`[data-event-id="${s}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:h("history-timeline-empty",p),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:h("history-timeline",u.compact&&"compact",p),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:m=>{let l=m.target.value;a({...t,types:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),T.map(m=>jsxRuntime.jsxs("option",{value:m,children:[qo(m)," ",m.replace("_"," ")]},m))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:m=>{let l=m.target.value;a({...t,users:l?[l]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(m=>jsxRuntime.jsx("option",{value:m,children:m},m))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:m=>a({...t,searchTerm:m.target.value})})]}),C>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",C,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:f.map(m=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&m.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:m.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[m.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:m.events.map((l,v)=>{let S=i.has(l.id),y=s===l.id,w=um(l.type);return jsxRuntime.jsxs("div",{"data-event-id":l.id,className:h("history-timeline-event",S&&"expanded",y&&"selected"),onClick:()=>o?.(l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:w},children:u.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:qo(l.type)})}),v<m.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:w}})]}),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:[u.showAvatars&&l.userAvatar&&jsxRuntime.jsx("img",{src:l.userAvatar,alt:l.userName||l.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:l.userName||l.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Yo(l)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?c(l.timestamp):l.timestamp.toLocaleString()})]}),Object.keys(l.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:x=>{x.stopPropagation(),N(l.id);},children:[S?"\u25BC":"\u25B6"," Show changes"]}),S&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(l.changes).map(([x,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[x,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},x)),l.metadata&&Object.keys(l.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(l.metadata).map(([x,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[x,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},x))]})]})]})]},l.id)})})]},m.date?.toISOString()||"all"))})]})}function hm({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:p,onSpeedChange:u,className:i}){let g=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),f=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:h("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:h("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&qo(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Yo(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:b=>p(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${f}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,T)=>jsxRuntime.jsx("div",{className:h("history-replay-progress-marker",T===e.currentIndex&&"active"),style:{left:`${T/(e.totalEvents-1)*100}%`},onClick:()=>p(T),title:Yo(b)},b.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:g.map(b=>jsxRuntime.jsxs("button",{className:h("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>u(b),children:[b,"x"]},b))})]}),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(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):jsxRuntime.jsxs("div",{className:h("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 Xi(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 Ji(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 bm(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 ym(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Hh(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(g=>{let d=a/2,f=r/2;g.vx+=(d-g.x)*o.centerForce*i,g.vy+=(f-g.y)*o.centerForce*i,n.forEach(b=>{if(g.id===b.id)return;let T=g.x-b.x,N=g.y-b.y,c=Math.sqrt(T*T+N*N)||1,C=o.chargeStrength*i/(c*c);g.vx+=T/c*C,g.vy+=N/c*C;});}),t.forEach(g=>{let d=p.get(typeof g.source=="string"?g.source:g.source.id),f=p.get(typeof g.target=="string"?g.target:g.target.id);if(!d||!f)return;let b=f.x-d.x,T=f.y-d.y,N=Math.sqrt(b*b+T*T)||1,c=(N-o.linkDistance)/N*o.forceStrength*i;d.vx+=b*c,d.vy+=T*c,f.vx-=b*c,f.vy-=T*c;}),n.forEach(g=>{g.fx!==null&&g.fx!==void 0?(g.x=g.fx,g.vx=0):g.x+=g.vx,g.fy!==null&&g.fy!==void 0?(g.y=g.fy,g.vy=0):g.y+=g.vy,g.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,g.x)),g.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,g.y)),g.vx*=.9,g.vy*=.9;});}return n}function vm({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:p,className:u}){let i=react.useRef(null),[g,d]=react.useState([]),[f,b]=react.useState(null),[T,N]=react.useState(null),[c,C]=react.useState(null),[m,l]=react.useState(1),[v,S]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let R=Hh(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let y=react.useCallback((R,j)=>{a.enableDragging&&(j.stopPropagation(),b(R));},[a.enableDragging]),w=react.useCallback(R=>{if(!f||!i.current)return;let ee=i.current.getBoundingClientRect(),ae=(R.clientX-ee.left-v.x)/m,re=(R.clientY-ee.top-v.y)/m;d(fe=>fe.map(ge=>ge.id===f?{...ge,x:ae,y:re,fx:ae,fy:re}:ge));},[f,m,v]),x=react.useCallback(()=>{b(null);},[]),B=react.useCallback((R,j)=>{j.stopPropagation(),p?.({type:"node-click",node:R,position:{x:j.clientX,y:j.clientY}});},[p]),D=react.useCallback((R,j)=>{j.stopPropagation(),p?.({type:"edge-click",edge:R,position:{x:j.clientX,y:j.clientY}});},[p]),k=react.useCallback(R=>{let j=g.find(ee=>ee.id===R);return j?{x:j.x,y:j.y}:{x:0,y:0}},[g]),$=react.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=R.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:h("relationships-graph-empty",u),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:h("relationships-graph",u),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:()=>l(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(m*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>l(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{l(1),S({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:Xi(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[bm(R)," ",Ji(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:w,onMouseUp:x,onMouseLeave:x,children:[jsxRuntime.jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${m})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let j=k(typeof R.source=="string"?R.source:R.source.id),ee=k(typeof R.target=="string"?R.target:R.target.id),ae=ym(R.type),re=c===R.id,fe=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-edge",re&&"hovered",fe&&"critical"),onMouseEnter:()=>C(R.id),onMouseLeave:()=>C(null),onClick:ge=>D(R,ge),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:ee.x,y2:ee.y,stroke:Xi(R.type),strokeWidth:fe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:re?1:.6,markerEnd:ae?"url(#arrowhead)":void 0}),a.showEdgeLabels&&re&&jsxRuntime.jsx("text",{x:(j.x+ee.x)/2,y:(j.y+ee.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Ji(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:g.map(R=>{let j=T===R.id,ee=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:h("relationships-graph-node",j&&"hovered",ee&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:ae=>y(R.id,ae),onMouseEnter:()=>N(R.id),onMouseLeave:()=>N(null),onClick:ae=>B(R,ae),children:[jsxRuntime.jsx("circle",{r:ee?a.nodeSize*1.2:a.nodeSize,fill:$(R),stroke:ee?"#fbbf24":"#ffffff",strokeWidth:ee?3:2,opacity:j?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 wm({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[p,u]=react.useState(false),[i,g]=react.useState(null),[d,f]=react.useState(null),b=react.useRef(null),T=p||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let m=l=>{l.key==="Escape"&&!T&&N();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,T]);let N=()=>{T||(n(""),g(null),f(null),t());},c=async()=>{if(!(!s.trim()||T)){u(true),g(null),f(null);try{let m=await r(s.trim());f(m);}catch(m){g(m instanceof Error?m.message:"Failed to generate plan");}finally{u(false);}}},C=()=>{d&&(a(d),N());};return e?jsxRuntime.jsxs(mt,{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-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: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.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:N,disabled:T,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((m,l)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:m.title},l))})]}),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((m,l)=>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:m.title}),m.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:m.description})]}),m.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${m.priority==="URGENT"?"bg-red-500/20 text-red-400":m.priority==="HIGH"?"bg-orange-500/20 text-orange-400":m.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:m.priority})]})},l)),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:b,value:s,onChange:m=>n(m.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),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((m,l)=>jsxRuntime.jsx("button",{onClick:()=>n(m),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:m},l))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&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:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?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 Plan to Board"}):jsxRuntime.jsx("button",{onClick:c,disabled:!s.trim()||T,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:T?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qi={"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 Gh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},_h={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 Vh(e,t,a){let r=Qi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Xo(e){return `$${e.toFixed(4)}`}var Zi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Vh(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,f)=>d+f.cost,0),s=a.reduce((d,f)=>d+f.inputTokens,0),n=a.reduce((d,f)=>d+f.outputTokens,0),p=a.filter(d=>d.success),u=a.reduce((d,f)=>d+f.duration,0),i={},g={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,g[d.feature]=(g[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:g,averageDuration:r>0?u/r:0,successRate:r>0?p.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 p=this.operations.filter(g=>g.timestamp>=n).length,u=Math.max(0,o-p),i=p/o*100;return {used:p,limit:o,remaining:u,percentUsed:i,isExceeded:p>=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)}},eo=new Zi;function Nm({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(eo.getStats()),[s,n]=react.useState(eo.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(eo.getStats()),n(eo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),react.useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let p=eo.getRecentOperations(5);return jsxRuntime.jsxs(mt,{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:u=>u.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:Xo(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(([u,i])=>{let g=r.costsByFeature[u]||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:u.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:Xo(g)})]})]}),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}%`}})})]},u)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Xo(u.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 Em({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,p]=react.useState(""),[u,i]=react.useState(""),[g,d]=react.useState(""),[f,b]=react.useState(false),[T,N]=react.useState(null),[c,C]=react.useState(null),[m,l]=react.useState(null),v=react.useRef(null),S=f||o;react.useEffect(()=>{e&&v.current&&v.current.focus();},[e]),react.useEffect(()=>{let D=k=>{k.key==="Escape"&&!S&&y();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,S]);let y=()=>{S||(p(""),i(""),d(""),N(null),C(null),l(null),t());},w=async()=>{if(!(!n.trim()||S)){b(true),N(null),C(null),l(null);try{let D=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:g||void 0});C(D.tasks.tasks),l({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){N(D instanceof Error?D.message:"Failed to generate tasks");}finally{b(false);}}},x=()=>{c&&(a(c),y());};if(!e)return null;let B=m?.similarity?((m.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(mt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),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:D=>D.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:y,disabled:S,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:c?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:[m?.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"}),m?.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 (",B,"% 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:[m?.tokens_used||0," tokens"]}),m?.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:[m.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:[c.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:c.map((D,k)=>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:["#",k+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:D.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"})]}),D.start," \u2192 ",D.end]}),jsxRuntime.jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:D.priority})]})},D.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:v,value:n,onChange:D=>p(D.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:S}),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:u,onChange:D=>i(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]}),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:g,onChange:D=>d(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:S})]})]}),T&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:T}),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((D,k)=>jsxRuntime.jsx("button",{onClick:()=>p(D),disabled:S,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:D},k))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:S&&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:y,disabled:S,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"}),c?jsxRuntime.jsx("button",{onClick:x,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:w,disabled:!n.trim()||S,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:S?"Generating...":"Generate Tasks"})]})]})]})})]})}function es({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(c=>{t&&sn(()=>Promise.resolve(t(c)),{maxAttempts:3,initialDelay:1e3,onRetry:(C,m,l)=>{console.warn(`Retry attempt ${m} after ${l}ms: ${C.message}`);}}).then(C=>{C.success||console.error(`Failed to persist board after ${C.attempts} attempts:`,C.error);});},[t]),s=react.useCallback(async(c,C,m)=>{r(l=>{let v=l.cards.find(D=>D.id===c);if(!v)return l;let S=v.columnId,y={...v,columnId:C,position:m},w=l.cards.map(D=>D.id===c?y:D),x=l.columns.map(D=>{if(D.id===S)return {...D,cardIds:D.cardIds.filter(k=>k!==c)};if(D.id===C){let k=w.filter($=>$.columnId===C).sort(($,R)=>$.position-R.position);return {...D,cardIds:k.map($=>$.id)}}return D}),B={...l,cards:w,columns:x};return o(B),B});},[o]),n=react.useCallback(async(c,C)=>{r(m=>{let l=m.cards.map(S=>S.id===c?{...S,...C}:S),v={...m,cards:l};return o(v),v});},[o]),p=react.useCallback(async c=>{let C=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(m=>{let l={...c,id:C},v=m.columns.map(y=>y.id===c.columnId?{...y,cardIds:[...y.cardIds,C]}:y),S={...m,cards:[...m.cards,l],columns:v};return o(S),S});},[o]),u=react.useCallback(async c=>{r(C=>{let m=C.cards.find(y=>y.id===c);if(!m)return C;let l=C.cards.filter(y=>y.id!==c),v=C.columns.map(y=>y.id===m.columnId?{...y,cardIds:y.cardIds.filter(w=>w!==c)}:y),S={...C,cards:l,columns:v};return o(S),S});},[o]),i=react.useCallback(async c=>{let C=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(m=>{let l={...c,id:C,cardIds:[]},v={...m,columns:[...m.columns,l]};return o(v),v});},[o]),g=react.useCallback(async(c,C)=>{r(m=>{let l=m.columns.map(S=>S.id===c?{...S,...C}:S),v={...m,columns:l};return o(v),v});},[o]),d=react.useCallback(async c=>{r(C=>{let m=C.cards.filter(S=>S.columnId!==c),l=C.columns.filter(S=>S.id!==c),v={...C,cards:m,columns:l};return o(v),v});},[o]),f=react.useCallback(c=>{let C=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(c),C},[p]),b=react.useCallback(c=>{let C=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(c),C},[i]),T=react.useCallback(()=>{r(c=>{let C={...c,cards:[],columns:[]};return o(C),C});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:p,onCardDelete:u,onColumnCreate:i,onColumnUpdate:g,onColumnDelete:d},setBoard:r,helpers:{addCard:f,addColumn:b,deleteCard:u,deleteColumn:d,clearBoard:T}}}function Mm({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=es({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(u,i,g={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...g});},addColumn:(u,i)=>{let g=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??g+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 Jo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Fm={by:"none",order:"asc"};function Im({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Jo,...e}),[s,n]=react.useState({...Fm,...t}),p=react.useCallback(N=>{o(c=>({...c,...N}));},[]),u=react.useCallback(N=>{n(c=>({...c,...N}));},[]),i=react.useCallback(()=>{o(Jo),n(Fm);},[]),g=react.useCallback(()=>{a&&o({...Jo,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Jo,dateFilter:"overdue"});},[]),f=react.useCallback(()=>{o({...Jo,priorities:["HIGH","URGENT"]});},[]),b=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]),T=react.useCallback(N=>{let c=[...N];if(r.search){let C=r.search.toLowerCase();c=c.filter(m=>m.title.toLowerCase().includes(C)||m.description?.toLowerCase().includes(C));}if(r.dateFilter!=="all"){let C=new Date,m=C.getFullYear(),l=String(C.getMonth()+1).padStart(2,"0"),v=String(C.getDate()).padStart(2,"0"),S=`${m}-${l}-${v}`;c=c.filter(y=>{if(!y.endDate&&!y.dueDate)return false;let w=y.endDate||y.dueDate;if(!w)return false;let x;if(typeof w=="string")x=w.split("T")[0]||w;else {let B=w.getUTCFullYear(),D=String(w.getUTCMonth()+1).padStart(2,"0"),k=String(w.getUTCDate()).padStart(2,"0");x=`${B}-${D}-${k}`;}switch(r.dateFilter){case "overdue":return x<S;case "today":return x===S;case "this-week":let B=new Date(S+"T00:00:00"),D=new Date(x+"T00:00:00"),k=new Date(B);return k.setDate(k.getDate()+7),D>=B&&D<=k;case "custom":if(r.dateRange){let $=typeof w=="string"?new Date(w):w;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(c=c.filter(C=>C.priority&&r.priorities.includes(C.priority))),r.assignees.length>0&&(c=c.filter(C=>(C.assignedUserIds||(C.assigneeId?[C.assigneeId]:[])).some(l=>r.assignees.includes(l)))),r.labels.length>0&&(c=c.filter(C=>C.labels&&C.labels.some(m=>r.labels.includes(m)))),r.columns.length>0&&(c=c.filter(C=>r.columns.includes(C.columnId))),s.by!=="none"&&c.sort((C,m)=>{let l=0;switch(s.by){case "created":let v=C.createdAt?new Date(C.createdAt).getTime():0,S=m.createdAt?new Date(m.createdAt).getTime():0;l=v-S;break;case "priority":let y={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},w=y[C.priority||"LOW"],x=y[m.priority||"LOW"];l=w-x;break;case "dueDate":let B=C.endDate||C.dueDate,D=m.endDate||m.dueDate;if(!B)return 1;if(!D)return -1;let k=typeof B=="string"?new Date(B).getTime():B.getTime(),$=typeof D=="string"?new Date(D).getTime():D.getTime();l=k-$;break;case "title":l=C.title.localeCompare(m.title);break;case "estimate":let R=C.estimatedTime||0,j=m.estimatedTime||0;l=R-j;break;default:l=0;}return s.order==="asc"?l:-l}),c},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:u,resetFilters:i,filterMyTasks:g,filterOverdue:d,filterHighPriority:f,applyFilters:T,hasActiveFilters:b}}var Bm,Rm;if(typeof window<"u")try{let e=rn("ai");Bm=e.generateObject,Rm=e.generateText;}catch{}function $m(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Bm&&Rm&&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(f){let b=f instanceof Error?f:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),p=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(f){let b=f instanceof Error?f:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),u=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(f){let b=f instanceof Error?f:new Error("Failed to predict risks");throw o(b),b}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(f){let b=f instanceof Error?f:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),g=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(f){let b=f instanceof Error?f:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:p,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:g,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 Om(e){let{cards:t}=e,[a,r]=tl(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,f)=>{if(!f){r({selectedCardIds:[d],lastSelectedCardId:d});return}let b=f.ctrlKey||f.metaKey,T=f.shiftKey;if(b)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(N=>N!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(T&&a.lastSelectedCardId){let N=t.find(C=>C.id===d),c=t.find(C=>C.id===a.lastSelectedCardId);if(N&&c&&N.columnId===c.columnId){let C=t.filter(x=>x.columnId===N.columnId).sort((x,B)=>x.position-B.position),m=C.findIndex(x=>x.id===a.lastSelectedCardId),l=C.findIndex(x=>x.id===d),[v,S]=m<l?[m,l]:[l,m],y=C.slice(v,S+1).map(x=>x.id),w=Array.from(new Set([...a.selectedCardIds,...y]));r({selectedCardIds:w,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(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=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]),g=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:p,selectAll:u,toggleCard:i,getSelectedCards:g}}var zm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Um(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...zm,...a}),[a]),[s,n]=react.useState([]),p=react.useCallback((N,c,C,m,l)=>{if(c.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:N,cardIds:c,columnId:C,strategy:m,color:l,isExpanded:true,position:s.filter(S=>S.columnId===C).length,createdAt:new Date};n(S=>[...S,v]);},[o.minCardsPerStack,s]),u=react.useCallback(N=>{n(c=>c.filter(C=>C.id!==N));},[]),i=react.useCallback(N=>{n(c=>c.map(C=>C.id===N?{...C,isExpanded:!C.isExpanded}:C));},[]),g=react.useCallback((N,c)=>{n(C=>C.map(m=>m.id===N&&!m.cardIds.includes(c)?{...m,cardIds:[...m.cardIds,c]}:m));},[]),d=react.useCallback((N,c)=>{n(C=>C.map(m=>{if(m.id===N){let l=m.cardIds.filter(v=>v!==c);return l.length<o.minCardsPerStack?null:{...m,cardIds:l}}return m}).filter(m=>m!==null));},[o.minCardsPerStack]),f=react.useCallback(N=>s.filter(c=>c.columnId===N).sort((c,C)=>c.position-C.position),[s]),b=react.useCallback(async N=>{let c=t.filter(S=>S.columnId===N);if(c.length<o.minCardsPerStack*2)return [];let C=[],m=new Map;c.forEach(S=>{S.labels&&S.labels.length>0&&S.labels.forEach(y=>{m.has(y)||m.set(y,[]),m.get(y).push(S);});}),m.forEach((S,y)=>{S.length>=o.minCardsPerStack&&C.push({stack:{title:`\u{1F4CC} ${y}`,cardIds:S.map(w=>w.id),columnId:N,strategy:"labels",color:"#3b82f6"},reason:`${S.length} cards with label "${y}"`,confidence:.85});});let l=new Map;c.forEach(S=>{S.assignedUserIds&&S.assignedUserIds.length>0&&S.assignedUserIds.forEach(y=>{l.has(y)||l.set(y,[]),l.get(y).push(S);});}),l.forEach((S,y)=>{S.length>=o.minCardsPerStack&&C.push({stack:{title:`\u{1F464} Assigned to user-${y.slice(-4)}`,cardIds:S.map(w=>w.id),columnId:N,strategy:"assignee",color:"#8b5cf6"},reason:`${S.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(c.forEach(S=>{S.priority&&(v.has(S.priority)||v.set(S.priority,[]),v.get(S.priority).push(S));}),v.forEach((S,y)=>{if(S.length>=o.minCardsPerStack){let w={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[y.toLowerCase()]||"\u26AA";C.push({stack:{title:`${w} ${y} Priority`,cardIds:S.map(x=>x.id),columnId:N,strategy:"priority",color:y==="high"||y==="urgent"?"#ef4444":"#10b981"},reason:`${S.length} cards with ${y} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let S of c){let w=(await r.findSimilar(S,c)).filter(x=>x.similarity>=o.autoStackConfidenceThreshold);if(w.length>=o.minCardsPerStack-1){let x=[S.id,...w.map(D=>D.card.id)],B=w.reduce((D,k)=>D+k.similarity,0)/w.length;C.push({stack:{title:`\u2728 Similar to "${S.title.substring(0,30)}${S.title.length>30?"...":""}"`,cardIds:x,columnId:N,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${w.length+1} similar tasks`,confidence:B});}}return C.filter(S=>S.confidence>=o.autoStackConfidenceThreshold).sort((S,y)=>y.confidence-S.confidence).slice(0,5)},[t,o,r]),T=react.useCallback(N=>{p(N.stack.title,N.stack.cardIds,N.stack.columnId,N.stack.strategy,N.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(c=>c.columnId)).forEach(async c=>{let C=await b(c),m=C[0];C.length>0&&m&&m.confidence>=.9&&T(m);});},[]),{stacks:s,createStack:p,deleteStack:u,toggleStack:i,addToStack:g,removeFromStack:d,getStacksForColumn:f,getSuggestions:b,applySuggestion:T,config:o}}var Hm=react.createContext(null);function Wm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=rn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=rn("@libxai/core");n.set(u.id,new i(u));});let p=null;if(t?.board){let{Board:u}=rn("@libxai/core");p=new u(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Hm.Provider,{value:{store:o},children:e})}function ts(){let e=react.useContext(Hm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Zo(){let e=ts(),[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 p=react.useCallback(m=>{e.updateBoard(m);},[e]),u=react.useCallback(m=>{e.addColumn(m);},[e]),i=react.useCallback((m,l)=>{e.updateColumn(m,l);},[e]),g=react.useCallback(m=>{e.deleteColumn(m);},[e]),d=react.useCallback(m=>e.getColumn(m),[e]),f=react.useCallback(m=>{e.addCard(m);},[e]),b=react.useCallback((m,l)=>{e.updateCard(m,l);},[e]),T=react.useCallback(m=>{e.deleteCard(m);},[e]),N=react.useCallback((m,l,v)=>{e.moveCard(m,l,v);},[e]),c=react.useCallback(m=>e.getCard(m),[e]),C=react.useCallback(m=>e.getCardsByColumn(m),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:u,updateColumn:i,deleteColumn:g,getColumn:d,addCard:f,updateCard:b,deleteCard:T,moveCard:N,getCard:c,getCardsByColumn:C}}function _m(e){let{cards:t}=Zo();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 Vm(e="position",t="asc"){let{cards:a}=Zo();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?p[o.priority]:0,i=s.priority?p[s.priority]:0;n=u-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 as=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ll.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 p=await Promise.resolve(n.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{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);}},lb=new as;function Km({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:p=0,getItemKey:u}){let i=react.useRef(null),g=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:p}),d=g.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${g.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${g.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:f,className:o,children:jsxRuntime.jsx("div",{style:b,children:d.map(T=>{let N=e[T.index];if(!N)return null;let c=u?u(N,T.index):T.index,C={position:"absolute",top:n?0:T.start,left:n?T.start:0,width:n?T.size:"100%",height:n?"100%":T.size};return jsxRuntime.jsx("div",{style:C,"data-index":T.index,children:r(N,T.index)},c)})})})}function Ym(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 Xm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:p=16,getItemKey:u,horizontal:i=true}){let g=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>g.current,estimateSize:()=>r,overscan:n,gap:p}),f=d.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},T={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:g,style:b,className:s,children:jsxRuntime.jsx("div",{style:T,children:f.map(N=>{let c=e[N.index];if(!c)return null;let C=u?u(c,N.index):N.index,m={position:"absolute",top:0,left:N.start,width:N.size,height:"100%"};return jsxRuntime.jsx("div",{style:m,"data-index":N.index,children:o(c,N.index)},C)})})})}function Jm(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 Qm(e,t=10){return e>t}var nl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},il={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ll={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dl={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ml={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pl={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)"},ul={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},gl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fl={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}},hl={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}},rs={spacing:nl,borderRadius:sl,fontSize:il,fontWeight:ll,lineHeight:dl,zIndex:cl,duration:ml,easing:pl,shadows:ul,opacity:gl,kanban:fl,gantt:hl};function Zm(e,t,a){return e[t]??a}function bl(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)?bl(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function mb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yl(e="asakaa"){let t=bl(rs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=mb(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
- }`}function Qo(e,t="asakaa"){let a=[],r=gl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
392
+ }`}function en(e,t="asakaa"){let a=[],r=bl(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
393
393
  ${a.join(`
394
394
  `)}
395
- }`}var ts={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"}},hl={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"}},bl={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 yl(e=ts,t="asakaa"){let a=fl(t),r=Qo(e,t);return `${a}
395
+ }`}var os={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"}},vl={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"}},xl={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 kl(e=os,t="asakaa"){let a=yl(t),r=en(e,t);return `${a}
396
396
 
397
- ${r}`}function Vm(){return `/**
397
+ ${r}`}function ep(){return `/**
398
398
  * ASAKAA Design Tokens
399
399
  * Auto-generated from design-tokens.ts
400
400
  * Do not edit this file directly
401
401
  */
402
402
 
403
- ${yl(ts)}
403
+ ${kl(os)}
404
404
 
405
405
  /* Light theme */
406
406
  [data-theme="light"] {
407
- ${Qo(hl,"asakaa").split(`
407
+ ${en(vl,"asakaa").split(`
408
408
  `).slice(1,-1).join(`
409
409
  `)}
410
410
  }
411
411
 
412
412
  /* Neutral theme */
413
413
  [data-theme="neutral"] {
414
- ${Qo(bl,"asakaa").split(`
414
+ ${en(xl,"asakaa").split(`
415
415
  `).slice(1,-1).join(`
416
416
  `)}
417
417
  }
418
- `}var Zh=({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 jm({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=go();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,p])=>{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 ${p.displayName} theme`,"aria-pressed":i,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Zh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
419
- 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=hm;exports.AI_FEATURES=Ah;exports.AI_MODELS=qi;exports.AddCardButton=Ms;exports.AddColumnButton=Ps;exports.AttachmentUploader=mr;exports.BoardProvider=Lm;exports.BulkOperationsToolbar=yn;exports.BurnDownChart=Ws;exports.CalendarBoard=em;exports.Card=fr;exports.CardDetailModal=Rs;exports.CardDetailModalV2=zs;exports.CardHistoryReplay=im;exports.CardHistoryTimeline=nm;exports.CardRelationshipsGraph=cm;exports.CardStack=wh;exports.CardTemplateSelector=qs;exports.CircuitBreaker=cs;exports.Column=io;exports.ColumnManager=Nn;exports.CommandPalette=Ls;exports.ConfigMenu=Zs;exports.ContextMenu=yo;exports.DEFAULT_SHORTCUTS=Io;exports.DEFAULT_TEMPLATES=Ys;exports.DateRangePicker=No;exports.DependenciesSelector=So;exports.DependencyLine=Ln;exports.DistributionCharts=Gs;exports.EditableColumnTitle=ys;exports.ErrorBoundary=co;exports.ExportImportModal=Js;exports.FilterBar=Qs;exports.GANTT_AI_SYSTEM_PROMPT=Fc;exports.GanttAIAssistant=On;exports.GanttBoard=Ec;exports.GanttI18nContext=ho;exports.GanttMilestone=Bn;exports.GanttToolbar=Tn;exports.GenerateGanttTasksDialog=vm;exports.GeneratePlanModal=um;exports.GroupBySelector=js;exports.KanbanBoard=Er;exports.KanbanToolbar=Ss;exports.KanbanViewAdapter=Ao;exports.KeyboardShortcutsHelp=Ks;exports.ListView=_c;exports.MenuIcons=Ot;exports.PluginManager=Zn;exports.PrioritySelector=zr;exports.RATE_LIMITS=Mh;exports.SwimlaneBoardView=_s;exports.TagBadge=xs;exports.TagList=id;exports.TagPicker=ir;exports.TaskBar=Mn;exports.TaskDetailModal=_r;exports.TaskFormModal=Ac;exports.TaskGrid=En;exports.ThemeModal=ri;exports.ThemeProvider=Vd;exports.ThemeSwitcher=jm;exports.Timeline=$n;exports.UserAssignmentSelector=Hr;exports.VelocityChart=Hs;exports.VirtualGrid=Hm;exports.VirtualList=Om;exports.aiUsageTracker=Qr;exports.borderRadius=rl;exports.calculatePosition=rn;exports.calendarDarkTheme=_i;exports.calendarEnTranslations=Ri;exports.calendarEsTranslations=$i;exports.calendarLightTheme=Vi;exports.calendarNeutralTheme=ji;exports.calendarThemes=Yn;exports.calendarTranslations=Vn;exports.cardToGanttTask=Un;exports.cardsToGanttTasks=zc;exports.cn=f;exports.createKanbanView=Td;exports.createRetryWrapper=gp;exports.darkTheme=ei;exports.darkTokenTheme=ts;exports.defaultTheme=xn;exports.designTokens=es;exports.duration=ll;exports.easing=dl;exports.exportTokensToCSS=Vm;exports.findTaskByName=vr;exports.fontSize=ol;exports.fontWeight=nl;exports.formatCost=Yo;exports.ganttEnTranslations=wn;exports.ganttEsTranslations=Kd;exports.ganttTaskToCardUpdate=Oc;exports.ganttThemes=Qe;exports.ganttTokens=ul;exports.ganttTranslations=oi;exports.ganttUtils=pe;exports.generateCSSVariables=fl;exports.generateCompleteCSS=yl;exports.generateInitialPositions=cp;exports.generateTasksContext=Lc;exports.generateThemeVariables=Qo;exports.getCalendarTheme=tm;exports.getCalendarTranslations=Go;exports.getListViewTheme=Vc;exports.getListViewTranslations=Fi;exports.getMonthNames=jc;exports.getToken=_m;exports.getTranslations=Yd;exports.getWeekdayNames=Kc;exports.kanbanTokens=pl;exports.lightTheme=ti;exports.lightTokenTheme=hl;exports.lineHeight=sl;exports.listViewDarkTheme=Li;exports.listViewEnTranslations=Mi;exports.listViewEsTranslations=Ai;exports.listViewLightTheme=Ii;exports.listViewNeutralTheme=Bi;exports.listViewThemes=_n;exports.listViewTranslations=Hn;exports.mergeCalendarTranslations=jn;exports.mergeListViewTranslations=Wn;exports.mergeTranslations=ni;exports.neutralTheme=ai;exports.neutralTokenTheme=bl;exports.opacity=ml;exports.parseLocalCommand=Rc;exports.parseNaturalDate=Si;exports.parseNaturalDuration=Ei;exports.parseProgress=Pi;exports.parseStatus=Bc;exports.pluginManager=qh;exports.retrySyncOperation=up;exports.retryWithBackoff=on;exports.shadows=cl;exports.shouldVirtualizeGrid=Gm;exports.spacing=al;exports.themes=Kr;exports.useAI=Em;exports.useBoard=km;exports.useBoardCore=Jo;exports.useBoardStore=Qn;exports.useCardStacking=Am;exports.useDragState=Ns;exports.useFilteredCards=Bm;exports.useFilters=Tm;exports.useGanttI18n=bo;exports.useKanbanState=Jn;exports.useKeyboardShortcuts=Wd;exports.useMultiSelect=Pm;exports.useSelectionState=Qi;exports.useSortedCards=Rm;exports.useTheme=go;exports.useVirtualGrid=Wm;exports.useVirtualList=zm;exports.validateAIResponse=$c;exports.withErrorBoundary=As;exports.wouldCreateCircularDependency=sn;exports.zIndex=il;//# sourceMappingURL=index.cjs.map
418
+ `}var pb=({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 tp({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=ho();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,p])=>{let u=n,i=u===r;return jsxRuntime.jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":i,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(pb,{theme:u})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},u)})})}
419
+ 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=Nm;exports.AI_FEATURES=_h;exports.AI_MODELS=Qi;exports.AddCardButton=Is;exports.AddColumnButton=Fs;exports.AttachmentUploader=pr;exports.BoardProvider=Wm;exports.BulkOperationsToolbar=kn;exports.BurnDownChart=Vs;exports.CalendarBoard=dm;exports.Card=hr;exports.CardDetailModal=zs;exports.CardDetailModalV2=Ws;exports.CardHistoryReplay=hm;exports.CardHistoryTimeline=gm;exports.CardRelationshipsGraph=vm;exports.CardStack=Bh;exports.CardTemplateSelector=Qs;exports.CircuitBreaker=us;exports.Column=co;exports.ColumnManager=En;exports.CommandPalette=Rs;exports.ConfigMenu=ai;exports.ContextMenu=vo;exports.DEFAULT_SHORTCUTS=Ro;exports.DEFAULT_TEMPLATES=Js;exports.DateRangePicker=Do;exports.DependenciesSelector=Eo;exports.DependencyLine=Rn;exports.DistributionCharts=js;exports.EditableColumnTitle=ks;exports.ErrorBoundary=po;exports.ExportImportModal=ei;exports.FilterBar=ti;exports.GANTT_AI_SYSTEM_PROMPT=Hc;exports.GanttAIAssistant=Hn;exports.GanttBoard=$c;exports.GanttI18nContext=yo;exports.GanttMilestone=On;exports.GanttToolbar=Sn;exports.GenerateGanttTasksDialog=Em;exports.GeneratePlanModal=wm;exports.GroupBySelector=qs;exports.KanbanBoard=Pr;exports.KanbanToolbar=Ms;exports.KanbanViewAdapter=Io;exports.KeyboardShortcutsHelp=Xs;exports.ListView=Zc;exports.MenuIcons=$t;exports.PluginManager=as;exports.PrioritySelector=Hr;exports.RATE_LIMITS=Gh;exports.SwimlaneBoardView=Ks;exports.TagBadge=Cs;exports.TagList=hd;exports.TagPicker=lr;exports.TaskBar=In;exports.TaskDetailModal=jr;exports.TaskFormModal=Uc;exports.TaskGrid=An;exports.ThemeModal=si;exports.ThemeProvider=ec;exports.ThemeSwitcher=tp;exports.Timeline=Un;exports.UserAssignmentSelector=Gr;exports.VelocityChart=_s;exports.VirtualGrid=Xm;exports.VirtualList=Km;exports.aiUsageTracker=eo;exports.borderRadius=sl;exports.calculatePosition=nn;exports.calendarDarkTheme=Ki;exports.calendarEnTranslations=zi;exports.calendarEsTranslations=Ui;exports.calendarLightTheme=Yi;exports.calendarNeutralTheme=qi;exports.calendarThemes=Jn;exports.calendarTranslations=Yn;exports.cardToGanttTask=Gn;exports.cardsToGanttTasks=Yc;exports.cn=h;exports.createKanbanView=Id;exports.createRetryWrapper=Cp;exports.darkTheme=ri;exports.darkTokenTheme=os;exports.defaultTheme=Cn;exports.designTokens=rs;exports.duration=ml;exports.easing=pl;exports.exportTokensToCSS=ep;exports.findTaskByName=xr;exports.fontSize=il;exports.fontWeight=ll;exports.formatCost=Xo;exports.ganttEnTranslations=Nn;exports.ganttEsTranslations=ac;exports.ganttTaskToCardUpdate=Kc;exports.ganttThemes=Je;exports.ganttTokens=hl;exports.ganttTranslations=ii;exports.ganttUtils=ue;exports.generateCSSVariables=yl;exports.generateCompleteCSS=kl;exports.generateInitialPositions=vp;exports.generateTasksContext=Wc;exports.generateThemeVariables=en;exports.getCalendarTheme=cm;exports.getCalendarTranslations=Vo;exports.getListViewTheme=em;exports.getListViewTranslations=Bi;exports.getMonthNames=tm;exports.getToken=Zm;exports.getTranslations=rc;exports.getWeekdayNames=am;exports.kanbanTokens=fl;exports.lightTheme=oi;exports.lightTokenTheme=vl;exports.lineHeight=dl;exports.listViewDarkTheme=Ri;exports.listViewEnTranslations=Ii;exports.listViewEsTranslations=Li;exports.listViewLightTheme=$i;exports.listViewNeutralTheme=Oi;exports.listViewThemes=Kn;exports.listViewTranslations=_n;exports.mergeCalendarTranslations=qn;exports.mergeListViewTranslations=Vn;exports.mergeTranslations=li;exports.neutralTheme=ni;exports.neutralTokenTheme=xl;exports.opacity=gl;exports.parseLocalCommand=Vc;exports.parseNaturalDate=Mi;exports.parseNaturalDuration=Ai;exports.parseProgress=Fi;exports.parseStatus=_c;exports.pluginManager=lb;exports.retrySyncOperation=wp;exports.retryWithBackoff=sn;exports.shadows=ul;exports.shouldVirtualizeGrid=Qm;exports.spacing=nl;exports.themes=qr;exports.useAI=$m;exports.useBoard=Mm;exports.useBoardCore=Zo;exports.useBoardStore=ts;exports.useCardStacking=Um;exports.useDragState=Es;exports.useFilteredCards=_m;exports.useFilters=Im;exports.useGanttI18n=Lr;exports.useKanbanState=es;exports.useKeyboardShortcuts=Jd;exports.useMultiSelect=Om;exports.useSelectionState=tl;exports.useSortedCards=Vm;exports.useTheme=ho;exports.useVirtualGrid=Jm;exports.useVirtualList=Ym;exports.validateAIResponse=jc;exports.withErrorBoundary=Ls;exports.wouldCreateCircularDependency=dn;exports.zIndex=cl;//# sourceMappingURL=index.cjs.map
420
420
  //# sourceMappingURL=index.cjs.map