@libxai/board 0.17.164 → 0.17.165

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'),Pd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Tm=require('react-markdown'),Dm=require('remark-gfm'),Nm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pd__default=/*#__PURE__*/_interopDefault(Pd);var Tm__default=/*#__PURE__*/_interopDefault(Tm);var Dm__default=/*#__PURE__*/_interopDefault(Dm);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Po=(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 Mo=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 [Mo.Translate.toString(e),Mo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function C(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ao(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 ap(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function In(e,t){return e.length===0?1e3:t===0?Ao(null,e[0].position):t>=e.length?Ao(e[e.length-1].position,null):Ao(e[t-1].position,e[t].position)}function Ri(e,t=100){return e>t}var rp=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 op(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 Io(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=rp,onRetry:p}=t,m,n=0;for(let u=1;u<=a;u++){n=u;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(m=d,u===a||!l(m,u))return {error:m,attempts:n,success:false};let c=op(u,r,o,s);if(p)try{p(m,u,c);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,c));}}return {error:m||new Error("Unknown error"),attempts:n,success:false}}function np(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 sp(e,t={}){return async(...a)=>Io(()=>e(...a),t)}var Ln=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 Oi=(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))(Oi||{}),lr=class lr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(p,o,m?l:"");break;case "INFO":console.info(p,o,m?l:"");break;case "WARN":console.warn(p,o,m?l:"");break;case "ERROR":console.error(p,o,m?l:""),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",...lr.globalOptions};}static configure(t){lr.globalOptions={...lr.globalOptions,...t};}child(t){return new lr({...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 Lo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Lo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Oi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lr.globalOptions={};var Fn=lr,Lo=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}},$i=new Fn;function lp(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 l=e.columns.find(p=>p.id===s.columnId);return [s.id,Bn(s.title),Bn(s.description||""),Bn(l?.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 cp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Pd__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=l.toDataURL("image/png"),m=297,n=210,u=l.width/l.height,d=m-20,i=d/u;i>n-20&&(i=n-20,d=i*u);let c=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});c.setFontSize(16),c.setTextColor(255,255,255),c.setFillColor(10,10,10),c.rect(0,0,m,15,"F"),c.text(e.title||"Kanban Board",10,10);let y=(m-d)/2;return c.addImage(p,"PNG",y,20,d,i),c}catch(l){console.error("Error capturing board:",l);}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(l=>{let p=e.cards.filter(m=>m.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.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 n=[];if(m.priority&&n.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&n.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&n.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}`),n.push(u.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Bn(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Ui(e,t,a,r){switch(t){case "json":return lp(e,r);case "csv":return dp(e);case "pdf":return await cp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Wi(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]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:l[t]}),m=URL.createObjectURL(p),n=document.createElement("a");n.href=m,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(m);}function pp(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 mp(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=Hi(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let p=Hi(t[l]||"");if(p.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let n={};a.forEach((c,y)=>{n[c]=p[y]||"";});let u=n.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),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(p){s.push(`Line ${l+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 Hi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Gi(e,t){switch(t){case "json":return pp(e);case "csv":return mp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function _i(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 Rn=react.createContext(null);function Vi(){return react.useContext(Rn)}var ji=react.createContext(null);function Ki({children:e,themeName:t}){return jsxRuntime.jsx(ji.Provider,{value:{themeName:t},children:e})}function Mr(){return react.useContext(ji)}function at({children:e,container:t}){let[a,r]=react.useState(false),o=Vi(),s=Mr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:p,themeName:m}=o,n={"--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:n,children:e}),l)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var Zi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},xp="#BDC3C7",kp=({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 dr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),n=()=>{if(!m.current)return;let c=m.current.getBoundingClientRect(),y=window.innerHeight,f=window.innerWidth,h=160,v=220,b=4,g=c.right-h;g<10&&(g=c.left),g+h>f-10&&(g=f-h-10);let k=y-c.bottom,N=c.top,x;k>=v+b?x=c.bottom+b:N>=v+b?x=c.top-v-b:x=k>=N?c.bottom+b:Math.max(10,c.top-v-b),l({top:x,left:g}),o(true);};react.useEffect(()=>{let c=y=>{p.current&&!p.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),react.useEffect(()=>{let c=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[r]);let u=c=>{t(c),o(false);},d=e?Zi[e]:null,i=d?.color||xp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}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:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(at,{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(Zi).map(([c,y])=>jsxRuntime.jsxs("button",{onClick:()=>u(c),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(kp,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===c&&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)),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: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("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 wp=[{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 Zr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,p]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),i=(Mr()?.themeName||"dark")==="dark",c=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),k=window.innerHeight,N=window.innerWidth,x=320,M=380,T=4,B=g.left;B+x>N-10&&(B=N-x-10),B<10&&(B=10);let D=k-g.bottom,w=g.top,U;D>=M+T?U=g.bottom+T:w>=M+T?U=g.top-M-T:U=D>=w?g.bottom+T:Math.max(10,g.top-M-T),p({top:U,left:B}),s(true);};react.useEffect(()=>{let g=k=>{m.current&&!m.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let y=g=>{let k=new Date,N=B=>{let D=B.getFullYear(),w=String(B.getMonth()+1).padStart(2,"0"),U=String(B.getDate()).padStart(2,"0");return `${D}-${w}-${U}`},x=N(k),M=new Date(k);M.setDate(M.getDate()+g);let T=N(M);a(x,T),s(false);},f=()=>{if(!e||!t)return "Set date";let g=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=M.split("-").map(Number);if(T.length!==3||T.some(U=>isNaN(U)))return null;let B=T[0],D=T[1],w=T[2];return B===void 0||D===void 0||w===void 0?null:new Date(B,D-1,w)},k=g(e),N=g(t);if(!k||!N||isNaN(k.getTime())||isNaN(N.getTime()))return "Set date";let x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${x[k.getMonth()]} ${k.getDate()} \u2013 ${x[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),g<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):c(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${f()}`:"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:f()})]}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:wp.map(g=>jsxRuntime.jsx("button",{onClick:()=>y(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function pr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[p,m]=react.useState(""),[n,u]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),c=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,k=window.innerWidth,N=300,x=380,M=4,T=b.right-N;T<10&&(T=b.left),T+N>k-10&&(T=k-N-10);let B=g-b.bottom,D=b.top,w;B>=x+M?w=b.bottom+M:D>=x+M?w=b.top-x-M:w=B>=D?b.bottom+M:Math.max(10,b.top-x-M),u({top:w,left:T}),l(true);};react.useEffect(()=>{let b=g=>{d.current&&!d.current.contains(g.target)&&!i.current?.contains(g.target)&&(l(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&(l(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let g=e.some(k=>k.id===b.id);a(g?e.filter(k=>k.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())),h=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?l(false):c(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:f.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"}):f.map(b=>{let g=e.some(k=>k.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(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 Fo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let n=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,p=m=>{if(!s.has(m)){s.add(m),l.add(m);let n=r.get(m)||[];for(let u of n){if(!s.has(u)&&p(u))return true;if(l.has(u))return true}}return l.delete(m),false};return p(a)}function eo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[p,m]=react.useState(false),[n,u]=react.useState(""),[d,i]=react.useState(t.length>0),[c,y]=react.useState({top:0,left:0}),[f,h]=react.useState(null),v=react.useRef(null),b=react.useRef(null),g=()=>{if(!b.current)return;let T=b.current.getBoundingClientRect(),B=window.innerHeight,D=window.innerWidth,w=300,U=d?380:120,A=4,H=T.right-w;H<10&&(H=T.left),H+w>D-10&&(H=D-w-10);let q=B-T.bottom,ve=T.top,we;q>=U+A?we=T.bottom+A:ve>=U+A?we=T.top-U-A:we=q>=ve?T.bottom+A:Math.max(10,T.top-U-A),y({top:we,left:H}),m(true);};react.useEffect(()=>{if(!p||!b.current)return;let T=b.current.getBoundingClientRect(),B=window.innerHeight,D=window.innerWidth,w=300,U=d?380:120,A=4,H=T.right-w;H<10&&(H=T.left),H+w>D-10&&(H=D-w-10);let q=B-T.bottom,ve=T.top,we;q>=U+A?we=T.bottom+A:ve>=U+A?we=T.top-U-A:we=q>=ve?T.bottom+A:Math.max(10,T.top-U-A),y({top:we,left:H});},[d,p]),react.useEffect(()=>{let T=B=>{v.current&&!v.current.contains(B.target)&&!b.current?.contains(B.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]),react.useEffect(()=>{let T=B=>{B.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[p]);let k=T=>{let B=t.includes(T),D=a.find(w=>w.id===T);if(h(null),B){let w=t.filter(U=>U!==T);r(w),w.length===0&&i(false);}else {if(s&&Fo(a,T,e)){let U=`Cannot add "${D?.title||T}" as dependency - would create circular reference`;h(U),l?.(T,D?.title||T),setTimeout(()=>h(null),3e3);return}r([...t,T]),i(true);}},N=()=>{let T=!d;i(T),T||r([]);},x=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(n.toLowerCase())||T.id.toLowerCase().includes(n.toLowerCase())),M=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>p?m(false):g(),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:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),p&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${c.top}px`,left:`${c.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:[f&&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:f})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:x.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"}):x.map(T=>{let B=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>k(T.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:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(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 Wa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:p=[],allCards:m=[]})=>{let{attributes:n,listeners:u,setNodeRef:d,transform:i,transition:c,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:Mo.Transform.toString(i),transition:c};if(t)return jsxRuntime.jsx("div",{ref:d,style:f,...n,...u,onClick:()=>a?.(e),children:t(e)});let h=p.filter(g=>e.assignedUserIds?.includes(g.id)),v=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:b,className:C("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...u,onClick:g=>{g.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:g=>{g.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(dr,{priority:e.priority,onChange:g=>l?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Zr,{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:(g,k)=>l?.(e.id,{startDate:g,endDate:k})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(pr,{assignedUsers:h,availableUsers:p,onChange:g=>l?.(e.id,{assignedUserIds:g.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(eo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:m,onChange:g=>l?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsxRuntime.jsx("span",{className:"asakaa-label",children:g},g))}),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));Wa.displayName="Card";var Bo={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"}},ll=({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 dl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[l,p]=react.useState({top:0,left:0}),m=react.useRef(null),n=react.useRef(null),u=[...Object.entries(Bo).map(([h,v])=>({id:h,label:v.label,color:v.color,icon:v.icon})),...r.filter(h=>!Object.keys(Bo).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Bo[e];if(h)return {...h,id:e};let v=r.find(b=>b.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...Bo.todo,id:"todo"}},i=()=>{if(!n.current)return;let h=n.current.getBoundingClientRect(),v=window.innerHeight,b=window.innerWidth,g=180,k=280,N=4,x=h.right-g;x<10&&(x=h.left),x+g>b-10&&(x=b-g-10);let M=v-h.bottom,T=h.top,B;M>=k+N?B=h.bottom+N:T>=k+N?B=h.top-k-N:B=M>=T?h.bottom+N:Math.max(10,h.top-k-N),p({top:B,left:x}),s(true);};react.useEffect(()=>{let h=v=>{m.current&&!m.current.contains(v.target)&&!n.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let c=h=>{t(h),s(false);},y=d(),f=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:y.label,children:jsxRuntime.jsx(ll,{icon:y.icon,color:f})}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.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(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ll,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function cl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=react.useState(false),[p,m]=react.useState(false),[n,u]=react.useState(e),[d,i]=react.useState({top:0,left:0}),c=react.useRef(null),y=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let g=y.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),react.useEffect(()=>{let g=k=>{c.current&&!c.current.contains(k.target)&&!y.current?.contains(k.target)&&(l(false),m(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),react.useEffect(()=>{let g=k=>{k.key==="Escape"&&(l(false),m(false),u(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),react.useEffect(()=>{p&&f.current&&(f.current.focus(),f.current.select());},[p]);let h=()=>{m(true),u(e);},v=()=>{let g=n.trim();g&&g!==e&&t(g),m(false),l(false),u(e);},b=g=>{g.key==="Enter"?v():g.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>l(!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(at,{children:jsxRuntime.jsx("div",{ref:c,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:f,type:"text",value:n,onChange:g=>u(g.target.value),onKeyDown:b,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[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(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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 Lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:p,availableUsers:m,allCards:n,enableVirtualization:u,cardHeight:d=120,isCollapsed:i,onToggleCollapse:c,onColumnRename:y,onColumnDelete:f,isDeletable:h=false,className:v})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),N=u??Ri(t.length),x=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:N});if(a)return jsxRuntime.jsx("div",{ref:b,className:v,children:a(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let w=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:w}:w>=80?{state:"warning",percentage:w}:w>=60?{state:"approaching",percentage:w}:{state:"ok",percentage:w}})(),B=T.state==="exceeded",D=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:C("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",v),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:C(D()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.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"})]}),T.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"})]}),T.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"})}),T.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||f)&&jsxRuntime.jsx(cl,{columnTitle:e.title,onRename:w=>y?.(e.id,w),onDelete:f?()=>f(e.id):void 0,isDeletable:h}),c&&jsxRuntime.jsx("button",{onClick:c,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(w=>w.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"})}):N?jsxRuntime.jsx("div",{style:{height:`${x.getTotalSize()}px`,position:"relative"},children:x.getVirtualItems().map(w=>{let U=t[w.index];return U?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${w.start}px)`},children:jsxRuntime.jsx(Wa,{card:U,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n})},U.id):null})}):t.map(w=>jsxRuntime.jsx(Wa,{card:w,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n},w.id))})})]})});Lr.displayName="Column";function Wn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=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):l(e),o(false);},n=u=>{u.key==="Enter"?m():u.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:s,onChange:u=>l(u.target.value),onBlur:m,onKeyDown:n,className:C("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:C("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Gn(){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 Za({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:p,isLoading:m,error:n,children:u}){let[d,i]=Gn(),c=o?.theme||"dark",f=c==="dark"||c==="neutral"?"dark":"",h=react.useCallback((D,w)=>{t.onCardUpdate?.(D,w);},[t]),v=react.useCallback((D,w)=>{t.onColumnUpdate?.(D,{title:w});},[t]),b=react.useCallback(D=>{t.onColumnDelete?.(D);},[t]),g=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),N=react.useMemo(()=>{let D=new Map;return e.columns.forEach(w=>{let U=w.cardIds.map(A=>e.cards.find(H=>H.id===A)).filter(A=>A!==void 0).sort((A,H)=>A.position-H.position);D.set(w.id,U);}),D},[e.cards,e.columns]),x=react.useCallback(D=>{let{active:w}=D,U=e.cards.find(A=>A.id===w.id);U&&i({isDragging:true,draggedCardId:U.id,sourceColumnId:U.columnId,targetColumnId:U.columnId});},[e.cards,i]),M=react.useCallback(D=>{let{active:w,over:U}=D;if(!U||!e.cards.find(q=>q.id===w.id))return;let H=null;U.data.current?.type==="column"?H=U.id:U.data.current?.type==="card"&&(H=e.cards.find(ve=>ve.id===U.id)?.columnId||null),H&&H!==d.targetColumnId&&i({...d,targetColumnId:H});},[e.cards,d,i]),T=react.useCallback(async D=>{let{active:w,over:U}=D;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!U)return;let A=e.cards.find(we=>we.id===w.id);if(!A)return;let H,q;if(U.data.current?.type==="column"){H=U.id;let we=N.get(H)||[];q=In(we,0);}else {let we=e.cards.find(R=>R.id===U.id);if(!we)return;H=we.columnId;let Ae=N.get(H)||[],Re=Ae.findIndex(R=>R.id===U.id);q=In(Ae,Re);}let ve=e.columns.find(we=>we.id===H);if(ve&&ve.wipLimit&&ve.wipLimitType==="hard"){let we=N.get(H)||[];if(A.columnId!==H&&we.length>=ve.wipLimit){t.onWipLimitExceeded?.(ve,A);return}}(A.columnId!==H||A.position!==q)&&await t.onCardMove?.(A.id,H,q);},[e.cards,e.columns,N,t,i]),B=react.useCallback(D=>{a?.(D);},[a]);return m?jsxRuntime.jsx("div",{className:C("asakaa-board",f,l),style:p,children:jsxRuntime.jsx(jp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:C("asakaa-board",f,l),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 n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Ki,{themeName:c,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:x,onDragOver:M,onDragEnd:T,children:[jsxRuntime.jsxs("div",{className:C("asakaa-board",f,l),style:p,"data-theme":c,children:[e.columns.sort((D,w)=>D.position-w.position).map(D=>{let w=N.get(D.id)||[],U=!g.includes(D.id);return jsxRuntime.jsx(Lr,{column:D,cards:w,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:B,onCardUpdate:h,onColumnRename:v,onColumnDelete:b,isDeletable:U,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},D.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(Wa,{card:e.cards.find(D=>D.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function jp({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 Jp={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)"},Zp={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)"},Qp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},em={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function tm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let n=u=>{p.current&&!p.current.contains(u.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let m=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!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((n,u)=>n.position-u.position).map((n,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(n.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:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function am({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[p,m]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let c=y=>{n.current&&!n.current.contains(y.target)&&l(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[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(c=>c.handler),i=async(c,y)=>{if(y){m(c);try{await y();}catch(f){console.error(`Export ${c} failed:`,f);}finally{m(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!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((c,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(c.id,c.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:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===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 rm({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 Vn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:p,onExportExcel:m,translations:n}){let u=r==="dark"?Jp:Zp,d={...o==="es"?Qp:em,...n},i=l||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:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(am,{theme:u,t:d,onExportCSV:l,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsxRuntime.jsx(tm,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsxRuntime.jsx(rm,{onClick:()=>t(),label:a||d.newTask}))]})})}function Kn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[p,m]=react.useState(""),n=react.useCallback(()=>{let i=p.trim();i&&(e(i),m(""),l(false));},[p,e]),u=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(m(""),l(false));},[n]),d=react.useCallback(()=>{setTimeout(()=>{p.trim()||l(false);},150);},[p]);return s?jsxRuntime.jsx("div",{className:C("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:i=>m(i.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:n,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(""),l(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:C("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(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 Yn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:p="dark",locale:m="es"}){let[n,u]=react.useState(false),[d,i]=react.useState(false),[c,y]=react.useState(""),[f,h]=react.useState([]),[v,b]=react.useState(""),[g,k]=react.useState(""),[N,x]=react.useState(""),[M,T]=react.useState(false),[B,D]=react.useState(false),[w,U]=react.useState(false),A=react.useRef(null),H=react.useRef(null),q={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"},ve=react.useCallback(()=>{y(""),h([]),b(""),k(""),x(""),T(false),D(false),U(false),u(false);},[]);react.useEffect(()=>{n&&A.current&&A.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let S=z=>{H.current&&!H.current.contains(z.target)&&(c.trim()||ve());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,c,ve]);let we=react.useCallback(async()=>{let S=c.trim();if(!(!S||d)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:v?new Date(v):void 0,endDate:g?new Date(g):void 0,priority:N||void 0}),y(""),h([]),b(""),k(""),x(""),T(!1),D(!1),U(!1),A.current?.focus();}catch(z){console.error("Error creating card:",z);}finally{i(false);}}},[c,e,f,v,g,N,t,d]),Ae=react.useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),we()):S.key==="Escape"&&ve();},[we,ve]),Re=react.useCallback(S=>{h(z=>z.includes(S)?z.filter(E=>E!==S):[...z,S]);},[]),R=p==="dark";return n?jsxRuntime.jsxs("div",{ref:H,className:C("rounded-lg overflow-hidden shadow-lg",R?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:A,type:"text",value:c,onChange:S=>y(S.target.value),onKeyDown:Ae,placeholder:q.placeholder,disabled:d,className:C("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",R?"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:()=>T(!M),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||f.length>0?"bg-emerald-500/20 text-emerald-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:q.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"})]}),f.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:f.length})]}),jsxRuntime.jsx("button",{onClick:()=>D(!B),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||v||g?"bg-blue-500/20 text-blue-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:q.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:()=>U(!w),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",w||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":R?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:q.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:we,disabled:!c.trim()||d,className:C("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"}):q.save})]})]}),M&&a.length>0&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(S=>jsxRuntime.jsxs("button",{onClick:()=>Re(S.id),className:C("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.id)?"bg-emerald-500 text-white":R?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[S.avatar?jsxRuntime.jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),B&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",R?"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:C("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:q.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:S=>b(S.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:C("block text-[10px] uppercase tracking-wide mb-1",R?"text-gray-500":"text-gray-400"),children:q.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:S=>k(S.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",R?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),w&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",R?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(S=>jsxRuntime.jsx("button",{onClick:()=>x(N===S?"":S),className:C("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:R?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:q[S]},S))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:l,className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",R?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"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:q.buttonLabel})]})}var no=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(Za,{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(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Cl(e={}){return new no(e)}var Fr=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(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=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:l?`Error in ${l}`:"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 qn(e,t){let a=r=>jsxRuntime.jsx(Fr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Jn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:p,onOpenAIUsage:m,shortcut:n="k",className:u=""}){let[d,i]=react.useState(false),[c,y]=react.useState(""),[f,h]=react.useState("home"),[v,b]=react.useState(""),[g,k]=react.useState("");react.useEffect(()=>{let T=B=>{(B.metaKey||B.ctrlKey)&&B.key===n&&(B.preventDefault(),i(D=>!D)),B.key==="Escape"&&(i(false),h("home"),y(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[n]),react.useEffect(()=>{d||(h("home"),y(""),b(""),k(""));},[d]);let N=react.useCallback(()=>{i(false);},[]),x=react.useCallback(T=>{let[B,D]=T.split(":");switch(B){case "create-card":h("create-card");break;case "create-card-in":b(D||"");break;case "navigate":D?(a?.(D),N()):h("navigate");break;case "search":r?.(c),N();break;case "priority":h("priority");break;case "set-priority":g&&D&&(o?.(g,D),N());break;case "assign":h("assign");break;case "assign-user":g&&D&&(s?.(g,D),N());break;case "ai":h("ai");break;case "ai-generate-plan":l?.(),N();break;case "ai-predict-risks":p?.(),N();break;case "ai-usage":m?.(),N();break;case "back":h("home");break;}},[c,g,t,a,r,o,s,l,p,m,N]),M=react.useCallback(()=>{v&&c.trim()&&(t?.(v,c.trim()),N());},[v,c,t,N]);return d?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:N,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:c,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:f==="create-card"&&v?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&f==="create-card"&&v&&M();}}),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."}),f==="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:x,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:x,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:x,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:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},T.id))})]}),f==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:x,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),f==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>{let B=e.columns.find(D=>D.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:D},D))})]},T.id)})})]}),f==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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:x,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:x,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:x,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 cm(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 pm(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 mm(e){return e.startsWith("image/")}function ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,p]=react.useState(false),[m,n]=react.useState(false),[u,d]=react.useState(null),i=react.useRef(null),c=react.useCallback(x=>{let M=[],T=[];return e.length+x.length>s?(T.push(`Maximum ${s} files allowed`),{valid:M,errors:T}):(x.forEach(B=>{if(B.size/1048576>r){T.push(`${B.name} is too large (max ${r}MB)`);return}if(o&&!o.some(w=>B.type.match(w))){T.push(`${B.name} has invalid file type`);return}M.push(B);}),{valid:M,errors:T})},[e.length,s,r,o]),y=react.useCallback(async x=>{let{valid:M,errors:T}=c(x);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(M.length!==0){n(true),d(null);try{await t?.(M);}catch(B){d(B instanceof Error?B.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[c,t]),f=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(true);},[]),h=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);},[]),v=react.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),b=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),p(false);let M=Array.from(x.dataTransfer.files);y(M);},[y]),g=react.useCallback(x=>{let M=x.target.files?Array.from(x.target.files):[];y(M),i.current&&(i.current.value="");},[y]),k=react.useCallback(()=>{i.current?.click();},[]),N=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 ${l?"dragging":""} ${m?"uploading":""}`,onDragEnter:f,onDragLeave:h,onDragOver:v,onDrop:b,onClick:k,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:g,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:l?"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(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:mm(x.type)&&x.url?jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:pm(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:cm(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:()=>N(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 Qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],aiInsights:m=[],attachments:n=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:c,onSuggestAssignee:y,onGenerateSubtasks:f,onEstimateEffort:h,currentUserId:v="user-1"}){let[b,g]=react.useState("details"),[k,N]=react.useState(false),[x,M]=react.useState({}),[T,B]=react.useState(""),[D,w]=react.useState(false),[U,A]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{N(false),M({}),g("details"),B(""),A({}),a();},[a]),q=react.useCallback(()=>{r&&Object.keys(x).length>0&&(r(e.id,x),M({}),N(false));},[e.id,x,r]),ve=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),we=react.useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),B(""));},[e.id,T,u]),Ae=react.useCallback(async()=>{if(y){w(true);try{let E=await y(e);A(Y=>({...Y,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{w(false);}}},[e,y]),Re=react.useCallback(async()=>{if(f){w(true);try{let E=await f(e);A(Y=>({...Y,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{w(false);}}},[e,f]),R=react.useCallback(async()=>{if(h){w(true);try{let E=await h(e);A(Y=>({...Y,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{w(false);}}},[e,h]),S={...e,...x},z=s.filter(E=>S.assignedUserIds?.includes(E.id));return jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:x.title??S.title,onChange:E=>M({...x,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:q,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{N(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ve,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>g("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:x.description??S.description??"",onChange:E=>M({...x,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:S.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??S.assignedUserIds??[],onChange:E=>{let Y=Array.from(E.target.selectedOptions,ae=>ae.value);M({...x,assignedUserIds:Y});},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:z.length>0?z.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"}),k?jsxRuntime.jsxs("select",{value:x.priority??S.priority??"",onChange:E=>M({...x,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:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:S.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:S.labels&&S.labels.length>0?S.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"}),k?jsxRuntime.jsx("input",{type:"date",value:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:E=>M({...x,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:E=>M({...x,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??S.estimatedTime??"",onChange:E=>M({...x,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:S.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:S.dependencies&&S.dependencies.length>0?S.dependencies.map(E=>{let Y=typeof E=="string"?E:E.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Y.slice(-4)]},Y)}):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:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:E=>B(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:we,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(E=>{let Y=s.find(ae=>ae.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:[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-comment-author-name",children:Y?.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"})]})})]}),b==="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 Y=s.find(ae=>ae.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:Y?.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"})]})}),b==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(ur,{cardId:e.id,attachments:n,onUpload:i?E=>i(e.id,E):void 0,onDelete:c,currentUserId:v,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:D||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Re,disabled:D||!f,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:R,disabled:D||!h,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),U.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),U.assignees.map((E,Y)=>{let ae=s.find(X=>X.id===E.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.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),"%"]})]})]},Y)})]}),U.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),U.subtasks.map((E,Y)=>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"]})]},Y))]}),U.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:[U.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(U.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(E=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!U.assignees&&!U.subtasks&&!U.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 io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[p,m]=react.useState({top:0,left:0}),n=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,c=window.innerWidth,y=4,f=d.left;f+o>c-10&&(f=c-o-10),f<10&&(f=10);let h=i-d.bottom,v=d.top,b;return h>=s+y?b=d.bottom+y:v>=s+y?b=d.top-s-y:h>=v?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:f}},[e,o,s]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let d=c=>{let y=c.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,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 Ho=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Rr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[p,m]=react.useState(false),[n,u]=react.useState(""),[d,i]=react.useState(false),[c,y]=react.useState(Ho[10]||"#3B82F6"),[f,h]=react.useState({top:0,left:0}),v=react.useRef(null),b=react.useRef(null),g=react.useRef(null),k=react.useRef(null),N=t.filter(w=>w.name.toLowerCase().includes(n.toLowerCase())),x=t.some(w=>w.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(p&&b.current){let w=b.current.getBoundingClientRect();h({top:w.bottom+6,left:w.left});}},[p]),react.useEffect(()=>{let w=U=>{let A=U.target,H=v.current?.contains(A),q=g.current?.contains(A);!H&&!q&&(m(false),u(""),i(false));};if(p)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[p]),react.useEffect(()=>{p&&k.current&&k.current.focus();},[p]);let M=w=>{let U=e.some(A=>A.id===w.id);a(U?e.filter(A=>A.id!==w.id):[...e,w]);},T=async()=>{if(!(!r||!n.trim())){i(true);try{let w=await r(n.trim(),c);w&&(a([...e,w]),u(""),y(Ho[Math.floor(Math.random()*Ho.length)]||"#3B82F6"));}finally{i(false);}}},B=(w,U)=>{U.stopPropagation(),a(e.filter(A=>A.id!==w));},D={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:b,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: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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),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:g,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:f.top,left:f.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:k,type:"text",value:n,onChange:w=>u(w.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:w=>{w.key==="Enter"&&n.trim()&&!x&&r&&T();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:U=>B(w.id,U),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(w=>{let U=e.some(A=>A.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:U?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:A=>{U||(A.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:A=>{U||(A.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),U&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.id)}):n.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"})}),n.trim()&&!x&&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:Ho.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:c===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:c,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 "',n.trim(),'"']})]})]})}),document.body)]})}function as({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 El({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(as,{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 Ue={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Sm=["LOW","MEDIUM","HIGH","URGENT"],Em=["todo","in-progress","review","done"];function os({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],onAddComment:m,onDeleteComment:n,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:c,availableColumns:y=[],availableLabels:f=[],availableTags:h=[],onCreateTag:v,onUploadCoverImage:b,unsplashAccessKey:g,theme:k,onSubtasksChange:N,attachments:x=[],onUploadAttachments:M,onDeleteAttachment:T}){let B=Mr(),D=k||B?.themeName||"dark",[w,U]=react.useState(e),[A,H]=react.useState(false),[q,ve]=react.useState(e?.subtasks||[]),[we,Ae]=react.useState(false),[Re,R]=react.useState(""),[S,z]=react.useState(""),[E,Y]=react.useState("all"),[ae,X]=react.useState(false),[me,be]=react.useState(false),[Ke,ue]=react.useState(false),[Ye,F]=react.useState(false),[ne,Se]=react.useState(false),[Me,Ie]=react.useState(false),et=react.useRef(null),It=react.useRef(null),ke=react.useRef(null),tt=react.useRef(null),Ze=react.useRef(null),ot=react.useRef(null),xt=react.useRef(null),fe=react.useRef(null),O=react.useRef(null),Ce=react.useRef(null),qe=react.useRef(null),je=react.useRef(null);react.useEffect(()=>{e&&!w?(U({...e}),ve(e.subtasks||[])):e&&w&&e.id!==w.id&&(U({...e}),ve(e.subtasks||[]));},[e,w]),react.useEffect(()=>{let $=de=>{let Te=de.target;tt.current&&!tt.current.contains(Te)&&X(false),Ze.current&&!Ze.current.contains(Te)&&be(false),ot.current&&!ot.current.contains(Te)&&ue(false),xt.current&&!xt.current.contains(Te)&&F(false);};if(ae||me||Ke||Ye)return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[ae,me,Ke,Ye]),react.useEffect(()=>{if(!t)return;let $=de=>{let Te=de.target,$t=Te.tagName==="INPUT"||Te.tagName==="TEXTAREA"||Te.isContentEditable;if(de.key==="Escape"){de.preventDefault(),ae||me||Ke||Ye||ne||Me?(X(false),be(false),ue(false),F(false),Se(false),Ie(false)):$t||a();return}if($t&&de.key!=="Escape")return;let ea=de.metaKey||de.ctrlKey;switch(de.key.toLowerCase()){case "s":de.preventDefault(),X(true);break;case "a":de.preventDefault(),ue(true);break;case "p":de.preventDefault(),be(true);break;case "l":de.preventDefault(),F(true);break;case "d":ea||(de.preventDefault(),Se(true),setTimeout(()=>fe.current?.focus(),0));break;case "e":ea||(de.preventDefault(),Ie(true));break;case "i":de.preventDefault(),H(true),setTimeout(()=>It.current?.focus(),0);break;case "t":de.preventDefault(),Ae(true);break;case "c":de.preventDefault(),ke.current?.focus();break}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,a,ae,me,Ke,Ye,ne,Me]);let Dt=react.useCallback($=>{let de=$.currentTarget.textContent?.trim()||"";if(w&&de!==w.title){let Te={...w,title:de};U(Te),r?.(w.id,{title:de});}},[w,r]),J=react.useCallback($=>{$.key==="Enter"&&($.preventDefault(),$.currentTarget.blur()),$.key==="Escape"&&($.preventDefault(),$.currentTarget.textContent=w?.title||"",$.currentTarget.blur());},[w]),Q=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),H(false);},[w,e,r]),xe=react.useCallback($=>{if(w){let de={...w,columnId:$};U(de),r?.(w.id,{columnId:$}),X(false);}},[w,r]),Ee=react.useCallback($=>{if(w){let de={...w,priority:$};U(de),r?.(w.id,{priority:$}),be(false);}},[w,r]),K=react.useCallback($=>{if(w){let de=w.assignedUserIds||[],Te=de.includes($)?de.filter(ea=>ea!==$):[...de,$],$t={...w,assignedUserIds:Te};U($t),r?.(w.id,{assignedUserIds:Te});}},[w,r]),Pe=react.useCallback($=>{if(w){let de=w.labels||[],Te=de.includes($)?de.filter(ea=>ea!==$):[...de,$],$t={...w,labels:Te};U($t),r?.(w.id,{labels:Te});}},[w,r]),ye=react.useCallback($=>{if(w){let de={...w,tags:$};U(de),r?.(w.id,{tags:$});}},[w,r]),De=react.useCallback($=>{if(w){let de=$.target.value,Te={...w,endDate:de};U(Te),r?.(w.id,{endDate:de}),Se(false);}},[w,r]),le=react.useCallback($=>{if(w){let de={...w,estimatedTime:parseFloat($)||0};U(de),r?.(w.id,{estimatedTime:parseFloat($)||0});}},[w,r]),Be=react.useCallback(()=>{if(Re.trim()&&w){let $={id:`subtask-${Date.now()}`,title:Re.trim(),completed:false,createdAt:new Date},de=[...q,$];ve(de),R(""),Ae(false),N?.(w.id,de);}},[Re,q,w,N]),Le=react.useCallback($=>{let de=q.map(Te=>Te.id===$?{...Te,completed:!Te.completed,updatedAt:new Date}:Te);ve(de),w&&N?.(w.id,de);},[q,w,N]),Oe=react.useCallback($=>{let de=q.filter(Te=>Te.id!==$);ve(de),w&&N?.(w.id,de);},[q,w,N]),G=react.useCallback(()=>{S.trim()&&w&&m&&(m(w.id,S.trim()),z(""));},[S,w,m]),V=react.useCallback($=>{($.metaKey||$.ctrlKey)&&$.key==="Enter"&&($.preventDefault(),G());},[G]),st=$=>jsxRuntime.jsx(Tm__default.default,{remarkPlugins:[Dm__default.default],rehypePlugins:[Nm__default.default],components:{a:({node:de,...Te})=>jsxRuntime.jsx("a",{...Te,target:"_blank",rel:"noopener noreferrer"})},children:$}),ze=p.filter($=>E==="comments"?$.type.includes("COMMENT"):E==="history"?!$.type.includes("COMMENT"):true);if(!t||!e)return null;let ge=w||e,Vt=s.filter($=>ge.assignedUserIds?.includes($.id)),kt=q.filter($=>$.completed).length;return jsxRuntime.jsx(at,{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:$=>$.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:et,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Dt,onKeyDown:J,children:ge.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:tt,children:[jsxRuntime.jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>X(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ge.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:O,isOpen:ae,onClose:()=>X(false),width:250,estimatedHeight:200,children:(y.length>0?y:Em.map($=>({id:$,title:$}))).map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ge.columnId===$.id?"active":""}`,onClick:()=>xe($.id),children:$.title},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ot,children:[jsxRuntime.jsxs("button",{ref:Ce,className:"modal-v2-field",onClick:()=>ue(!Ke),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.map($=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:$.color},title:$.name,children:$.initials},$.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Ce,isOpen:Ke,onClose:()=>ue(false),width:280,estimatedHeight:300,children:s.map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.assignedUserIds?.includes($.id)?"active":""}`,onClick:()=>K($.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:$.color},children:$.initials}),$.name,ge.assignedUserIds?.includes($.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"})})]},$.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ze,children:[jsxRuntime.jsxs("button",{ref:qe,className:"modal-v2-field",onClick:()=>be(!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:ge.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:qe,isOpen:me,onClose:()=>be(false),width:180,estimatedHeight:220,children:[Sm.map($=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${$.toLowerCase()} ${ge.priority===$?"active":""}`,onClick:()=>Ee($),children:$},$)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ee(""),children:"None"})]})]}),h.length>0||v?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Rr,{selectedTags:ge.tags||[],availableTags:h,onChange:ye,onCreateTag:v,theme:Ue[D]||Ue.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:xt,children:[jsxRuntime.jsxs("button",{ref:je,className:"modal-v2-field",onClick:()=>F(!Ye),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:ge.labels&&ge.labels.length>0?jsxRuntime.jsx("span",{children:ge.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:je,isOpen:Ye,onClose:()=>F(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map($=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ge.labels?.includes($)?"active":""}`,onClick:()=>Pe($),children:[$,ge.labels?.includes($)&&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"})})]},$))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{Se(!ne),setTimeout(()=>fe.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:ge.endDate?new Date(ge.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:fe,type:"date",value:typeof ge.endDate=="string"?ge.endDate.split("T")[0]:ge.endDate?(()=>{let $=new Date(ge.endDate),de=$.getUTCFullYear(),Te=String($.getUTCMonth()+1).padStart(2,"0"),$t=String($.getUTCDate()).padStart(2,"0");return `${de}-${Te}-${$t}`})():"",onChange:De,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ie(!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("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:ge.estimatedTime?`${ge.estimatedTime}h`:"Not set"})]}),Me&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ge.estimatedTime||"",onChange:$=>le($.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ie(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"})]}),A?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ge.description||"",onChange:$=>{if(w){let de={...w,description:$.target.value};U(de);}},onBlur:Q,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ge.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:st(ge.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"}),q.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[kt,"/",q.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ae(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:[q.map($=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${$.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Le($.id),children:$.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:$.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Oe($.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"})]})})]},$.id)),we&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Re,onChange:$=>R($.target.value),onKeyDown:$=>{$.key==="Enter"&&Be(),$.key==="Escape"&&(Ae(false),R(""));},onBlur:Be,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||x.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"}),x.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:x.length})]}),jsxRuntime.jsx(ur,{cardId:ge.id,attachments:x,onUpload:M?$=>M(ge.id,$):void 0,onDelete:T,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:()=>Y("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>Y("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>Y("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:ke,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:S,onChange:$=>z($.target.value),onKeyDown:V,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:G,disabled:!S.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[ze.map($=>{let de=s.find($t=>$t.id===$.userId);if($.type.includes("COMMENT")){let $t=l.find(ea=>ea.id===$.metadata?.commentId);return $t?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[de&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:de.color},children:de.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:de?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:$t.content})]})]},$.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.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:de?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:$.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)}),ze.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 Om({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 ss({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.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(Om,{})}),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((l,p)=>l+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((l,p)=>l+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.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((l,p)=>l+(p.planned||0),0)})]})]})]})}function jm({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 is({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-l)/s*100:0,n=l<=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(jm,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:n?"#10B981":"#EF4444"},children:l})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var tu={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Bl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function au({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,p=e+l*Math.cos(-a*(Math.PI/180)),m=t+l*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 Rl({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 ls({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,n)=>m+n.value,0),l=e.map(m=>({...m,totalValue:s,color:m.color||tu[m.name]||Bl[e.indexOf(m)%Bl.length]})),p=l.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:l,cx:"50%",cy:"50%",labelLine:false,label:o?au:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:p[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Rl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,n)=>{let u=n.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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(Rl,{})}),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:l.map((m,n)=>jsxRuntime.jsx(recharts.Cell,{fill:p[n]},`cell-${n}`))})]})}),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,n)=>n.value>m.value?n:m).name})]})]})]})}var _o=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,p]=react.useState(false),[m,n]=react.useState(false),[u,d]=react.useState(false),[i,c]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),f=k=>{r.onBulkUpdate?.(y,{priority:k}),p(false);},h=k=>{r.onBulkMove?.(y,k),n(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),d(false);},b=k=>{let N=new Set;e.forEach(M=>{M.labels?.forEach(T=>N.add(T));});let x=Array.from(new Set([...N,...k]));r.onBulkUpdate?.(y,{labels:x}),c(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(k),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!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(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(k.id),children:k.title},k.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(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,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"})})]})]})})});_o.displayName="BulkOperationsToolbar";function iu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,p,m,n;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(c=>{let y=a?.find(f=>f.id===c);l=`assignee-${c}`,p=y?.name||`User ${c}`,m=y?.color,n=y?.avatar,r.has(l)||r.set(l,{id:l,title:p,groupValue:c,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",p="Unassigned",m="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={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=i.title,m=i.color,r.has(l)||r.set(l,{id:l,title:p,groupValue:s,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(c=>{l=`label-${c}`,p=c,m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:c,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);}):(l="label-none",p="No Labels",m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ds({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),p=react.useMemo(()=>iu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(n=>{l(u=>{let d=new Set(u);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(Za,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[p.map(n=>{let u=s.has(n.id),d=e.cards.filter(c=>n.cardIds.includes(c.id)),i={...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(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.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(Za,{board:i,callbacks:r,availableUsers:a})})]},n.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 cs=[{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 ps({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),p=cs.find(n=>n.value===e)||cs[0];react.useEffect(()=>{function n(u){s.current&&!s.current.contains(u.target)&&l.current&&!l.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:C("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:cs.map(n=>jsxRuntime.jsxs("button",{onClick:()=>m(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var co=[{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 cu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&l&&p&&m}function Wl(e={}){let{shortcuts:t=co,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 l=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(n=>n.action!==m);},[]);return react.useEffect(()=>{function m(n){if(!s.current)return;let u=n.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(cu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:l,unregisterShortcut:p,isEnabled:a}}function mu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function uu(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 gu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=uu(e),r=t?mu(t):"";return a?`${a} + ${r}`:r}function fu(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 ms({shortcuts:e=co,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 l=fu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(l).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",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(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:gu(n)})]},n.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var us=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
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'),Pd=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Tm=require('react-markdown'),Dm=require('remark-gfm'),Nm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Pd__default=/*#__PURE__*/_interopDefault(Pd);var Tm__default=/*#__PURE__*/_interopDefault(Tm);var Dm__default=/*#__PURE__*/_interopDefault(Dm);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Po=(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 Mo=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 [Mo.Translate.toString(e),Mo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function C(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Ao(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 ap(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function In(e,t){return e.length===0?1e3:t===0?Ao(null,e[0].position):t>=e.length?Ao(e[e.length-1].position,null):Ao(e[t-1].position,e[t].position)}function Ri(e,t=100){return e>t}var rp=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 op(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 Io(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=rp,onRetry:c}=t,p,n=0;for(let m=1;m<=a;m++){n=m;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(p=d,m===a||!l(p,m))return {error:p,attempts:n,success:false};let u=op(m,r,o,s);if(c)try{c(p,m,u);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,u));}}return {error:p||new Error("Unknown error"),attempts:n,success:false}}function np(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 sp(e,t={}){return async(...a)=>Io(()=>e(...a),t)}var Ln=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 Oi=(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))(Oi||{}),dr=class dr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,c=`[${a}] [${r}] [${s}]`,p=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(c,o,p?l:"");break;case "INFO":console.info(c,o,p?l:"");break;case "WARN":console.warn(c,o,p?l:"");break;case "ERROR":console.error(c,o,p?l:""),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",...dr.globalOptions};}static configure(t){dr.globalOptions={...dr.globalOptions,...t};}child(t){return new dr({...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 Lo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Lo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Oi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};dr.globalOptions={};var Fn=dr,Lo=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}},$i=new Fn;function lp(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 l=e.columns.find(c=>c.id===s.columnId);return [s.id,Bn(s.title),Bn(s.description||""),Bn(l?.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 cp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Pd__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=l.toDataURL("image/png"),p=297,n=210,m=l.width/l.height,d=p-20,i=d/m;i>n-20&&(i=n-20,d=i*m);let u=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});u.setFontSize(16),u.setTextColor(255,255,255),u.setFillColor(10,10,10),u.rect(0,0,p,15,"F"),u.text(e.title||"Kanban Board",10,10);let y=(p-d)/2;return u.addImage(c,"PNG",y,20,d,i),u}catch(l){console.error("Error capturing board:",l);}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(l=>{let c=e.cards.filter(p=>p.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,c.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):c.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(p.description,160);o.text(m,25,s),s+=m.length*5;}let n=[];if(p.priority&&n.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&n.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&n.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let m=[];p.startDate&&m.push(`Start: ${p.startDate}`),p.endDate&&m.push(`End: ${p.endDate}`),n.push(m.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Bn(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Ui(e,t,a,r){switch(t){case "json":return lp(e,r);case "csv":return dp(e);case "pdf":return await cp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Wi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:l[t]}),p=URL.createObjectURL(c),n=document.createElement("a");n.href=p,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(p);}function pp(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 mp(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=Hi(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let c=Hi(t[l]||"");if(c.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,y)=>{n[u]=c[y]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(c){s.push(`Line ${l+1}: ${c instanceof Error?c.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 Hi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Gi(e,t){switch(t){case "json":return pp(e);case "csv":return mp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function _i(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 Rn=react.createContext(null);function Vi(){return react.useContext(Rn)}var ji=react.createContext(null);function Ki({children:e,themeName:t}){return jsxRuntime.jsx(ji.Provider,{value:{themeName:t},children:e})}function Mr(){return react.useContext(ji)}function at({children:e,container:t}){let[a,r]=react.useState(false),o=Vi(),s=Mr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),l)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var Zi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},xp="#BDC3C7",kp=({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 cr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),y=window.innerHeight,b=window.innerWidth,g=160,v=220,h=4,f=u.right-g;f<10&&(f=u.left),f+g>b-10&&(f=b-g-10);let k=y-u.bottom,D=u.top,x;k>=v+h?x=u.bottom+h:D>=v+h?x=u.top-v-h:x=k>=D?u.bottom+h:Math.max(10,u.top-v-h),l({top:x,left:f}),o(true);};react.useEffect(()=>{let u=y=>{c.current&&!c.current.contains(y.target)&&!p.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},d=e?Zi[e]:null,i=d?.color||xp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):n(),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?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}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:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[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(Zi).map(([u,y])=>jsxRuntime.jsxs("button",{onClick:()=>m(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter: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(kp,{color:y.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:y.label}),e===u&&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"})})]},u)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.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 wp=[{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 Zr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),i=(Mr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let f=n.current.getBoundingClientRect(),k=window.innerHeight,D=window.innerWidth,x=320,P=380,T=4,O=f.left;O+x>D-10&&(O=D-x-10),O<10&&(O=10);let N=k-f.bottom,w=f.top,F;N>=P+T?F=f.bottom+T:w>=P+T?F=f.top-P-T:F=N>=w?f.bottom+T:Math.max(10,f.top-P-T),c({top:F,left:O}),s(true);};react.useEffect(()=>{let f=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let y=f=>{let k=new Date,D=O=>{let N=O.getFullYear(),w=String(O.getMonth()+1).padStart(2,"0"),F=String(O.getDate()).padStart(2,"0");return `${N}-${w}-${F}`},x=D(k),P=new Date(k);P.setDate(P.getDate()+f);let T=D(P);a(x,T),s(false);},b=()=>{if(!e||!t)return "Set date";let f=P=>{if(P instanceof Date)return P;if(typeof P!="string"||!P.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=P.split("-").map(Number);if(T.length!==3||T.some(F=>isNaN(F)))return null;let O=T[0],N=T[1],w=T[2];return O===void 0||N===void 0||w===void 0?null:new Date(O,N-1,w)},k=f(e),D=f(t);if(!k||!D||isNaN(k.getTime())||isNaN(D.getTime()))return "Set date";let x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${x[k.getMonth()]} ${k.getDate()} \u2013 ${x[D.getMonth()]} ${D.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),f<k})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${b()}`:"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:b()})]}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"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:i?"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:i?"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:wp.map(f=>jsxRuntime.jsx("button",{onClick:()=>y(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"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:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[c,p]=react.useState(""),[n,m]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,k=window.innerWidth,D=300,x=380,P=4,T=h.right-D;T<10&&(T=h.left),T+D>k-10&&(T=k-D-10);let O=f-h.bottom,N=h.top,w;O>=x+P?w=h.bottom+P:N>=x+P?w=h.top-x-P:w=O>=N?h.bottom+P:Math.max(10,h.top-x-P),m({top:w,left:T}),l(true);};react.useEffect(()=>{let h=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(l(false),p(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&(l(false),p(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let f=e.some(k=>k.id===h.id);a(f?e.filter(k=>k.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>s?l(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[g.map(h=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),v>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:c,onChange:h=>p(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:b.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"}):b.map(h=>{let f=e.some(k=>k.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>y(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},h.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(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 Fo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,c=p=>{if(!s.has(p)){s.add(p),l.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(p),false};return c(a)}function eo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(t.length>0),[u,y]=react.useState({top:0,left:0}),[b,g]=react.useState(null),v=react.useRef(null),h=react.useRef(null),f=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),O=window.innerHeight,N=window.innerWidth,w=300,F=d?380:120,M=4,H=T.right-w;H<10&&(H=T.left),H+w>N-10&&(H=N-w-10);let X=O-T.bottom,ye=T.top,ke;X>=F+M?ke=T.bottom+M:ye>=F+M?ke=T.top-F-M:ke=X>=ye?T.bottom+M:Math.max(10,T.top-F-M),y({top:ke,left:H}),p(true);};react.useEffect(()=>{if(!c||!h.current)return;let T=h.current.getBoundingClientRect(),O=window.innerHeight,N=window.innerWidth,w=300,F=d?380:120,M=4,H=T.right-w;H<10&&(H=T.left),H+w>N-10&&(H=N-w-10);let X=O-T.bottom,ye=T.top,ke;X>=F+M?ke=T.bottom+M:ye>=F+M?ke=T.top-F-M:ke=X>=ye?T.bottom+M:Math.max(10,T.top-F-M),y({top:ke,left:H});},[d,c]),react.useEffect(()=>{let T=O=>{v.current&&!v.current.contains(O.target)&&!h.current?.contains(O.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),react.useEffect(()=>{let T=O=>{O.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[c]);let k=T=>{let O=t.includes(T),N=a.find(w=>w.id===T);if(g(null),O){let w=t.filter(F=>F!==T);r(w),w.length===0&&i(false);}else {if(s&&Fo(a,T,e)){let F=`Cannot add "${N?.title||T}" as dependency - would create circular reference`;g(F),l?.(T,N?.title||T),setTimeout(()=>g(null),3e3);return}r([...t,T]),i(true);}},D=()=>{let T=!d;i(T),T||r([]);},x=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(n.toLowerCase())||T.id.toLowerCase().includes(n.toLowerCase())),P=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:h,onClick:()=>c?p(false):f(),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:P,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:P},children:t.length})]}),c&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.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:[b&&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:b})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:n,onChange:T=>m(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:x.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"}):x.map(T=>{let O=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>k(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:N=>{N.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:O?"#3b82f6":"transparent",borderColor:O?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:O&&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:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),i(false),p(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 Wa=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:d,transform:i,transition:u,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:Mo.Transform.toString(i),transition:u};if(t)return jsxRuntime.jsx("div",{ref:d,style:b,...n,...m,onClick:()=>a?.(e),children:t(e)});let g=c.filter(f=>e.assignedUserIds?.includes(f.id)),v=e.progress===100,h={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:h,className:C("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:f=>{f.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:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(cr,{priority:e.priority,onChange:f=>l?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Zr,{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:(f,k)=>l?.(e.id,{startDate:f,endDate:k})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(mr,{assignedUsers:g,availableUsers:c,onChange:f=>l?.(e.id,{assignedUserIds:f.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(eo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>l?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))}),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));Wa.displayName="Card";var Bo={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"}},ll=({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 dl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=react.useState(false),[l,c]=react.useState({top:0,left:0}),p=react.useRef(null),n=react.useRef(null),m=[...Object.entries(Bo).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(Bo).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Bo[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...Bo.todo,id:"todo"}},i=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,f=180,k=280,D=4,x=g.right-f;x<10&&(x=g.left),x+f>h-10&&(x=h-f-10);let P=v-g.bottom,T=g.top,O;P>=k+D?O=g.bottom+D:T>=k+D?O=g.top-k-D:O=P>=T?g.bottom+D:Math.max(10,g.top-k-D),c({top:O,left:x}),s(true);};react.useEffect(()=>{let g=v=>{p.current&&!p.current.contains(v.target)&&!n.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let u=g=>{t(g),s(false);},y=d(),b=y.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:n,onClick:()=>o?s(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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:y.label,children:jsxRuntime.jsx(ll,{icon:y.icon,color:b})}),o&&jsxRuntime.jsx(at,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(g=>jsxRuntime.jsxs("button",{onClick:()=>u(g.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ll,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===g.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function cl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=react.useState(false),[c,p]=react.useState(false),[n,m]=react.useState(e),[d,i]=react.useState({top:0,left:0}),u=react.useRef(null),y=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(s&&y.current){let f=y.current.getBoundingClientRect();i({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[s]),react.useEffect(()=>{let f=k=>{u.current&&!u.current.contains(k.target)&&!y.current?.contains(k.target)&&(l(false),p(false));};if(s)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),react.useEffect(()=>{let f=k=>{k.key==="Escape"&&(l(false),p(false),m(e));};if(s)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s,e]),react.useEffect(()=>{c&&b.current&&(b.current.focus(),b.current.select());},[c]);let g=()=>{p(true),m(e);},v=()=>{let f=n.trim();f&&f!==e&&t(f),p(false),l(false),m(e);},h=f=>{f.key==="Enter"?v():f.key==="Escape"&&(p(false),m(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:y,onClick:()=>l(!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(at,{children:jsxRuntime.jsx("div",{ref:u,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:c?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:b,type:"text",value:n,onChange:f=>m(f.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:g,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[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 Lr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:d=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:y,onColumnDelete:b,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),k=react.useRef(null),D=m??Ri(t.length),x=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>d,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:h,className:v,children:a(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let w=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:w}:w>=80?{state:"warning",percentage:w}:w>=60?{state:"approaching",percentage:w}:{state:"ok",percentage:w}})(),O=T.state==="exceeded",N=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:h,className:C("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",O&&"ring-2 ring-asakaa-accent-red",v),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:C(N()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.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"})]}),T.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"})]}),T.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"})}),T.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||b)&&jsxRuntime.jsx(cl,{columnTitle:e.title,onRename:w=>y?.(e.id,w),onDelete:b?()=>b(e.id):void 0,isDeletable:g}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsxRuntime.jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(w=>w.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${x.getTotalSize()}px`,position:"relative"},children:x.getVirtualItems().map(w=>{let F=t[w.index];return F?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${w.start}px)`},children:jsxRuntime.jsx(Wa,{card:F,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n})},F.id):null})}):t.map(w=>jsxRuntime.jsx(Wa,{card:w,render:r,onClick:l,onUpdate:c,availableUsers:p,allCards:n},w.id))})})]})});Lr.displayName="Column";function Wn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):l(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:s,onChange:m=>l(m.target.value),onBlur:p,onKeyDown:n,className:C("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:C("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Gn(){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 Qa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:c,isLoading:p,error:n,children:m}){let[d,i]=Gn(),u=o?.theme||"dark",b=u==="dark"||u==="neutral"?"dark":"",g=react.useCallback((N,w)=>{t.onCardUpdate?.(N,w);},[t]),v=react.useCallback((N,w)=>{t.onColumnUpdate?.(N,{title:w});},[t]),h=react.useCallback(N=>{t.onColumnDelete?.(N);},[t]),f=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),D=react.useMemo(()=>{let N=new Map;return e.columns.forEach(w=>{let F=w.cardIds.map(M=>e.cards.find(H=>H.id===M)).filter(M=>M!==void 0).sort((M,H)=>M.position-H.position);N.set(w.id,F);}),N},[e.cards,e.columns]),x=react.useCallback(N=>{let{active:w}=N,F=e.cards.find(M=>M.id===w.id);F&&i({isDragging:true,draggedCardId:F.id,sourceColumnId:F.columnId,targetColumnId:F.columnId});},[e.cards,i]),P=react.useCallback(N=>{let{active:w,over:F}=N;if(!F||!e.cards.find(X=>X.id===w.id))return;let H=null;F.data.current?.type==="column"?H=F.id:F.data.current?.type==="card"&&(H=e.cards.find(ye=>ye.id===F.id)?.columnId||null),H&&H!==d.targetColumnId&&i({...d,targetColumnId:H});},[e.cards,d,i]),T=react.useCallback(async N=>{let{active:w,over:F}=N;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!F)return;let M=e.cards.find(ke=>ke.id===w.id);if(!M)return;let H,X;if(F.data.current?.type==="column"){H=F.id;let ke=D.get(H)||[];X=In(ke,0);}else {let ke=e.cards.find($=>$.id===F.id);if(!ke)return;H=ke.columnId;let Ae=D.get(H)||[],ze=Ae.findIndex($=>$.id===F.id);X=In(Ae,ze);}let ye=e.columns.find(ke=>ke.id===H);if(ye&&ye.wipLimit&&ye.wipLimitType==="hard"){let ke=D.get(H)||[];if(M.columnId!==H&&ke.length>=ye.wipLimit){t.onWipLimitExceeded?.(ye,M);return}}(M.columnId!==H||M.position!==X)&&await t.onCardMove?.(M.id,H,X);},[e.cards,e.columns,D,t,i]),O=react.useCallback(N=>{a?.(N);},[a]);return p?jsxRuntime.jsx("div",{className:C("asakaa-board",b,l),style:c,children:jsxRuntime.jsx(jp,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:C("asakaa-board",b,l),style:c,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 n=="string"?n:n.message})]})})}):jsxRuntime.jsx(Ki,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:x,onDragOver:P,onDragEnd:T,children:[jsxRuntime.jsxs("div",{className:C("asakaa-board",b,l),style:c,"data-theme":u,children:[e.columns.sort((N,w)=>N.position-w.position).map(N=>{let w=D.get(N.id)||[],F=!f.includes(N.id);return jsxRuntime.jsx(Lr,{column:N,cards:w,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:O,onCardUpdate:g,onColumnRename:v,onColumnDelete:h,isDeletable:F,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},N.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(Wa,{card:e.cards.find(N=>N.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function jp({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 Jp={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)"},Zp={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)"},Qp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},em={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function tm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!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((n,m)=>n.position-m.position).map((n,m)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.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:n.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function am({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[c,p]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let u=y=>{n.current&&!n.current.contains(y.target)&&l(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[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(u=>u.handler),i=async(u,y)=>{if(y){p(u);try{await y();}catch(b){console.error(`Export ${u} failed:`,b);}finally{p(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:n,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!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((u,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===u.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"})}):u.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:u.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function rm({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 Vn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Jp:Zp,d={...o==="es"?Qp:em,...n},i=l||c||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(am,{theme:m,t:d,onExportCSV:l,onExportJSON:c,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsxRuntime.jsx(tm,{columns:e,onSelect:t,theme:m,t:d,createTaskLabel:a}):jsxRuntime.jsx(rm,{onClick:()=>t(),label:a||d.newTask}))]})})}function Kn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[c,p]=react.useState(""),n=react.useCallback(()=>{let i=c.trim();i&&(e(i),p(""),l(false));},[c,e]),m=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),l(false));},[n]),d=react.useCallback(()=>{setTimeout(()=>{c.trim()||l(false);},150);},[c]);return s?jsxRuntime.jsx("div",{className:C("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:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:n,disabled:!c.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:()=>{p(""),l(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:C("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>l(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 Yn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:c="dark",locale:p="es"}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,y]=react.useState(""),[b,g]=react.useState([]),[v,h]=react.useState(""),[f,k]=react.useState(""),[D,x]=react.useState(""),[P,T]=react.useState(false),[O,N]=react.useState(false),[w,F]=react.useState(false),M=react.useRef(null),H=react.useRef(null),X={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},ye=react.useCallback(()=>{y(""),g([]),h(""),k(""),x(""),T(false),N(false),F(false),m(false);},[]);react.useEffect(()=>{n&&M.current&&M.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let L=z=>{H.current&&!H.current.contains(z.target)&&(u.trim()||ye());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[n,u,ye]);let ke=react.useCallback(async()=>{let L=u.trim();if(!(!L||d)){i(true);try{await t({name:L,columnId:e,assigneeIds:b.length>0?b:void 0,startDate:v?new Date(v):void 0,endDate:f?new Date(f):void 0,priority:D||void 0}),y(""),g([]),h(""),k(""),x(""),T(!1),N(!1),F(!1),M.current?.focus();}catch(z){console.error("Error creating card:",z);}finally{i(false);}}},[u,e,b,v,f,D,t,d]),Ae=react.useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),ke()):L.key==="Escape"&&ye();},[ke,ye]),ze=react.useCallback(L=>{g(z=>z.includes(L)?z.filter(S=>S!==L):[...z,L]);},[]),$=c==="dark";return n?jsxRuntime.jsxs("div",{ref:H,className:C("rounded-lg overflow-hidden shadow-lg",$?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:M,type:"text",value:u,onChange:L=>y(L.target.value),onKeyDown:Ae,placeholder:X.placeholder,disabled:d,className:C("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",$?"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:()=>T(!P),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",P||b.length>0?"bg-emerald-500/20 text-emerald-400":$?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:X.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"})]}),b.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:b.length})]}),jsxRuntime.jsx("button",{onClick:()=>N(!O),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",O||v||f?"bg-blue-500/20 text-blue-400":$?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:X.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:()=>F(!w),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",w||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":$?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:X.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:ke,disabled:!u.trim()||d,className:C("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"}):X.save})]})]}),P&&a.length>0&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",$?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxRuntime.jsxs("button",{onClick:()=>ze(L.id),className:C("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",b.includes(L.id)?"bg-emerald-500 text-white":$?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsxRuntime.jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",b.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),O&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",$?"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:C("block text-[10px] uppercase tracking-wide mb-1",$?"text-gray-500":"text-gray-400"),children:X.startDate}),jsxRuntime.jsx("input",{type:"date",value:v,onChange:L=>h(L.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",$?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:C("block text-[10px] uppercase tracking-wide mb-1",$?"text-gray-500":"text-gray-400"),children:X.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:L=>k(L.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",$?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),w&&jsxRuntime.jsx("div",{className:C("px-3 pb-3 pt-0","border-t",$?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsxRuntime.jsx("button",{onClick:()=>x(D===L?"":L),className:C("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:$?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:X[L]},L))})})]}):jsxRuntime.jsxs("button",{onClick:()=>m(true),disabled:l,className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",$?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"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:X.buttonLabel})]})}var no=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(Qa,{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(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Cl(e={}){return new no(e)}var Fr=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(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=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:l?`Error in ${l}`:"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 qn(e,t){let a=r=>jsxRuntime.jsx(Fr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Jn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[d,i]=react.useState(false),[u,y]=react.useState(""),[b,g]=react.useState("home"),[v,h]=react.useState(""),[f,k]=react.useState("");react.useEffect(()=>{let T=O=>{(O.metaKey||O.ctrlKey)&&O.key===n&&(O.preventDefault(),i(N=>!N)),O.key==="Escape"&&(i(false),g("home"),y(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[n]),react.useEffect(()=>{d||(g("home"),y(""),h(""),k(""));},[d]);let D=react.useCallback(()=>{i(false);},[]),x=react.useCallback(T=>{let[O,N]=T.split(":");switch(O){case "create-card":g("create-card");break;case "create-card-in":h(N||"");break;case "navigate":N?(a?.(N),D()):g("navigate");break;case "search":r?.(u),D();break;case "priority":g("priority");break;case "set-priority":f&&N&&(o?.(f,N),D());break;case "assign":g("assign");break;case "assign-user":f&&N&&(s?.(f,N),D());break;case "ai":g("ai");break;case "ai-generate-plan":l?.(),D();break;case "ai-predict-risks":c?.(),D();break;case "ai-usage":p?.(),D();break;case "back":g("home");break;}},[u,f,t,a,r,o,s,l,c,p,D]),P=react.useCallback(()=>{v&&u.trim()&&(t?.(v,u.trim()),D());},[v,u,t,D]);return d?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:b==="create-card"&&v?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&v&&P();}}),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."}),b==="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:x,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:x,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:x,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:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(O=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:O},O))})]},T.id))})]}),b==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:x,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:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),b==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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(T=>{let O=e.columns.find(N=>N.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:x,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:O?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},T.id)})})]}),b==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:x,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:x,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:x,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:x,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 cm(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 pm(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 mm(e){return e.startsWith("image/")}function Ga({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(null),i=react.useRef(null),u=react.useCallback(x=>{let P=[],T=[];return e.length+x.length>s?(T.push(`Maximum ${s} files allowed`),{valid:P,errors:T}):(x.forEach(O=>{if(O.size/1048576>r){T.push(`${O.name} is too large (max ${r}MB)`);return}if(o&&!o.some(w=>O.type.match(w))){T.push(`${O.name} has invalid file type`);return}P.push(O);}),{valid:P,errors:T})},[e.length,s,r,o]),y=react.useCallback(async x=>{let{valid:P,errors:T}=u(x);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){n(true),d(null);try{await t?.(P);}catch(O){d(O instanceof Error?O.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[u,t]),b=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(true);},[]),g=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);},[]),v=react.useCallback(x=>{x.preventDefault(),x.stopPropagation();},[]),h=react.useCallback(x=>{x.preventDefault(),x.stopPropagation(),c(false);let P=Array.from(x.dataTransfer.files);y(P);},[y]),f=react.useCallback(x=>{let P=x.target.files?Array.from(x.target.files):[];y(P),i.current&&(i.current.value="");},[y]),k=react.useCallback(()=>{i.current?.click();},[]),D=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 ${l?"dragging":""} ${p?"uploading":""}`,onDragEnter:b,onDragLeave:g,onDragOver:v,onDrop:h,onClick:k,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:f,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?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:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(x=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:mm(x.type)&&x.url?jsxRuntime.jsx("img",{src:x.thumbnailUrl||x.url,alt:x.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:pm(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:cm(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:()=>D(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 Qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:y,onGenerateSubtasks:b,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,f]=react.useState("details"),[k,D]=react.useState(false),[x,P]=react.useState({}),[T,O]=react.useState(""),[N,w]=react.useState(false),[F,M]=react.useState({});if(!t||!e)return null;let H=react.useCallback(()=>{D(false),P({}),f("details"),O(""),M({}),a();},[a]),X=react.useCallback(()=>{r&&Object.keys(x).length>0&&(r(e.id,x),P({}),D(false));},[e.id,x,r]),ye=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ke=react.useCallback(()=>{m&&T.trim()&&(m(e.id,T.trim()),O(""));},[e.id,T,m]),Ae=react.useCallback(async()=>{if(y){w(true);try{let S=await y(e);M(R=>({...R,assignees:S}));}catch(S){console.error("Failed to suggest assignee:",S);}finally{w(false);}}},[e,y]),ze=react.useCallback(async()=>{if(b){w(true);try{let S=await b(e);M(R=>({...R,subtasks:S}));}catch(S){console.error("Failed to generate subtasks:",S);}finally{w(false);}}},[e,b]),$=react.useCallback(async()=>{if(g){w(true);try{let S=await g(e);M(R=>({...R,effort:S}));}catch(S){console.error("Failed to estimate effort:",S);}finally{w(false);}}},[e,g]),L={...e,...x},z=s.filter(S=>L.assignedUserIds?.includes(S.id));return jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsxRuntime.jsx("input",{type:"text",value:x.title??L.title,onChange:S=>P({...x,title:S.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:X,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),P({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:ye,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),k?jsxRuntime.jsx("textarea",{value:x.description??L.description??"",onChange:S=>P({...x,description:S.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsxRuntime.jsx("select",{multiple:true,value:x.assignedUserIds??L.assignedUserIds??[],onChange:S=>{let R=Array.from(S.target.selectedOptions,ae=>ae.value);P({...x,assignedUserIds:R});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:z.length>0?z.map(S=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:S.color},children:S.initials}),jsxRuntime.jsx("span",{children:S.name})]},S.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxRuntime.jsxs("select",{value:x.priority??L.priority??"",onChange:S=>P({...x,priority:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:L.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(S=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:S},S)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsxRuntime.jsx("input",{type:"date",value:x.startDate?new Date(x.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:S=>P({...x,startDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsxRuntime.jsx("input",{type:"date",value:x.endDate?new Date(x.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:S=>P({...x,endDate:S.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:x.estimatedTime??L.estimatedTime??"",onChange:S=>P({...x,estimatedTime:S.target.value?parseFloat(S.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:L.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:L.dependencies&&L.dependencies.length>0?L.dependencies.map(S=>{let R=typeof S=="string"?S:S.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",R.slice(-4)]},R)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:T,onChange:S=>O(S.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ke,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(S=>{let R=s.find(ae=>ae.id===S.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[R&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:R.color},children:R.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:R?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(S.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(S.id),className:"card-detail-comment-delete",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:S.content})]},S.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(S=>{let R=s.find(ae=>ae.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[S.type.includes("CREATED")&&"\u2795",S.type.includes("UPDATED")&&"\u270F\uFE0F",S.type.includes("MOVED")&&"\u27A1\uFE0F",S.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",S.type.includes("COMMENT")&&"\u{1F4AC}",S.type.includes("ASSIGNED")&&"\u{1F464}",S.type.includes("PRIORITY")&&"\u{1F3AF}",S.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",S.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:R?.name||"Unknown"})," ",S.type.replace(/_/g," ").toLowerCase(),S.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:S.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(S.timestamp).toLocaleString()})]})]},S.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ga,{cardId:e.id,attachments:n,onUpload:i?S=>i(e.id,S):void 0,onDelete:u,currentUserId:v,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Ae,disabled:N||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:ze,disabled:N||!b,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:$,disabled:N||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),F.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),F.assignees.map((S,R)=>{let ae=s.find(q=>q.id===S.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ae&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ae.color},children:ae.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ae?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:S.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(S.confidence*100).toFixed(0),"%"]})]})]},R)})]}),F.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),F.subtasks.map((S,R)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:S.title}),S.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:S.description}),S.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",S.estimatedTime,"h"]})]},R))]}),F.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:[F.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(F.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(S=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${S.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:S.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:S.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:S.description}),S.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",S.suggestedAction]})]},S.id))]}),!F.assignees&&!F.subtasks&&!F.effort&&p.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 io({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[c,p]=react.useState({top:0,left:0}),n=react.useRef(null),m=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,y=4,b=d.left;b+o>u-10&&(b=u-o-10),b<10&&(b=10);let g=i-d.bottom,v=d.top,h;return g>=s+y?h=d.bottom+y:v>=s+y?h=d.top-s-y:g>=v?h=d.bottom+y:h=Math.max(10,d.top-s-y),{top:h,left:b}},[e,o,s]);return react.useEffect(()=>{t&&p(m());},[t,m]),react.useEffect(()=>{if(!t)return;let d=u=>{let y=u.target;n.current&&!n.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsxRuntime.jsx(at,{children:jsxRuntime.jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.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 Ho=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Rr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[c,p]=react.useState(false),[n,m]=react.useState(""),[d,i]=react.useState(false),[u,y]=react.useState(Ho[10]||"#3B82F6"),[b,g]=react.useState({top:0,left:0}),v=react.useRef(null),h=react.useRef(null),f=react.useRef(null),k=react.useRef(null),D=t.filter(w=>w.name.toLowerCase().includes(n.toLowerCase())),x=t.some(w=>w.name.toLowerCase()===n.toLowerCase());react.useEffect(()=>{if(c&&h.current){let w=h.current.getBoundingClientRect();g({top:w.bottom+6,left:w.left});}},[c]),react.useEffect(()=>{let w=F=>{let M=F.target,H=v.current?.contains(M),X=f.current?.contains(M);!H&&!X&&(p(false),m(""),i(false));};if(c)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]),react.useEffect(()=>{c&&k.current&&k.current.focus();},[c]);let P=w=>{let F=e.some(M=>M.id===w.id);a(F?e.filter(M=>M.id!==w.id):[...e,w]);},T=async()=>{if(!(!r||!n.trim())){i(true);try{let w=await r(n.trim(),u);w&&(a([...e,w]),m(""),y(Ho[Math.floor(Math.random()*Ho.length)]||"#3B82F6"));}finally{i(false);}}},O=(w,F)=>{F.stopPropagation(),a(e.filter(M=>M.id!==w));},N={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,type:"button",onClick:()=>!s&&p(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:N,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(w=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${w.color}20`,color:w.color},children:w.name},w.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Etiquetas"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,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:b.top,left:b.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:k,type:"text",value:n,onChange:w=>m(w.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:w=>{w.key==="Enter"&&n.trim()&&!x&&r&&T();}})}),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(w=>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:`${w.color}20`,color:w.color},onClick:F=>O(w.id,F),children:[w.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},w.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(w=>{let F=e.some(M=>M.id===w.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>P(w),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:F?`${w.color}15`:"transparent",color:o.textPrimary},onMouseEnter:M=>{F||(M.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:M=>{F||(M.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:w.name}),F&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:w.color}})]},w.id)}):n.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"})}),n.trim()&&!x&&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:Ho.map(w=>jsxRuntime.jsx("button",{type:"button",onClick:()=>y(w),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:w,outline:u===w?`2px solid ${w}`:"none",outlineOffset:"2px"}},w))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:u,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 "',n.trim(),'"']})]})]})}),document.body)]})}function as({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 El({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(as,{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 He={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:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 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:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 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:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",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 Sm=["LOW","MEDIUM","HIGH","URGENT"],Em=["todo","in-progress","review","done"];function os({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:y=[],availableLabels:b=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:f,theme:k,onSubtasksChange:D,attachments:x=[],onUploadAttachments:P,onDeleteAttachment:T}){let O=Mr(),N=k||O?.themeName||"dark",[w,F]=react.useState(e),[M,H]=react.useState(false),[X,ye]=react.useState(e?.subtasks||[]),[ke,Ae]=react.useState(false),[ze,$]=react.useState(""),[L,z]=react.useState(""),[S,R]=react.useState("all"),[ae,q]=react.useState(false),[Ee,xe]=react.useState(false),[Je,J]=react.useState(false),[qe,Ve]=react.useState(false),[gt,lt]=react.useState(false),[U,ne]=react.useState(false),Pe=react.useRef(null),Ue=react.useRef(null),Me=react.useRef(null),Be=react.useRef(null),Ze=react.useRef(null),we=react.useRef(null),It=react.useRef(null),ge=react.useRef(null),B=react.useRef(null),he=react.useRef(null),je=react.useRef(null),Xe=react.useRef(null);react.useEffect(()=>{e&&!w?(F({...e}),ye(e.subtasks||[])):e&&w&&e.id!==w.id&&(F({...e}),ye(e.subtasks||[]));},[e,w]),react.useEffect(()=>{let W=ce=>{let Ce=ce.target;Be.current&&!Be.current.contains(Ce)&&q(false),Ze.current&&!Ze.current.contains(Ce)&&xe(false),we.current&&!we.current.contains(Ce)&&J(false),It.current&&!It.current.contains(Ce)&&Ve(false);};if(ae||Ee||Je||qe)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[ae,Ee,Je,qe]),react.useEffect(()=>{if(!t)return;let W=ce=>{let Ce=ce.target,$t=Ce.tagName==="INPUT"||Ce.tagName==="TEXTAREA"||Ce.isContentEditable;if(ce.key==="Escape"){ce.preventDefault(),ae||Ee||Je||qe||gt||U?(q(false),xe(false),J(false),Ve(false),lt(false),ne(false)):$t||a();return}if($t&&ce.key!=="Escape")return;let ea=ce.metaKey||ce.ctrlKey;switch(ce.key.toLowerCase()){case "s":ce.preventDefault(),q(true);break;case "a":ce.preventDefault(),J(true);break;case "p":ce.preventDefault(),xe(true);break;case "l":ce.preventDefault(),Ve(true);break;case "d":ea||(ce.preventDefault(),lt(true),setTimeout(()=>ge.current?.focus(),0));break;case "e":ea||(ce.preventDefault(),ne(true));break;case "i":ce.preventDefault(),H(true),setTimeout(()=>Ue.current?.focus(),0);break;case "t":ce.preventDefault(),Ae(true);break;case "c":ce.preventDefault(),Me.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,ae,Ee,Je,qe,gt,U]);let Dt=react.useCallback(W=>{let ce=W.currentTarget.textContent?.trim()||"";if(w&&ce!==w.title){let Ce={...w,title:ce};F(Ce),r?.(w.id,{title:ce});}},[w,r]),Z=react.useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=w?.title||"",W.currentTarget.blur());},[w]),ee=react.useCallback(()=>{w&&e&&w.description!==e.description&&r?.(w.id,{description:w.description}),H(false);},[w,e,r]),ve=react.useCallback(W=>{if(w){let ce={...w,columnId:W};F(ce),r?.(w.id,{columnId:W}),q(false);}},[w,r]),Ne=react.useCallback(W=>{if(w){let ce={...w,priority:W};F(ce),r?.(w.id,{priority:W}),xe(false);}},[w,r]),Y=react.useCallback(W=>{if(w){let ce=w.assignedUserIds||[],Ce=ce.includes(W)?ce.filter(ea=>ea!==W):[...ce,W],$t={...w,assignedUserIds:Ce};F($t),r?.(w.id,{assignedUserIds:Ce});}},[w,r]),Se=react.useCallback(W=>{if(w){let ce=w.labels||[],Ce=ce.includes(W)?ce.filter(ea=>ea!==W):[...ce,W],$t={...w,labels:Ce};F($t),r?.(w.id,{labels:Ce});}},[w,r]),be=react.useCallback(W=>{if(w){let ce={...w,tags:W};F(ce),r?.(w.id,{tags:W});}},[w,r]),Te=react.useCallback(W=>{if(w){let ce=W.target.value,Ce={...w,endDate:ce};F(Ce),r?.(w.id,{endDate:ce}),lt(false);}},[w,r]),de=react.useCallback(W=>{if(w){let ce={...w,estimatedTime:parseFloat(W)||0};F(ce),r?.(w.id,{estimatedTime:parseFloat(W)||0});}},[w,r]),Fe=react.useCallback(()=>{if(ze.trim()&&w){let W={id:`subtask-${Date.now()}`,title:ze.trim(),completed:false,createdAt:new Date},ce=[...X,W];ye(ce),$(""),Ae(false),D?.(w.id,ce);}},[ze,X,w,D]),Ie=react.useCallback(W=>{let ce=X.map(Ce=>Ce.id===W?{...Ce,completed:!Ce.completed,updatedAt:new Date}:Ce);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),Re=react.useCallback(W=>{let ce=X.filter(Ce=>Ce.id!==W);ye(ce),w&&D?.(w.id,ce);},[X,w,D]),_=react.useCallback(()=>{L.trim()&&w&&p&&(p(w.id,L.trim()),z(""));},[L,w,p]),j=react.useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),_());},[_]),nt=W=>jsxRuntime.jsx(Tm__default.default,{remarkPlugins:[Dm__default.default],rehypePlugins:[Nm__default.default],components:{a:({node:ce,...Ce})=>jsxRuntime.jsx("a",{...Ce,target:"_blank",rel:"noopener noreferrer"})},children:W}),We=c.filter(W=>S==="comments"?W.type.includes("COMMENT"):S==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let ue=w||e,Vt=s.filter(W=>ue.assignedUserIds?.includes(W.id)),kt=X.filter(W=>W.completed).length;return jsxRuntime.jsx(at,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Pe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Dt,onKeyDown:Z,children:ue.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Be,children:[jsxRuntime.jsxs("button",{ref:B,className:"modal-v2-field",onClick:()=>q(!ae),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ue.columnId||"No status"})]}),jsxRuntime.jsx(io,{triggerRef:B,isOpen:ae,onClose:()=>q(false),width:250,estimatedHeight:200,children:(y.length>0?y:Em.map(W=>({id:W,title:W}))).map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ue.columnId===W.id?"active":""}`,onClick:()=>ve(W.id),children:W.title},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:we,children:[jsxRuntime.jsxs("button",{ref:he,className:"modal-v2-field",onClick:()=>J(!Je),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 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:Vt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Vt.map(W=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:he,isOpen:Je,onClose:()=>J(false),width:280,estimatedHeight:300,children:s.map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ue.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>Y(W.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,ue.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ze,children:[jsxRuntime.jsxs("button",{ref:je,className:"modal-v2-field",onClick:()=>xe(!Ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:ue.priority||"None"})]}),jsxRuntime.jsxs(io,{triggerRef:je,isOpen:Ee,onClose:()=>xe(false),width:180,estimatedHeight:220,children:[Sm.map(W=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${ue.priority===W?"active":""}`,onClick:()=>Ne(W),children:W},W)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ne(""),children:"None"})]})]}),g.length>0||v?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(Rr,{selectedTags:ue.tags||[],availableTags:g,onChange:be,onCreateTag:v,theme:He[N]||He.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:It,children:[jsxRuntime.jsxs("button",{ref:Xe,className:"modal-v2-field",onClick:()=>Ve(!qe),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:ue.labels&&ue.labels.length>0?jsxRuntime.jsx("span",{children:ue.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(io,{triggerRef:Xe,isOpen:qe,onClose:()=>Ve(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ue.labels?.includes(W)?"active":""}`,onClick:()=>Se(W),children:[W,ue.labels?.includes(W)&&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"})})]},W))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{lt(!gt),setTimeout(()=>ge.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:ue.endDate?new Date(ue.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ge,type:"date",value:typeof ue.endDate=="string"?ue.endDate.split("T")[0]:ue.endDate?(()=>{let W=new Date(ue.endDate),ce=W.getUTCFullYear(),Ce=String(W.getUTCMonth()+1).padStart(2,"0"),$t=String(W.getUTCDate()).padStart(2,"0");return `${ce}-${Ce}-${$t}`})():"",onChange:Te,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>ne(!U),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:ue.estimatedTime?`${ue.estimatedTime}h`:"Not set"})]}),U&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ue.estimatedTime||"",onChange:W=>de(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ne(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"})]}),M?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ue.description||"",onChange:W=>{if(w){let ce={...w,description:W.target.value};F(ce);}},onBlur:ee,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ue.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:nt(ue.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"}),X.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[kt,"/",X.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ae(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:[X.map(W=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ie(W.id),children:W.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:W.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(W.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"})]})})]},W.id)),ke&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:ze,onChange:W=>$(W.target.value),onKeyDown:W=>{W.key==="Enter"&&Fe(),W.key==="Escape"&&(Ae(false),$(""));},onBlur:Fe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(P||x.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"}),x.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:x.length})]}),jsxRuntime.jsx(Ga,{cardId:ue.id,attachments:x,onUpload:P?W=>P(ue.id,W):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="all"?"active":""}`,onClick:()=>R("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="comments"?"active":""}`,onClick:()=>R("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${S==="history"?"active":""}`,onClick:()=>R("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:Me,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:W=>z(W.target.value),onKeyDown:j,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:_,disabled:!L.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[We.map(W=>{let ce=s.find($t=>$t.id===W.userId);if(W.type.includes("COMMENT")){let $t=l.find(ea=>ea.id===W.metadata?.commentId);return $t?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ce&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ce.color},children:ce.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:ce?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:$t.content})]})]},W.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.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:ce?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:W.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),We.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 Om({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 ss({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((c,p)=>c+p.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(Om,{})}),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((l,c)=>l+c.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((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.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((l,c)=>l+(c.planned||0),0)})]})]})]})}function jm({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 is({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-l)/s*100:0,n=l<=c;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(jm,{})}),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:n?"#10B981":"#EF4444",fill:n?"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:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#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:p>=50?"#10B981":"#F59E0B"},children:[p.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:n?"#10B981":"#EF4444"},children:l})]}),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:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var tu={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Bl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function au({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),p=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Rl({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 ls({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),l=e.map(p=>({...p,totalValue:s,color:p.color||tu[p.name]||Bl[e.indexOf(p)%Bl.length]})),c=l.map(p=>p.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:l,cx:"50%",cy:"50%",labelLine:false,label:o?au:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Rl,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:l,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(Rl,{})}),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:l.map((p,n)=>jsxRuntime.jsx(recharts.Cell,{fill:c[n]},`cell-${n}`))})]})}),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((p,n)=>n.value>p.value?n:p).name})]})]})]})}var _o=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,c]=react.useState(false),[p,n]=react.useState(false),[m,d]=react.useState(false),[i,u]=react.useState(false);if(e.length===0)return null;let y=e.map(k=>k.id),b=k=>{r.onBulkUpdate?.(y,{priority:k}),c(false);},g=k=>{r.onBulkMove?.(y,k),n(false),a();},v=k=>{r.onBulkUpdate?.(y,{assignedUserIds:k}),d(false);},h=k=>{let D=new Set;e.forEach(P=>{P.labels?.forEach(T=>D.add(T));});let x=Array.from(new Set([...D,...k]));r.onBulkUpdate?.(y,{labels:x}),u(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(k),children:[jsxRuntime.jsx("span",{className:C("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k]),children:k},k))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,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"})})]})]})})});_o.displayName="BulkOperationsToolbar";function iu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let y=a?.find(b=>b.id===u);l=`assignee-${u}`,c=y?.name||`User ${u}`,p=y?.color,n=y?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:s,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,c=u,p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:u,cardIds:[],color:p}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",p="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:p}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ds({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),c=react.useMemo(()=>iu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(n=>{l(m=>{let d=new Set(m);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(Qa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:C("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),d=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...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&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Qa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.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 cs=[{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 ps({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),c=cs.find(n=>n.value===e)||cs[0];react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:C("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:cs.map(n=>jsxRuntime.jsxs("button",{onClick:()=>p(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:n.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:n.label}),e===n.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:n.description})]})]},n.value))})]})]})}var co=[{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 cu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&l&&c&&p}function Wl(e={}){let{shortcuts:t=co,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 l=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return react.useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(cu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function mu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function uu(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 gu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=uu(e),r=t?mu(t):"";return a?`${a} + ${r}`:r}function fu(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 ms({shortcuts:e=co,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=fu(e);return jsxRuntime.jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.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(l).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(n=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:n.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:gu(n)})]},n.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var us=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
6
6
  1.
7
7
 
8
8
  **Expected behavior:**
@@ -42,8 +42,8 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function gs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(u){s.current&&!s.current.contains(u.target)&&l.current&&!l.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);},m=e.reduce((n,u)=>{let d=u.category||"Other";return n[d]||(n[d]=[]),n[d].push(u),n},{});return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:C("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(([n,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:n})}),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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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))})]},n)),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 bs({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,p]=react.useState("export"),[m,n]=react.useState("json"),[u,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let c=async()=>{let f=o?.current||void 0,h=await Ui(e,m,f);Wi(h,m);},y=async f=>{let h=f.target.files?.[0];if(h){try{let v=await _i(h),b=h.name.endsWith(".json")?"json":"csv",g=Gi(v,b);d(g),g.success&&r&&r(g,v);}catch(v){d({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:C("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:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:[l==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:C("p-4 rounded-lg border-2 transition-all text-center",m===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:c,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"})]}),l==="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:i,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.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:C("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:C("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((f,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},h))})]})]})]})]})]})}var xu=["URGENT","HIGH","MEDIUM","LOW"],ku=[{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"}],wu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function hs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:p,availableUsers:m=[],availableLabels:n=[],availableColumns:u=[],showQuickFilters:d=true,compact:i=false,groupBy:c="none",onGroupByChange:y}){let[f,h]=react.useState(true),v=react.useCallback(x=>{a({search:x.target.value});},[a]),b=react.useCallback(x=>{a({dateFilter:x.target.value});},[a]),g=react.useCallback(x=>{r({by:x.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:x=>{x.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:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,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:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:x=>{let M=x.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),xu.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let M=x.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.name},x.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:x=>{let M=x.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:ku.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:c,onChange:x=>y(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:wu.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})}),N&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:p,onExportGanttCSV:m}){let[n,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return n&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c);}},[n]);let i=c=>{c(),u(false);};return jsxRuntime.jsxs("div",{className:C("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!n),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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",c.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",c.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(()=>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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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:()=>i(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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.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 vs={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"}},xs={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"}},ks={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"}},br={dark:vs,light:xs,neutral:ks},jo="dark";var Ko=react.createContext(void 0),Iu="asakaa-theme";function _l({children:e,defaultTheme:t=jo,storageKey:a=Iu}){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=br[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${Lu(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 i=m.colors[u];i&&p.style.setProperty(d,i);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:br};return jsxRuntime.jsx(Ko.Provider,{value:l,children:e})}function zr(){let e=react.useContext(Ko);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Lu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ws({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=zr();return e?jsxRuntime.jsxs("div",{className:C("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(br).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:C("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:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.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 Vl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ue[e]||Ue.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ue[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ue[e].bgSecondary),bgGrid:r("--theme-bg-card",Ue[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ue[e].bgWeekend),border:r("--theme-border-primary",Ue[e].border),borderLight:r("--theme-border-subtle",Ue[e].borderLight),textPrimary:r("--theme-text-primary",Ue[e].textPrimary),textSecondary:r("--theme-text-secondary",Ue[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ue[e].textTertiary),accent:r("--theme-accent-primary",Ue[e].accent),accentHover:r("--theme-accent-hover",Ue[e].accentHover),accentLight:r("--theme-accent-primary",Ue[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ue[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ue[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ue[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ue[e].dependency),dependencyHover:r("--theme-border-secondary",Ue[e].dependencyHover),criticalPath:r("--theme-error",Ue[e].criticalPath),criticalPathLight:r("--theme-error",Ue[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ue[e].today):e==="neutral"?r("--theme-text-primary",Ue[e].today):r("--theme-error",Ue[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ue[e].todayLight):e==="neutral"?r("--theme-text-primary",Ue[e].todayLight):r("--theme-error",Ue[e].todayLight),milestone:r("--theme-warning",Ue[e].milestone),milestoneLight:r("--theme-warning",Ue[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ue[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ue[e].statusInProgress),statusCompleted:r("--theme-success",Ue[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ue[e].hoverBg),focusRing:r("--theme-accent-primary",Ue[e].focusRing)}}var Yo={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"},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"}},jl={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"},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"}},Cs={en:Yo,es:jl};function Kl(e){return Cs[e]||Cs.en}function Ts(e,t){let a=Kl(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 Wr=react.createContext(Yo);function po(){return react.useContext(Wr)}function Xu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[p,m]=react.useState(false),[n,u]=react.useState(null),d=react.useRef(null),i=po();if(react.useEffect(()=>{let h=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return p&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[p]),!(t||a||r||o||s||l))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(h=>h.handler),f=async(h,v)=>{if(v){u(h);try{await v();}catch(b){console.error(`Export ${h} failed:`,b);}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:i.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:y.map((h,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(h.id,h.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===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 Ju({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 l=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:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&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:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Zu({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 Qu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=po();react.useEffect(()=>{let n=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],m=p.find(n=>n.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:`${l.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((n,u)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.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:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function qo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:p,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:i,onExportPNG:c,onExportPDF:y,onExportExcel:f,onExportCSV:h,onExportJSON:v,onExportMSProject:b}){let g=po(),k=c||y||f||h||v||b,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.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(Zu,{options:N,value:t,onChange:M=>a(M),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(Qu,{theme:e,value:p,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,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||g.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xu,{theme:e,onExportPNG:c,onExportPDF:y,onExportExcel:f,onExportCSV:h,onExportJSON:v,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Ju,{options:x,value:s,onChange:M=>l(M),theme:e})]})]})}function Xo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=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 n=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();l({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(at,{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"}),n.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 Hr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=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,i=8,c=window.innerWidth,y=window.innerHeight,f=t,h=a;t+u+i>c&&(f=t-u,f<i&&(f=i)),a+d+i>y&&(h=y-d-i,h<i&&(h=i)),m({x:f,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.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 n=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:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:n(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 yt={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 sd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:p,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:i=true}){let c=react.useRef(false),y=react.useCallback(g=>{c.current=g;},[]),f=react.useCallback(g=>{let k=[],N=x=>{for(let M of x)k.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&N(M.subtasks);};return N(g),k},[]),h=react.useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),v=react.useCallback((g,k)=>{let N=f(e);if(N.length===0)return;let x=h();if(!x){a(N[0].id,false);return}let M=N.findIndex(D=>D.id===x.id);if(M===-1)return;let T=g==="up"?M-1:M+1;if(T<0||T>=N.length)return;let B=N[T];a(B.id,k);},[e,h,f,a]),b=react.useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||c.current){g.key==="Escape"&&(k.blur(),c.current=false);return}let M=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,T=Array.from(t),B=h();if(g.key==="ArrowUp"){g.preventDefault(),v("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),v("down",g.shiftKey);return}if(B&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!B.isExpanded||g.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){T.length>0&&(g.preventDefault(),l(T,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){T.length>0&&(g.preventDefault(),p(T));return}if(g.key==="Tab"&&g.shiftKey){T.length>0&&(g.preventDefault(),m(T));return}if(g.key==="Enter"&&!g.shiftKey&&!M){B&&(g.preventDefault(),r(B.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!M){B&&(g.preventDefault(),r(B.id,"above"));return}if(g.key==="Enter"&&M){B&&(g.preventDefault(),d(B.id));return}if(g.key==="F2"){B&&(g.preventDefault(),n(B.id));return}if(g.key==="Delete"||g.key==="Backspace"&&M){T.length>0&&(g.preventDefault(),o(T));return}if(g.key==="d"&&M&&!g.shiftKey){T.length>0&&(g.preventDefault(),s(T));return}},[i,t,h,v,r,o,s,l,p,m,n,u,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:y}}function ld(){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(i=>{let c=new Set(i);return c.has(d)?c.delete(d):c.add(d),c}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let c=i.indexOf(a),y=i.indexOf(d);if(c===-1||y===-1){o(d);return}let f=Math.min(c,y),h=Math.max(c,y),v=i.slice(f,h+1);t(new Set(v)),r(d);},[a,o]),p=react.useCallback((d,i,c,y)=>{y?l(d,i):c?s(d):o(d);},[o,s,l]),m=react.useCallback((d,i)=>{i?t(c=>{let y=new Set(c);return y.add(d),y}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:u}}function Gr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let p={...r[l],parentId:o,level:s,position:l};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function dd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=dd(a.subtasks,t);if(r)return r}}return null}function Ss(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ss(a.subtasks,t);if(r)return r}return null}function Es(e,t){if(t.length===0)return e;let a=Gr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let c=[];return {tasks:d.filter(f=>{if(i.has(f.id))return c.push(f),false;if(f.subtasks){let h=l(f.subtasks,i);f.subtasks=h.tasks,c.push(...h.removed);}return true}),removed:c}},p=(d,i,c)=>d.map(y=>y.id===i?{...y,subtasks:[...y.subtasks||[],...c],isExpanded:true}:y.subtasks?{...y,subtasks:p(y.subtasks,i,c)}:y),m=new Set(t),{tasks:n,removed:u}=l(e,m);return p(n,s.id,u)}function Ps(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ss(a,r);if(!o)continue;let s=Ss(a,o.id),l=(n,u,d)=>{for(let i=0;i<n.length;i++){let c=n[i];if(c.id===u&&c.subtasks){let y=c.subtasks.findIndex(f=>f.id===d);if(y!==-1){let[f]=c.subtasks.splice(y,1);return f}}if(c.subtasks){let y=l(c.subtasks,u,d);if(y)return y}}return null},p=(n,u,d)=>{let i=n.findIndex(c=>c.id===u);if(i!==-1)return n.splice(i+1,0,d),n;for(let c of n)c.subtasks&&p(c.subtasks,u,d);return n},m=l(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function Ms(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,p,m)=>{let n=l.findIndex(d=>d.id===p);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?n-1:n+1;return u<0||u>=l.length?false:([l[n],l[u]]=[l[u],l[n]],true)};return s(r,o,a),r}function As(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 Is(e,t){let a=[...e];for(let r of t){let o=l=>{let p=l.findIndex(u=>u.id===r);if(p===-1){for(let u of l)if(u.subtasks&&o(u.subtasks))return true;return false}let m=l[p],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return l.splice(p+1,0,n),true},s=l=>l.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function cd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let n=m.findIndex(d=>d.id===t);if(n===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?n:n+1;return m.splice(u,0,l),true};return p(r),{tasks:r,newTask:l}}function Ls(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ls(r.subtasks,t,a)}:r)}function Fs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fs(a.subtasks,t)}:a)}function Bs(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(p),color:r?.color||"#3B82F6"},n=u=>u.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,m],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:m}}function pd(e,t,a,r){if(t===a)return e;let o=dd(e,t);if(!o)return e;if(a){let p=(m,n)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===n||p(u,n))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),l=s(e);if(a===null){let p=r!==void 0?r:l.length;l.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(n=>{if(n.id===a){let u=n.subtasks||[],d=r!==void 0?r:u.length,i=[...u];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:p(n.subtasks)}:n});l=p(l);}return l}function Qo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:p,onTaskToggle:m,scrollTop:n,columns:u,onToggleColumn:d,onColumnResize:i,onTaskUpdate:c,onTaskIndent:y,onTaskOutdent:f,onTaskMove:h,onMultiTaskDelete:v,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:N,onOpenTaskModal:x,onDeleteRequest:M,onTaskReparent:T}){let B=react.useContext(Wr),[D,w]=react.useState(null),[U,A]=react.useState(false),[H,q]=react.useState(null),[ve,we]=react.useState(""),Ae=react.useRef(null),Re=react.useRef(null),[R,S]=react.useState(null),[z,E]=react.useState(0),[Y,ae]=react.useState(0),[X,me]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[be,Ke]=react.useState(null),[ue,Ye]=react.useState(null),[F,ne]=react.useState(null),Se=react.useRef(0),Me=5,Ie=react.useRef(false),[et,It]=react.useState(null),[ke,tt]=react.useState(false),[Ze,ot]=react.useState(null);react.useEffect(()=>{function G(V){Ae.current&&!Ae.current.contains(V.target)&&A(false);}if(U)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[U]),react.useEffect(()=>{H&&Re.current&&(Re.current.focus(),Re.current.select());},[H]),react.useEffect(()=>{if(!R)return;let G=st=>{let ze=st.clientX-z,ge=Y+ze;i?.(R,ge);},V=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",V),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",V),document.body.style.cursor="",document.body.style.userSelect="";}},[R,z,Y,i]);let{selectedTaskIds:xt,handleTaskClick:fe,isTaskSelected:O}=ld(),{setIsEditing:Ce}=sd({tasks:e,selectedTaskIds:xt,onTaskSelect:(G,V)=>{let ze=Gr(e).map(ge=>ge.id);fe(G,ze,V||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:G=>{let V=Gr(e).find(st=>st.id===G);V&&Q(V);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:G=>{let V=Gr(e).find(st=>st.id===G);V&&x&&x(V);},enableKeyboard:true}),qe=(G,V=0)=>{let st=[];for(let ze of G)st.push({task:ze,level:V}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&st.push(...qe(ze.subtasks,V+1));return st},je=qe(e),Dt=48,J=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,Q=G=>{q(G.id),we(G.name),Ce(true);},xe=G=>{ve.trim()&&ve!==e.find(V=>V.id===G)?.name&&k?.(G,ve.trim()),q(null),we(""),Ce(false);},Ee=()=>{q(null),we(""),Ce(false);},K=(G,V)=>{V.stopPropagation(),N?.(G.id);},Pe=(G,V)=>{V.preventDefault(),Se.current=V.clientY,Ke(G),Ie.current=false,tt(false),It({x:V.clientX,y:V.clientY});},ye=G=>{if(!be||(Math.abs(G.clientY-Se.current)>Me&&!Ie.current&&(Ie.current=true,tt(true)),It({x:G.clientX,y:G.clientY}),!Ie.current))return;let st=document.querySelectorAll("[data-task-row]"),ze=null,ge=null;st.forEach(Vt=>{let kt=Vt.getBoundingClientRect(),$=Vt.getAttribute("data-task-row");if($&&$!==be&&G.clientY>=kt.top&&G.clientY<=kt.bottom){ze=$;let de=G.clientY-kt.top,Te=kt.height;de<Te*.25?ge="above":de>Te*.75?ge="below":ge="child";}}),Ye(ze),ne(ge);},De=()=>{if(Ie.current&&be&&ue&&F){if(F==="child")T?.(be,ue);else if(F==="above"||F==="below"){let G=(ze,ge,Vt=null)=>{for(let kt of ze){if(kt.id===ge)return Vt;if(kt.subtasks){let $=G(kt.subtasks,ge,kt.id);if($!==void 0)return $}}},V=G(e,ue,null),st=(ze,ge)=>{let Vt=ze.findIndex(kt=>kt.id===ge);return F==="below"?Vt+1:Vt};if(V===null){let ze=st(e,ue);T?.(be,null,ze);}else {let ze=je.find(ge=>ge.task.id===V)?.task;if(ze?.subtasks){let ge=st(ze.subtasks,ue);T?.(be,V,ge);}}}}Ke(null),Ye(null),ne(null),It(null),Ie.current=false,tt(false);};react.useEffect(()=>{if(be)return document.addEventListener("mousemove",ye),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[be,ue,F]);let le=(G,V,st)=>{switch(G.id){case "name":let ze=H===V.id,ge=D===V.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${st*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ge?1:.3},onMouseDown:se=>Pe(V.id,se),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),V.subtasks&&V.subtasks.length>0?jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),m?.(V.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:V.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"}),!(V.subtasks&&V.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:V.color||"#3B82F6",opacity:V.parentId?.6:1,borderColor:V.isMilestone?t.accent:"transparent",borderWidth:V.isMilestone?"2px":"0px"},title:V.isMilestone?"Milestone":V.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:Re,type:"text",value:ve,onChange:se=>we(se.target.value),onKeyDown:se=>{se.key==="Enter"?xe(V.id):se.key==="Escape"&&Ee();},onBlur:()=>xe(V.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:se=>se.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:V.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:V.parentId?"13px":"14px",fontWeight:V.isMilestone?600:V.parentId?400:600,letterSpacing:V.parentId?"0":"-0.01em"},title:V.name,children:V.name}),ge&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:se=>K(V,se),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:se=>{se.stopPropagation(),Q(V);},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 kt=G.id==="startDate"?"startDate":"endDate",$=V[kt],de=Ze?.taskId===V.id&&Ze?.field===kt,Te=se=>se?(typeof se=="string"?new Date(se):se).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:se=>se.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:se=>{if(de)ot(null);else {let wt=se.currentTarget.getBoundingClientRect();ot({taskId:V.id,field:kt,month:$?typeof $=="string"?new Date($):$:new Date,position:{top:wt.bottom+4,left:wt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Te($)})]}),de&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ot(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:Ze?.position.top,left:Ze?.position.left},onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,wt=new Date(se);wt.setDate(se.getDate()+1);let Jt=new Date(se);Jt.setDate(se.getDate()+7);let Sr=new Date(se);return Sr.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:wt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Sr}].map((Pr,za)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:sr=>sr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:sr=>sr.currentTarget.style.backgroundColor="transparent",onClick:()=>{c?.(V.id,{[kt]:Pr.date}),ot(null);},children:Pr.label},za))})(),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:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{c?.(V.id,{[kt]:void 0}),ot(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:()=>ot(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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:Ze?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ot(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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((se,wt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},wt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=Ze?.month||new Date,wt=se.getFullYear(),Jt=se.getMonth(),Sr=new Date(wt,Jt,1).getDay(),Er=new Date(wt,Jt+1,0).getDate(),Pr=new Date,za=[];for(let Nt=Sr-1;Nt>=0;Nt--)za.push({day:new Date(wt,Jt,-Nt).getDate(),date:new Date(wt,Jt-1,new Date(wt,Jt,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=Er;Nt++)za.push({day:Nt,date:new Date(wt,Jt,Nt),isCurrentMonth:true});let sr=42-za.length;for(let Nt=1;Nt<=sr;Nt++)za.push({day:Nt,date:new Date(wt,Jt+1,Nt),isCurrentMonth:false});return za.map((Nt,So)=>{let Eo=Nt.date.toDateString()===Pr.toDateString(),Jr=($?typeof $=="string"?new Date($):$:null)?.toDateString()===Nt.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:Nt.isCurrentMonth?Jr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Jr?"#3B82F6":"transparent",boxShadow:Eo&&!Jr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{c?.(V.id,{[kt]:Nt.date}),ot(null);},children:Nt.day},So)})})()})]})]})]}),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:J(V)})});case "assignees":let $t=r.filter(se=>V.assignees?.some(wt=>wt.name===se.name||wt.initials===se.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(pr,{assignedUsers:$t,availableUsers:r,onChange:se=>{let wt=se.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));c?.(V.id,{assignees:wt.length>0?wt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(dl,{status:V.status||"todo",onChange:se=>{c?.(V.id,{status:se,progress:se==="completed"?100:V.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:`${V.progress}%`,backgroundColor:V.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:[V.progress,"%"]})]});case "priority":let ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ya={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xr=ea[V.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(dr,{priority:Xr,onChange:se=>{se&&c?.(V.id,{priority:Ya[se]||"medium"});}})});default:return null}},Be=G=>[{id:"hide",label:"Hide Column",icon:yt.Hide,onClick:()=>d(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:yt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:yt.SortDesc,onClick:()=>{}}],Le=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:yt.Add,onClick:()=>{N?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:yt.Delete,onClick:()=>{M?M(G.id,G.name):v?.([G.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:yt.Pencil,onClick:()=>{l?.(G);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:yt.Add,onClick:()=>{N?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:yt.MarkIncomplete,onClick:()=>{c?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:yt.SetInProgress,onClick:()=>{c?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:yt.MarkComplete,onClick:()=>{c?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:yt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:yt.Delete,onClick:()=>{M?M(G.id,G.name):v?.([G.id]);}}],Oe=u.filter(G=>G.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Dt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Oe.map((G,V)=>{let st=V===Oe.length-1,ze=G.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${ze?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(ze?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:st?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ge=>{ge.preventDefault(),me({isOpen:true,x:ge.clientX,y:ge.clientY,type:"header",columnId:G.id});},onMouseEnter:ge=>{ge.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ge=>{ge.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:ze?"70px":"0"},title:G.label,children:G.label}),ze&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Xo,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>A(!U),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),G.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:R===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ge=>{ge.preventDefault(),ge.stopPropagation(),S(G.id),E(ge.clientX),ae(G.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},G.id)}),U&&jsxRuntime.jsxs("div",{ref:Ae,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:G=>G.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>A(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",children:je.map(({task:G,level:V},st)=>{let ze=O(G.id),ge=ue===G.id,Vt=ge&&F==="above",kt=ge&&F==="below",$=ge&&F==="child",de={};return $&&(de.backgroundColor=`${t.accent}15`,de.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${be===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:$?`${t.accent}15`:st%2===0?t.bgPrimary:t.bgGrid,...de},onMouseEnter:()=>w(G.id),onMouseLeave:()=>w(null),onClick:Te=>{let ea=Gr(e).map(se=>se.id),Xr=navigator.platform.toUpperCase().indexOf("MAC")>=0?Te.metaKey:Te.ctrlKey;fe(G.id,ea,Xr,Te.shiftKey),s?.(G);},onDoubleClick:Te=>{Te.stopPropagation(),l?.(G);},onContextMenu:Te=>{Te.preventDefault(),me({isOpen:true,x:Te.clientX,y:Te.clientY,type:"task",task:G}),p?.(G,Te);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:[Vt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),kt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Oe.map((Te,$t)=>{let ea=$t===Oe.length-1,Ya=Te.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ya?"justify-start":"justify-center"}`,style:{width:`${Te.width}px`,minWidth:`${Te.minWidth??(Ya?200:60)}px`,maxWidth:`${Te.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${D===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:le(Te,G,Ya?V:0)},`${G.id}-${Te.id}`)})]},G.id)})}),jsxRuntime.jsx(Hr,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?Be(X.columnId):X.type==="task"&&X.task?Le(X.task):[],onClose:()=>me({...X,isOpen:false}),theme:t}),ke&&et&&be&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:et.x+12,top:et.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=je.find(V=>V.task.id===be)?.task;return G?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:G.name})}):null})()}),document.body)]})}function bd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,p]=react.useState(e),[m,n]=react.useState(t),[u,d]=react.useState(null),[i,c]=react.useState(null),[y,f]=react.useState(null),[h,v]=react.useState(null),[b,g]=react.useState(0),[k,N]=react.useState(0),[x,M]=react.useState(null),[T,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:p,ghostWidth:m,setGhostWidth:n,connectionLine:u,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:c,activeZone:y,setActiveZone:f,draggedSegmentIndex:h,setDraggedSegmentIndex:v,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:N,hoveredSegmentIndex:x,setHoveredSegmentIndex:M,isHovered:T,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,q)=>{r("none"),d(null),c(null),p(H),n(q),N(0),v(null),g(0);}}}function en({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:p,onClick:m,onDoubleClick:n,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:c=[],onDragMove:y,onHoverChange:f}){let h=bd(t,r),v=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:N,ghostX:x,setGhostX:M,ghostWidth:T,setGhostWidth:B,connectionLine:D,setConnectionLine:w,hoveredTaskId:U,setHoveredTaskId:A,activeZone:H,setActiveZone:q,draggedSegmentIndex:ve,setDraggedSegmentIndex:we,draggedSegmentStartX:Ae,setDraggedSegmentStartX:Re,segmentDragOffsetX:R,setSegmentDragOffsetX:S,hoveredSegmentIndex:z,setHoveredSegmentIndex:E,isHovered:Y,setIsHovered:ae,isDragging:X,isResizing:me,isConnecting:be,resetDragState:Ke}=h,ue=32,Ye=8,F=e.endDate&&e.endDate<new Date&&e.progress<100,ne=e.isCriticalPath,Se=o.name==="neutral"||o.today==="#1C1917",Me=e.status==="completed"||e.progress===100,Ie={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},It=e.isCriticalPath||F?"#DC2626":e.color?e.color:e.priority&&Ie[e.priority]?Ie[e.priority]:o.taskBarPrimary,tt=(K=>K>=80?20:K>=60?15:K>=50?12:10)(r),Ze=r<50,ot=r<40;react.useEffect(()=>{if(f)if(Y&&!X&&!e.segments){let K=a<100;f({task:e,x:t,y:a,width:r,height:ue,showBelow:K});}else f(null);},[Y,X,e,t,a,r,ue,f]);let xt=K=>K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),fe=()=>{let K=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${K} day${K!==1?"s":""}`},O=K=>Math.round(K/s)*s,Ce=K=>{let Pe=Math.round(K/s),ye=new Date(l);return ye.setDate(ye.getDate()+Pe),ye},qe=(K,Pe)=>{for(let ye of c){if(ye.id===e.id)continue;let De=5;if(K>=ye.x-De&&K<=ye.x+ye.width+De&&Pe>=ye.y-De&&Pe<=ye.y+ye.height+De)return ye.id}return null},je=react.useCallback((K,Pe,ye)=>{K.preventDefault(),K.stopPropagation();let De=v.current?.ownerSVGElement;if(!De)return;let le=De.createSVGPoint();le.x=K.clientX,le.y=K.clientY;let Be=le.matrixTransform(De.getScreenCTM()?.inverse()),Le=ye!==void 0?ye:t,Oe=Pe;if(!Oe){let G=Be.x-Le;K.shiftKey?(Oe="connect",w({x:t+r,y:a+ue/2})):K.ctrlKey||K.metaKey?Oe="move":K.altKey?Oe=G<r/2?"resize-start":"resize-end":ot?G<r/2?Oe="move":Oe="resize-end":Ze?G<=tt/2?Oe="resize-start":G>=r-tt/2?Oe="resize-end":Oe="move":G<=tt?Oe="resize-start":G>=r-tt?Oe="resize-end":Oe="move";}g(Oe),ae(false),q(null),Oe==="move"?N(Be.x-Le):Oe==="connect"?w({x:t+r,y:a+ue/2}):N(0),M(Le),B(r);},[t,r,a,ue]),Dt=react.useCallback(K=>{if(b==="none")return;let Pe=v.current?.ownerSVGElement;if(!Pe)return;let ye=Pe.createSVGPoint();ye.x=K.clientX,ye.y=K.clientY;let De=ye.matrixTransform(Pe.getScreenCTM()?.inverse());if(b==="connect"){w({x:De.x,y:De.y});let le=qe(De.x,De.y);A(le);}else if(b==="move"){let le=De.x-k,Be=O(le);M(Be),B(r);let Le=Math.round((Be-t)/s);if(y?.(e.id,Le,true),e.segments&&e.segments.length>0&&ve!==null){let Oe=Be-Ae;S(Oe);}}else if(b==="resize-start"){let le=De.x,Be=O(le),Le=t+r-Be;Le>=s&&(M(Be),B(Le));}else if(b==="resize-end"){let le=De.x,Le=O(le)-t;Le>=s&&B(Le);}},[b,t,r,s,k,e,O,ve,Ae,qe,A,w,M,B,S,y]),J=react.useCallback(()=>{if(b!=="none"){if(b==="connect")U&&i&&i(e,U),w(null),A(null);else {let K=e.endDate.getTime()-e.startDate.getTime(),Pe,ye,De=true;if(b==="move"){if(Pe=Ce(x),ye=new Date(Pe.getTime()+K),e.segments&&e.segments.length>0&&ve!==null){let le=Math.round(R/s),Be=e.segments.map((V,st)=>{if(st===ve){let ze=new Date(V.startDate),ge=new Date(V.endDate);return ze.setDate(ze.getDate()+le),ge.setDate(ge.getDate()+le),{startDate:ze,endDate:ge}}return V}),Le=Be.flatMap(V=>[V.startDate,V.endDate]),Oe=new Date(Math.min(...Le.map(V=>V.getTime()))),G=new Date(Math.max(...Le.map(V=>V.getTime())));d?.({...e,segments:Be},Oe,G),Ke(t,r);return}}else b==="resize-start"?(Pe=Ce(x),ye=e.endDate,Pe>=ye&&(console.warn("Invalid date range: start date must be before end date"),De=false)):b==="resize-end"?(Pe=e.startDate,ye=Ce(x+T),ye<=Pe&&(console.warn("Invalid date range: end date must be after start date"),De=false)):De=false;De&&Pe&&ye&&(ye.getTime()-Pe.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Pe,ye));}y?.(e.id,0,false),Ke(t,r);}},[b,x,T,e,d,U,i,t,r,s,Ce,R,ve,Ke,y]);react.useEffect(()=>{if(b==="none")return;let K=ye=>{Dt(ye);},Pe=()=>{J();};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",Pe),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Pe);}},[b,Dt,J]);let Q=X&&!be?x:t,xe=X&&!be?T:r,Ee=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,onMouseEnter:()=>!X&&ae(true),onMouseLeave:()=>{X||(ae(false),q(null));},onClick:()=>!X&&m?.(e),onDoubleClick:K=>{X||(K.stopPropagation(),n?.(e));},onContextMenu:K=>{K.preventDefault(),u?.(e,K);},children:[Y&&!X&&!Ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:tt,height:ue,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>q("resize-start"),onMouseDown:K=>je(K,"resize-start")}),jsxRuntime.jsx("rect",{x:t+tt,y:a,width:r-tt*2,height:ue,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>q("move"),onMouseDown:K=>je(K,"move")}),jsxRuntime.jsx("rect",{x:t+r-tt,y:a,width:tt,height:ue,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>q("resize-end"),onMouseDown:K=>je(K,"resize-end")})]}),Y&&!X&&ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ue,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>q("move"),onMouseDown:K=>je(K,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ue,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>q("resize-end"),onMouseDown:K=>je(K,"resize-end")}),Y&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ue-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),X&&!be&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x,y:a,width:T,height:ue,rx:Ye,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:Q,y:a,width:xe,height:ue,rx:Ye,fill:It,"data-task-class":Ee,initial:{opacity:0,scale:.95},animate:{opacity:X&&!be?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!X?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:K=>je(K),style:{cursor:X?be?"crosshair":me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe*(e.progress/100),height:ue,rx:Ye,fill:It,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((K,Pe)=>{let ye=(K.startDate.getTime()-l.getTime())/864e5*s,le=(K.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ye+s,Be=X&&b==="move"&&ve===Pe,Le=z===Pe,Oe=Be?ye+R:ye;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!X&&E(Pe),onMouseLeave:()=>!X&&E(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:le,height:ue,rx:Ye,fill:It,initial:{opacity:0,scale:.95},animate:{opacity:Be||e.parentId?.6:Le?.9:.8,scale:Le&&!X?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:G=>{G.stopPropagation(),we(Pe),Re(ye),je(G,void 0,ye);},style:{cursor:X?be?"crosshair":me?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Oe,y:a,width:le*(e.progress/100),height:ue,rx:Ye,fill:It,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Pe}`)}),Se&&(F||ne)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ne&&!F&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:ue,rx:Ye,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),F&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:ue,rx:Ye,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let K=p.taskLabel(e),Pe=typeof K=="string"?K:e.name,ye=Pe.length>Math.floor(xe/8)?`${Pe.substring(0,Math.floor(xe/8))}...`:Pe;return jsxRuntime.jsx("text",{x:Q+12,y:a+ue/2,dominantBaseline:"middle",fill:Me?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Me?"line-through":"none"},children:ye})})(),xe>100&&e.progress>0&&e.progress<100&&!X&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+xe-12,y:a+ue/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&xe>80&&!X&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Y||me)&&!be&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ze?Q-15:Q-10,y:a-5,width:Ze?25:20,height:ue+10,fill:"transparent",onMouseDown:K=>je(K,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze?Q-8:Q-3,y:a+6,width:Ze?8:6,height:Ze?ue-12:ue-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Q+xe-10,y:a-5,width:Ze?25:20,height:ue+10,fill:"transparent",onMouseDown:K=>je(K,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze?Q+xe:Q+xe-3,y:a+6,width:Ze?8:6,height:Ze?ue-12:ue-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&!X&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+ue/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:K=>{K.stopPropagation(),je(K,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ue/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),be&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ue/2,x2:D.x,y2:D.y,stroke:U?o.statusCompleted:o.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:U?8:6,fill:U?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(Y||X)&&!be&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:xe+4,height:ue+4,rx:Ye+2,fill:"none",stroke:X?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:X?.6:.4,initial:{opacity:0},animate:{opacity:X?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),me&&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+T,y1:0,x2:x+T,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Y&&!X&&!e.segments&&!f&&(()=>{let ye=a<100,De=ye?a+ue+13:a-82-13,le=ye?`M ${Q+xe/2-6} ${a+ue+3} L ${Q+xe/2} ${a+ue+13} L ${Q+xe/2+6} ${a+ue+3}`:`M ${Q+xe/2-6} ${a-13} L ${Q+xe/2} ${a-3} L ${Q+xe/2+6} ${a-13}`,Be=De+22,Le=De+40,Oe=De+55,G=De+70,V=ye?De+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:le,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+xe/2-120,y:De,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:Q+xe/2,y:Be,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:Q+xe/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+xe/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:fe()}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+xe/2+65,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Q+xe/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+xe/2-50,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(st=>st.name).join(", ").substring(0,30),e.assignees.map(st=>st.name).join(", ").length>30?"...":""]})]}),!ye&&jsxRuntime.jsx("text",{x:Q+xe/2,y:V,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ot?"Left: move \u2022 Right: resize":Ze?"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 vd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:p}=e,m=82,n=13,u=p?o+l+n:o-m-n,d=p?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=u+22,c=u+40,y=u+55,f=u+70,h=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==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:i,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:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?h(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function rn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[p,m]=react.useState(false),n=a-e,u=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,c=6,y=Math.atan2(u,n),f=a-c*Math.cos(y-Math.PI/6),h=r-c*Math.sin(y-Math.PI/6),v=a-c*Math.cos(y+Math.PI/6),b=r-c*Math.sin(y+Math.PI/6),g=o.dependency;react.useEffect(()=>{l&&s&&l(p?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[p,e,t,a,r,s,l]);let k=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&m(true),onMouseLeave:()=>!k&&m(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&l?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${h} M ${a} ${r} L ${v} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&l?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:p&&l?0:p?1.3:1,opacity:p&&l?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:N=>{N.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function nn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),p=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(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 re={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=n=>{n.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 l=new Set,p=new Set,m=n=>{if(!l.has(n)){l.add(n),p.add(n);let u=r.get(n)||[];for(let d of u){if(!l.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(n),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=re.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=re.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=re.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=re.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(`
46
- `)},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=re.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=re.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)=>re.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=re.findTaskById(e,t);return !a||!a.dependencies?[]:re.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>re.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>re.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=re.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=>re.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=re.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 l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let n=m.startDate&&m.endDate?re.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?re.formatDate(m.startDate):"N/A",m.endDate?re.formatDate(m.endDate):"N/A",n>0?`${n} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:l,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=re.flattenTasks(e).map(m=>{let n=m.startDate&&m.endDate?re.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?re.formatDate(m.startDate):"","End Date":m.endDate?re.formatDate(m.endDate):"","Duration (days)":n>0?n:"","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),l=[{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"]=l;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=re.flattenTasks(e),o=new Map;r.forEach((i,c)=>{o.set(i.id,c+1);});let s=i=>i.toISOString().replace("Z",""),l=re.getEarliestStartDate(e)||new Date,p=re.getLatestEndDate(e)||new Date,m=r.map((i,c)=>{let y=o.get(i.id),f=i.startDate&&i.endDate?re.calculateDuration(i.startDate,i.endDate):0,h=(i.dependencies||[]).filter(v=>o.has(v)).map(v=>`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function gs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&l.current&&!l.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let d=m.category||"Other";return n[d]||(n[d]=[]),n[d].push(m),n},{});return jsxRuntime.jsxs("div",{className:C("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,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:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:C("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(p).map(([n,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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))})]},n)),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 bs({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,c]=react.useState("export"),[p,n]=react.useState("json"),[m,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let b=o?.current||void 0,g=await Ui(e,p,b);Wi(g,p);},y=async b=>{let g=b.target.files?.[0];if(g){try{let v=await _i(g),h=g.name.endsWith(".json")?"json":"csv",f=Gi(v,h);d(f),f.success&&r&&r(f,v);}catch(v){d({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:C("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:()=>c("export"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="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:[l==="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(b=>jsxRuntime.jsxs("button",{onClick:()=>n(b),className:C("p-4 rounded-lg border-2 transition-all text-center",p===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:u,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"})]}),l==="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:i,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:C("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:C("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((b,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},g))})]})]})]})]})]})}var xu=["URGENT","HIGH","MEDIUM","LOW"],ku=[{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"}],wu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function hs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:d=true,compact:i=false,groupBy:u="none",onGroupByChange:y}){let[b,g]=react.useState(true),v=react.useCallback(x=>{a({search:x.target.value});},[a]),h=react.useCallback(x=>{a({dateFilter:x.target.value});},[a]),f=react.useCallback(x=>{r({by:x.target.value});},[r]),k=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:x=>{x.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:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:v,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:x=>{let P=x.target.value;a({priorities:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),xu.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:x=>{let P=x.target.value;a({assignees:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(x=>jsxRuntime.jsx("option",{value:x.id,children:x.name},x.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:x=>{let P=x.target.value;a({labels:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(x=>jsxRuntime.jsx("option",{value:x,children:x},x))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:ku.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:x=>y(x.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:wu.map(x=>jsxRuntime.jsx("option",{value:x.value,children:x.label},x.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:C("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 vs={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"}},xs={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"}},ks={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"}},br={dark:vs,light:xs,neutral:ks},jo="dark";var Ko=react.createContext(void 0),Iu="asakaa-theme";function _l({children:e,defaultTheme:t=jo,storageKey:a=Iu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=br[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${Lu(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let i=p.colors[m];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:br};return jsxRuntime.jsx(Ko.Provider,{value:l,children:e})}function zr(){let e=react.useContext(Ko);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Lu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ws({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=zr();return e?jsxRuntime.jsxs("div",{className:C("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(br).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:C("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:l.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.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 Vl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return He[e]||He.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",He[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",He[e].bgSecondary),bgGrid:r("--theme-bg-card",He[e].bgGrid),bgWeekend:r("--theme-bg-hover",He[e].bgWeekend),border:r("--theme-border-primary",He[e].border),borderLight:r("--theme-border-subtle",He[e].borderLight),textPrimary:r("--theme-text-primary",He[e].textPrimary),textSecondary:r("--theme-text-secondary",He[e].textSecondary),textTertiary:r("--theme-text-tertiary",He[e].textTertiary),accent:r("--theme-accent-primary",He[e].accent),accentHover:r("--theme-accent-hover",He[e].accentHover),accentLight:r("--theme-accent-primary",He[e].accentLight),taskBarPrimary:r("--theme-accent-primary",He[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",He[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",He[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",He[e].dependency),dependencyHover:r("--theme-border-secondary",He[e].dependencyHover),criticalPath:r("--theme-error",He[e].criticalPath),criticalPathLight:r("--theme-error",He[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",He[e].today):e==="neutral"?r("--theme-text-primary",He[e].today):r("--theme-error",He[e].today),todayLight:e==="light"?r("--theme-accent-primary",He[e].todayLight):e==="neutral"?r("--theme-text-primary",He[e].todayLight):r("--theme-error",He[e].todayLight),milestone:r("--theme-warning",He[e].milestone),milestoneLight:r("--theme-warning",He[e].milestoneLight),statusTodo:r("--theme-text-tertiary",He[e].statusTodo),statusInProgress:r("--theme-accent-primary",He[e].statusInProgress),statusCompleted:r("--theme-success",He[e].statusCompleted),hoverBg:r("--theme-bg-hover",He[e].hoverBg),focusRing:r("--theme-accent-primary",He[e].focusRing)}}var Yo={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"},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"}},jl={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"},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"}},Cs={en:Yo,es:jl};function Kl(e){return Cs[e]||Cs.en}function Ts(e,t){let a=Kl(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 Wr=react.createContext(Yo);function po(){return react.useContext(Wr)}function Xu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[c,p]=react.useState(false),[n,m]=react.useState(null),d=react.useRef(null),i=po();if(react.useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&p(false);};return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!(t||a||r||o||s||l))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(g=>g.handler),b=async(g,v)=>{if(v){m(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(g.id,g.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===g.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):g.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ju({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 l=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:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&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:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Zu({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 Qu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=po();react.useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],p=c.find(n=>n.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:`${l.toolbar.density||"Density"}: ${p}`,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:c.map((n,m)=>{let d=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.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:m<c.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:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function qo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:i,onExportPNG:u,onExportPDF:y,onExportExcel:b,onExportCSV:g,onExportJSON:v,onExportMSProject:h}){let f=po(),k=u||y||b||g||v||h,D=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.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(Zu,{options:D,value:t,onChange:P=>a(P),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(Qu,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,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||f.toolbar.createTask})]}),(k||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Xu,{theme:e,onExportPNG:u,onExportPDF:y,onExportExcel:b,onExportCSV:g,onExportJSON:v,onExportMSProject:h}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Ju,{options:x,value:s,onChange:P=>l(P),theme:e})]})]})}function Xo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();l({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(at,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor: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"}),n.map(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Hr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[c,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,i=8,u=window.innerWidth,y=window.innerHeight,b=t,g=a;t+m+i>u&&(b=t-m,b<i&&(b=i)),a+d+i>y&&(g=y-d-i,g<i&&(g=i)),p({x:b,y:g});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let m=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(m=>jsxRuntime.jsxs("div",{children:[m.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var vt={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 sd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:i=true}){let u=react.useRef(false),y=react.useCallback(f=>{u.current=f;},[]),b=react.useCallback(f=>{let k=[],D=x=>{for(let P of x)k.push(P),P.subtasks&&P.subtasks.length>0&&P.isExpanded&&D(P.subtasks);};return D(f),k},[]),g=react.useCallback(()=>{let f=b(e);for(let k of f)if(t.has(k.id))return k;return null},[e,t,b]),v=react.useCallback((f,k)=>{let D=b(e);if(D.length===0)return;let x=g();if(!x){a(D[0].id,false);return}let P=D.findIndex(N=>N.id===x.id);if(P===-1)return;let T=f==="up"?P-1:P+1;if(T<0||T>=D.length)return;let O=D[T];a(O.id,k);},[e,g,b,a]),h=react.useCallback(f=>{if(!i)return;let k=f.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){f.key==="Escape"&&(k.blur(),u.current=false);return}let P=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,T=Array.from(t),O=g();if(f.key==="ArrowUp"){f.preventDefault(),v("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),v("down",f.shiftKey);return}if(O&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){O.subtasks&&O.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!O.isExpanded||f.key==="ArrowLeft"&&O.isExpanded)&&m(O.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){T.length>0&&(f.preventDefault(),l(T,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){T.length>0&&(f.preventDefault(),c(T));return}if(f.key==="Tab"&&f.shiftKey){T.length>0&&(f.preventDefault(),p(T));return}if(f.key==="Enter"&&!f.shiftKey&&!P){O&&(f.preventDefault(),r(O.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!P){O&&(f.preventDefault(),r(O.id,"above"));return}if(f.key==="Enter"&&P){O&&(f.preventDefault(),d(O.id));return}if(f.key==="F2"){O&&(f.preventDefault(),n(O.id));return}if(f.key==="Delete"||f.key==="Backspace"&&P){T.length>0&&(f.preventDefault(),o(T));return}if(f.key==="d"&&P&&!f.shiftKey){T.length>0&&(f.preventDefault(),s(T));return}},[i,t,g,v,r,o,s,l,c,p,n,m,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[i,h]),{setIsEditing:y}}function ld(){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(i=>{let u=new Set(i);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let u=i.indexOf(a),y=i.indexOf(d);if(u===-1||y===-1){o(d);return}let b=Math.min(u,y),g=Math.max(u,y),v=i.slice(b,g+1);t(new Set(v)),r(d);},[a,o]),c=react.useCallback((d,i,u,y)=>{y?l(d,i):u?s(d):o(d);},[o,s,l]),p=react.useCallback((d,i)=>{i?t(u=>{let y=new Set(u);return y.add(d),y}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function Gr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:s,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function dd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=dd(a.subtasks,t);if(r)return r}}return null}function Ss(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ss(a.subtasks,t);if(r)return r}return null}function Es(e,t){if(t.length===0)return e;let a=Gr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let u=[];return {tasks:d.filter(b=>{if(i.has(b.id))return u.push(b),false;if(b.subtasks){let g=l(b.subtasks,i);b.subtasks=g.tasks,u.push(...g.removed);}return true}),removed:u}},c=(d,i,u)=>d.map(y=>y.id===i?{...y,subtasks:[...y.subtasks||[],...u],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,i,u)}:y),p=new Set(t),{tasks:n,removed:m}=l(e,p);return c(n,s.id,m)}function Ps(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ss(a,r);if(!o)continue;let s=Ss(a,o.id),l=(n,m,d)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let y=u.subtasks.findIndex(b=>b.id===d);if(y!==-1){let[b]=u.subtasks.splice(y,1);return b}}if(u.subtasks){let y=l(u.subtasks,m,d);if(y)return y}}return null},c=(n,m,d)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,d),n;for(let u of n)u.subtasks&&c(u.subtasks,m,d);return n},p=l(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function Ms(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,c,p)=>{let n=l.findIndex(d=>d.id===c);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=l.length?false:([l[n],l[m]]=[l[m],l[n]],true)};return s(r,o,a),r}function As(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 Is(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(m=>m.id===r);if(c===-1){for(let m of l)if(m.subtasks&&o(m.subtasks))return true;return false}let p=l[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return l.splice(c+1,0,n),true},s=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function cd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(d=>d.id===t);if(n===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,l),true};return c(r),{tasks:r,newTask:l}}function Ls(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ls(r.subtasks,t,a)}:r)}function Fs(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fs(a.subtasks,t)}:a)}function Bs(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,p],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:p}}function pd(e,t,a,r){if(t===a)return e;let o=dd(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),l=s(e);if(a===null){let c=r!==void 0?r:l.length;l.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],d=r!==void 0?r:m.length,i=[...m];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});l=c(l);}return l}function Qo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:d,onColumnResize:i,onTaskUpdate:u,onTaskIndent:y,onTaskOutdent:b,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:f,onTaskRename:k,onCreateSubtask:D,onOpenTaskModal:x,onDeleteRequest:P,onTaskReparent:T}){let O=react.useContext(Wr),[N,w]=react.useState(null),[F,M]=react.useState(false),[H,X]=react.useState(null),[ye,ke]=react.useState(""),Ae=react.useRef(null),ze=react.useRef(null),[$,L]=react.useState(null),[z,S]=react.useState(0),[R,ae]=react.useState(0),[q,Ee]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[xe,Je]=react.useState(null),[J,qe]=react.useState(null),[Ve,gt]=react.useState(null),lt=react.useRef(0),U=5,ne=react.useRef(false),[Pe,Ue]=react.useState(null),[Me,Be]=react.useState(false),[Ze,we]=react.useState(null);react.useEffect(()=>{function _(j){Ae.current&&!Ae.current.contains(j.target)&&M(false);}if(F)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[F]),react.useEffect(()=>{H&&ze.current&&(ze.current.focus(),ze.current.select());},[H]),react.useEffect(()=>{if(!$)return;let _=nt=>{let We=nt.clientX-z,ue=R+We;i?.($,ue);},j=()=>{L(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[$,z,R,i]);let{selectedTaskIds:It,handleTaskClick:ge,isTaskSelected:B}=ld(),{setIsEditing:he}=sd({tasks:e,selectedTaskIds:It,onTaskSelect:(_,j)=>{let We=Gr(e).map(ue=>ue.id);ge(_,We,j||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:_=>{let j=Gr(e).find(nt=>nt.id===_);j&&ee(j);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let j=Gr(e).find(nt=>nt.id===_);j&&x&&x(j);},enableKeyboard:true}),je=(_,j=0)=>{let nt=[];for(let We of _)nt.push({task:We,level:j}),We.subtasks&&We.subtasks.length>0&&We.isExpanded&&nt.push(...je(We.subtasks,j+1));return nt},Xe=je(e),Dt=48,Z=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ee=_=>{X(_.id),ke(_.name),he(true);},ve=_=>{ye.trim()&&ye!==e.find(j=>j.id===_)?.name&&k?.(_,ye.trim()),X(null),ke(""),he(false);},Ne=()=>{X(null),ke(""),he(false);},Y=(_,j)=>{j.stopPropagation(),D?.(_.id);},Se=(_,j)=>{j.preventDefault(),lt.current=j.clientY,Je(_),ne.current=false,Be(false),Ue({x:j.clientX,y:j.clientY});},be=_=>{if(!xe||(Math.abs(_.clientY-lt.current)>U&&!ne.current&&(ne.current=true,Be(true)),Ue({x:_.clientX,y:_.clientY}),!ne.current))return;let nt=document.querySelectorAll("[data-task-row]"),We=null,ue=null;nt.forEach(Vt=>{let kt=Vt.getBoundingClientRect(),W=Vt.getAttribute("data-task-row");if(W&&W!==xe&&_.clientY>=kt.top&&_.clientY<=kt.bottom){We=W;let ce=_.clientY-kt.top,Ce=kt.height;ce<Ce*.25?ue="above":ce>Ce*.75?ue="below":ue="child";}}),qe(We),gt(ue);},Te=()=>{if(ne.current&&xe&&J&&Ve){if(Ve==="child")T?.(xe,J);else if(Ve==="above"||Ve==="below"){let _=(We,ue,Vt=null)=>{for(let kt of We){if(kt.id===ue)return Vt;if(kt.subtasks){let W=_(kt.subtasks,ue,kt.id);if(W!==void 0)return W}}},j=_(e,J,null),nt=(We,ue)=>{let Vt=We.findIndex(kt=>kt.id===ue);return Ve==="below"?Vt+1:Vt};if(j===null){let We=nt(e,J);T?.(xe,null,We);}else {let We=Xe.find(ue=>ue.task.id===j)?.task;if(We?.subtasks){let ue=nt(We.subtasks,J);T?.(xe,j,ue);}}}}Je(null),qe(null),gt(null),Ue(null),ne.current=false,Be(false);};react.useEffect(()=>{if(xe)return document.addEventListener("mousemove",be),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,J,Ve]);let de=(_,j,nt)=>{switch(_.id){case "name":let We=H===j.id,ue=N===j.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${nt*20}px`},children:[T&&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:ue?1:.3},onMouseDown:ie=>Se(j.id,ie),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:ie=>{ie.stopPropagation(),p?.(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"}),!(j.subtasks&&j.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 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"}),We?jsxRuntime.jsx("input",{ref:ze,type:"text",value:ye,onChange:ie=>ke(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ve(j.id):ie.key==="Escape"&&Ne();},onBlur:()=>ve(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:ie=>ie.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}),ue&&!We&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>Y(j,ie),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:ie=>{ie.stopPropagation(),ee(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 kt=_.id==="startDate"?"startDate":"endDate",W=j[kt],ce=Ze?.taskId===j.id&&Ze?.field===kt,Ce=ie=>ie?(typeof ie=="string"?new Date(ie):ie).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:ie=>ie.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:ie=>{if(ce)we(null);else {let wt=ie.currentTarget.getBoundingClientRect();we({taskId:j.id,field:kt,month:W?typeof W=="string"?new Date(W):W:new Date,position:{top:wt.bottom+4,left:wt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Ce(W)})]}),ce&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>we(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:Ze?.position.top,left:Ze?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,wt=new Date(ie);wt.setDate(ie.getDate()+1);let Jt=new Date(ie);Jt.setDate(ie.getDate()+7);let Sr=new Date(ie);return Sr.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:wt},{label:"Pr\xF3xima semana",date:Jt},{label:"2 semanas",date:Sr}].map((Pr,za)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ir=>ir.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ir=>ir.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[kt]:Pr.date}),we(null);},children:Pr.label},za))})(),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:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(j.id,{[kt]:void 0}),we(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:()=>we(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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:Ze?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>we(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.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((ie,wt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},wt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ze?.month||new Date,wt=ie.getFullYear(),Jt=ie.getMonth(),Sr=new Date(wt,Jt,1).getDay(),Er=new Date(wt,Jt+1,0).getDate(),Pr=new Date,za=[];for(let Nt=Sr-1;Nt>=0;Nt--)za.push({day:new Date(wt,Jt,-Nt).getDate(),date:new Date(wt,Jt-1,new Date(wt,Jt,-Nt).getDate()),isCurrentMonth:false});for(let Nt=1;Nt<=Er;Nt++)za.push({day:Nt,date:new Date(wt,Jt,Nt),isCurrentMonth:true});let ir=42-za.length;for(let Nt=1;Nt<=ir;Nt++)za.push({day:Nt,date:new Date(wt,Jt+1,Nt),isCurrentMonth:false});return za.map((Nt,So)=>{let Eo=Nt.date.toDateString()===Pr.toDateString(),Jr=(W?typeof W=="string"?new Date(W):W:null)?.toDateString()===Nt.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:Nt.isCurrentMonth?Jr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Jr?"#3B82F6":"transparent",boxShadow:Eo&&!Jr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(j.id,{[kt]:Nt.date}),we(null);},children:Nt.day},So)})})()})]})]})]}),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:Z(j)})});case "assignees":let $t=r.filter(ie=>j.assignees?.some(wt=>wt.name===ie.name||wt.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(mr,{assignedUsers:$t,availableUsers:r,onChange:ie=>{let wt=ie.map(Jt=>({id:Jt.id,name:Jt.name,initials:Jt.initials,color:Jt.color}));u?.(j.id,{assignees:wt.length>0?wt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(dl,{status:j.status||"todo",onChange:ie=>{u?.(j.id,{status:ie,progress:ie==="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 ea={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xr=ea[j.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(cr,{priority:Xr,onChange:ie=>{ie&&u?.(j.id,{priority:qa[ie]||"medium"});}})});default:return null}},Fe=_=>[{id:"hide",label:"Hide Column",icon:vt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:vt.SortDesc,onClick:()=>{}}],Ie=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{P?P(_.id,_.name):v?.([_.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:vt.Pencil,onClick:()=>{l?.(_);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:vt.MarkIncomplete,onClick:()=>{u?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:vt.SetInProgress,onClick:()=>{u?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:vt.MarkComplete,onClick:()=>{u?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{P?P(_.id,_.name):v?.([_.id]);}}],Re=m.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Dt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Re.map((_,j)=>{let nt=j===Re.length-1,We=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${We?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(We?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:nt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ue=>{ue.preventDefault(),Ee({isOpen:true,x:ue.clientX,y:ue.clientY,type:"header",columnId:_.id});},onMouseEnter:ue=>{ue.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ue=>{ue.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:We?"70px":"0"},title:_.label,children:_.label}),We&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Xo,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>M(!F),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})})]}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:$===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ue=>{ue.preventDefault(),ue.stopPropagation(),L(_.id),S(ue.clientX),ae(_.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"}})})]},_.id)}),F&&jsxRuntime.jsxs("div",{ref:Ae,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:_=>_.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:()=>M(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",children:Xe.map(({task:_,level:j},nt)=>{let We=B(_.id),ue=J===_.id,Vt=ue&&Ve==="above",kt=ue&&Ve==="below",W=ue&&Ve==="child",ce={};return W&&(ce.backgroundColor=`${t.accent}15`,ce.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${xe===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:We?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:We?t.accentLight:W?`${t.accent}15`:nt%2===0?t.bgPrimary:t.bgGrid,...ce},onMouseEnter:()=>w(_.id),onMouseLeave:()=>w(null),onClick:Ce=>{let ea=Gr(e).map(ie=>ie.id),Xr=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ce.metaKey:Ce.ctrlKey;ge(_.id,ea,Xr,Ce.shiftKey),s?.(_);},onDoubleClick:Ce=>{Ce.stopPropagation(),l?.(_);},onContextMenu:Ce=>{Ce.preventDefault(),Ee({isOpen:true,x:Ce.clientX,y:Ce.clientY,type:"task",task:_}),c?.(_,Ce);},whileHover:{backgroundColor:We?t.accentLight:t.hoverBg},children:[Vt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),kt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((Ce,$t)=>{let ea=$t===Re.length-1,qa=Ce.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${qa?"justify-start":"justify-center"}`,style:{width:`${Ce.width}px`,minWidth:`${Ce.minWidth??(qa?200:60)}px`,maxWidth:`${Ce.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ea?"none":`1px solid ${N===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:de(Ce,_,qa?j:0)},`${_.id}-${Ce.id}`)})]},_.id)})}),jsxRuntime.jsx(Hr,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Fe(q.columnId):q.type==="task"&&q.task?Ie(q.task):[],onClose:()=>Ee({...q,isOpen:false}),theme:t}),Me&&Pe&&xe&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Pe.x+12,top:Pe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Xe.find(j=>j.task.id===xe)?.task;return _?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:_.name})}):null})()}),document.body)]})}function bd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,c]=react.useState(e),[p,n]=react.useState(t),[m,d]=react.useState(null),[i,u]=react.useState(null),[y,b]=react.useState(null),[g,v]=react.useState(null),[h,f]=react.useState(0),[k,D]=react.useState(0),[x,P]=react.useState(null),[T,O]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:u,activeZone:y,setActiveZone:b,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:f,segmentDragOffsetX:k,setSegmentDragOffsetX:D,hoveredSegmentIndex:x,setHoveredSegmentIndex:P,isHovered:T,setIsHovered:O,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,X)=>{r("none"),d(null),u(null),c(H),n(X),D(0),v(null),f(0);}}}function en({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:y,onHoverChange:b}){let g=bd(t,r),v=react.useRef(null),{dragMode:h,setDragMode:f,dragOffset:k,setDragOffset:D,ghostX:x,setGhostX:P,ghostWidth:T,setGhostWidth:O,connectionLine:N,setConnectionLine:w,hoveredTaskId:F,setHoveredTaskId:M,activeZone:H,setActiveZone:X,draggedSegmentIndex:ye,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ae,setDraggedSegmentStartX:ze,segmentDragOffsetX:$,setSegmentDragOffsetX:L,hoveredSegmentIndex:z,setHoveredSegmentIndex:S,isHovered:R,setIsHovered:ae,isDragging:q,isResizing:Ee,isConnecting:xe,resetDragState:Je}=g,J=32,qe=8,Ve=e.endDate&&e.endDate<new Date&&e.progress<100,gt=e.isCriticalPath,lt=o.name==="neutral"||o.today==="#1C1917",U=e.status==="completed"||e.progress===100,ne={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Ue=e.isCriticalPath||Ve?"#DC2626":e.color?e.color:e.priority&&ne[e.priority]?ne[e.priority]:o.taskBarPrimary,Be=(Y=>Y>=80?20:Y>=60?15:Y>=50?12:10)(r),Ze=r<50,we=r<40;react.useEffect(()=>{if(b)if(R&&!q&&!e.segments){let Y=a<100;b({task:e,x:t,y:a,width:r,height:J,showBelow:Y});}else b(null);},[R,q,e,t,a,r,J,b]);let It=Y=>Y.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ge=()=>{let Y=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Y} day${Y!==1?"s":""}`},B=Y=>Math.round(Y/s)*s,he=Y=>{let Se=Math.round(Y/s),be=new Date(l);return be.setDate(be.getDate()+Se),be},je=(Y,Se)=>{for(let be of u){if(be.id===e.id)continue;let Te=5;if(Y>=be.x-Te&&Y<=be.x+be.width+Te&&Se>=be.y-Te&&Se<=be.y+be.height+Te)return be.id}return null},Xe=react.useCallback((Y,Se,be)=>{Y.preventDefault(),Y.stopPropagation();let Te=v.current?.ownerSVGElement;if(!Te)return;let de=Te.createSVGPoint();de.x=Y.clientX,de.y=Y.clientY;let Fe=de.matrixTransform(Te.getScreenCTM()?.inverse()),Ie=be!==void 0?be:t,Re=Se;if(!Re){let _=Fe.x-Ie;Y.shiftKey?(Re="connect",w({x:t+r,y:a+J/2})):Y.ctrlKey||Y.metaKey?Re="move":Y.altKey?Re=_<r/2?"resize-start":"resize-end":we?_<r/2?Re="move":Re="resize-end":Ze?_<=Be/2?Re="resize-start":_>=r-Be/2?Re="resize-end":Re="move":_<=Be?Re="resize-start":_>=r-Be?Re="resize-end":Re="move";}f(Re),ae(false),X(null),Re==="move"?D(Fe.x-Ie):Re==="connect"?w({x:t+r,y:a+J/2}):D(0),P(Ie),O(r);},[t,r,a,J]),Dt=react.useCallback(Y=>{if(h==="none")return;let Se=v.current?.ownerSVGElement;if(!Se)return;let be=Se.createSVGPoint();be.x=Y.clientX,be.y=Y.clientY;let Te=be.matrixTransform(Se.getScreenCTM()?.inverse());if(h==="connect"){w({x:Te.x,y:Te.y});let de=je(Te.x,Te.y);M(de);}else if(h==="move"){let de=Te.x-k,Fe=B(de);P(Fe),O(r);let Ie=Math.round((Fe-t)/s);if(y?.(e.id,Ie,true),e.segments&&e.segments.length>0&&ye!==null){let Re=Fe-Ae;L(Re);}}else if(h==="resize-start"){let de=Te.x,Fe=B(de),Ie=t+r-Fe;Ie>=s&&(P(Fe),O(Ie));}else if(h==="resize-end"){let de=Te.x,Ie=B(de)-t;Ie>=s&&O(Ie);}},[h,t,r,s,k,e,B,ye,Ae,je,M,w,P,O,L,y]),Z=react.useCallback(()=>{if(h!=="none"){if(h==="connect")F&&i&&i(e,F),w(null),M(null);else {let Y=e.endDate.getTime()-e.startDate.getTime(),Se,be,Te=true;if(h==="move"){if(Se=he(x),be=new Date(Se.getTime()+Y),e.segments&&e.segments.length>0&&ye!==null){let de=Math.round($/s),Fe=e.segments.map((j,nt)=>{if(nt===ye){let We=new Date(j.startDate),ue=new Date(j.endDate);return We.setDate(We.getDate()+de),ue.setDate(ue.getDate()+de),{startDate:We,endDate:ue}}return j}),Ie=Fe.flatMap(j=>[j.startDate,j.endDate]),Re=new Date(Math.min(...Ie.map(j=>j.getTime()))),_=new Date(Math.max(...Ie.map(j=>j.getTime())));d?.({...e,segments:Fe},Re,_),Je(t,r);return}}else h==="resize-start"?(Se=he(x),be=e.endDate,Se>=be&&(console.warn("Invalid date range: start date must be before end date"),Te=false)):h==="resize-end"?(Se=e.startDate,be=he(x+T),be<=Se&&(console.warn("Invalid date range: end date must be after start date"),Te=false)):Te=false;Te&&Se&&be&&(be.getTime()-Se.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,Se,be));}y?.(e.id,0,false),Je(t,r);}},[h,x,T,e,d,F,i,t,r,s,he,$,ye,Je,y]);react.useEffect(()=>{if(h==="none")return;let Y=be=>{Dt(be);},Se=()=>{Z();};return window.addEventListener("mousemove",Y),window.addEventListener("mouseup",Se),()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",Se);}},[h,Dt,Z]);let ee=q&&!xe?x:t,ve=q&&!xe?T:r,Ne=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:v,onMouseEnter:()=>!q&&ae(true),onMouseLeave:()=>{q||(ae(false),X(null));},onClick:()=>!q&&p?.(e),onDoubleClick:Y=>{q||(Y.stopPropagation(),n?.(e));},onContextMenu:Y=>{Y.preventDefault(),m?.(e,Y);},children:[R&&!q&&!Ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Be,height:J,fill:H==="resize-start"?o.accent:"transparent",opacity:H==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-start"),onMouseDown:Y=>Xe(Y,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Be,y:a,width:r-Be*2,height:J,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:Y=>Xe(Y,"move")}),jsxRuntime.jsx("rect",{x:t+r-Be,y:a,width:Be,height:J,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:Y=>Xe(Y,"resize-end")})]}),R&&!q&&we&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:J,fill:H==="move"?o.accent:"transparent",opacity:H==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:Y=>Xe(Y,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:J,fill:H==="resize-end"?o.accent:"transparent",opacity:H==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:Y=>Xe(Y,"resize-end")}),R&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+J-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x,y:a,width:T,height:J,rx:qe,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:ee,y:a,width:ve,height:J,rx:qe,fill:Ue,"data-task-class":Ne,initial:{opacity:0,scale:.95},animate:{opacity:q&&!xe?.15:e.parentId?.6:R?.9:.8,scale:R&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Y=>Xe(Y),style:{cursor:q?xe?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ee,y:a,width:ve*(e.progress/100),height:J,rx:qe,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Y,Se)=>{let be=(Y.startDate.getTime()-l.getTime())/864e5*s,de=(Y.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-be+s,Fe=q&&h==="move"&&ye===Se,Ie=z===Se,Re=Fe?be+$:be;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!q&&S(Se),onMouseLeave:()=>!q&&S(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Re,y:a,width:de,height:J,rx:qe,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:Fe||e.parentId?.6:Ie?.9:.8,scale:Ie&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>{_.stopPropagation(),ke(Se),ze(be),Xe(_,void 0,be);},style:{cursor:q?xe?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Re,y:a,width:de*(e.progress/100),height:J,rx:qe,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Se}`)}),lt&&(Ve||gt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[gt&&!Ve&&jsxRuntime.jsx("rect",{x:ee,y:a,width:ve,height:J,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Ve&&jsxRuntime.jsx("rect",{x:ee,y:a,width:ve,height:J,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ve>60&&!e.segments&&(()=>{let Y=c.taskLabel(e),Se=typeof Y=="string"?Y:e.name,be=Se.length>Math.floor(ve/8)?`${Se.substring(0,Math.floor(ve/8))}...`:Se;return jsxRuntime.jsx("text",{x:ee+12,y:a+J/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:be})})(),ve>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxRuntime.jsxs("text",{x:ee+ve-12,y:a+J/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&&ve>80&&!q&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ee+ve-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ee+ve-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(R||Ee)&&!xe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ze?ee-15:ee-10,y:a-5,width:Ze?25:20,height:J+10,fill:"transparent",onMouseDown:Y=>Xe(Y,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze?ee-8:ee-3,y:a+6,width:Ze?8:6,height:Ze?J-12:J-16,rx:3,fill:h==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ee+ve-10,y:a-5,width:Ze?25:20,height:J+10,fill:"transparent",onMouseDown:Y=>Xe(Y,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ze?ee+ve:ee+ve-3,y:a+6,width:Ze?8:6,height:Ze?J-12:J-16,rx:3,fill:h==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:h==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&!q&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+8,cy:a+J/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:Y=>{Y.stopPropagation(),Xe(Y,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+J/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),xe&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+J/2,x2:N.x,y2:N.y,stroke:F?o.statusCompleted:o.accent,strokeWidth:F?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:F?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:N.x,cy:N.y,r:F?8:6,fill:F?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),F&&jsxRuntime.jsx(framerMotion.motion.text,{x:N.x+15,y:N.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(R||q)&&!xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee-2,y:a-2,width:ve+4,height:J+4,rx:qe+2,fill:"none",stroke:q?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:q?.6:.4,initial:{opacity:0},animate:{opacity:q?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ee&&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+T,y1:0,x2:x+T,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R&&!q&&!e.segments&&!b&&(()=>{let be=a<100,Te=be?a+J+13:a-82-13,de=be?`M ${ee+ve/2-6} ${a+J+3} L ${ee+ve/2} ${a+J+13} L ${ee+ve/2+6} ${a+J+3}`:`M ${ee+ve/2-6} ${a-13} L ${ee+ve/2} ${a-3} L ${ee+ve/2+6} ${a-13}`,Fe=Te+22,Ie=Te+40,Re=Te+55,_=Te+70,j=be?Te+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ee+ve/2-120,y:Te,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:ee+ve/2,y:Fe,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:ee+ve/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ee+ve/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.startDate)}),jsxRuntime.jsx("text",{x:ee+ve/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ee+ve/2-70,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It(e.endDate)}),jsxRuntime.jsx("text",{x:ee+ve/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ee+ve/2+65,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ge()}),jsxRuntime.jsx("text",{x:ee+ve/2+10,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ee+ve/2+65,y:Re,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:ee+ve/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ee+ve/2-50,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(nt=>nt.name).join(", ").substring(0,30),e.assignees.map(nt=>nt.name).join(", ").length>30?"...":""]})]}),!be&&jsxRuntime.jsx("text",{x:ee+ve/2,y:j,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:we?"Left: move \u2022 Right: resize":Ze?"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 vd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:c}=e,p=82,n=13,m=c?o+l+n:o-p-n,d=c?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,y=m+55,b=m+70,g=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-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:m,width:240,height:p,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:i,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:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsxRuntime.jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function rn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[c,p]=react.useState(false),n=a-e,m=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,u=6,y=Math.atan2(m,n),b=a-u*Math.cos(y-Math.PI/6),g=r-u*Math.sin(y-Math.PI/6),v=a-u*Math.cos(y+Math.PI/6),h=r-u*Math.sin(y+Math.PI/6),f=o.dependency;react.useEffect(()=>{l&&s&&l(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,l]);let k=!s&&!l;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&l?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${b} ${g} M ${a} ${r} L ${v} ${h}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&l?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:c&&l?0:c?1.3:1,opacity:c&&l?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!l&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function nn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,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-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+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:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,c=new Set,p=n=>{if(!l.has(n)){l.add(n),c.add(n);let m=r.get(n)||[];for(let d of m){if(!l.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(n),false};return p(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=se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=se.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
46
+ `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=se.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=se.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=se.findTaskById(e,t);return !a||!a.dependencies?[]:se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>se.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>se.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?se.formatDate(p.startDate):"N/A",p.endDate?se.formatDate(p.endDate):"N/A",n>0?`${n} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:l,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=se.flattenTasks(e).map(p=>{let n=p.startDate&&p.endDate?se.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?se.formatDate(p.startDate):"","End Date":p.endDate?se.formatDate(p.endDate):"","Duration (days)":n>0?n:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(m=>m.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.level||0}}),s=a.utils.json_to_sheet(o),l=[{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"]=l;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=se.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),l=se.getEarliestStartDate(e)||new Date,c=se.getLatestEndDate(e)||new Date,p=r.map((i,u)=>{let y=o.get(i.id),b=i.startDate&&i.endDate?se.calculateDuration(i.startDate,i.endDate):0,g=(i.dependencies||[]).filter(v=>o.has(v)).map(v=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${o.get(v)}</PredecessorUID>
49
49
  <Type>1</Type>
@@ -53,20 +53,20 @@
53
53
  </PredecessorLink>`).join("");return `
54
54
  <Task>
55
55
  <UID>${y}</UID>
56
- <ID>${c+1}</ID>
56
+ <ID>${u+1}</ID>
57
57
  <Name>${i.name.replace(/[<>&'"]/g,v=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[v]||v)}</Name>
58
58
  <Type>0</Type>
59
59
  <IsNull>0</IsNull>
60
60
  <CreateDate>${s(new Date)}</CreateDate>
61
- <WBS>${c+1}</WBS>
62
- <OutlineNumber>${c+1}</OutlineNumber>
61
+ <WBS>${u+1}</WBS>
62
+ <OutlineNumber>${u+1}</OutlineNumber>
63
63
  <OutlineLevel>${i.level||0}</OutlineLevel>
64
64
  <Priority>500</Priority>
65
65
  <Start>${i.startDate?s(i.startDate):""}</Start>
66
66
  <Finish>${i.endDate?s(i.endDate):""}</Finish>
67
- <Duration>PT${f*8}H0M0S</Duration>
67
+ <Duration>PT${b*8}H0M0S</Duration>
68
68
  <DurationFormat>7</DurationFormat>
69
- <Work>PT${f*8}H0M0S</Work>
69
+ <Work>PT${b*8}H0M0S</Work>
70
70
  <Stop>${i.endDate?s(i.endDate):""}</Stop>
71
71
  <Resume>${i.startDate?s(i.startDate):""}</Resume>
72
72
  <ResumeValid>0</ResumeValid>
@@ -98,15 +98,15 @@
98
98
  <OvertimeWork>PT0H0M0S</OvertimeWork>
99
99
  <ActualStart>${i.progress>0&&i.startDate?s(i.startDate):""}</ActualStart>
100
100
  <ActualFinish>${i.progress===100&&i.endDate?s(i.endDate):""}</ActualFinish>
101
- <ActualDuration>PT${Math.round(f*i.progress/100)*8}H0M0S</ActualDuration>
101
+ <ActualDuration>PT${Math.round(b*i.progress/100)*8}H0M0S</ActualDuration>
102
102
  <ActualCost>0</ActualCost>
103
103
  <ActualOvertimeCost>0</ActualOvertimeCost>
104
- <ActualWork>PT${Math.round(f*i.progress/100)*8}H0M0S</ActualWork>
104
+ <ActualWork>PT${Math.round(b*i.progress/100)*8}H0M0S</ActualWork>
105
105
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
106
- <RegularWork>PT${f*8}H0M0S</RegularWork>
107
- <RemainingDuration>PT${Math.round(f*(100-i.progress)/100)*8}H0M0S</RemainingDuration>
106
+ <RegularWork>PT${b*8}H0M0S</RegularWork>
107
+ <RemainingDuration>PT${Math.round(b*(100-i.progress)/100)*8}H0M0S</RemainingDuration>
108
108
  <RemainingCost>0</RemainingCost>
109
- <RemainingWork>PT${Math.round(f*(100-i.progress)/100)*8}H0M0S</RemainingWork>
109
+ <RemainingWork>PT${Math.round(b*(100-i.progress)/100)*8}H0M0S</RemainingWork>
110
110
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
111
111
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
112
112
  <ACWP>0</ACWP>
@@ -125,7 +125,7 @@
125
125
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
126
126
  <EarnedValueMethod>0</EarnedValueMethod>
127
127
  <IsPublished>1</IsPublished>
128
- <CommitmentType>0</CommitmentType>${h}
128
+ <CommitmentType>0</CommitmentType>${g}
129
129
  </Task>`}).join(""),n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
130
130
  <Project xmlns="http://schemas.microsoft.com/project">
131
131
  <SaveVersion>14</SaveVersion>
@@ -135,7 +135,7 @@
135
135
  <LastSaved>${s(new Date)}</LastSaved>
136
136
  <ScheduleFromStart>1</ScheduleFromStart>
137
137
  <StartDate>${s(l)}</StartDate>
138
- <FinishDate>${s(p)}</FinishDate>
138
+ <FinishDate>${s(c)}</FinishDate>
139
139
  <FYStartDate>1</FYStartDate>
140
140
  <CriticalSlackLimit>0</CriticalSlackLimit>
141
141
  <CurrencyDigits>2</CurrencyDigits>
@@ -271,11 +271,11 @@
271
271
  </WeekDays>
272
272
  </Calendar>
273
273
  </Calendars>
274
- <Tasks>${m}
274
+ <Tasks>${p}
275
275
  </Tasks>
276
- </Project>`,u=new Blob([n],{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=re.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let u=n.startDate&&n.endDate?re.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let c of n.dependencies){let y=t.find(f=>f.id===c);if(y){o(y);let f=r.get(c)?.ef||0;d=Math.max(d,f);}}let i=d+u;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,p=n=>{if(l.has(n.id))return;let u=n.startDate&&n.endDate?re.calculateDuration(n.startDate,n.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),i=s;if(d.length>0)for(let y of d){p(y);let f=l.get(y.id)?.ls||0;i=Math.min(i,f);}let c=i-u;l.set(n.id,{ls:c,lf:i});};a.forEach(p);let m=[];for(let n of a){let u=r.get(n.id),d=l.get(n.id);if(u&&d){let i=d.ls-u.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=re.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(re.calculateCriticalPath(e).includes(t))return 0;let o=re.getDependentTasks(e,t);if(o.length===0){let p=re.getLatestEndDate(e);if(!p)return null;let m=re.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 l=re.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>re.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=re.findTaskById(e,t);if(!r||!r.endDate)return e;let o=re.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let p=re.calculateDuration(l.startDate,l.endDate),m;a!==void 0?(m=new Date(l.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=re.calculateEndDate(m,p),u=d=>d.map(i=>i.id===l.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:u(i.subtasks)}:i);s=u(s),s=re.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,p)=>{if(a===0)return [];let m=[],n=o.getTime(),u=1e3*60*60*24,d=re.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(c,y,f=new Set)=>{if(f.has(c))return;f.add(c);let h=re.getDependentTasks(e,c);for(let v of h){if(!v.startDate||!v.endDate)continue;let b=r.findIndex(w=>w.id===v.id);if(b===-1)continue;let g=v.startDate.getTime(),N=(v.endDate.getTime()-g)/u,M=(g-n)/u*s,T=M+y*s,B=Math.max(N*s,s),D=p+b*l+12;m.push({taskId:v.id,taskName:v.name,originalX:M,previewX:T,width:B,y:D,rowIndex:b,daysDelta:y,color:v.color}),i(v.id,y,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=re.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 l=new Date(a);l.setDate(l.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:p}],n=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:p,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:c}){let[f,h]=react.useState([]),[v,b]=react.useState(null),[g,k]=react.useState(null),N=react.useCallback(R=>{b(R);},[]),x=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,T=x*M*l,B=R=>{let S=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),z=S.getUTCDay()||7;S.setUTCDate(S.getUTCDate()+4-z);let E=new Date(Date.UTC(S.getUTCFullYear(),0,1));return Math.ceil(((S.getTime()-E.getTime())/864e5+1)/7)},D=R=>{let S=R.getDay();return S===0||S===6},w=react.useCallback(R=>{let S=Math.round(R/(M*l)),z=new Date(o);return z.setDate(z.getDate()+S),z},[o,M,l]),U=react.useCallback((R,S)=>{if(S.startDate&&S.endDate)return;let z=R.currentTarget.ownerSVGElement;if(!z)return;let E=z.createSVGPoint();E.x=R.clientX,E.y=R.clientY;let Y=E.matrixTransform(z.getScreenCTM()?.inverse()),ae=w(Y.x),X=new Date(ae);X.setDate(X.getDate()+1),d?.(S,ae,X);},[w,d]),A=react.useMemo(()=>{let R=Y=>Y.map(ae=>{if(ae.subtasks&&ae.subtasks.length>0){let X=R(ae.subtasks),me=X.filter(be=>be.startDate&&be.endDate);if(me.length>0){let be=me.map(F=>F.startDate.getTime()),Ke=me.map(F=>F.endDate.getTime()),ue=new Date(Math.min(...be)),Ye=new Date(Math.max(...Ke));return {...ae,subtasks:X,startDate:ue,endDate:Ye}}return {...ae,subtasks:X}}return ae}),S=(Y,ae=[])=>{for(let X of Y)ae.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&S(X.subtasks,ae);return ae},z=R(e);return S(z)},[e]),H=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let S=R.startDate.getTime(),z=R.endDate.getTime(),E=o.getTime(),Y=(S-E)/(1e3*60*60*24),ae=(z-S)/(1e3*60*60*24),X=Y*M*l,me=Math.max(M*l,40),be=Math.max(ae*M*l,me);return {x:X,width:be}},[o,M,l]),q=react.useMemo(()=>A.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:S,width:z}=H(R),Y=A.findIndex(ae=>ae.id===R.id)*a+12;return {id:R.id,x:S,y:Y,width:z,height:32}}),[A,H]),ve=react.useCallback((R,S,z)=>{if(!z||S===0){h([]);return}let E=re.calculateCascadePreview(e,R,S,A,o,M*l,a,48);h(E);},[e,A,o,M,l,a,48]),we=react.useMemo(()=>{let R=[],S=new Date(o);for(;S<=s;){let Y=(S.getTime()-o.getTime())/864e5*M*l;if(r==="day")R.push({date:new Date(S),label:S.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),S.setDate(S.getDate()+1);else if(r==="week"){let ae=B(S);R.push({date:new Date(S),label:`Week ${ae}`,x:Y}),S.setDate(S.getDate()+7);}else R.push({date:new Date(S),label:S.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),S.setMonth(S.getMonth()+1);}return R},[o,s,r,M,l]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*l,[o,M,l]),Re=Math.max(A.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},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(T,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(T,1e3),height:48,fill:t.bgGrid}),we.map((R,S)=>jsxRuntime.jsxs("g",{children:[S>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${S}`)),Ae>=0&&Ae<=T&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(T,1e3),height:Re,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(T,1e3),height:Re,fill:t.bgPrimary}),we.map((R,S)=>{let z=we[S+1]?.x||T,E=D(R.date);return jsxRuntime.jsxs("g",{children:[E&&jsxRuntime.jsx("rect",{x:R.x,y:0,width:z-R.x,height:A.length*a,fill:t.bgWeekend,opacity:1}),S>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:A.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},S)}),Ae>=0&&Ae<=T&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:A.length*a,stroke:t.today,strokeWidth:2,opacity:1}),A.map((R,S)=>{let z=R.startDate&&R.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:S*a,width:T,height:a,fill:S%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${R.id}`),!z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:S*a,width:T,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:E=>U(E,R),onMouseEnter:E=>{E.currentTarget.setAttribute("fill",t.accentLight),E.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:E=>{E.currentTarget.setAttribute("fill","transparent"),E.currentTarget.setAttribute("opacity","1");}},`clickable-${R.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae:100,y:S*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-${R.id}`)]})]},`row-group-${R.id}`)}),A.map((R,S)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(z=>{let E=A.find(me=>me.id===z);if(!E||!E.startDate||!E.endDate)return null;let Y=A.findIndex(me=>me.id===z),ae=H(E),X=H(R);return jsxRuntime.jsx(rn,{x1:ae.x+ae.width,y1:Y*a+a/2,x2:X.x,y2:S*a+a/2,theme:t},`dep-${z}-${R.id}`)})),A.map((R,S)=>{if(!R.startDate||!R.endDate)return null;let{x:z,width:E}=H(R),Y=S*a+12,ae=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;return R.isMilestone?jsxRuntime.jsx(nn,{task:R,x:z+E/2,y:Y+16,theme:t,onClick:m},R.id):ae?jsxRuntime.jsxs("g",{onClick:()=>m?.(R),onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),u?.(R,X);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:z,y:Y,width:E,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:z,y1:Y,x2:z+E,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:Y,x2:z,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+E,y1:Y,x2:z+E,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:Y+32,x2:z+E,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),E>60&&jsxRuntime.jsx("text",{x:z+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:R.name})]},R.id):jsxRuntime.jsx(en,{task:R,x:z,y:Y,width:E,theme:t,dayWidth:M*l,startDate:o,templates:p,onClick:m,onDoubleClick:n,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:q,onDragMove:ve,onHoverChange:N},R.id)}),A.map((R,S)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(z=>{let E=A.find(ke=>ke.id===z);if(!E||!E.startDate||!E.endDate)return null;let Y=A.findIndex(ke=>ke.id===z),ae=H(E),X=H(R),me=ae.x+ae.width,be=Y*a+a/2,Ke=X.x,ue=S*a+a/2,Ye=Ke-me,F=me+Ye/2,ne=ke=>{let tt=1-ke,Ze=tt*tt,ot=Ze*tt,xt=ke*ke,fe=xt*ke,O=ot*me+3*Ze*ke*F+3*tt*xt*F+fe*Ke,Ce=ot*be+3*Ze*ke*be+3*tt*xt*ue+fe*ue;return {x:O,y:Ce}},Se=20,Me=[];for(let ke=0;ke<=Se;ke++){let tt=.1+ke/Se*.8;Me.push(ne(tt));}let Ie=Me[0],et=`M ${Ie.x} ${Ie.y} `+Me.slice(1).map(ke=>`L ${ke.x} ${ke.y}`).join(" ");return g&&g.x1===me&&g.y1===be&&g.x2===Ke&&g.y2===ue?null:jsxRuntime.jsx("path",{d:et,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:me,y1:be,x2:Ke,y2:ue,onDelete:()=>c?.(R.id,z)});}},`dep-hover-${z}-${R.id}`)})),f.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:32,rx:8,fill:R.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),g&&(()=>{let{x1:R,y1:S,x2:z,y2:E,onDelete:Y}=g,ae=z-R,X=E-S,me=R+ae/2,be=(S+E)/2,Ke=`M ${R} ${S} C ${me} ${S}, ${me} ${E}, ${z} ${E}`,ue=6,Ye=Math.atan2(X,ae),F=z-ue*Math.cos(Ye-Math.PI/6),ne=E-ue*Math.sin(Ye-Math.PI/6),Se=z-ue*Math.cos(Ye+Math.PI/6),Me=E-ue*Math.sin(Ye+Math.PI/6),Ie=t.dependency,et="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:Ke,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:me,cy:be,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Ke,fill:"none",stroke:Ie,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Ke,fill:"none",stroke:Ie,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${z} ${E} L ${F} ${ne} M ${z} ${E} L ${Se} ${Me}`,fill:"none",stroke:Ie,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:z,cy:E,r:4,fill:Ie,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ke=>{ke.stopPropagation(),k(null),Y();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:me,cy:be,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:et,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:me-3,y1:be-3,x2:me+3,y2:be+3,stroke:et,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:me+3,y1:be-3,x2:me-3,y2:be+3,stroke:et,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),v&&jsxRuntime.jsx(vd,{tooltipData:v,theme:t})]})]})}var dn=[{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"}];var Us=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ws=[{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 cn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:n=[],availableTags:u=[],onCreateTag:d}){let i=[...Us,...n.filter(F=>!Us.some(ne=>ne.id===F.id))],c=Ue[m]||Ue.dark,[y,f]=react.useState(false),[h,v]=react.useState(false),[b,g]=react.useState(false),[k,N]=react.useState(false),[x,M]=react.useState({top:0,left:0}),[T,B]=react.useState(null),[D,w]=react.useState(new Date),[U,A]=react.useState({top:0,left:0}),[H,q]=react.useState(false),ve=react.useRef(null),we=react.useRef(null),Ae=react.useRef(null),Re=react.useRef(null),R=react.useRef(null),[S,z]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[E,Y]=react.useState({});react.useEffect(()=>{a?(z({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)&&q(true)):(z({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),q(false));},[a,e]),react.useEffect(()=>{let F=ne=>{ve.current&&!ve.current.contains(ne.target)&&f(false),we.current&&!we.current.contains(ne.target)&&v(false),Ae.current&&!Ae.current.contains(ne.target)&&g(false),Re.current&&!Re.current.contains(ne.target)&&N(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let ae=()=>{let F={};return S.name.trim()||(F.name="El nombre es requerido"),S.startDate&&S.endDate&&S.startDate>S.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),Y(F),Object.keys(F).length===0},X=async F=>{if(F.preventDefault(),!!ae())try{await s(S),t();}catch(ne){console.error("Error submitting task:",ne);}},me=(F,ne)=>{z(Se=>{let Me={...Se,[F]:ne};if(F==="status"){let Ie=ne;Ie==="todo"?Me.progress=0:Ie==="in-progress"?(Se.progress===0||Se.progress===100)&&(Me.progress=50):Ie==="completed"||Ie==="closed"?Me.progress=100:(Ie==="in-review"||Ie==="review")&&(Me.progress=75);}if(F==="progress"){let Ie=typeof ne=="number"?ne:parseInt(ne,10);Ie===100&&Se.status!=="completed"?Me.status="completed":Ie>0&&Ie<100&&Se.status==="todo"?Me.status="in-progress":Ie===0&&Se.status!=="todo"&&(Me.status="todo");}return Me}),E[F]&&Y(Se=>{let Me={...Se};return delete Me[F],Me});},be=i.find(F=>F.id===S.status)??Us[0],Ke=Ws.find(F=>F.id===S.priority)??Ws[1],ue=dn.find(F=>F.value===S.color)??dn[0],Ye={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",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:F=>F.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:be.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:F=>{F.currentTarget.style.backgroundColor=c.hoverBg,F.currentTarget.style.color=c.textPrimary;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=c.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:X,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:S.name,onChange:F=>me("name",F.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:l,autoFocus:true}),E.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"}),E.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:S.description||"",onChange:F=>me("description",F.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:l})}),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:ve,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&f(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ye,borderColor:be.color,backgroundColor:`${be.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:be.color}}),jsxRuntime.jsx("span",{style:{color:be.color},children:be.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:be.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:i.map(F=>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:ne=>ne.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{me("status",F.id),f(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,S.status===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},F.id))})})]}),jsxRuntime.jsxs("div",{ref:we,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Ke.color}}),jsxRuntime.jsx("span",{children:Ke.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:Ws.map(F=>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:ne=>ne.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{me("priority",F.id),v(false);},children:[jsxRuntime.jsx("span",{children:F.icon}),F.label,S.priority===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},F.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:Ae,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:l,children:[S.assignees&&S.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:S.assignees.slice(0,3).map((F,ne)=>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:F.color||c.accent,borderColor:c.bgSecondary},children:F.initials},ne))}),S.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",S.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: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-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(F=>{let ne=S.assignees?.some(Se=>Se.name===F.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:Se=>Se.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Se=ne?(S.assignees||[]).filter(Me=>Me.name!==F.name):[...S.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(Me=>Me[0]).join("").toUpperCase().slice(0,2),color:c.accent}];me("assignees",Se);},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:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},F.id)})})})]}),jsxRuntime.jsxs("div",{ref:Re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(k)N(false);else {if(Re.current){let F=Re.current.getBoundingClientRect(),ne=window.innerHeight,Se=120,Ie=ne-F.bottom<Se?F.top-Se-8:F.bottom+8;M({top:Ie,left:F.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:S.color}}),jsxRuntime.jsx("span",{children:ue.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(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:`${x.top}px`,left:`${x.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:dn.slice(0,18).map(F=>{let ne=S.color===F.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{me("color",F.value),N(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:ne?`2px solid ${F.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:F.name},F.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(Rr,{selectedTags:S.tags||[],availableTags:u,onChange:F=>me("tags",F),onCreateTag:d,theme:c,disabled:l}):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:R,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!S.isMilestone)if(T==="start")B(null);else {if(R.current){let F=R.current.getBoundingClientRect(),ne=window.innerHeight,Se=320,Ie=ne-F.bottom<Se?F.top-Se-8:F.bottom+8;A({top:Ie,left:F.left});}B("start"),w(S.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:S.isMilestone?.5:1,cursor:S.isMilestone?"not-allowed":"pointer"},disabled:l||S.isMilestone,children:S.startDate?S.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(!l&&!S.isMilestone)if(T==="end")B(null);else {if(R.current){let F=R.current.getBoundingClientRect(),ne=window.innerHeight,Se=320,Ie=ne-F.bottom<Se?F.top-Se-8:F.bottom+8;A({top:Ie,left:F.left});}B("end"),w(S.endDate||S.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:S.isMilestone?.5:1,cursor:S.isMilestone?"not-allowed":"pointer"},disabled:l||S.isMilestone,children:S.endDate?S.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(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:`${U.top}px`,left:`${U.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let F=new Date,ne=new Date(F);ne.setDate(F.getDate()+1);let Se=new Date(F);Se.setDate(F.getDate()+7);let Me=new Date(F);return Me.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Se},{label:"2 semanas",date:Me}].map((et,It)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(me("startDate",et.date),(!S.endDate||et.date>S.endDate)&&me("endDate",et.date),B("end")):(me("endDate",et.date),(!S.startDate||et.date<S.startDate)&&me("startDate",et.date),B(null));},children:et.label},It))})(),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:F=>F.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{me("startDate",void 0),me("endDate",void 0),B(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:()=>w(new Date(D.getFullYear(),D.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:D.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>w(new Date(D.getFullYear(),D.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((F,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:F},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=D.getFullYear(),ne=D.getMonth(),Se=new Date(F,ne,1).getDay(),Me=new Date(F,ne+1,0).getDate(),Ie=new Date,et=[];for(let ke=Se-1;ke>=0;ke--)et.push({day:new Date(F,ne,-ke).getDate(),date:new Date(F,ne-1,new Date(F,ne,-ke).getDate()),isCurrentMonth:false});for(let ke=1;ke<=Me;ke++)et.push({day:ke,date:new Date(F,ne,ke),isCurrentMonth:true});let It=42-et.length;for(let ke=1;ke<=It;ke++)et.push({day:ke,date:new Date(F,ne+1,ke),isCurrentMonth:false});return et.map((ke,tt)=>{let Ze=ke.date.toDateString()===Ie.toDateString(),ot=S.startDate?.toDateString()===ke.date.toDateString(),xt=S.endDate?.toDateString()===ke.date.toDateString(),fe=S.startDate&&S.endDate&&ke.date>=S.startDate&&ke.date<=S.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:ke.isCurrentMonth?ot||xt?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:ot?"#3B82F6":xt?"#7C3AED":fe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ze&&!ot&&!xt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(me("startDate",ke.date),S.endDate&&ke.date>S.endDate&&me("endDate",ke.date),B("end")):(me("endDate",ke.date),S.startDate&&ke.date<S.startDate&&me("startDate",ke.date),B(null));},children:ke.day},tt)})})()})]})]})]})})]}),E.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:E.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:S.progress,onChange:F=>me("progress",parseInt(F.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"}20`,color:S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"},children:[S.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>q(!H),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 ${H?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("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:S.isMilestone,onChange:F=>me("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:l}),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(F=>F.id!==a?.id).map(F=>{let ne=S.dependencies?.includes(F.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Se=ne?(S.dependencies||[]).filter(Me=>Me!==F.id):[...S.dependencies||[],F.id];me("dependencies",Se);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ne?`${c.accent}30`:c.bgPrimary,color:ne?c.accent:c.textSecondary,border:`1px solid ${ne?c.accent:c.borderLight}`},disabled:l,children:F.name},F.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:F=>F.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,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:F=>!l&&(F.currentTarget.style.opacity="0.9"),onMouseLeave:F=>!l&&(F.currentTarget.style.opacity="1"),children:l?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 af=['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"'],Td=()=>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"})]}),rf=()=>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"})}),of=()=>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"})}),nf=()=>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"})}),sf=()=>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 pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:p,onDependencyDelete:m}){let[n,u]=react.useState(false),[d,i]=react.useState(false),[c,y]=react.useState([]),[f,h]=react.useState(""),[v,b]=react.useState(false),[g,k]=react.useState(true),N=react.useRef(null),x=react.useRef(null),M=react.useRef(null),{enabled:T=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:D="bottom-right",onCommand:w,suggestions:U=af,maxHistory:A=50,persistHistory:H}=a,q=H?.storageKey||"gantt-ai-history",ve=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let z=localStorage.getItem(q);if(z){let Y=JSON.parse(z).map(ae=>({...ae,timestamp:new Date(ae.timestamp)}));y(Y.slice(-ve));}}catch(z){console.warn("[GanttAIAssistant] Failed to load persisted history:",z);}},[H?.enabled,q,ve]),react.useEffect(()=>{if(H?.enabled&&c.length>0)try{let z=c.filter(E=>!E.isLoading).slice(-ve);localStorage.setItem(q,JSON.stringify(z));}catch(z){console.warn("[GanttAIAssistant] Failed to persist history:",z);}},[c,H?.enabled,q,ve]),react.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[c]),react.useEffect(()=>{n&&!d&&N.current&&setTimeout(()=>N.current?.focus(),100);},[n,d]);let we=react.useCallback(z=>{if(z.success)switch(z.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":z.taskId&&z.updates&&o?.(z.taskId,z.updates);break;case "create_task":z.newTask&&s?.(z.newTask);break;case "delete_task":z.taskId&&l?.(z.taskId);break;case "link_tasks":z.dependencyFrom&&z.dependencyTo&&p?.(z.dependencyFrom,z.dependencyTo);break;case "unlink_tasks":z.taskId&&z.dependencyFrom&&m?.(z.taskId,z.dependencyFrom);break}},[o,s,l,p,m]),Ae=react.useCallback(async z=>{if(!z.trim()||v)return;let E={id:`user-${Date.now()}`,role:"user",content:z,timestamp:new Date};y(ae=>[...ae.slice(-(A-1)),E]),h(""),k(false),b(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(ae=>[...ae,Y]);try{if(w){let ae=await w(z,e);y(X=>{let me=X.filter(Ke=>!Ke.isLoading),be={id:`assistant-${Date.now()}`,role:"assistant",content:ae.message,timestamp:new Date,command:ae};return [...me,be]}),we(ae);}else y(ae=>[...ae.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(ae){y(X=>[...X.filter(be=>!be.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ae instanceof Error?ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[v,A,w,e,we]),Re=z=>{z.preventDefault(),Ae(f);},R=z=>{h(z),N.current?.focus();};if(react.useEffect(()=>{let z=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),u(Y=>!Y),n||i(false)),E.key==="Escape"&&n&&u(false);};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[n]),react.useEffect(()=>{if(!n)return;let z=Y=>{let ae=Y.target;M.current&&!M.current.contains(ae)&&u(false);},E=setTimeout(()=>{document.addEventListener("mousedown",z);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",z);}},[n]),!T)return null;let S={"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(at,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&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 ${S[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:()=>u(true),children:[jsxRuntime.jsx(Td,{}),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:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[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(Td,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(z=>!z),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(nf,{})}),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(of,{})})]})]}),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:[c.length===0&&g&&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:U.slice(0,4).map((z,E)=>jsxRuntime.jsx("button",{onClick:()=>R(z),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:z.length>30?z.slice(0,30)+"...":z},E))})]}),c.map(z=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${z.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${z.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:z.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:z.role==="user"?"white":t.textPrimary},children:[z.isLoading?jsxRuntime.jsx(sf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.content}),z.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:z.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:z.command.success?"#10B981":"#EF4444"},children:[z.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:z.command.type.replace(/_/g," ")})]})]})},z.id)),jsxRuntime.jsx("div",{ref:x})]}),jsxRuntime.jsxs("form",{onSubmit:Re,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:N,type:"text",value:f,onChange:z=>h(z.target.value),placeholder:B,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(rf,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Dd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,u=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!u)return {...d,present:i};let c=[...d.past,d.present];return c.length>t&&c.shift(),{past:c,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let u=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[n.present,...n.future]}});},[]),p=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let u=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Nd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?l.metaKey:l.ctrlKey;if(m&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!p&&m&&l.key==="y"){l.preventDefault(),t();return}if(p&&m&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var pf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${re.formatDate(e.startDate)} - ${re.formatDate(e.endDate)}`);let a=re.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=>re.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Sd(e){return {...pf,...e}}var yf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Md=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:c,locale:y="en",customTranslations:f,showCreateTaskButton:h=false,createTaskLabel:v,onCreateTask:b,onThemeChange:g,onTaskClick:k,onTaskDblClick:N,onTaskContextMenu:x,onTaskUpdate:M,onProgressChange:T,onTaskEdit:B,onTaskAddSubtask:D,onTaskMarkIncomplete:w,onTaskSetInProgress:U,onDependencyCreate:A,onDependencyDelete:H,onBeforeTaskAdd:q,onAfterTaskAdd:ve,onBeforeTaskUpdate:we,onAfterTaskUpdate:Ae,onBeforeTaskDelete:Re,onAfterTaskDelete:R}=a,z=react.useContext(Ko)?.theme,[E,Y]=react.useState(z||s||"dark"),[ae,X]=react.useState(l),[me,be]=react.useState(p),[Ke,ue]=react.useState(1),[Ye,F]=react.useState(0),[ne,Se]=react.useState(false),[Me,Ie]=react.useState(null),[et,It]=react.useState({isOpen:false,x:0,y:0,task:null}),[ke,tt]=react.useState(null),[Ze,ot]=react.useState(null);react.useEffect(()=>{z&&z!==E&&Y(z);},[z]),react.useEffect(()=>{s&&s!==E&&Y(s);},[s]);let xt=react.useCallback(P=>{Y(P),g?.(P);},[g]),{state:fe,setState:O,undo:Ce,redo:qe,canUndo:je,canRedo:Dt,clearHistory:J}=Dd(t,50),Q=react.useRef(new Map);react.useEffect(()=>{let P=I=>I.map(j=>{let ee=Q.current.get(j.id),ie=ee!==void 0?{...j,isExpanded:ee}:j;return ie.subtasks?.length?{...ie,subtasks:P(ie.subtasks)}:ie});Q.current.size>0?O(P(t)):O(t);},[t,O]);let xe=react.useRef(t),Ee=react.useRef(true);react.useEffect(()=>{if(Ee.current){Ee.current=false,xe.current=fe;return}if(!r)return;let P=JSON.stringify(xe.current),I=JSON.stringify(fe);P!==I&&(xe.current=fe,r(fe));},[fe,r]);let K=react.useMemo(()=>Ts(y,f),[y,f]),Pe=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ye,De]=react.useState(()=>Pe(K));react.useEffect(()=>{De(P=>P.map(I=>({...I,label:K.columns[I.id==="name"?"taskName":I.id]||I.label})));},[K]);let le=react.useMemo(()=>{let P=ye.filter(ee=>ee.visible),I=P.some(ee=>ee.id!=="name");return P.reduce((ee,ie)=>ee+ie.width,0)+(I?20:0)},[ye]);react.useEffect(()=>{Me!==null&&Me>le&&(ye.filter(j=>j.visible).some(j=>j.id!=="name")||Ie(null));},[ye,le,Me]);let Be=react.useMemo(()=>Me!==null?Math.max(280,Me,le):Math.max(280,le),[Me,le]),Le=react.useRef(null),Oe=react.useRef(null),G=react.useRef(null),V=react.useMemo(()=>Vl(E),[E]),st=react.useMemo(()=>({theme:V,themeName:E}),[V,E]),ze=react.useMemo(()=>Sd(d),[d]),ge=react.useMemo(()=>{if(!i)return fe;let P=re.calculateCriticalPath(fe),I=j=>j.map(ee=>({...ee,isCriticalPath:P.includes(ee.id),subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(fe)},[fe,i]),Vt=yf(me);Nd({undo:Ce,redo:qe,canUndo:je,canRedo:Dt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>re.findTaskById(fe,P),addTask:(P,I)=>{O(j=>{if(!I)return [...j,{...P,level:0}];let ee=ie=>ie.map(Ne=>Ne.id===I?{...Ne,subtasks:[...Ne.subtasks||[],{...P,parentId:I,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:ee(Ne.subtasks)}:Ne);return ee(j)});},updateTask:(P,I)=>{O(j=>{let ee=ie=>ie.map(Ne=>Ne.id===P?{...Ne,...I}:Ne.subtasks?{...Ne,subtasks:ee(Ne.subtasks)}:Ne);return ee(j)});},deleteTask:P=>{O(I=>{let j=ee=>ee.filter(ie=>ie.id===P?false:(ie.subtasks&&(ie.subtasks=j(ie.subtasks)),true));return j(I)});},deleteTasks:P=>{O(I=>As(I,P));},duplicateTask:P=>{O(I=>Is(I,[P]));},splitTask:(P,I,j=3)=>{O(ee=>re.splitTask(ee,P,I,j));},calculateEndDate:re.calculateEndDate,calculateDuration:re.calculateDuration,validateDependency:(P,I)=>!re.validateDependencies(fe,P,I),getAllTasks:()=>re.flattenTasks(fe),getTasksByStatus:P=>re.flattenTasks(fe).filter(I=>I.status===P),getTasksByParent:P=>P?re.findTaskById(fe,P)?.subtasks||[]:fe.filter(j=>!j.parentId),getCriticalPath:()=>re.flattenTasks(fe).filter(P=>P.isCriticalPath),indentTask:P=>{O(I=>Es(I,[P]));},outdentTask:P=>{O(I=>Ps(I,[P]));},moveTask:(P,I)=>{O(j=>Ms(j,[P],I));},createSubtask:async P=>{let{tasks:I,newTask:j}=Bs(fe,P);if(q){let ee=q({...j,parentId:P});if((ee instanceof Promise?await ee:ee)===false)return}O(I),ve&&ve({...j,parentId:P});},scrollToTask:P=>{let j=re.flattenTasks(fe).findIndex(ee=>ee.id===P);if(j!==-1&&Le.current){let ee=j*Vt;Le.current.scrollTo({top:ee,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:ee,behavior:"smooth"});}},highlightTask:(P,I=2e3)=>{},expandTask:P=>{O(I=>{let j=ee=>ee.map(ie=>ie.id===P?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:j(ie.subtasks)}:ie);return j(I)});},collapseTask:P=>{O(I=>{let j=ee=>ee.map(ie=>ie.id===P?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:j(ie.subtasks)}:ie);return j(I)});},expandAll:()=>{O(P=>{let I=j=>j.map(ee=>({...ee,isExpanded:true,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(P)});},collapseAll:()=>{O(P=>{let I=j=>j.map(ee=>({...ee,isExpanded:false,subtasks:ee.subtasks?I(ee.subtasks):void 0}));return I(P)});},undo:Ce,redo:qe,canUndo:()=>je,canRedo:()=>Dt,clearHistory:J,exportToPNG:async()=>{if(!G.current)throw new Error("Gantt container not found");let P=await Pd__default.default(G.current,{backgroundColor:V.bgPrimary,scale:2});return new Promise((I,j)=>{P.toBlob(ee=>{ee?I(ee):j(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await re.exportToPDF(fe,P);},exportToExcel:async P=>{await re.exportToExcel(fe,P);},exportToJSON:()=>re.exportToJSON(fe),exportToCSV:()=>re.exportToCSV(fe),importFromJSON:P=>{let I=re.importFromJSON(P);O(I);},getTasks:()=>fe,refresh:()=>{O(P=>[...P]);},clearAll:()=>{O([]);}}),[fe,Ce,qe,je,Dt,J,V,Vt]);let kt=react.useCallback(P=>{De(I=>I.map(j=>j.id===P?{...j,visible:!j.visible}:j));},[]),$=react.useCallback((P,I)=>{De(j=>j.map(ee=>{if(ee.id!==P)return ee;let ie=ee.minWidth??100,Ne=ee.maxWidth??800,Bt=Math.max(ie,Math.min(Ne,I));return {...ee,width:Bt}}));},[]),de=react.useCallback(P=>{O(I=>{let j=Fs(I,P),ee=ie=>{for(let Ne of ie){if(Ne.id===P){Q.current.set(P,Ne.isExpanded??true);return}Ne.subtasks?.length&&ee(Ne.subtasks);}};return ee(j),j}),a.onTaskToggleExpand?.(P);},[a]),Te=react.useCallback((P,I)=>{if(we&&we(P,I)===false)return;let ee=re.findTaskById(fe,P)?.progress,ie=Bt=>Bt.map(Ht=>Ht.id===P?{...Ht,...I}:Ht.subtasks?{...Ht,subtasks:ie(Ht.subtasks)}:Ht);O(ie(fe));let Ne=re.findTaskById(ie(fe),P);Ne&&(M?.(Ne),Ae?.(Ne),I.progress!==void 0&&ee!==void 0&&I.progress!==ee&&T?.(P,ee,I.progress));},[fe,M,we,Ae,T]),$t=react.useCallback(P=>{P.length!==0&&(O(I=>Es(I,P)),a.onTaskIndent?.(P[0]));},[a]),ea=react.useCallback(P=>{P.length!==0&&(O(I=>Ps(I,P)),a.onTaskOutdent?.(P[0]));},[a]),Ya=react.useCallback((P,I,j)=>{O(ee=>pd(ee,P,I,j)),a.onTaskReparent?.(P,I,j);},[a]),Xr=react.useCallback((P,I)=>{P.length!==0&&(O(j=>Ms(j,P,I)),a.onTaskMove?.(P[0],I));},[a]),se=react.useCallback(async P=>{let I=[];for(let j of P)Re&&await Promise.resolve(Re(j))===false||I.push(j);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(O(j=>As(j,I)),I.forEach(j=>a.onTaskDelete?.(j))),R&&I.forEach(j=>R(j)));},[a,Re,R]),wt=react.useCallback(P=>{O(I=>Is(I,P)),P.forEach(I=>a.onTaskDuplicate?.(I));},[a]),Jt=react.useCallback((P,I)=>{O(j=>{let{tasks:ee,newTask:ie}=cd(j,P,I);return q&&q(ie)===false?j:(a.onTaskCreate?.(ie.parentId,ie.position||0),ve?.(ie),ee)});},[a,q,ve]),Sr=react.useCallback((P,I)=>{O(j=>Ls(j,P,I)),a.onTaskRename?.(P,I);},[a]),Er=react.useCallback(P=>{O(I=>{let{tasks:j}=Bs(I,P);return a.onTaskCreate?.(P,0),j});},[a]),Pr=react.useCallback((P,I,j)=>{let ee=P.startDate?Math.round((I.getTime()-P.startDate.getTime())/864e5):0,ie=Ht=>Ht.map(Zt=>Zt.id===P.id?{...Zt,startDate:I,endDate:j,...P.segments&&{segments:P.segments}}:Zt.subtasks?{...Zt,subtasks:ie(Zt.subtasks)}:Zt),Ne=ie(fe);Ne=re.autoScheduleDependents(Ne,P.id,ee),O(Ne);let Bt={...P,startDate:I,endDate:j};M?.(Bt);},[fe,M]),za=react.useCallback((P,I)=>{x?.(P,I),It({isOpen:true,x:I.clientX,y:I.clientY,task:P});},[x]),sr=react.useCallback((P,I)=>{let j=re.splitTask(fe,P.id,I);O(j),It({isOpen:false,x:0,y:0,task:null});},[fe]),Nt=react.useCallback(P=>{let I=re.findTaskById(fe,P.id)||P;N?.(I),B||tt(I);},[fe,N,B]),So=react.useCallback((P,I,j)=>{let ee=new Map,ie=Ca=>{Ca.forEach(Ua=>{Ua.dependencies&&ee.set(Ua.id,Ua.dependencies),Ua.subtasks&&ie(Ua.subtasks);});};ie(j);let Ne=ee.get(I)||[];ee.set(I,[...Ne,P]);let Bt=new Set,Ht=new Set,Zt=Ca=>{if(!Bt.has(Ca)){Bt.add(Ca),Ht.add(Ca);let Ua=ee.get(Ca)||[];for(let ir of Ua){if(!Bt.has(ir)&&Zt(ir))return true;if(Ht.has(ir))return true}}return Ht.delete(Ca),false};return Zt(I)},[]),Eo=react.useCallback((P,I)=>{if(So(P.id,I,fe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=se.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let y=t.find(b=>b.id===u);if(y){o(y);let b=r.get(u)?.ef||0;d=Math.max(d,b);}}let i=d+m;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,c=n=>{if(l.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(n.id)),i=s;if(d.length>0)for(let y of d){c(y);let b=l.get(y.id)?.ls||0;i=Math.min(i,b);}let u=i-m;l.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),d=l.get(n.id);if(m&&d){let i=d.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(se.calculateCriticalPath(e).includes(t))return 0;let o=se.getDependentTasks(e,t);if(o.length===0){let c=se.getLatestEndDate(e);if(!c)return null;let p=se.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let l=se.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=se.findTaskById(e,t);if(!r||!r.endDate)return e;let o=se.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=se.calculateDuration(l.startDate,l.endDate),p;a!==void 0?(p=new Date(l.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=se.calculateEndDate(p,c),m=d=>d.map(i=>i.id===l.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=se.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,d=se.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(u,y,b=new Set)=>{if(b.has(u))return;b.add(u);let g=se.getDependentTasks(e,u);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(w=>w.id===v.id);if(h===-1)continue;let f=v.startDate.getTime(),D=(v.endDate.getTime()-f)/m,P=(f-n)/m*s,T=P+y*s,O=Math.max(D*s,s),N=c+h*l+12;p.push({taskId:v.id,taskName:v.name,originalX:P,previewX:T,width:O,y:N,rowIndex:h,daysDelta:y,color:v.color}),i(v.id,y,b);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:c}],n=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:u}){let[b,g]=react.useState([]),[v,h]=react.useState(null),[f,k]=react.useState(null),D=react.useCallback($=>{h($);},[]),x=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),P=r==="day"?60:r==="week"?20:8,T=x*P*l,O=$=>{let L=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),z=L.getUTCDay()||7;L.setUTCDate(L.getUTCDate()+4-z);let S=new Date(Date.UTC(L.getUTCFullYear(),0,1));return Math.ceil(((L.getTime()-S.getTime())/864e5+1)/7)},N=$=>{let L=$.getDay();return L===0||L===6},w=react.useCallback($=>{let L=Math.round($/(P*l)),z=new Date(o);return z.setDate(z.getDate()+L),z},[o,P,l]),F=react.useCallback(($,L)=>{if(L.startDate&&L.endDate)return;let z=$.currentTarget.ownerSVGElement;if(!z)return;let S=z.createSVGPoint();S.x=$.clientX,S.y=$.clientY;let R=S.matrixTransform(z.getScreenCTM()?.inverse()),ae=w(R.x),q=new Date(ae);q.setDate(q.getDate()+1),d?.(L,ae,q);},[w,d]),M=react.useMemo(()=>{let $=R=>R.map(ae=>{if(ae.subtasks&&ae.subtasks.length>0){let q=$(ae.subtasks),Ee=q.filter(xe=>xe.startDate&&xe.endDate);if(Ee.length>0){let xe=Ee.map(Ve=>Ve.startDate.getTime()),Je=Ee.map(Ve=>Ve.endDate.getTime()),J=new Date(Math.min(...xe)),qe=new Date(Math.max(...Je));return {...ae,subtasks:q,startDate:J,endDate:qe}}return {...ae,subtasks:q}}return ae}),L=(R,ae=[])=>{for(let q of R)ae.push(q),q.subtasks&&q.subtasks.length>0&&(q.isExpanded===void 0||q.isExpanded)&&L(q.subtasks,ae);return ae},z=$(e);return L(z)},[e]),H=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let L=$.startDate.getTime(),z=$.endDate.getTime(),S=o.getTime(),R=(L-S)/(1e3*60*60*24),ae=(z-L)/(1e3*60*60*24),q=R*P*l,Ee=Math.max(P*l,40),xe=Math.max(ae*P*l,Ee);return {x:q,width:xe}},[o,P,l]),X=react.useMemo(()=>M.filter($=>$.startDate&&$.endDate).map($=>{let{x:L,width:z}=H($),R=M.findIndex(ae=>ae.id===$.id)*a+12;return {id:$.id,x:L,y:R,width:z,height:32}}),[M,H]),ye=react.useCallback(($,L,z)=>{if(!z||L===0){g([]);return}let S=se.calculateCascadePreview(e,$,L,M,o,P*l,a,48);g(S);},[e,M,o,P,l,a,48]),ke=react.useMemo(()=>{let $=[],L=new Date(o);for(;L<=s;){let R=(L.getTime()-o.getTime())/864e5*P*l;if(r==="day")$.push({date:new Date(L),label:L.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),L.setDate(L.getDate()+1);else if(r==="week"){let ae=O(L);$.push({date:new Date(L),label:`Week ${ae}`,x:R}),L.setDate(L.getDate()+7);}else $.push({date:new Date(L),label:L.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),L.setMonth(L.getMonth()+1);}return $},[o,s,r,P,l]),Ae=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*P*l,[o,P,l]),ze=Math.max(M.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},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(T,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(T,1e3),height:48,fill:t.bgGrid}),ke.map(($,L)=>jsxRuntime.jsxs("g",{children:[L>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-${L}`)),Ae>=0&&Ae<=T&&jsxRuntime.jsx("circle",{cx:Ae,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(T,1e3),height:ze,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(T,1e3),height:ze,fill:t.bgPrimary}),ke.map(($,L)=>{let z=ke[L+1]?.x||T,S=N($.date);return jsxRuntime.jsxs("g",{children:[S&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:z-$.x,height:M.length*a,fill:t.bgWeekend,opacity:1}),L>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:M.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},L)}),Ae>=0&&Ae<=T&&jsxRuntime.jsx("line",{x1:Ae,y1:0,x2:Ae,y2:M.length*a,stroke:t.today,strokeWidth:2,opacity:1}),M.map(($,L)=>{let z=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:T,height:a,fill:L%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:L*a,width:T,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:S=>F(S,$),onMouseEnter:S=>{S.currentTarget.setAttribute("fill",t.accentLight),S.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:S=>{S.currentTarget.setAttribute("fill","transparent"),S.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:Ae>0?Ae:100,y:L*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}`)}),M.map(($,L)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(z=>{let S=M.find(Ee=>Ee.id===z);if(!S||!S.startDate||!S.endDate)return null;let R=M.findIndex(Ee=>Ee.id===z),ae=H(S),q=H($);return jsxRuntime.jsx(rn,{x1:ae.x+ae.width,y1:R*a+a/2,x2:q.x,y2:L*a+a/2,theme:t},`dep-${z}-${$.id}`)})),M.map(($,L)=>{if(!$.startDate||!$.endDate)return null;let{x:z,width:S}=H($),R=L*a+12,ae=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(nn,{task:$,x:z+S/2,y:R+16,theme:t,onClick:p},$.id):ae?jsxRuntime.jsxs("g",{onClick:()=>p?.($),onContextMenu:q=>{q.preventDefault(),q.stopPropagation(),m?.($,q);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:z,y:R,width:S,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:z,y1:R,x2:z+S,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:R,x2:z,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z+S,y1:R,x2:z+S,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:z,y1:R+32,x2:z+S,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),S>60&&jsxRuntime.jsx("text",{x:z+12,y:R+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(en,{task:$,x:z,y:R,width:S,theme:t,dayWidth:P*l,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:d,onDependencyCreate:i,allTaskPositions:X,onDragMove:ye,onHoverChange:D},$.id)}),M.map(($,L)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(z=>{let S=M.find(Me=>Me.id===z);if(!S||!S.startDate||!S.endDate)return null;let R=M.findIndex(Me=>Me.id===z),ae=H(S),q=H($),Ee=ae.x+ae.width,xe=R*a+a/2,Je=q.x,J=L*a+a/2,qe=Je-Ee,Ve=Ee+qe/2,gt=Me=>{let Be=1-Me,Ze=Be*Be,we=Ze*Be,It=Me*Me,ge=It*Me,B=we*Ee+3*Ze*Me*Ve+3*Be*It*Ve+ge*Je,he=we*xe+3*Ze*Me*xe+3*Be*It*J+ge*J;return {x:B,y:he}},lt=20,U=[];for(let Me=0;Me<=lt;Me++){let Be=.1+Me/lt*.8;U.push(gt(Be));}let ne=U[0],Pe=`M ${ne.x} ${ne.y} `+U.slice(1).map(Me=>`L ${Me.x} ${Me.y}`).join(" ");return f&&f.x1===Ee&&f.y1===xe&&f.x2===Je&&f.y2===J?null:jsxRuntime.jsx("path",{d:Pe,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:Ee,y1:xe,x2:Je,y2:J,onDelete:()=>u?.($.id,z)});}},`dep-hover-${z}-${$.id}`)})),b.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}`)),f&&(()=>{let{x1:$,y1:L,x2:z,y2:S,onDelete:R}=f,ae=z-$,q=S-L,Ee=$+ae/2,xe=(L+S)/2,Je=`M ${$} ${L} C ${Ee} ${L}, ${Ee} ${S}, ${z} ${S}`,J=6,qe=Math.atan2(q,ae),Ve=z-J*Math.cos(qe-Math.PI/6),gt=S-J*Math.sin(qe-Math.PI/6),lt=z-J*Math.cos(qe+Math.PI/6),U=S-J*Math.sin(qe+Math.PI/6),ne=t.dependency,Pe="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>k(null),children:[jsxRuntime.jsx("path",{d:Je,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:Ee,cy:xe,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Je,fill:"none",stroke:ne,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Je,fill:"none",stroke:ne,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${z} ${S} L ${Ve} ${gt} M ${z} ${S} L ${lt} ${U}`,fill:"none",stroke:ne,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:z,cy:S,r:4,fill:ne,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Me=>{Me.stopPropagation(),k(null),R();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:Ee,cy:xe,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:Pe,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:Ee-3,y1:xe-3,x2:Ee+3,y2:xe+3,stroke:Pe,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Ee+3,y1:xe-3,x2:Ee-3,y2:xe+3,stroke:Pe,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),v&&jsxRuntime.jsx(vd,{tooltipData:v,theme:t})]})]})}var dn=[{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"}];var Us=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ws=[{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 cn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[],availableTags:m=[],onCreateTag:d,attachments:i=[],onUploadAttachments:u,onDeleteAttachment:y}){let b=[...Us,...n.filter(U=>!Us.some(ne=>ne.id===U.id))],g=He[p]||He.dark,[v,h]=react.useState(false),[f,k]=react.useState(false),[D,x]=react.useState(false),[P,T]=react.useState(false),[O,N]=react.useState({top:0,left:0}),[w,F]=react.useState(null),[M,H]=react.useState(new Date),[X,ye]=react.useState({top:0,left:0}),[ke,Ae]=react.useState(false),ze=react.useRef(null),$=react.useRef(null),L=react.useRef(null),z=react.useRef(null),S=react.useRef(null),[R,ae]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[q,Ee]=react.useState({});react.useEffect(()=>{a?(ae({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)&&Ae(true)):(ae({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),Ae(false));},[a,e]),react.useEffect(()=>{let U=ne=>{ze.current&&!ze.current.contains(ne.target)&&h(false),$.current&&!$.current.contains(ne.target)&&k(false),L.current&&!L.current.contains(ne.target)&&x(false),z.current&&!z.current.contains(ne.target)&&T(false);};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);let xe=()=>{let U={};return R.name.trim()||(U.name="El nombre es requerido"),R.startDate&&R.endDate&&R.startDate>R.endDate&&(U.endDate="La fecha de fin debe ser posterior a la de inicio"),Ee(U),Object.keys(U).length===0},Je=async U=>{if(U.preventDefault(),!!xe())try{await s(R),t();}catch(ne){console.error("Error submitting task:",ne);}},J=(U,ne)=>{ae(Pe=>{let Ue={...Pe,[U]:ne};if(U==="status"){let Me=ne;Me==="todo"?Ue.progress=0:Me==="in-progress"?(Pe.progress===0||Pe.progress===100)&&(Ue.progress=50):Me==="completed"||Me==="closed"?Ue.progress=100:(Me==="in-review"||Me==="review")&&(Ue.progress=75);}if(U==="progress"){let Me=typeof ne=="number"?ne:parseInt(ne,10);Me===100&&Pe.status!=="completed"?Ue.status="completed":Me>0&&Me<100&&Pe.status==="todo"?Ue.status="in-progress":Me===0&&Pe.status!=="todo"&&(Ue.status="todo");}return Ue}),q[U]&&Ee(Pe=>{let Ue={...Pe};return delete Ue[U],Ue});},qe=b.find(U=>U.id===R.status)??Us[0],Ve=Ws.find(U=>U.id===R.priority)??Ws[1],gt=dn.find(U=>U.value===R.color)??dn[0],lt={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:qe.color||g.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:U=>{U.currentTarget.style.backgroundColor=g.hoverBg,U.currentTarget.style.color=g.textPrimary;},onMouseLeave:U=>{U.currentTarget.style.backgroundColor="transparent",U.currentTarget.style.color=g.textTertiary;},disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Je,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:R.name,onChange:U=>J("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:g.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),q.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"}),q.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:R.description||"",onChange:U=>J("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:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...lt,borderColor:qe.color,backgroundColor:`${qe.color}15`},disabled:l,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:qe.color}}),jsxRuntime.jsx("span",{style:{color:qe.color},children:qe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:qe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:b.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:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{J("status",U.id),h(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:U.color}}),U.title,R.status===U.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},U.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&k(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:l,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:Ve.color}}),jsxRuntime.jsx("span",{children:Ve.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ws.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:g.textPrimary},onMouseEnter:ne=>ne.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ne=>ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{J("priority",U.id),k(false);},children:[jsxRuntime.jsx("span",{children:U.icon}),U.label,R.priority===U.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},U.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:L,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!l&&x(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:l,children:[R.assignees&&R.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:R.assignees.slice(0,3).map((U,ne)=>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||g.accent,borderColor:g.bgSecondary},children:U.initials},ne))}),R.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:g.textTertiary},children:["+",R.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(U=>{let ne=R.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:g.textPrimary},onMouseEnter:Pe=>Pe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Pe=>Pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Pe=ne?(R.assignees||[]).filter(Ue=>Ue.name!==U.name):[...R.assignees||[],{name:U.name,avatar:U.avatar,initials:U.name.split(" ").map(Ue=>Ue[0]).join("").toUpperCase().slice(0,2),color:g.accent}];J("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:g.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:ne&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},U.id)})})})]}),jsxRuntime.jsxs("div",{ref:z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!l)if(P)T(false);else {if(z.current){let U=z.current.getBoundingClientRect(),ne=window.innerHeight,Pe=120,Me=ne-U.bottom<Pe?U.top-Pe-8:U.bottom+8;N({top:Me,left:U.left});}T(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:lt,disabled:l,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:R.color}}),jsxRuntime.jsx("span",{children:gt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>T(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:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:U=>U.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:dn.slice(0,18).map(U=>{let ne=R.color===U.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{J("color",U.value),T(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:U.value,outline:ne?`2px solid ${U.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:U.name},U.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Rr,{selectedTags:R.tags||[],availableTags:m,onChange:U=>J("tags",U),onCreateTag:d,theme:g,disabled:l}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{ref:S,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!R.isMilestone)if(w==="start")F(null);else {if(S.current){let U=S.current.getBoundingClientRect(),ne=window.innerHeight,Pe=320,Me=ne-U.bottom<Pe?U.top-Pe-8:U.bottom+8;ye({top:Me,left:U.left});}F("start"),H(R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...lt,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:l||R.isMilestone,children:R.startDate?R.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!l&&!R.isMilestone)if(w==="end")F(null);else {if(S.current){let U=S.current.getBoundingClientRect(),ne=window.innerHeight,Pe=320,Me=ne-U.bottom<Pe?U.top-Pe-8:U.bottom+8;ye({top:Me,left:U.left});}F("end"),H(R.endDate||R.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...lt,opacity:R.isMilestone?.5:1,cursor:R.isMilestone?"not-allowed":"pointer"},disabled:l||R.isMilestone,children:R.endDate?R.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(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:`${X.top}px`,left:`${X.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let U=new Date,ne=new Date(U);ne.setDate(U.getDate()+1);let Pe=new Date(U);Pe.setDate(U.getDate()+7);let Ue=new Date(U);return Ue.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Pe},{label:"2 semanas",date:Ue}].map((Be,Ze)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{w==="start"?(J("startDate",Be.date),(!R.endDate||Be.date>R.endDate)&&J("endDate",Be.date),F("end")):(J("endDate",Be.date),(!R.startDate||Be.date<R.startDate)&&J("startDate",Be.date),F(null));},children:Be.label},Ze))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:U=>U.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{J("startDate",void 0),J("endDate",void 0),F(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:()=>H(new Date(M.getFullYear(),M.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:M.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>H(new Date(M.getFullYear(),M.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((U,ne)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:U},ne))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let U=M.getFullYear(),ne=M.getMonth(),Pe=new Date(U,ne,1).getDay(),Ue=new Date(U,ne+1,0).getDate(),Me=new Date,Be=[];for(let we=Pe-1;we>=0;we--)Be.push({day:new Date(U,ne,-we).getDate(),date:new Date(U,ne-1,new Date(U,ne,-we).getDate()),isCurrentMonth:false});for(let we=1;we<=Ue;we++)Be.push({day:we,date:new Date(U,ne,we),isCurrentMonth:true});let Ze=42-Be.length;for(let we=1;we<=Ze;we++)Be.push({day:we,date:new Date(U,ne+1,we),isCurrentMonth:false});return Be.map((we,It)=>{let ge=we.date.toDateString()===Me.toDateString(),B=R.startDate?.toDateString()===we.date.toDateString(),he=R.endDate?.toDateString()===we.date.toDateString(),je=R.startDate&&R.endDate&&we.date>=R.startDate&&we.date<=R.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:we.isCurrentMonth?B||he?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:B?"#3B82F6":he?"#7C3AED":je?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ge&&!B&&!he?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{w==="start"?(J("startDate",we.date),R.endDate&&we.date>R.endDate&&J("endDate",we.date),F("end")):(J("endDate",we.date),R.startDate&&we.date<R.startDate&&J("startDate",we.date),F(null));},children:we.day},It)})})()})]})]})]})})]}),q.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:q.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress,onChange:U=>J("progress",parseInt(U.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"}20`,color:R.progress<30?"#EF4444":R.progress<70?"#F59E0B":"#10B981"},children:[R.progress,"%"]})]})]}),(u||i.length>0)&&jsxRuntime.jsxs("div",{className:"pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",i.length>0&&`(${i.length})`]})]}),jsxRuntime.jsx(Ga,{cardId:a?.id||"new",attachments:i,onUpload:u&&a?.id?U=>u(a.id,U):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),c==="create"&&i.length===0&&jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Podr\xE1s adjuntar archivos despu\xE9s de crear la tarea"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ae(!ke),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ke?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("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:R.isMilestone,onChange:U=>J("isMilestone",U.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:l}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:g.bgSecondary},children:r.filter(U=>U.id!==a?.id).map(U=>{let ne=R.dependencies?.includes(U.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let Pe=ne?(R.dependencies||[]).filter(Ue=>Ue!==U.id):[...R.dependencies||[],U.id];J("dependencies",Pe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:ne?`${g.accent}30`:g.bgPrimary,color:ne?g.accent:g.textSecondary,border:`1px solid ${ne?g.accent:g.borderLight}`},disabled:l,children:U.name},U.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:U=>U.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:U=>!l&&(U.currentTarget.style.opacity="0.9"),onMouseLeave:U=>!l&&(U.currentTarget.style.opacity="1"),children:l?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:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var af=['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"'],Td=()=>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"})]}),rf=()=>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"})}),of=()=>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"})}),nf=()=>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"})}),sf=()=>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 pn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=react.useState(false),[d,i]=react.useState(false),[u,y]=react.useState([]),[b,g]=react.useState(""),[v,h]=react.useState(false),[f,k]=react.useState(true),D=react.useRef(null),x=react.useRef(null),P=react.useRef(null),{enabled:T=true,placeholder:O='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:w,suggestions:F=af,maxHistory:M=50,persistHistory:H}=a,X=H?.storageKey||"gantt-ai-history",ye=H?.maxMessages??5;react.useEffect(()=>{if(H?.enabled)try{let z=localStorage.getItem(X);if(z){let R=JSON.parse(z).map(ae=>({...ae,timestamp:new Date(ae.timestamp)}));y(R.slice(-ye));}}catch(z){console.warn("[GanttAIAssistant] Failed to load persisted history:",z);}},[H?.enabled,X,ye]),react.useEffect(()=>{if(H?.enabled&&u.length>0)try{let z=u.filter(S=>!S.isLoading).slice(-ye);localStorage.setItem(X,JSON.stringify(z));}catch(z){console.warn("[GanttAIAssistant] Failed to persist history:",z);}},[u,H?.enabled,X,ye]),react.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,d]);let ke=react.useCallback(z=>{if(z.success)switch(z.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":z.taskId&&z.updates&&o?.(z.taskId,z.updates);break;case "create_task":z.newTask&&s?.(z.newTask);break;case "delete_task":z.taskId&&l?.(z.taskId);break;case "link_tasks":z.dependencyFrom&&z.dependencyTo&&c?.(z.dependencyFrom,z.dependencyTo);break;case "unlink_tasks":z.taskId&&z.dependencyFrom&&p?.(z.taskId,z.dependencyFrom);break}},[o,s,l,c,p]),Ae=react.useCallback(async z=>{if(!z.trim()||v)return;let S={id:`user-${Date.now()}`,role:"user",content:z,timestamp:new Date};y(ae=>[...ae.slice(-(M-1)),S]),g(""),k(false),h(true);let R={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(ae=>[...ae,R]);try{if(w){let ae=await w(z,e);y(q=>{let Ee=q.filter(Je=>!Je.isLoading),xe={id:`assistant-${Date.now()}`,role:"assistant",content:ae.message,timestamp:new Date,command:ae};return [...Ee,xe]}),ke(ae);}else y(ae=>[...ae.filter(Ee=>!Ee.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(ae){y(q=>[...q.filter(xe=>!xe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ae instanceof Error?ae.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,M,w,e,ke]),ze=z=>{z.preventDefault(),Ae(b);},$=z=>{g(z),D.current?.focus();};if(react.useEffect(()=>{let z=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),m(R=>!R),n||i(false)),S.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[n]),react.useEffect(()=>{if(!n)return;let z=R=>{let ae=R.target;P.current&&!P.current.contains(ae)&&m(false);},S=setTimeout(()=>{document.addEventListener("mousedown",z);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",z);}},[n]),!T)return null;let L={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[N]} 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:()=>m(true),children:[jsxRuntime.jsx(Td,{}),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:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:P,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[N]} 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(Td,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(z=>!z),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(nf,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(of,{})})]})]}),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:[u.length===0&&f&&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:F.slice(0,4).map((z,S)=>jsxRuntime.jsx("button",{onClick:()=>$(z),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:z.length>30?z.slice(0,30)+"...":z},S))})]}),u.map(z=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${z.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${z.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:z.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:z.role==="user"?"white":t.textPrimary},children:[z.isLoading?jsxRuntime.jsx(sf,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.content}),z.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:z.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:z.command.success?"#10B981":"#EF4444"},children:[z.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:z.command.type.replace(/_/g," ")})]})]})},z.id)),jsxRuntime.jsx("div",{ref:x})]}),jsxRuntime.jsxs("form",{onSubmit:ze,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:b,onChange:z=>g(z.target.value),placeholder:O,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!b.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:b.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:b.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(rf,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Dd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,m=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!m)return {...d,present:i};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function Nd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?l.metaKey:l.ctrlKey;if(p&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&p&&l.key==="y"){l.preventDefault(),t();return}if(c&&p&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var pf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${se.formatDate(e.startDate)} - ${se.formatDate(e.endDate)}`);let a=se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Sd(e){return {...pf,...e}}var yf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Md=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:u,locale:y="en",customTranslations:b,showCreateTaskButton:g=false,createTaskLabel:v,onCreateTask:h,onThemeChange:f,onTaskClick:k,onTaskDblClick:D,onTaskContextMenu:x,onTaskUpdate:P,onProgressChange:T,onTaskEdit:O,onTaskAddSubtask:N,onTaskMarkIncomplete:w,onTaskSetInProgress:F,onDependencyCreate:M,onDependencyDelete:H,onBeforeTaskAdd:X,onAfterTaskAdd:ye,onBeforeTaskUpdate:ke,onAfterTaskUpdate:Ae,onBeforeTaskDelete:ze,onAfterTaskDelete:$}=a,z=react.useContext(Ko)?.theme,[S,R]=react.useState(z||s||"dark"),[ae,q]=react.useState(l),[Ee,xe]=react.useState(c),[Je,J]=react.useState(1),[qe,Ve]=react.useState(0),[gt,lt]=react.useState(false),[U,ne]=react.useState(null),[Pe,Ue]=react.useState({isOpen:false,x:0,y:0,task:null}),[Me,Be]=react.useState(null),[Ze,we]=react.useState(null);react.useEffect(()=>{z&&z!==S&&R(z);},[z]),react.useEffect(()=>{s&&s!==S&&R(s);},[s]);let It=react.useCallback(E=>{R(E),f?.(E);},[f]),{state:ge,setState:B,undo:he,redo:je,canUndo:Xe,canRedo:Dt,clearHistory:Z}=Dd(t,50),ee=react.useRef(new Map);react.useEffect(()=>{let E=A=>A.map(K=>{let te=ee.current.get(K.id),le=te!==void 0?{...K,isExpanded:te}:K;return le.subtasks?.length?{...le,subtasks:E(le.subtasks)}:le});ee.current.size>0?B(E(t)):B(t);},[t,B]);let ve=react.useRef(t),Ne=react.useRef(true);react.useEffect(()=>{if(Ne.current){Ne.current=false,ve.current=ge;return}if(!r)return;let E=JSON.stringify(ve.current),A=JSON.stringify(ge);E!==A&&(ve.current=ge,r(ge));},[ge,r]);let Y=react.useMemo(()=>Ts(y,b),[y,b]),Se=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[be,Te]=react.useState(()=>Se(Y));react.useEffect(()=>{Te(E=>E.map(A=>({...A,label:Y.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Y]);let de=react.useMemo(()=>{let E=be.filter(te=>te.visible),A=E.some(te=>te.id!=="name");return E.reduce((te,le)=>te+le.width,0)+(A?20:0)},[be]);react.useEffect(()=>{U!==null&&U>de&&(be.filter(K=>K.visible).some(K=>K.id!=="name")||ne(null));},[be,de,U]);let Fe=react.useMemo(()=>U!==null?Math.max(280,U,de):Math.max(280,de),[U,de]),Ie=react.useRef(null),Re=react.useRef(null),_=react.useRef(null),j=react.useMemo(()=>Vl(S),[S]),nt=react.useMemo(()=>({theme:j,themeName:S}),[j,S]),We=react.useMemo(()=>Sd(d),[d]),ue=react.useMemo(()=>{if(!i)return ge;let E=se.calculateCriticalPath(ge),A=K=>K.map(te=>({...te,isCriticalPath:E.includes(te.id),subtasks:te.subtasks?A(te.subtasks):void 0}));return A(ge)},[ge,i]),Vt=yf(Ee);Nd({undo:he,redo:je,canUndo:Xe,canRedo:Dt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:E=>se.findTaskById(ge,E),addTask:(E,A)=>{B(K=>{if(!A)return [...K,{...E,level:0}];let te=le=>le.map(De=>De.id===A?{...De,subtasks:[...De.subtasks||[],{...E,parentId:A,level:(De.level||0)+1}],isExpanded:true}:De.subtasks?{...De,subtasks:te(De.subtasks)}:De);return te(K)});},updateTask:(E,A)=>{B(K=>{let te=le=>le.map(De=>De.id===E?{...De,...A}:De.subtasks?{...De,subtasks:te(De.subtasks)}:De);return te(K)});},deleteTask:E=>{B(A=>{let K=te=>te.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=K(le.subtasks)),true));return K(A)});},deleteTasks:E=>{B(A=>As(A,E));},duplicateTask:E=>{B(A=>Is(A,[E]));},splitTask:(E,A,K=3)=>{B(te=>se.splitTask(te,E,A,K));},calculateEndDate:se.calculateEndDate,calculateDuration:se.calculateDuration,validateDependency:(E,A)=>!se.validateDependencies(ge,E,A),getAllTasks:()=>se.flattenTasks(ge),getTasksByStatus:E=>se.flattenTasks(ge).filter(A=>A.status===E),getTasksByParent:E=>E?se.findTaskById(ge,E)?.subtasks||[]:ge.filter(K=>!K.parentId),getCriticalPath:()=>se.flattenTasks(ge).filter(E=>E.isCriticalPath),indentTask:E=>{B(A=>Es(A,[E]));},outdentTask:E=>{B(A=>Ps(A,[E]));},moveTask:(E,A)=>{B(K=>Ms(K,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:K}=Bs(ge,E);if(X){let te=X({...K,parentId:E});if((te instanceof Promise?await te:te)===false)return}B(A),ye&&ye({...K,parentId:E});},scrollToTask:E=>{let K=se.flattenTasks(ge).findIndex(te=>te.id===E);if(K!==-1&&Ie.current){let te=K*Vt;Ie.current.scrollTo({top:te,behavior:"smooth"}),Re.current&&Re.current.scrollTo({top:te,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{B(A=>{let K=te=>te.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},collapseTask:E=>{B(A=>{let K=te=>te.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:K(le.subtasks)}:le);return K(A)});},expandAll:()=>{B(E=>{let A=K=>K.map(te=>({...te,isExpanded:true,subtasks:te.subtasks?A(te.subtasks):void 0}));return A(E)});},collapseAll:()=>{B(E=>{let A=K=>K.map(te=>({...te,isExpanded:false,subtasks:te.subtasks?A(te.subtasks):void 0}));return A(E)});},undo:he,redo:je,canUndo:()=>Xe,canRedo:()=>Dt,clearHistory:Z,exportToPNG:async()=>{if(!_.current)throw new Error("Gantt container not found");let E=await Pd__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2});return new Promise((A,K)=>{E.toBlob(te=>{te?A(te):K(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async E=>{await se.exportToPDF(ge,E);},exportToExcel:async E=>{await se.exportToExcel(ge,E);},exportToJSON:()=>se.exportToJSON(ge),exportToCSV:()=>se.exportToCSV(ge),importFromJSON:E=>{let A=se.importFromJSON(E);B(A);},getTasks:()=>ge,refresh:()=>{B(E=>[...E]);},clearAll:()=>{B([]);}}),[ge,he,je,Xe,Dt,Z,j,Vt]);let kt=react.useCallback(E=>{Te(A=>A.map(K=>K.id===E?{...K,visible:!K.visible}:K));},[]),W=react.useCallback((E,A)=>{Te(K=>K.map(te=>{if(te.id!==E)return te;let le=te.minWidth??100,De=te.maxWidth??800,Bt=Math.max(le,Math.min(De,A));return {...te,width:Bt}}));},[]),ce=react.useCallback(E=>{B(A=>{let K=Fs(A,E),te=le=>{for(let De of le){if(De.id===E){ee.current.set(E,De.isExpanded??true);return}De.subtasks?.length&&te(De.subtasks);}};return te(K),K}),a.onTaskToggleExpand?.(E);},[a]),Ce=react.useCallback((E,A)=>{if(ke&&ke(E,A)===false)return;let te=se.findTaskById(ge,E)?.progress,le=Bt=>Bt.map(Ht=>Ht.id===E?{...Ht,...A}:Ht.subtasks?{...Ht,subtasks:le(Ht.subtasks)}:Ht);B(le(ge));let De=se.findTaskById(le(ge),E);De&&(P?.(De),Ae?.(De),A.progress!==void 0&&te!==void 0&&A.progress!==te&&T?.(E,te,A.progress));},[ge,P,ke,Ae,T]),$t=react.useCallback(E=>{E.length!==0&&(B(A=>Es(A,E)),a.onTaskIndent?.(E[0]));},[a]),ea=react.useCallback(E=>{E.length!==0&&(B(A=>Ps(A,E)),a.onTaskOutdent?.(E[0]));},[a]),qa=react.useCallback((E,A,K)=>{B(te=>pd(te,E,A,K)),a.onTaskReparent?.(E,A,K);},[a]),Xr=react.useCallback((E,A)=>{E.length!==0&&(B(K=>Ms(K,E,A)),a.onTaskMove?.(E[0],A));},[a]),ie=react.useCallback(async E=>{let A=[];for(let K of E)ze&&await Promise.resolve(ze(K))===false||A.push(K);A.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(A):(B(K=>As(K,A)),A.forEach(K=>a.onTaskDelete?.(K))),$&&A.forEach(K=>$(K)));},[a,ze,$]),wt=react.useCallback(E=>{B(A=>Is(A,E)),E.forEach(A=>a.onTaskDuplicate?.(A));},[a]),Jt=react.useCallback((E,A)=>{B(K=>{let{tasks:te,newTask:le}=cd(K,E,A);return X&&X(le)===false?K:(a.onTaskCreate?.(le.parentId,le.position||0),ye?.(le),te)});},[a,X,ye]),Sr=react.useCallback((E,A)=>{B(K=>Ls(K,E,A)),a.onTaskRename?.(E,A);},[a]),Er=react.useCallback(E=>{B(A=>{let{tasks:K}=Bs(A,E);return a.onTaskCreate?.(E,0),K});},[a]),Pr=react.useCallback((E,A,K)=>{let te=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/864e5):0,le=Ht=>Ht.map(Zt=>Zt.id===E.id?{...Zt,startDate:A,endDate:K,...E.segments&&{segments:E.segments}}:Zt.subtasks?{...Zt,subtasks:le(Zt.subtasks)}:Zt),De=le(ge);De=se.autoScheduleDependents(De,E.id,te),B(De);let Bt={...E,startDate:A,endDate:K};P?.(Bt);},[ge,P]),za=react.useCallback((E,A)=>{x?.(E,A),Ue({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[x]),ir=react.useCallback((E,A)=>{let K=se.splitTask(ge,E.id,A);B(K),Ue({isOpen:false,x:0,y:0,task:null});},[ge]),Nt=react.useCallback(E=>{let A=se.findTaskById(ge,E.id)||E;D?.(A),O||Be(A);},[ge,D,O]),So=react.useCallback((E,A,K)=>{let te=new Map,le=Ca=>{Ca.forEach(Ua=>{Ua.dependencies&&te.set(Ua.id,Ua.dependencies),Ua.subtasks&&le(Ua.subtasks);});};le(K);let De=te.get(A)||[];te.set(A,[...De,E]);let Bt=new Set,Ht=new Set,Zt=Ca=>{if(!Bt.has(Ca)){Bt.add(Ca),Ht.add(Ca);let Ua=te.get(Ca)||[];for(let lr of Ua){if(!Bt.has(lr)&&Zt(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(Ca),false};return Zt(A)},[]),Eo=react.useCallback((E,A)=>{if(So(E.id,A,ge)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
277
277
 
278
- Task dependencies must flow in one direction only.`);return}let j=ee=>ee.map(ie=>{if(ie.id===I){let Ne=ie.dependencies||[];if(!Ne.includes(P.id))return {...ie,dependencies:[...Ne,P.id]}}return ie.subtasks?{...ie,subtasks:j(ie.subtasks)}:ie});O(j(fe)),A?.(P.id,I);},[fe,A,So]),An=react.useCallback((P,I)=>{let j=ee=>ee.map(ie=>{if(ie.id===P&&ie.dependencies){let Ne=ie.dependencies.filter(Bt=>Bt!==I);return {...ie,dependencies:Ne}}return ie.subtasks?{...ie,subtasks:j(ie.subtasks)}:ie});O(j(fe)),H?.(P,I);},[fe,H]),{startDate:Jr,endDate:_c}=react.useMemo(()=>{let P=fe.filter(Ne=>Ne.startDate&&Ne.endDate);if(P.length===0){let Ne=new Date,Bt=new Date(Ne);Bt.setDate(Bt.getDate()-30);let Ht=new Date(Ne);return Ht.setDate(Ht.getDate()+60),{startDate:Bt,endDate:Ht}}let I=P.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),j=new Date(Math.min(...I.map(Ne=>Ne.getTime()))),ee=new Date(Math.max(...I.map(Ne=>Ne.getTime()))),ie=ae==="day"?7:ae==="week"?14:30;return j.setDate(j.getDate()-ie),ee.setDate(ee.getDate()+ie),{startDate:j,endDate:ee}},[fe,ae]),Vc=react.useCallback(async()=>{if(!G.current)return;let P=await Pd__default.default(G.current,{backgroundColor:V.bgPrimary,scale:2}),I=document.createElement("a");I.download="gantt-chart.png",I.href=P.toDataURL("image/png"),I.click();},[V]),jc=react.useCallback(async()=>{await re.exportToPDF(fe);},[fe]),Kc=react.useCallback(async()=>{await re.exportToExcel(fe);},[fe]),Yc=react.useCallback(()=>{let P=re.exportToCSV(fe),I=new Blob([P],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[fe]),qc=react.useCallback(()=>{let P=re.exportToJSON(fe),I=new Blob([P],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[fe]),Xc=react.useCallback(()=>{re.exportToMSProject(fe,"Gantt Project","project.xml");},[fe]),Jc=P=>{P.preventDefault(),Se(true);};return react.useEffect(()=>{let P=Oe.current,I=Le.current;if(!P||!I)return;let j=I.querySelector(".gantt-taskgrid-content"),ee=()=>{let Zt=P.scrollTop;F(Zt),j&&(j.style.transform=`translateY(-${Zt}px)`);},ie=Zt=>{if(ne&&I){let Ua=I.parentElement?.getBoundingClientRect()?.left||0,ir=Zt.clientX-Ua,Zc=280,Qc=Math.min(window.innerWidth-300,800);ir>=Zc&&ir<=Qc&&Ie(ir);}},Ne=()=>{Se(false);},Bt=I.querySelector(".gantt-grid-scroll")||I,Ht=Zt=>{let Ca=Zt;Ca.deltaY!==0&&(P.scrollTop+=Ca.deltaY,Zt.preventDefault());};return P.addEventListener("scroll",ee),Bt.addEventListener("wheel",Ht,{passive:false}),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",Ne),()=>{P.removeEventListener("scroll",ee),Bt.removeEventListener("wheel",Ht),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",Ne);}},[ne]),jsxRuntime.jsx(Wr.Provider,{value:K,children:jsxRuntime.jsx(Rn.Provider,{value:st,children:jsxRuntime.jsxs("div",{ref:G,className:"flex flex-col h-full w-full",style:{backgroundColor:V.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(qo,{theme:V,timeScale:ae,onTimeScaleChange:X,zoom:Ke,onZoomChange:ue,currentTheme:E,onThemeChange:xt,rowDensity:me,onRowDensityChange:be,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:v,onCreateTask:b,onExportPNG:n?Vc:void 0,onExportPDF:n?jc:void 0,onExportExcel:n?Kc:void 0,onExportCSV:n?Yc:void 0,onExportJSON:n?qc:void 0,onExportMSProject:n?Xc:void 0}),jsxRuntime.jsxs("div",{ref:Le,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:Be,overflow:"hidden"},children:jsxRuntime.jsx(Qo,{tasks:ge,theme:V,rowHeight:Vt,availableUsers:u,templates:ze,onTaskClick:k,onTaskDblClick:Nt,onTaskContextMenu:x,onTaskToggle:de,scrollTop:Ye,columns:ye,onToggleColumn:kt,onColumnResize:$,onTaskUpdate:Te,onTaskIndent:$t,onTaskOutdent:ea,onTaskMove:Xr,onMultiTaskDelete:se,onTaskDuplicate:wt,onTaskCreate:Jt,onTaskRename:Sr,onCreateSubtask:Er,onOpenTaskModal:k?P=>k(P):void 0,onDeleteRequest:(P,I)=>ot({taskId:P,taskName:I}),onTaskReparent:Ya})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Jc}),jsxRuntime.jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ln,{tasks:ge,theme:V,rowHeight:Vt,timeScale:ae,startDate:Jr,endDate:_c,zoom:Ke,templates:ze,onTaskClick:k,onTaskDblClick:Nt,onTaskContextMenu:za,onTaskDateChange:Pr,onDependencyCreate:Eo,onDependencyDelete:An})})]}),et.task&&jsxRuntime.jsx(Hr,{isOpen:et.isOpen,x:et.x,y:et.y,theme:V,onClose:()=>It({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=et.task;if(!P)return [];let I=re.findTaskById(fe,P.id)||P;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:K.contextMenu?.addSubtask||"Add Subtask",icon:yt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:K.contextMenu?.deleteTask||"Delete Task",icon:yt.Delete,onClick:()=>{ot({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:K.contextMenu?.editTask||"Edit Task",icon:yt.Pencil,onClick:()=>{B?B(I):tt(I);}},{id:"addSubtask",label:K.contextMenu?.addSubtask||"Add Subtask",icon:yt.Add,onClick:()=>{D?D(I):Er(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:K.contextMenu?.markIncomplete||"Mark Incomplete",icon:yt.MarkIncomplete,onClick:()=>{w?w(I):Te(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:K.contextMenu?.setInProgress||"Set In Progress",icon:yt.SetInProgress,onClick:()=>{U?U(I):Te(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:K.contextMenu?.markComplete||"Mark Complete",icon:yt.MarkComplete,onClick:()=>{Te(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:K.contextMenu?.splitTask||"Split Task",icon:yt.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ee=I.startDate.getTime(),ie=I.endDate.getTime(),Ne=ee+(ie-ee)/2,Bt=new Date(Ne);sr(I,Bt);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:K.contextMenu?.deleteTask||"Delete Task",icon:yt.Delete,onClick:()=>{ot({taskId:I.id,taskName:I.name});}}]})()}),ke&&jsxRuntime.jsx(cn,{isOpen:true,onClose:()=>tt(null),task:ke,onSubmit:P=>{Te(ke.id,P),tt(null);},mode:"edit",theme:E}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&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:()=>ot(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:V.bgSecondary,border:`1px solid ${V.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${V.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:V.textPrimary,fontFamily:"Inter, sans-serif"},children:[K.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:V.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:V.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:V.textPrimary},children:['"',Ze.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:V.bgPrimary,borderTop:`1px solid ${V.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ot(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:V.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=V.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{se([Ze.taskId]),ot(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),c?.enabled&&jsxRuntime.jsx(pn,{tasks:fe,theme:V,config:c,onTasksUpdate:O,onTaskUpdate:Te,onTaskCreate:P=>{O(I=>[...I,P]);},onTaskDelete:P=>{se([P]);},onDependencyCreate:(P,I)=>{let j=re.findTaskById(fe,P);j&&Eo(j,I);},onDependencyDelete:An})]})})})});var Ad=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
278
+ Task dependencies must flow in one direction only.`);return}let K=te=>te.map(le=>{if(le.id===A){let De=le.dependencies||[];if(!De.includes(E.id))return {...le,dependencies:[...De,E.id]}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});B(K(ge)),M?.(E.id,A);},[ge,M,So]),An=react.useCallback((E,A)=>{let K=te=>te.map(le=>{if(le.id===E&&le.dependencies){let De=le.dependencies.filter(Bt=>Bt!==A);return {...le,dependencies:De}}return le.subtasks?{...le,subtasks:K(le.subtasks)}:le});B(K(ge)),H?.(E,A);},[ge,H]),{startDate:Jr,endDate:_c}=react.useMemo(()=>{let E=ge.filter(De=>De.startDate&&De.endDate);if(E.length===0){let De=new Date,Bt=new Date(De);Bt.setDate(Bt.getDate()-30);let Ht=new Date(De);return Ht.setDate(Ht.getDate()+60),{startDate:Bt,endDate:Ht}}let A=E.flatMap(De=>[De.startDate,De.endDate]).filter(De=>De!==void 0),K=new Date(Math.min(...A.map(De=>De.getTime()))),te=new Date(Math.max(...A.map(De=>De.getTime()))),le=ae==="day"?7:ae==="week"?14:30;return K.setDate(K.getDate()-le),te.setDate(te.getDate()+le),{startDate:K,endDate:te}},[ge,ae]),Vc=react.useCallback(async()=>{if(!_.current)return;let E=await Pd__default.default(_.current,{backgroundColor:j.bgPrimary,scale:2}),A=document.createElement("a");A.download="gantt-chart.png",A.href=E.toDataURL("image/png"),A.click();},[j]),jc=react.useCallback(async()=>{await se.exportToPDF(ge);},[ge]),Kc=react.useCallback(async()=>{await se.exportToExcel(ge);},[ge]),Yc=react.useCallback(()=>{let E=se.exportToCSV(ge),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(A),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[ge]),qc=react.useCallback(()=>{let E=se.exportToJSON(ge),A=new Blob([E],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(A),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[ge]),Xc=react.useCallback(()=>{se.exportToMSProject(ge,"Gantt Project","project.xml");},[ge]),Jc=E=>{E.preventDefault(),lt(true);};return react.useEffect(()=>{let E=Re.current,A=Ie.current;if(!E||!A)return;let K=A.querySelector(".gantt-taskgrid-content"),te=()=>{let Zt=E.scrollTop;Ve(Zt),K&&(K.style.transform=`translateY(-${Zt}px)`);},le=Zt=>{if(gt&&A){let Ua=A.parentElement?.getBoundingClientRect()?.left||0,lr=Zt.clientX-Ua,Zc=280,Qc=Math.min(window.innerWidth-300,800);lr>=Zc&&lr<=Qc&&ne(lr);}},De=()=>{lt(false);},Bt=A.querySelector(".gantt-grid-scroll")||A,Ht=Zt=>{let Ca=Zt;Ca.deltaY!==0&&(E.scrollTop+=Ca.deltaY,Zt.preventDefault());};return E.addEventListener("scroll",te),Bt.addEventListener("wheel",Ht,{passive:false}),document.addEventListener("mousemove",le),document.addEventListener("mouseup",De),()=>{E.removeEventListener("scroll",te),Bt.removeEventListener("wheel",Ht),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",De);}},[gt]),jsxRuntime.jsx(Wr.Provider,{value:Y,children:jsxRuntime.jsx(Rn.Provider,{value:nt,children:jsxRuntime.jsxs("div",{ref:_,className:"flex flex-col h-full w-full",style:{backgroundColor:j.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(qo,{theme:j,timeScale:ae,onTimeScaleChange:q,zoom:Je,onZoomChange:J,currentTheme:S,onThemeChange:It,rowDensity:Ee,onRowDensityChange:xe,showThemeSelector:p,showCreateTaskButton:g,createTaskLabel:v,onCreateTask:h,onExportPNG:n?Vc:void 0,onExportPDF:n?jc:void 0,onExportExcel:n?Kc:void 0,onExportCSV:n?Yc:void 0,onExportJSON:n?qc:void 0,onExportMSProject:n?Xc:void 0}),jsxRuntime.jsxs("div",{ref:Ie,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:Fe,overflow:"hidden"},children:jsxRuntime.jsx(Qo,{tasks:ue,theme:j,rowHeight:Vt,availableUsers:m,templates:We,onTaskClick:k,onTaskDblClick:Nt,onTaskContextMenu:x,onTaskToggle:ce,scrollTop:qe,columns:be,onToggleColumn:kt,onColumnResize:W,onTaskUpdate:Ce,onTaskIndent:$t,onTaskOutdent:ea,onTaskMove:Xr,onMultiTaskDelete:ie,onTaskDuplicate:wt,onTaskCreate:Jt,onTaskRename:Sr,onCreateSubtask:Er,onOpenTaskModal:k?E=>k(E):void 0,onDeleteRequest:(E,A)=>we({taskId:E,taskName:A}),onTaskReparent:qa})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Jc}),jsxRuntime.jsx("div",{ref:Re,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ln,{tasks:ue,theme:j,rowHeight:Vt,timeScale:ae,startDate:Jr,endDate:_c,zoom:Je,templates:We,onTaskClick:k,onTaskDblClick:Nt,onTaskContextMenu:za,onTaskDateChange:Pr,onDependencyCreate:Eo,onDependencyDelete:An})})]}),Pe.task&&jsxRuntime.jsx(Hr,{isOpen:Pe.isOpen,x:Pe.x,y:Pe.y,theme:j,onClose:()=>Ue({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Pe.task;if(!E)return [];let A=se.findTaskById(ge,E.id)||E;return A.subtasks&&A.subtasks.length>0?[{id:"addSubtask",label:Y.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{N?N(A):Er(A.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Y.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{we({taskId:A.id,taskName:A.name});}}]:[{id:"edit",label:Y.contextMenu?.editTask||"Edit Task",icon:vt.Pencil,onClick:()=>{O?O(A):Be(A);}},{id:"addSubtask",label:Y.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{N?N(A):Er(A.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Y.contextMenu?.markIncomplete||"Mark Incomplete",icon:vt.MarkIncomplete,onClick:()=>{w?w(A):Ce(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"},{id:"setInProgress",label:Y.contextMenu?.setInProgress||"Set In Progress",icon:vt.SetInProgress,onClick:()=>{F?F(A):Ce(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"},{id:"markComplete",label:Y.contextMenu?.markComplete||"Mark Complete",icon:vt.MarkComplete,onClick:()=>{Ce(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Y.contextMenu?.splitTask||"Split Task",icon:vt.Split,onClick:()=>{if(!A.startDate||!A.endDate){console.warn("Cannot split task without dates");return}let te=A.startDate.getTime(),le=A.endDate.getTime(),De=te+(le-te)/2,Bt=new Date(De);ir(A,Bt);},disabled:!A.startDate||!A.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Y.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{we({taskId:A.id,taskName:A.name});}}]})()}),Me&&jsxRuntime.jsx(cn,{isOpen:true,onClose:()=>Be(null),task:Me,onSubmit:E=>{Ce(Me.id,E),Be(null);},mode:"edit",theme:S}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&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:()=>we(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:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:j.bgSecondary,border:`1px solid ${j.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${j.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:j.textPrimary,fontFamily:"Inter, sans-serif"},children:[Y.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:j.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:j.textPrimary},children:['"',Ze.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:j.bgPrimary,borderTop:`1px solid ${j.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>we(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:j.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=j.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ie([Ze.taskId]),we(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:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(pn,{tasks:ge,theme:j,config:u,onTasksUpdate:B,onTaskUpdate:Ce,onTaskCreate:E=>{B(A=>[...A,E]);},onTaskDelete:E=>{ie([E]);},onDependencyCreate:(E,A)=>{let K=se.findTaskById(ge,E);K&&Eo(K,A);},onDependencyDelete:An})]})})})});var Ad=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
279
 
280
280
  AVAILABLE COMMANDS:
281
281
  1. move_task - Move a task to a different date
@@ -320,7 +320,7 @@ If ambiguous, ask for clarification in the message field.`;function Id(e){return
320
320
  ${Ld(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",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
321
321
  `)}
322
322
 
323
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Ld(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ja(e,t){let a=Ld(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 l=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return l.every(n=>m.includes(n))})}function _s(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 c={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(c!==void 0){let y=new Date(r),f=y.getDay(),h=c-f;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),c=s[2].toLowerCase(),y=new Date(r);return c==="day"||c==="d\xEDa"||c==="dias"?y.setDate(y.getDate()+i):c==="week"||c==="semana"||c==="semanas"?y.setDate(y.getDate()+i*7):(c==="month"||c==="mes"||c==="meses")&&y.setMonth(y.getMonth()+i),y}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 i=parseInt(p[1],10),c=parseInt(p[2],10)-1,y=parseInt(p[3],10);return new Date(y,c,i)}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},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),c=m[n[2].toLowerCase()],y=n[3]?parseInt(n[3],10):r.getFullYear();if(c!==void 0)return new Date(y,c,i)}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 i=u[d[1].toLowerCase()],c=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(y,i,c)}return null}function Vs(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 js(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 Fd(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 Bd(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 n=r[1].trim(),u=r[2].trim(),d=ja(t,n),i=_s(u);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)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 c=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(i);return y.setDate(y.getDate()+c),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:y},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),u=o[2].trim(),d=ja(t,n),i=Vs(u);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!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 c=new Date(d.endDate);return c.setDate(c.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:c},message:`Extended "${d.name}" by ${i} days. New end date: ${c.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 n=s[1].trim(),u=s[2].trim(),d=ja(t,n),i=js(u);return d?i===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:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),u=l[2].trim(),d=ja(t,n);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:n,message:`Could not find a task named "${n}".`,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 n=p[1].trim(),u=p[2].trim(),d=ja(t,n),i=ja(t,u);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.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:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),u=ja(t,n);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Rd(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 vf(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 xf(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(i=>i.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 l=u=>{if(u)return typeof u=="string"?new Date(u):u},p=l(e.startDate),m=l(e.endDate),n=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:vf(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Od(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:xf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $d(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>un(r,e,t))}var Ks={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"}},Ys={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"}},gn={en:Ks,es:Ys};function qs(e){return gn[e]||gn.en}function fn(e,t){let a=qs(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 Hd(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(...Hd(r.subtasks,t+1));return a}function Af({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 Gd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:p="dark",locale:m="en",customTranslations:n,showSearch:u=true,showHierarchy:d=true}=t,i=fn(m,n),c=p==="dark",[y,f]=react.useState(new Set),[h,v]=react.useState("startDate"),[b,g]=react.useState("asc"),[k,N]=react.useState("");react.useMemo(()=>{let D=new Set;function w(U){for(let A of U)A.subtasks?.length&&(D.add(A.id),w(A.subtasks));}w(e),f(D);},[e]);let x=react.useCallback(D=>{f(w=>{let U=new Set(w);return U.has(D)?U.delete(D):U.add(D),U}),a.onTaskToggleExpand?.(D);},[a]),M=react.useCallback(D=>{h===D?g(w=>w==="asc"?"desc":"asc"):(v(D),g("asc")),a.onSortChange?.({column:D,direction:b==="asc"?"desc":"asc"});},[h,b,a]),T=react.useMemo(()=>{let D=Hd(e);if(k.trim()){let U=k.toLowerCase();D=D.filter(A=>A.name.toLowerCase().includes(U));}let w=[];for(let U of D){let A=U.level===0;U.level>0&&(A=true),(A||k.trim())&&w.push(U);}return k.trim()&&w.sort((U,A)=>{let H,q;switch(h){case "name":H=U.name.toLowerCase(),q=A.name.toLowerCase();break;case "startDate":H=U.startDate?.getTime()||0,q=A.startDate?.getTime()||0;break;case "endDate":H=U.endDate?.getTime()||0,q=A.endDate?.getTime()||0;break;case "progress":H=U.progress||0,q=A.progress||0;break;case "status":H=U.status||"todo",q=A.status||"todo";break;default:return 0}return H<q?b==="asc"?-1:1:H>q?b==="asc"?1:-1:0}),w},[e,k,h,b]),B=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-hidden",c?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",c?"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:C("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:D=>N(D.target.value),placeholder:i.toolbar.searchPlaceholder,className:C("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",c?"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:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[T.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:C("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",c?"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:()=>M("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>M("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>M("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>M("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>M("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:T.map((D,w)=>{let U=y.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:w*.02},className:C("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",c?"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:A=>{A.stopPropagation(),x(D.id);},className:C("p-0.5 rounded",c?"hover:bg-white/10":"hover:bg-gray-200"),children:U?jsxRuntime.jsx(lucideReact.ChevronDown,{className:C("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Af,{status:D.status,progress:D.progress})}),jsxRuntime.jsx("span",{className:C("truncate",c?"text-white":"text-gray-900",D.progress===100&&(c?"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:C("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":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D.progress===100||D.status==="completed"?i.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(D.startDate)]}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",c?"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:C("flex-1 h-1.5 rounded-full overflow-hidden",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-xs w-8",c?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),T.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:C("w-12 h-12 mx-auto mb-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:C(c?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Xs={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"},Js={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"},Zs={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"},hn={dark:Xs,light:Js,neutral:Zs};function _d(e){return hn[e]||hn.dark}var Qs={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"}},ei={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:Qs,es:ei};function vo(e){return yn[e]||yn.en}function vn(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 Vd(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 jd(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 _f(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 ni(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 qd({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 Jd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:p}){let{theme:m="dark",locale:n="en",customTranslations:u}=t,d=vn(n,u),i=m==="dark",[c,y]=react.useState(r||new Date),[f,h]=react.useState(null),[v,b]=react.useState(null),[g,k]=react.useState(null),[N,x]=react.useState(new Date),[M,T]=react.useState({}),B=4,D=3,[w,U]=react.useState(false),[A,H]=react.useState(false),[q,ve]=react.useState(false),[we,Ae]=react.useState(null),[Re,R]=react.useState(""),[S,z]=react.useState(void 0),[E,Y]=react.useState(null),[ae,X]=react.useState(false),[me,be]=react.useState(false),[Ke,ue]=react.useState(null),[Ye,F]=react.useState(false),[ne,Se]=react.useState(new Date),Me=react.useCallback(()=>{y(new Date(c.getFullYear(),c.getMonth()-1,1));},[c]),Ie=react.useCallback(()=>{y(new Date(c.getFullYear(),c.getMonth()+1,1));},[c]),et=react.useCallback(()=>{y(new Date);},[]),It=react.useMemo(()=>{let O=c.getFullYear(),Ce=c.getMonth(),qe=new Date(O,Ce,1),je=new Date(O,Ce+1,0),Dt=qe.getDay(),J=je.getDate(),Q=_f(e),xe=new Date;xe.setHours(0,0,0,0);let Ee=[],K=Dt,Pe=new Date(O,Ce,0).getDate();for(let De=K-1;De>=0;De--){let le=new Date(O,Ce-1,Pe-De);Ee.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Q.filter(Be=>ni(le,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}for(let De=1;De<=J;De++){let le=new Date(O,Ce,De),Be=le.getTime()===xe.getTime();Ee.push({date:le,isCurrentMonth:true,isToday:Be,isWeekend:le.getDay()===0||le.getDay()===6,events:Q.filter(Le=>ni(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}let ye=42-Ee.length;for(let De=1;De<=ye;De++){let le=new Date(O,Ce+1,De);Ee.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Q.filter(Be=>ni(le,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}return Ee},[c,e]),ke=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],tt=c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ze=react.useCallback((O,Ce)=>{if(!f)return;let qe={...f,[O]:Ce};h(qe),a.onTaskUpdate?.(qe);},[f,a]),ot=react.useCallback(O=>{if(!f)return;let Ce=f.progress||0;O==="completed"?Ce=100:O==="todo"&&(Ce=0);let qe={...f,status:O,progress:Ce};h(qe),a.onTaskUpdate?.(qe),U(false);},[f,a]),xt=react.useCallback((O,Ce)=>{if(!f)return;let qe={...f,startDate:O,endDate:Ce};h(qe),a.onTaskUpdate?.(qe);},[f,a]),fe=react.useCallback(()=>{U(false),H(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),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:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),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:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),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:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:p,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",i?"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:C("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:tt}),jsxRuntime.jsx("button",{onClick:et,className:C("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Me,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ie,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-5 h-5",i?"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:ke.map(O=>jsxRuntime.jsx("div",{className:C("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:C("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:It.map((O,Ce)=>{let qe=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:C("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?qe?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":qe?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let je=M[Ce]||B,Dt=O.events.slice(0,je),J=O.events.length-je;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Dt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{h(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:C("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(qd,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),T(xe=>({...xe,[Ce]:je+D}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),je>B&&O.events.length>B&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),T(xe=>({...xe,[Ce]:B}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let je=Ce>=28,Dt=Ce%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),we===Ce?Ae(null):(Ae(Ce),R(""),z(void 0),Y(null),ue(null),X(false),be(false),F(false),Se(O.date));},className:C("w-5 h-5 rounded flex items-center justify-center transition-all",we===Ce?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:C("w-3.5 h-3.5 transition-transform",we===Ce&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:we===Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(null),R(""),z(void 0),Y(null),ue(null),X(false),be(false),F(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:je?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:je?-5:5,scale:.95},transition:{duration:.12},className:C("absolute w-[320px] rounded-lg shadow-2xl z-50",je?"bottom-full mb-1":"top-full mt-1",Dt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),X(false),be(false),F(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Re,onChange:J=>R(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:C("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Re.trim()){let Q=t.availableUsers?.find(Ee=>Ee.id===E),xe=Ke||O.date;a.onTaskCreate?.({name:Re.trim(),startDate:xe,endDate:xe,priority:S,assignees:Q?[Q]:void 0}),R(""),z(void 0),Y(null),ue(null),Ae(null);}J.key==="Escape"&&(Ae(null),R(""),z(void 0),Y(null),ue(null));}})}),jsxRuntime.jsxs("div",{className:C("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),X(!ae),be(false);},className:C("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"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:ae&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),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(J=>jsxRuntime.jsxs("button",{onClick:()=>{z(J.id),X(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),F(!Ye),X(false),be(false),Se(Ke||O.date);},className:C("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ke?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"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"}),(Ke||O.date).toLocaleDateString(n==="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:C("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:C("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let xe=new Date(J);xe.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let Ee=new Date(J);Ee.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let K=new Date(J);K.setDate(J.getDate()+14);let Pe=new Date(J);return Pe.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ee,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Pe,display:Pe.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((De,le)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ue(De.date),F(false);},children:[jsxRuntime.jsx("span",{children:De.label}),jsxRuntime.jsx("span",{className:C("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:De.display})]},le))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:C("text-xs font-medium",i?"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-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Se(new Date),className:C("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Se(new Date(ne.getFullYear(),ne.getMonth()-1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Se(new Date(ne.getFullYear(),ne.getMonth()+1)),className:C("p-0.5 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:C("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=ne.getFullYear(),Q=ne.getMonth(),xe=new Date(J,Q,1).getDay(),Ee=new Date(J,Q+1,0).getDate(),K=new Date(J,Q,0).getDate(),Pe=new Date,ye=[];for(let le=xe-1;le>=0;le--)ye.push({dayNum:K-le,isCurrentMonth:false,date:new Date(J,Q-1,K-le)});for(let le=1;le<=Ee;le++)ye.push({dayNum:le,isCurrentMonth:true,date:new Date(J,Q,le)});let De=42-ye.length;for(let le=1;le<=De;le++)ye.push({dayNum:le,isCurrentMonth:false,date:new Date(J,Q+1,le)});return ye.map((le,Be)=>{let Le=le.date.toDateString()===Pe.toDateString(),Oe=(Ke||O.date).toDateString()===le.date.toDateString();return jsxRuntime.jsx("button",{className:C("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!le.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),le.isCurrentMonth&&(i?"text-white":"text-gray-900"),Le&&"ring-1 ring-[#3B82F6]",Oe&&"bg-[#7C3AED] text-white",!Oe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ue(le.date),F(false);},children:le.dayNum},Be)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),be(!me),X(false);},className:C("p-1 rounded transition-colors",E?"text-[#7C3AED] bg-[#7C3AED]/20":i?"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(J=>J.id===E)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===E)?.initials||t.availableUsers?.find(J=>J.id===E)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{Y(null),be(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!E&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:C("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{Y(J.id),be(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",E===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:C("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Re.trim()){let J=t.availableUsers?.find(xe=>xe.id===E),Q=Ke||O.date;a.onTaskCreate?.({name:Re.trim(),startDate:Q,endDate:Q,priority:S,assignees:J?[J]:void 0}),R(""),z(void 0),Y(null),ue(null),Ae(null);}},disabled:!Re.trim(),className:C("px-2.5 py-1 rounded text-xs font-medium transition-colors",Re.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:C("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},Ce)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(null),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:C("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:C("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:C("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:C("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:C("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"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:C("p-1.5 rounded transition-colors",i?"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:C("p-1.5 rounded transition-colors",i?"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:()=>h(null),className:C("p-1.5 rounded transition-colors",i?"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 O=f.progress===100?0:100,qe={...f,progress:O,status:O===100?"completed":"todo"};h(qe),a.onTaskUpdate?.(qe);},className:C("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:C("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.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:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{fe(),U(!w);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.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:()=>U(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>ot(O.id),className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,Ce)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},Ce)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(g?null:"start"),x(f.startDate||new Date);},className:C("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:C("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:C("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:C("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,Ce=new Date(O);Ce.setDate(O.getDate()+1);let qe=new Date(O);qe.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let je=new Date(O);je.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let Dt=new Date(O);Dt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let J=new Date(O);J.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:qe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Dt,display:Dt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ee,K)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Pe=f.endDate&&Ee.date>f.endDate?Ee.date:f.endDate;xt(Ee.date,Pe),k("end");}else {let Pe=f.startDate&&Ee.date<f.startDate?Ee.date:f.startDate;xt(Pe,Ee.date),k(null);}},children:[jsxRuntime.jsx("span",{children:Ee.label}),jsxRuntime.jsx("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Ee.display})]},K))})(),jsxRuntime.jsx("div",{className:C("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{xt(void 0,void 0),k(null);},className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:C("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="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:C("font-medium",i?"text-white":"text-gray-900"),children:N.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:()=>x(new Date),className:C("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(N.getFullYear(),N.getMonth()-1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(N.getFullYear(),N.getMonth()+1)),className:C("p-1 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:C("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=N.getFullYear(),Ce=N.getMonth(),qe=new Date(O,Ce,1).getDay(),je=new Date(O,Ce+1,0).getDate(),Dt=new Date(O,Ce,0).getDate(),J=new Date,Q=[];for(let Ee=qe-1;Ee>=0;Ee--)Q.push({day:Dt-Ee,isCurrentMonth:false,date:new Date(O,Ce-1,Dt-Ee)});for(let Ee=1;Ee<=je;Ee++)Q.push({day:Ee,isCurrentMonth:true,date:new Date(O,Ce,Ee)});let xe=42-Q.length;for(let Ee=1;Ee<=xe;Ee++)Q.push({day:Ee,isCurrentMonth:false,date:new Date(O,Ce+1,Ee)});return Q.map((Ee,K)=>{let Pe=Ee.date.toDateString()===J.toDateString(),ye=f.startDate?.toDateString()===Ee.date.toDateString(),De=f.endDate?.toDateString()===Ee.date.toDateString(),le=ye||De,Be=f.startDate&&f.endDate&&Ee.date>=f.startDate&&Ee.date<=f.endDate;return jsxRuntime.jsx("button",{className:C("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Ee.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Ee.isCurrentMonth&&(i?"text-white":"text-gray-900"),Pe&&"ring-2 ring-[#3B82F6]",ye&&"bg-[#3B82F6] text-white",De&&!ye&&"bg-[#7C3AED] text-white",Be&&!le&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!le&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Le=new Date(Ee.date);if(g==="start"){let Oe=f.endDate&&Le>f.endDate?Le:f.endDate;xt(Le,Oe),k("end");}else {let Oe=f.startDate&&Le<f.startDate?Le:f.startDate;xt(Oe,Le),k(null);}},children:Ee.day},K)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{fe(),H(!A);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:A&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(O=>jsxRuntime.jsxs("button",{onClick:()=>{Ze("priority",O.id),H(false);},className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.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:C("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[q?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let Ce=parseInt(O.target.value),qe=f.status;Ce===100?qe="completed":Ce>0?qe="in-progress":qe="todo";let je={...f,progress:Ce,status:qe};h(je),a.onTaskUpdate?.(je);},onBlur:()=>ve(false),className:C("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ve(true),className:C("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm mt-2 transition-colors",i?"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:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[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:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:C("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:C("p-1 rounded transition-colors",i?"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:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:C("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:C("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:C("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:C("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:C("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:C("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:C("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:C("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(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:C("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:v.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:C("p-1 rounded",i?"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:v.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),h(O.task);},className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(qd,{task:O.task}),jsxRuntime.jsx("span",{className:C("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var si={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"},ii={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"},li={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"},Cn={dark:si,light:ii,neutral:li};function Zd(e){return Cn[e]||Cn.dark}function jf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:p}){let[m,n]=react.useState(false),u=react.useMemo(()=>t.filter(c=>e.cardIds.includes(c.id)),[t,e.cardIds]),d=react.useMemo(()=>{let c=u.length,y=new Set(u.flatMap(v=>v.assignedUserIds||[])).size,f=u.map(v=>v.priority).filter(Boolean),h=new Set(u.flatMap(v=>v.labels||[])).size;return {totalCards:c,uniqueAssignees:y,priorities:f,labels:h}},[u]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:C("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:C("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:c=>{c.stopPropagation(),l?.(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(c=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(c),children:a(c)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(c),children:[jsxRuntime.jsx("h4",{children:c.title}),c.description&&jsxRuntime.jsxs("p",{children:[c.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,c.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"})]})})]},c.id))})})]})}var ec={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function xo(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 tc(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 ac({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:p}){let m=react.useMemo(()=>({...ec,...l}),[l]),[n,u]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let k=g.timestamp.toISOString().split("T")[0],N=b.get(k);N?N.push(g):b.set(k,[g]);}),Array.from(b.entries()).sort((g,k)=>k[0].localeCompare(g[0])).map(([g,k])=>({date:new Date(g),events:k.sort((N,x)=>x.timestamp.getTime()-N.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:c,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(k=>{b.add(k.userId),g.add(k.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{u(g=>{let k=new Set(g);return k.has(b)?k.delete(b):k.add(b),k});},h=b=>{let k=new Date().getTime()-b.getTime(),N=Math.floor(k/6e4),x=Math.floor(k/36e5),M=Math.floor(k/864e5);return N<1?"just now":N<60?`${N}m ago`:x<24?`${x}h ago`:M<7?`${M}d ago`:b.toLocaleDateString()},v=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:C("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:C("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:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[ko(b)," ",b.replace("_"," ")]},b))]}),c.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),c.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,k)=>{let N=n.has(g.id),x=s===g.id,M=tc(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:C("history-timeline-event",N&&"expanded",x&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ko(g.type)})}),k<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),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&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:xo(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?h(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),f(g.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([T,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),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)})]})]},T)),g.metadata&&Object.keys(g.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(g.metadata).map(([T,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},T))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function oc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:p,onSpeedChange:m,className:n}){let u=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:C("history-replay-empty",n),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:C("history-replay",n),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&&xo(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:c=>p(parseInt(c.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((c,y)=>jsxRuntime.jsx("div",{className:C("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>p(y),title:xo(c)},c.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:l,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(c=>jsxRuntime.jsxs("button",{className:C("history-replay-speed-btn",e.speed===c&&"active"),onClick:()=>m(c),children:[c,"x"]},c))})]}),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(c=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:c},c))})]})]})]})]}):jsxRuntime.jsxs("div",{className:C("history-replay-start",n),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 di(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 ci(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 nc(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 sc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Zf(e,t,a,r,o,s=100){let l=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(l.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;l.forEach(u=>{let d=a/2,i=r/2;u.vx+=(d-u.x)*o.centerForce*n,u.vy+=(i-u.y)*o.centerForce*n,l.forEach(c=>{if(u.id===c.id)return;let y=u.x-c.x,f=u.y-c.y,h=Math.sqrt(y*y+f*f)||1,v=o.chargeStrength*n/(h*h);u.vx+=y/h*v,u.vy+=f/h*v;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),i=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!i)return;let c=i.x-d.x,y=i.y-d.y,f=Math.sqrt(c*c+y*y)||1,h=(f-o.linkDistance)/f*o.forceStrength*n;d.vx+=c*h,d.vy+=y*h,i.vx-=c*h,i.vy-=y*h;}),l.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 l}function ic({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:p,className:m}){let n=react.useRef(null),[u,d]=react.useState([]),[i,c]=react.useState(null),[y,f]=react.useState(null),[h,v]=react.useState(null),[b,g]=react.useState(1),[k,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=Zf(e,t,a.width,a.height,a,150);d(A);},[e,t,a]);let x=react.useCallback((A,H)=>{a.enableDragging&&(H.stopPropagation(),c(A));},[a.enableDragging]),M=react.useCallback(A=>{if(!i||!n.current)return;let q=n.current.getBoundingClientRect(),ve=(A.clientX-q.left-k.x)/b,we=(A.clientY-q.top-k.y)/b;d(Ae=>Ae.map(Re=>Re.id===i?{...Re,x:ve,y:we,fx:ve,fy:we}:Re));},[i,b,k]),T=react.useCallback(()=>{c(null);},[]),B=react.useCallback((A,H)=>{H.stopPropagation(),p?.({type:"node-click",node:A,position:{x:H.clientX,y:H.clientY}});},[p]),D=react.useCallback((A,H)=>{H.stopPropagation(),p?.({type:"edge-click",edge:A,position:{x:H.clientX,y:H.clientY}});},[p]),w=react.useCallback(A=>{let H=u.find(q=>q.id===A);return H?{x:H.x,y:H.y}:{x:0,y:0}},[u]),U=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=A.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:C("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:C("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:l.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:l.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:()=>g(A=>Math.min(A+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:di(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[nc(A)," ",ci(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let H=w(typeof A.source=="string"?A.source:A.source.id),q=w(typeof A.target=="string"?A.target:A.target.id),ve=sc(A.type),we=h===A.id,Ae=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-edge",we&&"hovered",Ae&&"critical"),onMouseEnter:()=>v(A.id),onMouseLeave:()=>v(null),onClick:Re=>D(A,Re),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:q.x,y2:q.y,stroke:di(A.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:we?1:.6,markerEnd:ve?"url(#arrowhead)":void 0}),a.showEdgeLabels&&we&&jsxRuntime.jsx("text",{x:(H.x+q.x)/2,y:(H.y+q.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ci(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(A=>{let H=y===A.id,q=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-node",H&&"hovered",q&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:ve=>x(A.id,ve),onMouseEnter:()=>f(A.id),onMouseLeave:()=>f(null),onClick:ve=>B(A,ve),children:[jsxRuntime.jsx("circle",{r:q?a.nodeSize*1.2:a.nodeSize,fill:U(A),stroke:q?"#fbbf24":"#ffffff",strokeWidth:q?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.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 cc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[p,m]=react.useState(false),[n,u]=react.useState(null),[d,i]=react.useState(null),c=react.useRef(null),y=p||o;react.useEffect(()=>{e&&c.current&&c.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!y&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let f=()=>{y||(l(""),u(null),i(null),t());},h=async()=>{if(!(!s.trim()||y)){m(true),u(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){u(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{d&&(a(d),f());};return e?jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),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:c,value:s,onChange:b=>l(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,g)=>jsxRuntime.jsx("button",{onClick:()=>l(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},g))})]})]})}),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:f,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var pi={"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 eb={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},tb={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 ab(e,t,a){let r=pi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function wo(e){return `$${e.toFixed(4)}`}var mi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ab(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,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,i)=>d+i.duration,0),n={},u={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,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,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=l).length,m=Math.max(0,o-p),n=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:n,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)}},Cr=new mi;function uc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Cr.getStats()),[s,l]=react.useState(Cr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Cr.getStats()),l(Cr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Cr.getRecentOperations(5);return jsxRuntime.jsxs(at,{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:wo(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,n])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?n/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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(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:wo(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 bc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,p]=react.useState(""),[m,n]=react.useState(""),[u,d]=react.useState(""),[i,c]=react.useState(false),[y,f]=react.useState(null),[h,v]=react.useState(null),[b,g]=react.useState(null),k=react.useRef(null),N=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let D=w=>{w.key==="Escape"&&!N&&x();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,N]);let x=()=>{N||(p(""),n(""),d(""),f(null),v(null),g(null),t());},M=async()=>{if(!(!l.trim()||N)){c(true),f(null),v(null),g(null);try{let D=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});v(D.tasks.tasks),g({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){f(D instanceof Error?D.message:"Failed to generate tasks");}finally{c(false);}}},T=()=>{h&&(a(h),x());};if(!e)return null;let B=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:x,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",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:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((D,w)=>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:["#",w+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:k,value:l,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:N}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:D=>n(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),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: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:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((D,w)=>jsxRuntime.jsx("button",{onClick:()=>p(D),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:D},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:M,disabled:!l.trim()||N,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:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Nn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Io(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(h,v,b)=>{r(g=>{let k=g.cards.find(D=>D.id===h);if(!k)return g;let N=k.columnId,x={...k,columnId:v,position:b},M=g.cards.map(D=>D.id===h?x:D),T=g.columns.map(D=>{if(D.id===N)return {...D,cardIds:D.cardIds.filter(w=>w!==h)};if(D.id===v){let w=M.filter(U=>U.columnId===v).sort((U,A)=>U.position-A.position);return {...D,cardIds:w.map(U=>U.id)}}return D}),B={...g,cards:M,columns:T};return o(B),B});},[o]),l=react.useCallback(async(h,v)=>{r(b=>{let g=b.cards.map(N=>N.id===h?{...N,...v}:N),k={...b,cards:g};return o(k),k});},[o]),p=react.useCallback(async h=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...h,id:v},k=b.columns.map(x=>x.id===h.columnId?{...x,cardIds:[...x.cardIds,v]}:x),N={...b,cards:[...b.cards,g],columns:k};return o(N),N});},[o]),m=react.useCallback(async h=>{r(v=>{let b=v.cards.find(x=>x.id===h);if(!b)return v;let g=v.cards.filter(x=>x.id!==h),k=v.columns.map(x=>x.id===b.columnId?{...x,cardIds:x.cardIds.filter(M=>M!==h)}:x),N={...v,cards:g,columns:k};return o(N),N});},[o]),n=react.useCallback(async h=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...h,id:v,cardIds:[]},k={...b,columns:[...b.columns,g]};return o(k),k});},[o]),u=react.useCallback(async(h,v)=>{r(b=>{let g=b.columns.map(N=>N.id===h?{...N,...v}:N),k={...b,columns:g};return o(k),k});},[o]),d=react.useCallback(async h=>{r(v=>{let b=v.cards.filter(N=>N.columnId!==h),g=v.columns.filter(N=>N.id!==h),k={...v,cards:b,columns:g};return o(k),k});},[o]),i=react.useCallback(h=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(h),v},[p]),c=react.useCallback(h=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(h),v},[n]),y=react.useCallback(()=>{r(h=>{let v={...h,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:p,onCardDelete:m,onColumnCreate:n,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:c,deleteCard:m,deleteColumn:d,clearBoard:y}}}function yc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Nn({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(m,n,u={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,n)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:n??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:l}}var Co={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},xc={by:"none",order:"asc"};function kc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Co,...e}),[s,l]=react.useState({...xc,...t}),p=react.useCallback(f=>{o(h=>({...h,...f}));},[]),m=react.useCallback(f=>{l(h=>({...h,...f}));},[]),n=react.useCallback(()=>{o(Co),l(xc);},[]),u=react.useCallback(()=>{a&&o({...Co,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Co,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Co,priorities:["HIGH","URGENT"]});},[]),c=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(f=>{let h=[...f];if(r.search){let v=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(v)||b.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,b=v.getFullYear(),g=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),N=`${b}-${g}-${k}`;h=h.filter(x=>{if(!x.endDate&&!x.dueDate)return false;let M=x.endDate||x.dueDate;if(!M)return false;let T;if(typeof M=="string")T=M.split("T")[0]||M;else {let B=M.getUTCFullYear(),D=String(M.getUTCMonth()+1).padStart(2,"0"),w=String(M.getUTCDate()).padStart(2,"0");T=`${B}-${D}-${w}`;}switch(r.dateFilter){case "overdue":return T<N;case "today":return T===N;case "this-week":let B=new Date(N+"T00:00:00"),D=new Date(T+"T00:00:00"),w=new Date(B);return w.setDate(w.getDate()+7),D>=B&&D<=w;case "custom":if(r.dateRange){let U=typeof M=="string"?new Date(M):M;return U>=r.dateRange.start&&U<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(h=h.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(h=h.filter(v=>v.labels&&v.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&h.sort((v,b)=>{let g=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;g=k-N;break;case "priority":let x={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=x[v.priority||"LOW"],T=x[b.priority||"LOW"];g=M-T;break;case "dueDate":let B=v.endDate||v.dueDate,D=b.endDate||b.dueDate;if(!B)return 1;if(!D)return -1;let w=typeof B=="string"?new Date(B).getTime():B.getTime(),U=typeof D=="string"?new Date(D).getTime():D.getTime();g=w-U;break;case "title":g=v.title.localeCompare(b.title);break;case "estimate":let A=v.estimatedTime||0,H=b.estimatedTime||0;g=A-H;break;default:g=0;}return s.order==="asc"?g:-g}),h},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:n,filterMyTasks:u,filterOverdue:d,filterHighPriority:i,applyFilters:y,hasActiveFilters:c}}var Cc,Tc;if(typeof window<"u")try{let e=Po("ai");Cc=e.generateObject,Tc=e.generateText;}catch{}function Dc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Cc&&Tc&&e.apiKey),l=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(i){let c=i instanceof Error?i:new Error("Failed to generate plan");throw o(c),c}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(i){let c=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(c),c}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(i){let c=i instanceof Error?i:new Error("Failed to predict risks");throw o(c),c}finally{a(false);}},[s]),n=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(i){let c=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(c),c}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(i){let c=i instanceof Error?i:new Error("Failed to estimate effort");throw o(c),c}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function gi(){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 Nc(e){let{cards:t}=e,[a,r]=gi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let c=i.ctrlKey||i.metaKey,y=i.shiftKey;if(c)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let f=t.find(v=>v.id===d),h=t.find(v=>v.id===a.lastSelectedCardId);if(f&&h&&f.columnId===h.columnId){let v=t.filter(T=>T.columnId===f.columnId).sort((T,B)=>T.position-B.position),b=v.findIndex(T=>T.id===a.lastSelectedCardId),g=v.findIndex(T=>T.id===d),[k,N]=b<g?[b,g]:[g,b],x=v.slice(k,N+1).map(T=>T.id),M=Array.from(new Set([...a.selectedCardIds,...x]));r({selectedCardIds:M,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==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]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,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:l,clearSelection:p,selectAll:m,toggleCard:n,getSelectedCards:u}}var Sc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Ec(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Sc,...a}),[a]),[s,l]=react.useState([]),p=react.useCallback((f,h,v,b,g)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:h,columnId:v,strategy:b,color:g,isExpanded:true,position:s.filter(N=>N.columnId===v).length,createdAt:new Date};l(N=>[...N,k]);},[o.minCardsPerStack,s]),m=react.useCallback(f=>{l(h=>h.filter(v=>v.id!==f));},[]),n=react.useCallback(f=>{l(h=>h.map(v=>v.id===f?{...v,isExpanded:!v.isExpanded}:v));},[]),u=react.useCallback((f,h)=>{l(v=>v.map(b=>b.id===f&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((f,h)=>{l(v=>v.map(b=>{if(b.id===f){let g=b.cardIds.filter(k=>k!==h);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(h=>h.columnId===f).sort((h,v)=>h.position-v.position),[s]),c=react.useCallback(async f=>{let h=t.filter(N=>N.columnId===f);if(h.length<o.minCardsPerStack*2)return [];let v=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(x=>{b.has(x)||b.set(x,[]),b.get(x).push(N);});}),b.forEach((N,x)=>{N.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${x}`,cardIds:N.map(M=>M.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${x}"`,confidence:.85});});let g=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(x=>{g.has(x)||g.set(x,[]),g.get(x).push(N);});}),g.forEach((N,x)=>{N.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${x.slice(-4)}`,cardIds:N.map(M=>M.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(h.forEach(N=>{N.priority&&(k.has(N.priority)||k.set(N.priority,[]),k.get(N.priority).push(N));}),k.forEach((N,x)=>{if(N.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[x.toLowerCase()]||"\u26AA";v.push({stack:{title:`${M} ${x} Priority`,cardIds:N.map(T=>T.id),columnId:f,strategy:"priority",color:x==="high"||x==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${x} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let M=(await r.findSimilar(N,h)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let T=[N.id,...M.map(D=>D.card.id)],B=M.reduce((D,w)=>D+w.similarity,0)/M.length;v.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:T,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:B});}}return v.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,x)=>x.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(f=>{p(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let v=await c(h),b=v[0];v.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:n,addToStack:u,removeFromStack:d,getStacksForColumn:i,getSuggestions:c,applySuggestion:y,config:o}}var Pc=react.createContext(null);function Mc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(m=>{let{Column:n}=Po("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=Po("@libxai/core");l.set(m.id,new n(m));});let p=null;if(t?.board){let{Board:m}=Po("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Pc.Provider,{value:{store:o},children:e})}function Sn(){let e=react.useContext(Pc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Do(){let e=Sn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let p=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),u=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),c=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,k)=>{e.moveCard(b,g,k);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),v=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:n,deleteColumn:u,getColumn:d,addCard:i,updateCard:c,deleteCard:y,moveCard:f,getCard:h,getCardsByColumn:v}}function Ic(e){let{cards:t}=Do();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 Lc(e="position",t="asc"){let{cards:a}=Do();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=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,n=s.priority?p[s.priority]:0;l=m-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var En=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=$i.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 l=s[t];if(typeof l=="function")try{let p=await Promise.resolve(l.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(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},vb=new En;function Bc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:p=0,getItemKey:m}){let n=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:p}),d=u.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},c=l?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:c,children:d.map(y=>{let f=e[y.index];if(!f)return null;let h=m?m(f,y.index):y.index,v={position:"absolute",top:l?0:y.start,left:l?y.start:0,width:l?y.size:"100%",height:l?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(f,y.index)},h)})})})}function Rc(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 $c({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:p=16,getItemKey:m,horizontal:n=true}){let u=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:l,gap:p}),i=d.getVirtualItems(),c={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:c,className:s,children:jsxRuntime.jsx("div",{style:y,children:i.map(f=>{let h=e[f.index];if(!h)return null;let v=m?m(h,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(h,f.index)},v)})})})}function zc(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 Uc(e,t=10){return e>t}var yi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},xi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},wi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ci={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ti={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Di={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)"},Ni={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)"},Si={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ei={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}},Pi={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}},Pn={spacing:yi,borderRadius:vi,fontSize:xi,fontWeight:ki,lineHeight:wi,zIndex:Ci,duration:Ti,easing:Di,shadows:Ni,opacity:Si,kanban:Ei,gantt:Pi};function Wc(e,t,a){return e[t]??a}function Mi(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)?Mi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function wb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ai(e="asakaa"){let t=Mi(Pn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=wb(o);a.push(` ${s}: ${l};`);}return `:root {
323
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Ld(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ka(e,t){let a=Ld(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return l.every(n=>p.includes(n))})}function _s(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 i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}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 u={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(u!==void 0){let y=new Date(r),b=y.getDay(),g=u-b;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),y=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?y.setDate(y.getDate()+i):u==="week"||u==="semana"||u==="semanas"?y.setDate(y.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&y.setMonth(y.getMonth()+i),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=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(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],y=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=m[d[1].toLowerCase()],u=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(y,i,u)}return null}function Vs(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 js(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 Fd(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 Bd(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 n=r[1].trim(),m=r[2].trim(),d=Ka(t,n),i=_s(m);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(i);return y.setDate(y.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:y},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),d=Ka(t,n),i=Vs(m);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${i} days. New end date: ${u.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 n=s[1].trim(),m=s[2].trim(),d=Ka(t,n),i=js(m);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),m=l[2].trim(),d=Ka(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),d=Ka(t,n),i=Ka(t,m);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ka(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Rd(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 vf(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 xf(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(m=>{let d=a.find(i=>i.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>un(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let l=m=>{if(m)return typeof m=="string"?new Date(m):m},c=l(e.startDate),p=l(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:vf(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:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Od(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:xf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $d(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>un(r,e,t))}var Ks={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"}},Ys={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"}},gn={en:Ks,es:Ys};function qs(e){return gn[e]||gn.en}function fn(e,t){let a=qs(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 Hd(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(...Hd(r.subtasks,t+1));return a}function Af({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 Gd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:d=true}=t,i=fn(p,n),u=c==="dark",[y,b]=react.useState(new Set),[g,v]=react.useState("startDate"),[h,f]=react.useState("asc"),[k,D]=react.useState("");react.useMemo(()=>{let N=new Set;function w(F){for(let M of F)M.subtasks?.length&&(N.add(M.id),w(M.subtasks));}w(e),b(N);},[e]);let x=react.useCallback(N=>{b(w=>{let F=new Set(w);return F.has(N)?F.delete(N):F.add(N),F}),a.onTaskToggleExpand?.(N);},[a]),P=react.useCallback(N=>{g===N?f(w=>w==="asc"?"desc":"asc"):(v(N),f("asc")),a.onSortChange?.({column:N,direction:h==="asc"?"desc":"asc"});},[g,h,a]),T=react.useMemo(()=>{let N=Hd(e);if(k.trim()){let F=k.toLowerCase();N=N.filter(M=>M.name.toLowerCase().includes(F));}let w=[];for(let F of N){let M=F.level===0;F.level>0&&(M=true),(M||k.trim())&&w.push(F);}return k.trim()&&w.sort((F,M)=>{let H,X;switch(g){case "name":H=F.name.toLowerCase(),X=M.name.toLowerCase();break;case "startDate":H=F.startDate?.getTime()||0,X=M.startDate?.getTime()||0;break;case "endDate":H=F.endDate?.getTime()||0,X=M.endDate?.getTime()||0;break;case "progress":H=F.progress||0,X=M.progress||0;break;case "status":H=F.status||"todo",X=M.status||"todo";break;default:return 0}return H<X?h==="asc"?-1:1:H>X?h==="asc"?1:-1:0}),w},[e,k,g,h]),O=N=>N?(N instanceof Date?N:new Date(N)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:C("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:C("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:k,onChange:N=>D(N.target.value),placeholder:i.toolbar.searchPlaceholder,className:C("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"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:C("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[T.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:C("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"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:()=>P("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>P("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>P("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>P("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.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:()=>P("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:T.map((N,w)=>{let F=y.has(N.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:w*.02},className:C("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+N.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),x(N.id);},className:C("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:F?jsxRuntime.jsx(lucideReact.ChevronDown,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),a.onTaskUpdate?.({...N,progress:N.progress===100?0:100,status:N.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Af,{status:N.status,progress:N.progress})}),jsxRuntime.jsx("span",{className:C("truncate",u?"text-white":"text-gray-900",N.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:N.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:C("px-2 py-1 rounded-full text-xs font-medium",N.progress===100||N.status==="completed"?"bg-green-500/10 text-green-500":N.progress&&N.progress>0||N.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N.progress===100||N.status==="completed"?i.status.completed:N.progress&&N.progress>0||N.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),O(N.startDate)]}),jsxRuntime.jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),O(N.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:C("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${N.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[N.progress||0,"%"]})]})})]},N.id)})}),T.length===0&&k&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:C("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:C(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Xs={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"},Js={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"},Zs={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"},hn={dark:Xs,light:Js,neutral:Zs};function _d(e){return hn[e]||hn.dark}var Qs={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"}},ei={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:Qs,es:ei};function vo(e){return yn[e]||yn.en}function vn(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 Vd(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 jd(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 _f(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 ni(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 qd({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 Jd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,d=vn(n,m),i=p==="dark",[u,y]=react.useState(r||new Date),[b,g]=react.useState(null),[v,h]=react.useState(null),[f,k]=react.useState(null),[D,x]=react.useState(new Date),[P,T]=react.useState({}),O=4,N=3,[w,F]=react.useState(false),[M,H]=react.useState(false),[X,ye]=react.useState(false),[ke,Ae]=react.useState(null),[ze,$]=react.useState(""),[L,z]=react.useState(void 0),[S,R]=react.useState(null),[ae,q]=react.useState(false),[Ee,xe]=react.useState(false),[Je,J]=react.useState(null),[qe,Ve]=react.useState(false),[gt,lt]=react.useState(new Date),U=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),ne=react.useCallback(()=>{y(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Pe=react.useCallback(()=>{y(new Date);},[]),Ue=react.useMemo(()=>{let B=u.getFullYear(),he=u.getMonth(),je=new Date(B,he,1),Xe=new Date(B,he+1,0),Dt=je.getDay(),Z=Xe.getDate(),ee=_f(e),ve=new Date;ve.setHours(0,0,0,0);let Ne=[],Y=Dt,Se=new Date(B,he,0).getDate();for(let Te=Y-1;Te>=0;Te--){let de=new Date(B,he-1,Se-Te);Ne.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:ee.filter(Fe=>ni(de,Fe)).map(Fe=>({id:Fe.id,title:Fe.name,start:Fe.startDate,end:Fe.endDate,task:Fe}))});}for(let Te=1;Te<=Z;Te++){let de=new Date(B,he,Te),Fe=de.getTime()===ve.getTime();Ne.push({date:de,isCurrentMonth:true,isToday:Fe,isWeekend:de.getDay()===0||de.getDay()===6,events:ee.filter(Ie=>ni(de,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}let be=42-Ne.length;for(let Te=1;Te<=be;Te++){let de=new Date(B,he+1,Te);Ne.push({date:de,isCurrentMonth:false,isToday:false,isWeekend:de.getDay()===0||de.getDay()===6,events:ee.filter(Fe=>ni(de,Fe)).map(Fe=>({id:Fe.id,title:Fe.name,start:Fe.startDate,end:Fe.endDate,task:Fe}))});}return Ne},[u,e]),Me=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Be=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ze=react.useCallback((B,he)=>{if(!b)return;let je={...b,[B]:he};g(je),a.onTaskUpdate?.(je);},[b,a]),we=react.useCallback(B=>{if(!b)return;let he=b.progress||0;B==="completed"?he=100:B==="todo"&&(he=0);let je={...b,status:B,progress:he};g(je),a.onTaskUpdate?.(je),F(false);},[b,a]),It=react.useCallback((B,he)=>{if(!b)return;let je={...b,startDate:B,endDate:he};g(je),a.onTaskUpdate?.(je);},[b,a]),ge=react.useCallback(()=>{F(false),H(false),k(null);},[]);return o?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,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:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,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:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,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:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",i?"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:C("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:Be}),jsxRuntime.jsx("button",{onClick:Pe,className:C("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:U,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ne,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:C("w-5 h-5",i?"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:Me.map(B=>jsxRuntime.jsx("div",{className:C("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:B},B))}),jsxRuntime.jsx("div",{className:C("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:Ue.map((B,he)=>{let je=B.date.getDay()===0||B.date.getDay()===6;return jsxRuntime.jsxs("div",{className:C("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?je?"bg-[#1C1F26]":B.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":je?"bg-gray-100":B.isCurrentMonth?"bg-white":"bg-gray-50",B.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Xe=P[he]||O,Dt=B.events.slice(0,Xe),Z=B.events.length-Xe;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[Dt.map(ee=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{g(ee.task),a.onEventClick?.(ee);},whileHover:{scale:1.02},className:C("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ee.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(qd,{task:ee.task}),jsxRuntime.jsx("span",{className:"truncate",children:ee.title})]})},ee.id)),Z>0&&jsxRuntime.jsxs("button",{onClick:ee=>{ee.stopPropagation(),T(ve=>({...ve,[he]:Xe+N}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",n==="es"?"M\xC1S":"MORE"]}),Xe>O&&B.events.length>O&&jsxRuntime.jsx("button",{onClick:ee=>{ee.stopPropagation(),T(ve=>({...ve,[he]:O}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Xe=he>=28,Dt=he%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),ke===he?Ae(null):(Ae(he),$(""),z(void 0),R(null),J(null),q(false),xe(false),Ve(false),lt(B.date));},className:C("w-5 h-5 rounded flex items-center justify-center transition-all",ke===he?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:C("w-3.5 h-3.5 transition-transform",ke===he&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ke===he&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ae(null),$(""),z(void 0),R(null),J(null),q(false),xe(false),Ve(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Xe?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Xe?-5:5,scale:.95},transition:{duration:.12},className:C("absolute w-[320px] rounded-lg shadow-2xl z-50",Xe?"bottom-full mb-1":"top-full mt-1",Dt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),q(false),xe(false),Ve(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ze,onChange:Z=>$(Z.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:C("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&ze.trim()){let ee=t.availableUsers?.find(Ne=>Ne.id===S),ve=Je||B.date;a.onTaskCreate?.({name:ze.trim(),startDate:ve,endDate:ve,priority:L,assignees:ee?[ee]:void 0}),$(""),z(void 0),R(null),J(null),Ae(null);}Z.key==="Escape"&&(Ae(null),$(""),z(void 0),R(null),J(null));}})}),jsxRuntime.jsxs("div",{className:C("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),q(!ae),xe(false);},className:C("p-1 rounded transition-colors",L?L==="urgent"||L==="high"?"text-red-400 bg-red-500/20":L==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"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:ae&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),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(Z=>jsxRuntime.jsxs("button",{onClick:()=>{z(Z.id),q(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",L===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",Z.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Z=>{Z.stopPropagation(),Ve(!qe),q(false),xe(false),lt(Je||B.date);},className:C("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Je?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"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"}),(Je||B.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{className:C("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,ee=new Date(Z);ee.setDate(Z.getDate()+1);let ve=new Date(Z);ve.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let Ne=new Date(Z);Ne.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let Y=new Date(Z);Y.setDate(Z.getDate()+14);let Se=new Date(Z);return Se.setDate(Z.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ne,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Se,display:Se.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Te,de)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{J(Te.date),Ve(false);},children:[jsxRuntime.jsx("span",{children:Te.label}),jsxRuntime.jsx("span",{className:C("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Te.display})]},de))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:C("text-xs font-medium",i?"text-white":"text-gray-900"),children:gt.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>lt(new Date),className:C("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>lt(new Date(gt.getFullYear(),gt.getMonth()-1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>lt(new Date(gt.getFullYear(),gt.getMonth()+1)),className:C("p-0.5 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsxRuntime.jsx("div",{className:C("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=gt.getFullYear(),ee=gt.getMonth(),ve=new Date(Z,ee,1).getDay(),Ne=new Date(Z,ee+1,0).getDate(),Y=new Date(Z,ee,0).getDate(),Se=new Date,be=[];for(let de=ve-1;de>=0;de--)be.push({dayNum:Y-de,isCurrentMonth:false,date:new Date(Z,ee-1,Y-de)});for(let de=1;de<=Ne;de++)be.push({dayNum:de,isCurrentMonth:true,date:new Date(Z,ee,de)});let Te=42-be.length;for(let de=1;de<=Te;de++)be.push({dayNum:de,isCurrentMonth:false,date:new Date(Z,ee+1,de)});return be.map((de,Fe)=>{let Ie=de.date.toDateString()===Se.toDateString(),Re=(Je||B.date).toDateString()===de.date.toDateString();return jsxRuntime.jsx("button",{className:C("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!de.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),de.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ie&&"ring-1 ring-[#3B82F6]",Re&&"bg-[#7C3AED] text-white",!Re&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{J(de.date),Ve(false);},children:de.dayNum},Fe)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Z=>{Z.stopPropagation(),xe(!Ee),q(false);},className:C("p-1 rounded transition-colors",S?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:S?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Z=>Z.id===S)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===S)?.initials||t.availableUsers?.find(Z=>Z.id===S)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{R(null),xe(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!S&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:C("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxRuntime.jsxs("button",{onClick:()=>{R(Z.id),xe(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===Z.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:C("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ze.trim()){let Z=t.availableUsers?.find(ve=>ve.id===S),ee=Je||B.date;a.onTaskCreate?.({name:ze.trim(),startDate:ee,endDate:ee,priority:L,assignees:Z?[Z]:void 0}),$(""),z(void 0),R(null),J(null),Ae(null);}},disabled:!ze.trim(),className:C("px-2.5 py-1 rounded text-xs font-medium transition-colors",ze.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:C("text-sm font-medium",B.isToday?"text-[#3B82F6]":B.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:B.date.getDate()})]})]},he)})})]})}),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:()=>g(null),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:C("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:C("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:C("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:C("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:C("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:b.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"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:C("p-1.5 rounded transition-colors",i?"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:C("p-1.5 rounded transition-colors",i?"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:()=>g(null),className:C("p-1.5 rounded transition-colors",i?"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 B=b.progress===100?0:100,je={...b,progress:B,status:B===100?"completed":"todo"};g(je),a.onTaskUpdate?.(je);},className:C("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",b.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:b.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:C("text-xl font-semibold flex-1",b.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:b.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:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ge(),F(!w);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.progress===100||b.status==="completed"?"bg-green-500/20 text-green-400":b.progress&&b.progress>0||b.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:b.progress===100||b.status==="completed"?n==="es"?"COMPLETADO":"DONE":b.progress&&b.progress>0||b.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>F(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(B=>jsxRuntime.jsxs("button",{onClick:()=>we(B.id),className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(b.status===B.id||B.id==="completed"&&b.progress===100||B.id==="in-progress"&&b.progress&&b.progress>0&&b.progress<100||B.id==="todo"&&(!b.progress||b.progress===0)&&b.status!=="in-progress"&&b.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",B.id==="completed"?"bg-green-500":B.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:B.label})]},B.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),b.assignees&&b.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[b.assignees.slice(0,3).map((B,he)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:B.color||"#8B5CF6"},title:B.name,children:B.initials||B.name.slice(0,2).toUpperCase()},he)),b.assignees.length>3&&jsxRuntime.jsxs("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",b.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(f?null:"start"),x(b.startDate||new Date);},className:C("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[b.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:C("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),b.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(b.startDate||b.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:B=>{B.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:C("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:C("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let B=new Date,he=new Date(B);he.setDate(B.getDate()+1);let je=new Date(B);je.setDate(B.getDate()+((6-B.getDay()+7)%7||7));let Xe=new Date(B);Xe.setDate(B.getDate()+((1-B.getDay()+7)%7||7));let Dt=new Date(B);Dt.setDate(B.getDate()+(6-B.getDay()+7)%7+7);let Z=new Date(B);Z.setDate(B.getDate()+14);let ee=new Date(B);return ee.setDate(B.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:B,display:B.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:he,display:he.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:je,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Dt,display:Dt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Z,display:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,Y)=>jsxRuntime.jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(f==="start"){let Se=b.endDate&&Ne.date>b.endDate?Ne.date:b.endDate;It(Ne.date,Se),k("end");}else {let Se=b.startDate&&Ne.date<b.startDate?Ne.date:b.startDate;It(Se,Ne.date),k(null);}},children:[jsxRuntime.jsx("span",{children:Ne.label}),jsxRuntime.jsx("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},Y))})(),jsxRuntime.jsx("div",{className:C("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{It(void 0,void 0),k(null);},className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[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:C("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f==="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:C("font-medium",i?"text-white":"text-gray-900"),children:D.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:()=>x(new Date),className:C("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(D.getFullYear(),D.getMonth()-1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>x(new Date(D.getFullYear(),D.getMonth()+1)),className:C("p-1 rounded",i?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(B=>jsxRuntime.jsx("div",{className:C("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:B},B))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=D.getFullYear(),he=D.getMonth(),je=new Date(B,he,1).getDay(),Xe=new Date(B,he+1,0).getDate(),Dt=new Date(B,he,0).getDate(),Z=new Date,ee=[];for(let Ne=je-1;Ne>=0;Ne--)ee.push({day:Dt-Ne,isCurrentMonth:false,date:new Date(B,he-1,Dt-Ne)});for(let Ne=1;Ne<=Xe;Ne++)ee.push({day:Ne,isCurrentMonth:true,date:new Date(B,he,Ne)});let ve=42-ee.length;for(let Ne=1;Ne<=ve;Ne++)ee.push({day:Ne,isCurrentMonth:false,date:new Date(B,he+1,Ne)});return ee.map((Ne,Y)=>{let Se=Ne.date.toDateString()===Z.toDateString(),be=b.startDate?.toDateString()===Ne.date.toDateString(),Te=b.endDate?.toDateString()===Ne.date.toDateString(),de=be||Te,Fe=b.startDate&&b.endDate&&Ne.date>=b.startDate&&Ne.date<=b.endDate;return jsxRuntime.jsx("button",{className:C("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!Ne.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),Ne.isCurrentMonth&&(i?"text-white":"text-gray-900"),Se&&"ring-2 ring-[#3B82F6]",be&&"bg-[#3B82F6] text-white",Te&&!be&&"bg-[#7C3AED] text-white",Fe&&!de&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!de&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Ie=new Date(Ne.date);if(f==="start"){let Re=b.endDate&&Ie>b.endDate?Ie:b.endDate;It(Ie,Re),k("end");}else {let Re=b.startDate&&Ie<b.startDate?Ie:b.startDate;It(Re,Ie),k(null);}},children:Ne.day},Y)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ge(),H(!M);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",b.priority==="high"||b.priority==="urgent"?"bg-red-500/20 text-red-400":b.priority==="medium"?"bg-yellow-500/20 text-yellow-400":b.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:b.priority?b.priority==="high"||b.priority==="urgent"?n==="es"?"Urgente":"Urgent":b.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>H(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(B=>jsxRuntime.jsxs("button",{onClick:()=>{Ze("priority",B.id),H(false);},className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",b.priority===B.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:C("w-2 h-2 rounded-full",B.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:B.label})]},B.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-white":"text-gray-900"),children:b.startDate&&b.endDate?`${Math.ceil((b.endDate.getTime()-b.startDate.getTime())/(1e3*60*60*24))} ${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:C("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:b.progress||0,onChange:B=>{let he=parseInt(B.target.value),je=b.status;he===100?je="completed":he>0?je="in-progress":je="todo";let Xe={...b,progress:he,status:je};g(Xe),a.onTaskUpdate?.(Xe);},onBlur:()=>ye(false),className:C("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>ye(true),className:C("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:C("h-full rounded-full transition-all",b.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${b.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:C("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[b.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:b.dependencies&&b.dependencies.length>0?`${b.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:C("flex items-center gap-2 text-sm mt-2 transition-colors",i?"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:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[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:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),b.subtasks&&b.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:b.subtasks.map(B=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:C("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",B.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:C("text-sm",B.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:B.name})]},B.id))}),jsxRuntime.jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:C("p-1 rounded transition-colors",i?"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:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:C("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:C("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:C("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:C("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:C("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:C("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:C("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:C("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>h(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:C("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",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:v.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>h(null),className:C("p-1 rounded",i?"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:v.events.map(B=>jsxRuntime.jsxs("button",{onClick:()=>{h(null),g(B.task);},className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(qd,{task:B.task}),jsxRuntime.jsx("span",{className:C("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:B.title}),B.task.priority==="high"||B.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},B.id))})]})]})})]})}var si={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"},ii={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"},li={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"},Cn={dark:si,light:ii,neutral:li};function Zd(e){return Cn[e]||Cn.dark}function jf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:c}){let[p,n]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,y=new Set(m.flatMap(v=>v.assignedUserIds||[])).size,b=m.map(v=>v.priority).filter(Boolean),g=new Set(m.flatMap(v=>v.labels||[])).size;return {totalCards:u,uniqueAssignees:y,priorities:b,labels:g}},[m]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:C("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,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:C("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"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,u.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"})]})})]},u.id))})})]})}var ec={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function xo(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 tc(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 ac({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:c}){let p=react.useMemo(()=>({...ec,...l}),[l]),[n,m]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(f=>{let k=f.timestamp.toISOString().split("T")[0],D=h.get(k);D?D.push(f):h.set(k,[f]);}),Array.from(h.entries()).sort((f,k)=>k[0].localeCompare(f[0])).map(([f,k])=>({date:new Date(f),events:k.sort((D,x)=>x.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,f=new Set;return e.forEach(k=>{h.add(k.userId),f.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(f)}},[e]),b=h=>{m(f=>{let k=new Set(f);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),D=Math.floor(k/6e4),x=Math.floor(k/36e5),P=Math.floor(k/864e5);return D<1?"just now":D<60?`${D}m ago`:x<24?`${x}h ago`:P<7?`${P}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:C("history-timeline-empty",c),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:C("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[ko(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let f=h.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((f,k)=>{let D=n.has(f.id),x=s===f.id,P=tc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:C("history-timeline-event",D&&"expanded",x&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:P},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ko(f.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:P}})]}),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:[p.showAvatars&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:xo(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?g(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(f.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([T,O])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(O.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(O.to)})]})]},T)),f.metadata&&Object.keys(f.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(f.metadata).map(([T,O])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(O)})]},T))]})]})]})]},f.id)})})]},h.date?.toISOString()||"all"))})]})}function oc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:C("history-replay-empty",n),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:C("history-replay",n),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&&xo(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:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,y)=>jsxRuntime.jsx("div",{className:C("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:xo(u)},u.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:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:C("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),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(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:C("history-replay-start",n),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 di(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 ci(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 nc(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 sc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Zf(e,t,a,r,o,s=100){let l=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;l.forEach(m=>{let d=a/2,i=r/2;m.vx+=(d-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,l.forEach(u=>{if(m.id===u.id)return;let y=m.x-u.x,b=m.y-u.y,g=Math.sqrt(y*y+b*b)||1,v=o.chargeStrength*n/(g*g);m.vx+=y/g*v,m.vy+=b/g*v;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!i)return;let u=i.x-d.x,y=i.y-d.y,b=Math.sqrt(u*u+y*y)||1,g=(b-o.linkDistance)/b*o.forceStrength*n;d.vx+=u*g,d.vy+=y*g,i.vx-=u*g,i.vy-=y*g;}),l.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return l}function ic({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:c,className:p}){let n=react.useRef(null),[m,d]=react.useState([]),[i,u]=react.useState(null),[y,b]=react.useState(null),[g,v]=react.useState(null),[h,f]=react.useState(1),[k,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let M=Zf(e,t,a.width,a.height,a,150);d(M);},[e,t,a]);let x=react.useCallback((M,H)=>{a.enableDragging&&(H.stopPropagation(),u(M));},[a.enableDragging]),P=react.useCallback(M=>{if(!i||!n.current)return;let X=n.current.getBoundingClientRect(),ye=(M.clientX-X.left-k.x)/h,ke=(M.clientY-X.top-k.y)/h;d(Ae=>Ae.map(ze=>ze.id===i?{...ze,x:ye,y:ke,fx:ye,fy:ke}:ze));},[i,h,k]),T=react.useCallback(()=>{u(null);},[]),O=react.useCallback((M,H)=>{H.stopPropagation(),c?.({type:"node-click",node:M,position:{x:H.clientX,y:H.clientY}});},[c]),N=react.useCallback((M,H)=>{H.stopPropagation(),c?.({type:"edge-click",edge:M,position:{x:H.clientX,y:H.clientY}});},[c]),w=react.useCallback(M=>{let H=m.find(X=>X.id===M);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),F=react.useCallback(M=>{if(M.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return M.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=M.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return M.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:C("relationships-graph-empty",p),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:C("relationships-graph",p),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:l.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:l.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:()=>f(M=>Math.min(M+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(M=>Math.max(M-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(M=>M.type))).map(M=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:di(M)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[nc(M)," ",ci(M)]})]},M))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:P,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(M=>{let H=w(typeof M.source=="string"?M.source:M.source.id),X=w(typeof M.target=="string"?M.target:M.target.id),ye=sc(M.type),ke=g===M.id,Ae=M.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-edge",ke&&"hovered",Ae&&"critical"),onMouseEnter:()=>v(M.id),onMouseLeave:()=>v(null),onClick:ze=>N(M,ze),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:X.x,y2:X.y,stroke:di(M.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ye?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsxRuntime.jsx("text",{x:(H.x+X.x)/2,y:(H.y+X.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ci(M.type)})]},M.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(M=>{let H=y===M.id,X=M.onCriticalPath;return jsxRuntime.jsxs("g",{className:C("relationships-graph-node",H&&"hovered",X&&"critical"),transform:`translate(${M.x}, ${M.y})`,onMouseDown:ye=>x(M.id,ye),onMouseEnter:()=>b(M.id),onMouseLeave:()=>b(null),onClick:ye=>O(M,ye),children:[jsxRuntime.jsx("circle",{r:X?a.nodeSize*1.2:a.nodeSize,fill:F(M),stroke:X?"#fbbf24":"#ffffff",strokeWidth:X?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:M.card.title.length>20?M.card.title.substring(0,20)+"...":M.card.title})]},M.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 cc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[c,p]=react.useState(false),[n,m]=react.useState(null),[d,i]=react.useState(null),u=react.useRef(null),y=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&!y&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let b=()=>{y||(l(""),m(null),i(null),t());},g=async()=>{if(!(!s.trim()||y)){p(true),m(null),i(null);try{let h=await r(s.trim());i(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},v=()=>{d&&(a(d),b());};return e?jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,f)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},f)),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:u,value:s,onChange:h=>l(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,f)=>jsxRuntime.jsx("button",{onClick:()=>l(h),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},f))})]})]})}),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:b,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var pi={"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 eb={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},tb={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 ab(e,t,a){let r=pi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function wo(e){return `$${e.toFixed(4)}`}var mi=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ab(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,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,i)=>d+i.duration,0),n={},m={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.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,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=l).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=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)}},Cr=new mi;function uc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Cr.getStats()),[s,l]=react.useState(Cr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Cr.getStats()),l(Cr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=Cr.getRecentOperations(5);return jsxRuntime.jsxs(at,{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:p=>p.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:wo(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(([p,n])=>{let m=r.costsByFeature[p]||0,d=r.totalOperations>0?n/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:p.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:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.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:c.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:wo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 bc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,c]=react.useState(""),[p,n]=react.useState(""),[m,d]=react.useState(""),[i,u]=react.useState(false),[y,b]=react.useState(null),[g,v]=react.useState(null),[h,f]=react.useState(null),k=react.useRef(null),D=i||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let N=w=>{w.key==="Escape"&&!D&&x();};if(e)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[e,D]);let x=()=>{D||(c(""),n(""),d(""),b(null),v(null),f(null),t());},P=async()=>{if(!(!l.trim()||D)){u(true),b(null),v(null),f(null);try{let N=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});v(N.tasks.tasks),f({from_cache:N.from_cache,tokens_used:N.tokens_used,mock_mode:N.mock_mode,similarity:N.similarity,tokens_saved:N.tokens_saved});}catch(N){b(N instanceof Error?N.message:"Failed to generate tasks");}finally{u(false);}}},T=()=>{g&&(a(g),x());};if(!e)return null;let O=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(at,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:N=>N.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:x,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",O,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((N,w)=>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:["#",w+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:N.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"})]}),N.start," \u2192 ",N.end]}),jsxRuntime.jsxs("span",{children:[N.duration," days"]}),N.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",N.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${N.priority==="high"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:N.priority})]})},N.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:k,value:l,onChange:N=>c(N.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:N=>n(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:N=>d(N.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((N,w)=>jsxRuntime.jsx("button",{onClick:()=>c(N),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:N},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:P,disabled:!l.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Nn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&Io(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,f)=>{console.warn(`Retry attempt ${h} after ${f}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(f=>{let k=f.cards.find(N=>N.id===g);if(!k)return f;let D=k.columnId,x={...k,columnId:v,position:h},P=f.cards.map(N=>N.id===g?x:N),T=f.columns.map(N=>{if(N.id===D)return {...N,cardIds:N.cardIds.filter(w=>w!==g)};if(N.id===v){let w=P.filter(F=>F.columnId===v).sort((F,M)=>F.position-M.position);return {...N,cardIds:w.map(F=>F.id)}}return N}),O={...f,cards:P,columns:T};return o(O),O});},[o]),l=react.useCallback(async(g,v)=>{r(h=>{let f=h.cards.map(D=>D.id===g?{...D,...v}:D),k={...h,cards:f};return o(k),k});},[o]),c=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:v},k=h.columns.map(x=>x.id===g.columnId?{...x,cardIds:[...x.cardIds,v]}:x),D={...h,cards:[...h.cards,f],columns:k};return o(D),D});},[o]),p=react.useCallback(async g=>{r(v=>{let h=v.cards.find(x=>x.id===g);if(!h)return v;let f=v.cards.filter(x=>x.id!==g),k=v.columns.map(x=>x.id===h.columnId?{...x,cardIds:x.cardIds.filter(P=>P!==g)}:x),D={...v,cards:f,columns:k};return o(D),D});},[o]),n=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let f={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,f]};return o(k),k});},[o]),m=react.useCallback(async(g,v)=>{r(h=>{let f=h.columns.map(D=>D.id===g?{...D,...v}:D),k={...h,columns:f};return o(k),k});},[o]),d=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(D=>D.columnId!==g),f=v.columns.filter(D=>D.id!==g),k={...v,cards:h,columns:f};return o(k),k});},[o]),i=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(g),v},[c]),u=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(g),v},[n]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:y}}}function yc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Nn({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var Co={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},xc={by:"none",order:"asc"};function kc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Co,...e}),[s,l]=react.useState({...xc,...t}),c=react.useCallback(b=>{o(g=>({...g,...b}));},[]),p=react.useCallback(b=>{l(g=>({...g,...b}));},[]),n=react.useCallback(()=>{o(Co),l(xc);},[]),m=react.useCallback(()=>{a&&o({...Co,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Co,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Co,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(b=>{let g=[...b];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),f=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),D=`${h}-${f}-${k}`;g=g.filter(x=>{if(!x.endDate&&!x.dueDate)return false;let P=x.endDate||x.dueDate;if(!P)return false;let T;if(typeof P=="string")T=P.split("T")[0]||P;else {let O=P.getUTCFullYear(),N=String(P.getUTCMonth()+1).padStart(2,"0"),w=String(P.getUTCDate()).padStart(2,"0");T=`${O}-${N}-${w}`;}switch(r.dateFilter){case "overdue":return T<D;case "today":return T===D;case "this-week":let O=new Date(D+"T00:00:00"),N=new Date(T+"T00:00:00"),w=new Date(O);return w.setDate(w.getDate()+7),N>=O&&N<=w;case "custom":if(r.dateRange){let F=typeof P=="string"?new Date(P):P;return F>=r.dateRange.start&&F<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let f=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;f=k-D;break;case "priority":let x={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},P=x[v.priority||"LOW"],T=x[h.priority||"LOW"];f=P-T;break;case "dueDate":let O=v.endDate||v.dueDate,N=h.endDate||h.dueDate;if(!O)return 1;if(!N)return -1;let w=typeof O=="string"?new Date(O).getTime():O.getTime(),F=typeof N=="string"?new Date(N).getTime():N.getTime();f=w-F;break;case "title":f=v.title.localeCompare(h.title);break;case "estimate":let M=v.estimatedTime||0,H=h.estimatedTime||0;f=M-H;break;default:f=0;}return s.order==="asc"?f:-f}),g},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:d,filterHighPriority:i,applyFilters:y,hasActiveFilters:u}}var Cc,Tc;if(typeof window<"u")try{let e=Po("ai");Cc=e.generateObject,Tc=e.generateText;}catch{}function Dc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Cc&&Tc&&e.apiKey),l=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(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}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("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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=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(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function gi(){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 Nc(e){let{cards:t}=e,[a,r]=gi(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=i.ctrlKey||i.metaKey,y=i.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let b=t.find(v=>v.id===d),g=t.find(v=>v.id===a.lastSelectedCardId);if(b&&g&&b.columnId===g.columnId){let v=t.filter(T=>T.columnId===b.columnId).sort((T,O)=>T.position-O.position),h=v.findIndex(T=>T.id===a.lastSelectedCardId),f=v.findIndex(T=>T.id===d),[k,D]=h<f?[h,f]:[f,h],x=v.slice(k,D+1).map(T=>T.id),P=Array.from(new Set([...a.selectedCardIds,...x]));r({selectedCardIds:P,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var Sc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Ec(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Sc,...a}),[a]),[s,l]=react.useState([]),c=react.useCallback((b,g,v,h,f)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:g,columnId:v,strategy:h,color:f,isExpanded:true,position:s.filter(D=>D.columnId===v).length,createdAt:new Date};l(D=>[...D,k]);},[o.minCardsPerStack,s]),p=react.useCallback(b=>{l(g=>g.filter(v=>v.id!==b));},[]),n=react.useCallback(b=>{l(g=>g.map(v=>v.id===b?{...v,isExpanded:!v.isExpanded}:v));},[]),m=react.useCallback((b,g)=>{l(v=>v.map(h=>h.id===b&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=react.useCallback((b,g)=>{l(v=>v.map(h=>{if(h.id===b){let f=h.cardIds.filter(k=>k!==g);return f.length<o.minCardsPerStack?null:{...h,cardIds:f}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),i=react.useCallback(b=>s.filter(g=>g.columnId===b).sort((g,v)=>g.position-v.position),[s]),u=react.useCallback(async b=>{let g=t.filter(D=>D.columnId===b);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(x=>{h.has(x)||h.set(x,[]),h.get(x).push(D);});}),h.forEach((D,x)=>{D.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${x}`,cardIds:D.map(P=>P.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${x}"`,confidence:.85});});let f=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(x=>{f.has(x)||f.set(x,[]),f.get(x).push(D);});}),f.forEach((D,x)=>{D.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${x.slice(-4)}`,cardIds:D.map(P=>P.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(D=>{D.priority&&(k.has(D.priority)||k.set(D.priority,[]),k.get(D.priority).push(D));}),k.forEach((D,x)=>{if(D.length>=o.minCardsPerStack){let P={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[x.toLowerCase()]||"\u26AA";v.push({stack:{title:`${P} ${x} Priority`,cardIds:D.map(T=>T.id),columnId:b,strategy:"priority",color:x==="high"||x==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${x} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let P=(await r.findSimilar(D,g)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(P.length>=o.minCardsPerStack-1){let T=[D.id,...P.map(N=>N.card.id)],O=P.reduce((N,w)=>N+w.similarity,0)/P.length;v.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${P.length+1} similar tasks`,confidence:O});}}return v.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,x)=>x.confidence-D.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(b=>{c(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await u(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:d,getStacksForColumn:i,getSuggestions:u,applySuggestion:y,config:o}}var Pc=react.createContext(null);function Mc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(p=>{let{Column:n}=Po("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=Po("@libxai/core");l.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=Po("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Pc.Provider,{value:{store:o},children:e})}function Sn(){let e=react.useContext(Pc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Do(){let e=Sn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),n=react.useCallback((h,f)=>{e.updateColumn(h,f);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),i=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,f)=>{e.updateCard(h,f);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),b=react.useCallback((h,f,k)=>{e.moveCard(h,f,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:d,addCard:i,updateCard:u,deleteCard:y,moveCard:b,getCard:g,getCardsByColumn:v}}function Ic(e){let{cards:t}=Do();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 Lc(e="position",t="asc"){let{cards:a}=Do();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;l=p-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var En=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=$i.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 l=s[t];if(typeof l=="function")try{let c=await Promise.resolve(l.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{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(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},vb=new En;function Bc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:c=0,getItemKey:p}){let n=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:c}),d=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(y=>{let b=e[y.index];if(!b)return null;let g=p?p(b,y.index):y.index,v={position:"absolute",top:l?0:y.start,left:l?y.start:0,width:l?y.size:"100%",height:l?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(b,y.index)},g)})})})}function Rc(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 $c({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:s,children:jsxRuntime.jsx("div",{style:y,children:i.map(b=>{let g=e[b.index];if(!g)return null;let v=p?p(g,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":b.index,children:o(g,b.index)},v)})})})}function zc(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 Uc(e,t=10){return e>t}var yi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},vi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},xi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ki={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},wi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ci={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ti={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Di={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)"},Ni={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)"},Si={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ei={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}},Pi={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}},Pn={spacing:yi,borderRadius:vi,fontSize:xi,fontWeight:ki,lineHeight:wi,zIndex:Ci,duration:Ti,easing:Di,shadows:Ni,opacity:Si,kanban:Ei,gantt:Pi};function Wc(e,t,a){return e[t]??a}function Mi(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)?Mi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function wb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ai(e="asakaa"){let t=Mi(Pn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=wb(o);a.push(` ${s}: ${l};`);}return `:root {
324
324
  ${a.join(`
325
325
  `)}
326
326
  }`}function No(e,t="asakaa"){let a=[],r=Mi(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
@@ -349,6 +349,6 @@ ${No(Li,"asakaa").split(`
349
349
  `).slice(1,-1).join(`
350
350
  `)}
351
351
  }
352
- `}var Cb=({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 Gc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=zr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,p])=>{let m=l,n=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":n,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Cb,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
353
- 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=uc;exports.AI_FEATURES=tb;exports.AI_MODELS=pi;exports.AddCardButton=Yn;exports.AddColumnButton=Kn;exports.AttachmentUploader=ur;exports.BoardProvider=Mc;exports.BulkOperationsToolbar=_o;exports.BurnDownChart=is;exports.CalendarBoard=Jd;exports.Card=Wa;exports.CardDetailModal=Qn;exports.CardDetailModalV2=os;exports.CardHistoryReplay=oc;exports.CardHistoryTimeline=ac;exports.CardRelationshipsGraph=ic;exports.CardStack=jf;exports.CardTemplateSelector=gs;exports.CircuitBreaker=Ln;exports.Column=Lr;exports.ColumnManager=Xo;exports.CommandPalette=Jn;exports.ConfigMenu=ys;exports.ContextMenu=Hr;exports.DEFAULT_SHORTCUTS=co;exports.DEFAULT_TEMPLATES=us;exports.DateRangePicker=Zr;exports.DependenciesSelector=eo;exports.DependencyLine=rn;exports.DistributionCharts=ls;exports.EditableColumnTitle=Wn;exports.ErrorBoundary=Fr;exports.ExportImportModal=bs;exports.FilterBar=hs;exports.GANTT_AI_SYSTEM_PROMPT=Ad;exports.GanttAIAssistant=pn;exports.GanttBoard=Md;exports.GanttI18nContext=Wr;exports.GanttMilestone=nn;exports.GanttToolbar=qo;exports.GenerateGanttTasksDialog=bc;exports.GeneratePlanModal=cc;exports.GroupBySelector=ps;exports.KanbanBoard=Za;exports.KanbanToolbar=Vn;exports.KanbanViewAdapter=no;exports.KeyboardShortcutsHelp=ms;exports.ListView=Gd;exports.MenuIcons=yt;exports.PluginManager=En;exports.PrioritySelector=dr;exports.RATE_LIMITS=eb;exports.SwimlaneBoardView=ds;exports.TagBadge=as;exports.TagList=El;exports.TagPicker=Rr;exports.TaskBar=en;exports.TaskFormModal=cn;exports.TaskGrid=Qo;exports.ThemeModal=ws;exports.ThemeProvider=_l;exports.ThemeSwitcher=Gc;exports.Timeline=ln;exports.UserAssignmentSelector=pr;exports.VelocityChart=ss;exports.VirtualGrid=$c;exports.VirtualList=Bc;exports.aiUsageTracker=Cr;exports.borderRadius=vi;exports.calculatePosition=Ao;exports.calendarDarkTheme=si;exports.calendarEnTranslations=Qs;exports.calendarEsTranslations=ei;exports.calendarLightTheme=ii;exports.calendarNeutralTheme=li;exports.calendarThemes=Cn;exports.calendarTranslations=yn;exports.cardToGanttTask=un;exports.cardsToGanttTasks=$d;exports.cn=C;exports.createKanbanView=Cl;exports.createRetryWrapper=sp;exports.darkTheme=vs;exports.darkTokenTheme=Mn;exports.defaultTheme=jo;exports.designTokens=Pn;exports.duration=Ti;exports.easing=Di;exports.exportTokensToCSS=Hc;exports.findTaskByName=ja;exports.fontSize=xi;exports.fontWeight=ki;exports.formatCost=wo;exports.ganttEnTranslations=Yo;exports.ganttEsTranslations=jl;exports.ganttTaskToCardUpdate=Od;exports.ganttThemes=Ue;exports.ganttTokens=Pi;exports.ganttTranslations=Cs;exports.ganttUtils=re;exports.generateCSSVariables=Ai;exports.generateCompleteCSS=Fi;exports.generateInitialPositions=ap;exports.generateTasksContext=Id;exports.generateThemeVariables=No;exports.getCalendarTheme=Zd;exports.getCalendarTranslations=vo;exports.getListViewTheme=_d;exports.getListViewTranslations=qs;exports.getMonthNames=Vd;exports.getToken=Wc;exports.getTranslations=Kl;exports.getWeekdayNames=jd;exports.kanbanTokens=Ei;exports.lightTheme=xs;exports.lightTokenTheme=Ii;exports.lineHeight=wi;exports.listViewDarkTheme=Xs;exports.listViewEnTranslations=Ks;exports.listViewEsTranslations=Ys;exports.listViewLightTheme=Js;exports.listViewNeutralTheme=Zs;exports.listViewThemes=hn;exports.listViewTranslations=gn;exports.mergeCalendarTranslations=vn;exports.mergeListViewTranslations=fn;exports.mergeTranslations=Ts;exports.neutralTheme=ks;exports.neutralTokenTheme=Li;exports.opacity=Si;exports.parseLocalCommand=Bd;exports.parseNaturalDate=_s;exports.parseNaturalDuration=Vs;exports.parseProgress=js;exports.parseStatus=Fd;exports.pluginManager=vb;exports.retrySyncOperation=np;exports.retryWithBackoff=Io;exports.shadows=Ni;exports.shouldVirtualizeGrid=Uc;exports.spacing=yi;exports.themes=br;exports.useAI=Dc;exports.useBoard=yc;exports.useBoardCore=Do;exports.useBoardStore=Sn;exports.useCardStacking=Ec;exports.useDragState=Gn;exports.useFilteredCards=Ic;exports.useFilters=kc;exports.useGanttI18n=po;exports.useKanbanState=Nn;exports.useKeyboardShortcuts=Wl;exports.useMultiSelect=Nc;exports.useSelectionState=gi;exports.useSortedCards=Lc;exports.useTheme=zr;exports.useVirtualGrid=zc;exports.useVirtualList=Rc;exports.validateAIResponse=Rd;exports.withErrorBoundary=qn;exports.wouldCreateCircularDependency=Fo;exports.zIndex=Ci;//# sourceMappingURL=index.cjs.map
352
+ `}var Cb=({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 Gc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=zr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,c])=>{let p=l,n=p===r;return jsxRuntime.jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Cb,{theme:p})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},p)})})}
353
+ 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=uc;exports.AI_FEATURES=tb;exports.AI_MODELS=pi;exports.AddCardButton=Yn;exports.AddColumnButton=Kn;exports.AttachmentUploader=Ga;exports.BoardProvider=Mc;exports.BulkOperationsToolbar=_o;exports.BurnDownChart=is;exports.CalendarBoard=Jd;exports.Card=Wa;exports.CardDetailModal=Qn;exports.CardDetailModalV2=os;exports.CardHistoryReplay=oc;exports.CardHistoryTimeline=ac;exports.CardRelationshipsGraph=ic;exports.CardStack=jf;exports.CardTemplateSelector=gs;exports.CircuitBreaker=Ln;exports.Column=Lr;exports.ColumnManager=Xo;exports.CommandPalette=Jn;exports.ConfigMenu=ys;exports.ContextMenu=Hr;exports.DEFAULT_SHORTCUTS=co;exports.DEFAULT_TEMPLATES=us;exports.DateRangePicker=Zr;exports.DependenciesSelector=eo;exports.DependencyLine=rn;exports.DistributionCharts=ls;exports.EditableColumnTitle=Wn;exports.ErrorBoundary=Fr;exports.ExportImportModal=bs;exports.FilterBar=hs;exports.GANTT_AI_SYSTEM_PROMPT=Ad;exports.GanttAIAssistant=pn;exports.GanttBoard=Md;exports.GanttI18nContext=Wr;exports.GanttMilestone=nn;exports.GanttToolbar=qo;exports.GenerateGanttTasksDialog=bc;exports.GeneratePlanModal=cc;exports.GroupBySelector=ps;exports.KanbanBoard=Qa;exports.KanbanToolbar=Vn;exports.KanbanViewAdapter=no;exports.KeyboardShortcutsHelp=ms;exports.ListView=Gd;exports.MenuIcons=vt;exports.PluginManager=En;exports.PrioritySelector=cr;exports.RATE_LIMITS=eb;exports.SwimlaneBoardView=ds;exports.TagBadge=as;exports.TagList=El;exports.TagPicker=Rr;exports.TaskBar=en;exports.TaskFormModal=cn;exports.TaskGrid=Qo;exports.ThemeModal=ws;exports.ThemeProvider=_l;exports.ThemeSwitcher=Gc;exports.Timeline=ln;exports.UserAssignmentSelector=mr;exports.VelocityChart=ss;exports.VirtualGrid=$c;exports.VirtualList=Bc;exports.aiUsageTracker=Cr;exports.borderRadius=vi;exports.calculatePosition=Ao;exports.calendarDarkTheme=si;exports.calendarEnTranslations=Qs;exports.calendarEsTranslations=ei;exports.calendarLightTheme=ii;exports.calendarNeutralTheme=li;exports.calendarThemes=Cn;exports.calendarTranslations=yn;exports.cardToGanttTask=un;exports.cardsToGanttTasks=$d;exports.cn=C;exports.createKanbanView=Cl;exports.createRetryWrapper=sp;exports.darkTheme=vs;exports.darkTokenTheme=Mn;exports.defaultTheme=jo;exports.designTokens=Pn;exports.duration=Ti;exports.easing=Di;exports.exportTokensToCSS=Hc;exports.findTaskByName=Ka;exports.fontSize=xi;exports.fontWeight=ki;exports.formatCost=wo;exports.ganttEnTranslations=Yo;exports.ganttEsTranslations=jl;exports.ganttTaskToCardUpdate=Od;exports.ganttThemes=He;exports.ganttTokens=Pi;exports.ganttTranslations=Cs;exports.ganttUtils=se;exports.generateCSSVariables=Ai;exports.generateCompleteCSS=Fi;exports.generateInitialPositions=ap;exports.generateTasksContext=Id;exports.generateThemeVariables=No;exports.getCalendarTheme=Zd;exports.getCalendarTranslations=vo;exports.getListViewTheme=_d;exports.getListViewTranslations=qs;exports.getMonthNames=Vd;exports.getToken=Wc;exports.getTranslations=Kl;exports.getWeekdayNames=jd;exports.kanbanTokens=Ei;exports.lightTheme=xs;exports.lightTokenTheme=Ii;exports.lineHeight=wi;exports.listViewDarkTheme=Xs;exports.listViewEnTranslations=Ks;exports.listViewEsTranslations=Ys;exports.listViewLightTheme=Js;exports.listViewNeutralTheme=Zs;exports.listViewThemes=hn;exports.listViewTranslations=gn;exports.mergeCalendarTranslations=vn;exports.mergeListViewTranslations=fn;exports.mergeTranslations=Ts;exports.neutralTheme=ks;exports.neutralTokenTheme=Li;exports.opacity=Si;exports.parseLocalCommand=Bd;exports.parseNaturalDate=_s;exports.parseNaturalDuration=Vs;exports.parseProgress=js;exports.parseStatus=Fd;exports.pluginManager=vb;exports.retrySyncOperation=np;exports.retryWithBackoff=Io;exports.shadows=Ni;exports.shouldVirtualizeGrid=Uc;exports.spacing=yi;exports.themes=br;exports.useAI=Dc;exports.useBoard=yc;exports.useBoardCore=Do;exports.useBoardStore=Sn;exports.useCardStacking=Ec;exports.useDragState=Gn;exports.useFilteredCards=Ic;exports.useFilters=kc;exports.useGanttI18n=po;exports.useKanbanState=Nn;exports.useKeyboardShortcuts=Wl;exports.useMultiSelect=Nc;exports.useSelectionState=gi;exports.useSortedCards=Lc;exports.useTheme=zr;exports.useVirtualGrid=zc;exports.useVirtualList=Rc;exports.validateAIResponse=Rd;exports.withErrorBoundary=qn;exports.wouldCreateCircularDependency=Fo;exports.zIndex=Ci;//# sourceMappingURL=index.cjs.map
354
354
  //# sourceMappingURL=index.cjs.map