@libxai/board 0.17.53 → 0.17.55

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'),Al=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Nm=require('react-markdown'),Dm=require('remark-gfm'),Sm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Al__default=/*#__PURE__*/_interopDefault(Al);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Dm__default=/*#__PURE__*/_interopDefault(Dm);var Sm__default=/*#__PURE__*/_interopDefault(Sm);var _r=(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 Vr=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 [Vr.Translate.toString(e),Vr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function I(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function jr(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 gc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function $o(e,t){return e.length===0?1e3:t===0?jr(null,e[0].position):t>=e.length?jr(e[e.length-1].position,null):jr(e[t-1].position,e[t].position)}function js(e,t=100){return e>t}var fc=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 bc(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 Kr(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=fc,onRetry:m}=t,c,n=0;for(let p=1;p<=a;p++){n=p;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(c=d,p===a||!l(c,p))return {error:c,attempts:n,success:false};let g=bc(p,r,o,s);if(m)try{m(c,p,g);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,g));}}return {error:c||new Error("Unknown error"),attempts:n,success:false}}function hc(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 vc(e,t={}){return async(...a)=>Kr(()=>e(...a),t)}var Ho=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 Ks=(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))(Ks||{}),La=class La{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,m=`[${a}] [${r}] [${s}]`,c=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(m,o,c?l:"");break;case "INFO":console.info(m,o,c?l:"");break;case "WARN":console.warn(m,o,c?l:"");break;case "ERROR":console.error(m,o,c?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",...La.globalOptions};}static configure(t){La.globalOptions={...La.globalOptions,...t};}child(t){return new La({...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 Yr((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Yr(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ks[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};La.globalOptions={};var Wo=La,Yr=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}},Ys=new Wo;function xc(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 kc(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(m=>m.id===s.columnId);return [s.id,_o(s.title),_o(s.description||""),_o(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 wc(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 Al__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=l.toDataURL("image/png"),c=297,n=210,p=l.width/l.height,d=c-20,i=d/p;i>n-20&&(i=n-20,d=i*p);let g=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let v=(c-d)/2;return g.addImage(m,"PNG",v,20,d,i),g}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 m=e.cards.filter(c=>c.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,m.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):m.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let n=[];if(c.priority&&n.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&n.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&n.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),n.push(p.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 _o(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function qs(e,t,a,r){switch(t){case "json":return xc(e,r);case "csv":return kc(e);case "pdf":return await wc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Js(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);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"},m=new Blob([e],{type:l[t]}),c=URL.createObjectURL(m),n=document.createElement("a");n.href=c,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(c);}function Cc(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 Tc(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=Zs(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let m=Zs(t[l]||"");if(m.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-m.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let n={};a.forEach((g,v)=>{n[g]=m[v]||"";});let p=n.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),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(m){s.push(`Line ${l+1}: ${m instanceof Error?m.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 Zs(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 Qs(e,t){switch(t){case "json":return Cc(e);case "csv":return Tc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ei(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 Vo=react.createContext(null);function ti(){return react.useContext(Vo)}var ai=react.createContext(null);function ri({children:e,themeName:t}){return jsxRuntime.jsx(ai.Provider,{value:{themeName:t},children:e})}function Za(){return react.useContext(ai)}function Be({children:e,container:t}){let[a,r]=react.useState(false),o=ti(),s=Za();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:m,themeName:c}=o,n={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"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 ii={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Ac="#BDC3C7",Fc=({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 Ba({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(r&&c.current){let i=c.current.getBoundingClientRect();l({top:i.bottom+window.scrollY+8,left:i.left+window.scrollX});}},[r]),react.useEffect(()=>{let i=g=>{m.current&&!m.current.contains(g.target)&&!c.current?.contains(g.target)&&o(false);};if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]),react.useEffect(()=>{let i=g=>{g.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]);let n=i=>{t(i),o(false);},p=e?ii[e]:null,d=p?.color||Ac;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>o(!r),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?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.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:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"absolute",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",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(ii).map(([i,g])=>jsxRuntime.jsxs("button",{onClick:()=>n(i),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:g.color,background:"transparent"},onMouseEnter: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(Fc,{color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:g.label}),e===i&&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"})})]},i)),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:()=>n(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:i=>{i.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:i=>{i.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 Lc=[{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 vr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=react.useState(false),[l,m]=react.useState({top:0,left:0}),c=react.useRef(null),n=react.useRef(null),i=(Za()?.themeName||"dark")==="dark";react.useEffect(()=>{if(o&&n.current){let f=n.current.getBoundingClientRect();m({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[o]),react.useEffect(()=>{let f=u=>{c.current&&!c.current.contains(u.target)&&!n.current?.contains(u.target)&&s(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=u=>{u.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let g=f=>{let u=new Date,N=k=>{let S=k.getFullYear(),w=String(k.getMonth()+1).padStart(2,"0"),U=String(k.getDate()).padStart(2,"0");return `${S}-${w}-${U}`},T=N(u),b=new Date(u);b.setDate(b.getDate()+f);let D=N(b);a(T,D),s(false);},v=()=>{if(!e||!t)return "Set date";let f=b=>{if(b instanceof Date)return b;if(typeof b!="string"||!b.match(/^\d{4}-\d{2}-\d{2}$/))return null;let D=b.split("-").map(Number);if(D.length!==3||D.some(U=>isNaN(U)))return null;let k=D[0],S=D[1],w=D[2];return k===void 0||S===void 0||w===void 0?null:new Date(k,S-1,w)},u=f(e),N=f(t);if(!u||!N||isNaN(u.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[u.getMonth()]} ${u.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,u=new Date;return u.setHours(0,0,0,0),f<u})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>s(!o),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${v()}`:"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:v()})]}),o&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu absolute rounded-xl shadow-2xl border min-w-[320px]",style:{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:Lc.map(f=>jsxRuntime.jsx("button",{onClick:()=>g(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:u=>{u.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",u.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:u=>{u.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",u.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 Oa({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=react.useState(false),[m,c]=react.useState(""),[n,p]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{if(s&&i.current){let h=i.current.getBoundingClientRect();p({top:h.bottom+window.scrollY+8,left:h.left+window.scrollX});}},[s]),react.useEffect(()=>{let h=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(l(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&(l(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let g=h=>{let f=e.some(u=>u.id===h.id);a(f?e.filter(u=>u.id!==h.id):[...e,h]);},v=t.filter(h=>h.name.toLowerCase().includes(m.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>l(!s),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:[y.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)),x>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):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(Be,{children:jsxRuntime.jsxs("div",{ref:d,className:"user-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${n.top}px`,left:`${n.left}px`,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:m,onChange:h=>c(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:v.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"}):v.map(h=>{let f=e.some(u=>u.id===h.id);return jsxRuntime.jsxs("button",{onClick:()=>g(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:u=>{u.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",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\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 Xr(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let n=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,m=c=>{if(!s.has(c)){s.add(c),l.add(c);let n=r.get(c)||[];for(let p of n){if(!s.has(p)&&m(p))return true;if(l.has(p))return true}}return l.delete(c),false};return m(a)}function xr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[m,c]=react.useState(false),[n,p]=react.useState(""),[d,i]=react.useState(t.length>0),[g,v]=react.useState({top:0,left:0}),[y,x]=react.useState(null),h=react.useRef(null),f=react.useRef(null);react.useEffect(()=>{if(m&&f.current){let D=f.current.getBoundingClientRect();v({top:D.bottom+window.scrollY+8,left:D.left+window.scrollX});}},[m]),react.useEffect(()=>{let D=k=>{h.current&&!h.current.contains(k.target)&&!f.current?.contains(k.target)&&(c(false),p(""));};if(m)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[m]),react.useEffect(()=>{let D=k=>{k.key==="Escape"&&(c(false),p(""));};if(m)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m]);let u=D=>{let k=t.includes(D),S=a.find(w=>w.id===D);if(x(null),k){let w=t.filter(U=>U!==D);r(w),w.length===0&&i(false);}else {if(s&&Xr(a,D,e)){let U=`Cannot add "${S?.title||D}" as dependency - would create circular reference`;x(U),l?.(D,S?.title||D),setTimeout(()=>x(null),3e3);return}r([...t,D]),i(true);}},N=()=>{let D=!d;i(D),D||r([]);},T=a.filter(D=>D.id!==e).filter(D=>D.title.toLowerCase().includes(n.toLowerCase())||D.id.toLowerCase().includes(n.toLowerCase())),b=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:f,onClick:()=>c(!m),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:b,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:b},children:t.length})]}),m&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:h,className:"dependencies-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${g.top}px`,left:`${g.left}px`,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:[y&&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:y})]}),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:D=>p(D.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:T.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):T.map(D=>{let k=t.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>u(D.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:S=>{S.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:S=>{S.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:k?"#3b82f6":"transparent",borderColor:k?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:k&&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:D.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:D.id})]})]},D.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),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ba=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:m=[],allCards:c=[]})=>{let{attributes:n,listeners:p,setNodeRef:d,transform:i,transition:g,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),y={transform:Vr.Transform.toString(i),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:y,...n,...p,onClick:()=>a?.(e),children:t(e)});let x=m.filter(u=>e.assignedUserIds?.includes(u.id)),h=e.progress===100,f={...y,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:d,style:f,className:I("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...p,onClick:u=>{u.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:u=>{u.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.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:u=>u.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ba,{priority:e.priority,onChange:u=>l?.(e.id,{priority:u})})}),jsxRuntime.jsx("div",{onClick:u=>u.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(vr,{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:(u,N)=>l?.(e.id,{startDate:u,endDate:N})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:u=>u.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Oa,{assignedUsers:x,availableUsers:m,onChange:u=>l?.(e.id,{assignedUserIds:u.map(N=>N.id)})})}),jsxRuntime.jsx("div",{onClick:u=>u.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(xr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(u=>typeof u=="string"?u:u.taskId):[],availableTasks:c,onChange:u=>l?.(e.id,{dependencies:u})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(u=>jsxRuntime.jsx("span",{className:"asakaa-label",children:u},u))}),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));ba.displayName="Card";function pi({columnTitle:e,onRename:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(false),[m,c]=react.useState(e),[n,p]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(r&&i.current){let h=i.current.getBoundingClientRect();p({top:h.bottom+window.scrollY+8,left:h.left+window.scrollX});}},[r]),react.useEffect(()=>{let h=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(o(false),l(false));};if(r)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[r]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&(o(false),l(false),c(e));};if(r)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r,e]),react.useEffect(()=>{s&&g.current&&(g.current.focus(),g.current.select());},[s]);let v=()=>{l(true),c(e);},y=()=>{let h=m.trim();h&&h!==e&&t(h),l(false),o(false),c(e);},x=h=>{h.key==="Enter"?y():h.key==="Escape"&&(l(false),c(e));};return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>o(!r),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"})]})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${n.top}px`,left:`${n.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:s?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:g,type:"text",value:m,onChange:h=>c(h.target.value),onKeyDown:x,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:v,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"})]})})})})]})}var tr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:m,availableUsers:c,allCards:n,enableVirtualization:p,cardHeight:d=120,isCollapsed:i,onToggleCollapse:g,onColumnRename:v,className:y})=>{let{setNodeRef:x,isOver:h}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),f=react.useRef(null),u=p??js(t.length),N=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>f.current,estimateSize:()=>d,enabled:u});if(a)return jsxRuntime.jsx("div",{ref:x,className:y,children:a(e,t)});let b=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),D=b.state==="exceeded",k=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:I("asakaa-column",h&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",y),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:I(k()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&b.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${b.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[b.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"})]}),b.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"})]}),b.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"})}),b.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"})]})]}),v&&jsxRuntime.jsx(pi,{columnTitle:e.title,onRename:S=>v(e.id,S)}),g&&jsxRuntime.jsx("button",{onClick:g,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:f,className:"asakaa-column-cards",style:{maxHeight:u?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(S=>S.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"})}):u?jsxRuntime.jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(S=>{let w=t[S.index];return w?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsxRuntime.jsx(ba,{card:w,render:r,onClick:l,onUpdate:m,availableUsers:c,allCards:n})},w.id):null})}):t.map(S=>jsxRuntime.jsx(ba,{card:S,render:r,onClick:l,onUpdate:m,availableUsers:c,allCards:n},S.id))})})]})});tr.displayName="Column";function Qo({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):l(e),o(false);},n=p=>{p.key==="Enter"?c():p.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:s,onChange:p=>l(p.target.value),onBlur:c,onKeyDown:n,className:I("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:I("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function tn(){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 Na({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:m,isLoading:c,error:n,children:p}){let[d,i]=tn(),g=o?.theme||"dark",y=g==="dark"||g==="neutral"?"dark":"",x=react.useCallback((k,S)=>{t.onCardUpdate?.(k,S);},[t]),h=react.useCallback((k,S)=>{t.onColumnUpdate?.(k,{title:S});},[t]),f=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),u=react.useMemo(()=>{let k=new Map;return e.columns.forEach(S=>{let w=S.cardIds.map(U=>e.cards.find(W=>W.id===U)).filter(U=>U!==void 0).sort((U,W)=>U.position-W.position);k.set(S.id,w);}),k},[e.cards,e.columns]),N=react.useCallback(k=>{let{active:S}=k,w=e.cards.find(U=>U.id===S.id);w&&i({isDragging:true,draggedCardId:w.id,sourceColumnId:w.columnId,targetColumnId:w.columnId});},[e.cards,i]),T=react.useCallback(k=>{let{active:S,over:w}=k;if(!w||!e.cards.find(A=>A.id===S.id))return;let W=null;w.data.current?.type==="column"?W=w.id:w.data.current?.type==="card"&&(W=e.cards.find(_=>_.id===w.id)?.columnId||null),W&&W!==d.targetColumnId&&i({...d,targetColumnId:W});},[e.cards,d,i]),b=react.useCallback(async k=>{let{active:S,over:w}=k;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!w)return;let U=e.cards.find(E=>E.id===S.id);if(!U)return;let W,A;if(w.data.current?.type==="column"){W=w.id;let E=u.get(W)||[];A=$o(E,0);}else {let E=e.cards.find(ae=>ae.id===w.id);if(!E)return;W=E.columnId;let z=u.get(W)||[],q=z.findIndex(ae=>ae.id===w.id);A=$o(z,q);}let _=e.columns.find(E=>E.id===W);if(_&&_.wipLimit&&_.wipLimitType==="hard"){let E=u.get(W)||[];if(U.columnId!==W&&E.length>=_.wipLimit){t.onWipLimitExceeded?.(_,U);return}}(U.columnId!==W||U.position!==A)&&await t.onCardMove?.(U.id,W,A);},[e.cards,e.columns,u,t,i]),D=react.useCallback(k=>{a?.(k);},[a]);return c?jsxRuntime.jsx("div",{className:I("asakaa-board",y,l),style:m,children:jsxRuntime.jsx(rm,{columnCount:3})}):n?jsxRuntime.jsx("div",{className:I("asakaa-board",y,l),style:m,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(ri,{themeName:g,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:f,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:T,onDragEnd:b,children:[jsxRuntime.jsxs("div",{className:I("asakaa-board",y,l),style:m,"data-theme":g,children:[e.columns.sort((k,S)=>k.position-S.position).map(k=>{let S=u.get(k.id)||[];return jsxRuntime.jsx(tr,{column:k,cards:S,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:D,onCardUpdate:x,onColumnRename:h,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},k.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(ba,{card:e.cards.find(k=>k.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function rm({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 lm={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)"},dm={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)"},cm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},mm={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function pm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let n=p=>{m.current&&!m.current.contains(p.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let c=n=>{t(n),l(false);};return jsxRuntime.jsxs("div",{ref:m,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,p)=>n.position-p.position).map((n,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.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 um({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=react.useState(false),[m,c]=react.useState(null),n=react.useRef(null);if(react.useEffect(()=>{let g=v=>{n.current&&!n.current.contains(v.target)&&l(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),i=async(g,v)=>{if(v){c(g);try{await v();}catch(y){console.error(`Export ${g} failed:`,y);}finally{c(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((g,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(g.id,g.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.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:m===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 gm({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 rn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:m,onExportExcel:c,translations:n}){let p=r==="dark"?lm:dm,d={...o==="es"?cm:mm,...n},i=l||m||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(um,{theme:p,t:d,onExportCSV:l,onExportJSON:m,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(s?jsxRuntime.jsx(pm,{columns:e,onSelect:t,theme:p,t:d,createTaskLabel:a}):jsxRuntime.jsx(gm,{onClick:()=>t(),label:a||d.newTask}))]})})}function nn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=react.useState(false),[m,c]=react.useState(""),n=react.useCallback(()=>{let i=m.trim();i&&(e(i),c(""),l(false));},[m,e]),p=react.useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(c(""),l(false));},[n]),d=react.useCallback(()=>{setTimeout(()=>{m.trim()||l(false);},150);},[m]);return s?jsxRuntime.jsx("div",{className:I("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:m,onChange:i=>c(i.target.value),onKeyDown:p,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:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),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:I("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 sn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:m="dark",locale:c="es"}){let[n,p]=react.useState(false),[d,i]=react.useState(false),[g,v]=react.useState(""),[y,x]=react.useState([]),[h,f]=react.useState(""),[u,N]=react.useState(""),[T,b]=react.useState(""),[D,k]=react.useState(false),[S,w]=react.useState(false),[U,W]=react.useState(false),A=react.useRef(null),_=react.useRef(null),E={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},z=react.useCallback(()=>{v(""),x([]),f(""),N(""),b(""),k(false),w(false),W(false),p(false);},[]);react.useEffect(()=>{n&&A.current&&A.current.focus();},[n]),react.useEffect(()=>{if(!n)return;let B=R=>{_.current&&!_.current.contains(R.target)&&(g.trim()||z());};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[n,g,z]);let q=react.useCallback(async()=>{let B=g.trim();if(!(!B||d)){i(true);try{await t({name:B,columnId:e,assigneeIds:y.length>0?y:void 0,startDate:h?new Date(h):void 0,endDate:u?new Date(u):void 0,priority:T||void 0}),v(""),x([]),f(""),N(""),b(""),k(!1),w(!1),W(!1),A.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{i(false);}}},[g,e,y,h,u,T,t,d]),ae=react.useCallback(B=>{B.key==="Enter"&&!B.shiftKey?(B.preventDefault(),q()):B.key==="Escape"&&z();},[q,z]),ie=react.useCallback(B=>{x(R=>R.includes(B)?R.filter(M=>M!==B):[...R,B]);},[]),J=m==="dark";return n?jsxRuntime.jsxs("div",{ref:_,className:I("rounded-lg overflow-hidden shadow-lg",J?"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:g,onChange:B=>v(B.target.value),onKeyDown:ae,placeholder:E.placeholder,disabled:d,className:I("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",J?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>k(!D),className:I("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",D||y.length>0?"bg-emerald-500/20 text-emerald-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.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"})]}),y.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:y.length})]}),jsxRuntime.jsx("button",{onClick:()=>w(!S),className:I("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",S||h||u?"bg-blue-500/20 text-blue-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>W(!U),className:I("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",U||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:E.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:q,disabled:!g.trim()||d,className:I("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"}):E.save})]})]}),D&&a.length>0&&jsxRuntime.jsx("div",{className:I("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(B=>jsxRuntime.jsxs("button",{onClick:()=>ie(B.id),className:I("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",y.includes(B.id)?"bg-emerald-500 text-white":J?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[B.avatar?jsxRuntime.jsx("img",{src:B.avatar,alt:B.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:I("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",y.includes(B.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:B.name.split(" ")[0]})]},B.id))})}),S&&jsxRuntime.jsx("div",{className:I("px-3 pb-3 pt-0","border-t",J?"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:I("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:E.startDate}),jsxRuntime.jsx("input",{type:"date",value:h,onChange:B=>f(B.target.value),className:I("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:I("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:E.endDate}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:B=>N(B.target.value),className:I("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),U&&jsxRuntime.jsx("div",{className:I("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(B=>jsxRuntime.jsx("button",{onClick:()=>b(T===B?"":B),className:I("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===B?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[B]} text-white`:J?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:E[B]},B))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:l,className:I("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",J?"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:E.buttonLabel})]})}var Tr=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(Na,{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 Ni(e={}){return new Tr(e)}var rr=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 ln(e,t){let a=r=>jsxRuntime.jsx(rr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function cn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:m,onOpenAIUsage:c,shortcut:n="k",className:p=""}){let[d,i]=react.useState(false),[g,v]=react.useState(""),[y,x]=react.useState("home"),[h,f]=react.useState(""),[u,N]=react.useState("");react.useEffect(()=>{let k=S=>{(S.metaKey||S.ctrlKey)&&S.key===n&&(S.preventDefault(),i(w=>!w)),S.key==="Escape"&&(i(false),x("home"),v(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n]),react.useEffect(()=>{d||(x("home"),v(""),f(""),N(""));},[d]);let T=react.useCallback(()=>{i(false);},[]),b=react.useCallback(k=>{let[S,w]=k.split(":");switch(S){case "create-card":x("create-card");break;case "create-card-in":f(w||"");break;case "navigate":w?(a?.(w),T()):x("navigate");break;case "search":r?.(g),T();break;case "priority":x("priority");break;case "set-priority":u&&w&&(o?.(u,w),T());break;case "assign":x("assign");break;case "assign-user":u&&w&&(s?.(u,w),T());break;case "ai":x("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":m?.(),T();break;case "ai-usage":c?.(),T();break;case "back":x("home");break;}},[g,u,t,a,r,o,s,l,m,c,T]),D=react.useCallback(()=>{h&&g.trim()&&(t?.(h,g.trim()),T());},[h,g,t,T]);return d?jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:v,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:y==="create-card"&&h?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&y==="create-card"&&h&&D();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),y==="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:b,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:b,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:b,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:b,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},k.id))})]}),y==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),y==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let S=e.columns.find(w=>w.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:b,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(w=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:w},w))})]},k.id)})})]}),y==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:b,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:b,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:b,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:b,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 km(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 wm(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 Cm(e){return e.startsWith("image/")}function Dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,m]=react.useState(false),[c,n]=react.useState(false),[p,d]=react.useState(null),i=react.useRef(null),g=react.useCallback(b=>{let D=[],k=[];return e.length+b.length>s?(k.push(`Maximum ${s} files allowed`),{valid:D,errors:k}):(b.forEach(S=>{if(S.size/1048576>r){k.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>S.type.match(U))){k.push(`${S.name} has invalid file type`);return}D.push(S);}),{valid:D,errors:k})},[e.length,s,r,o]),v=react.useCallback(async b=>{let{valid:D,errors:k}=g(b);if(k.length>0){d(k.join(", ")),setTimeout(()=>d(null),5e3);return}if(D.length!==0){n(true),d(null);try{await t?.(D);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[g,t]),y=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(true);},[]),x=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);},[]),h=react.useCallback(b=>{b.preventDefault(),b.stopPropagation();},[]),f=react.useCallback(b=>{b.preventDefault(),b.stopPropagation(),m(false);let D=Array.from(b.dataTransfer.files);v(D);},[v]),u=react.useCallback(b=>{let D=b.target.files?Array.from(b.target.files):[];v(D),i.current&&(i.current.value="");},[v]),N=react.useCallback(()=>{i.current?.click();},[]),T=react.useCallback(b=>{confirm("Are you sure you want to delete this attachment?")&&a?.(b);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${c?"uploading":""}`,onDragEnter:y,onDragLeave:x,onDragOver:h,onDrop:f,onClick:N,children:[jsxRuntime.jsx("input",{ref:i,type:"file",multiple:true,onChange:u,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children: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"]})]})})]}),p&&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:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(b=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Cm(b.type)&&b.url?jsxRuntime.jsx("img",{src:b.thumbnailUrl||b.url,alt:b.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:wm(b.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:b.name,children:b.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:km(b.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(b.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>T(b.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"})})})]},b.id))})]})}function pn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:m=[],aiInsights:c=[],attachments:n=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:g,onSuggestAssignee:v,onGenerateSubtasks:y,onEstimateEffort:x,currentUserId:h="user-1"}){let[f,u]=react.useState("details"),[N,T]=react.useState(false),[b,D]=react.useState({}),[k,S]=react.useState(""),[w,U]=react.useState(false),[W,A]=react.useState({});if(!t||!e)return null;let _=react.useCallback(()=>{T(false),D({}),u("details"),S(""),A({}),a();},[a]),E=react.useCallback(()=>{r&&Object.keys(b).length>0&&(r(e.id,b),D({}),T(false));},[e.id,b,r]),z=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),_());},[e.id,o,_]),q=react.useCallback(()=>{p&&k.trim()&&(p(e.id,k.trim()),S(""));},[e.id,k,p]),ae=react.useCallback(async()=>{if(v){U(true);try{let M=await v(e);A(ue=>({...ue,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{U(false);}}},[e,v]),ie=react.useCallback(async()=>{if(y){U(true);try{let M=await y(e);A(ue=>({...ue,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{U(false);}}},[e,y]),J=react.useCallback(async()=>{if(x){U(true);try{let M=await x(e);A(ue=>({...ue,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{U(false);}}},[e,x]),B={...e,...b},R=s.filter(M=>B.assignedUserIds?.includes(M.id));return jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:_,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:M=>M.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),N?jsxRuntime.jsx("input",{type:"text",value:b.title??B.title,onChange:M=>D({...b,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[N?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(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:z,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:_,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>u("details"),className:`card-detail-tab ${f==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>u("comments"),className:`card-detail-tab ${f==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("activity"),className:`card-detail-tab ${f==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("attachments"),className:`card-detail-tab ${f==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxRuntime.jsxs("button",{onClick:()=>u("ai"),className:`card-detail-tab ${f==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[f==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),N?jsxRuntime.jsx("textarea",{value:b.description??B.description??"",onChange:M=>D({...b,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),N?jsxRuntime.jsx("select",{multiple:true,value:b.assignedUserIds??B.assignedUserIds??[],onChange:M=>{let ue=Array.from(M.target.selectedOptions,X=>X.value);D({...b,assignedUserIds:ue});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(M=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsxRuntime.jsx("span",{children:M.name})]},M.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"}),N?jsxRuntime.jsxs("select",{value:b.priority??B.priority??"",onChange:M=>D({...b,priority:M.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:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:B.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:B.labels&&B.labels.length>0?B.labels.map(M=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:M},M)):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"}),N?jsxRuntime.jsx("input",{type:"date",value:b.startDate?new Date(b.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:M=>D({...b,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),N?jsxRuntime.jsx("input",{type:"date",value:b.endDate?new Date(b.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:M=>D({...b,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),N?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:b.estimatedTime??B.estimatedTime??"",onChange:M=>D({...b,estimatedTime:M.target.value?parseFloat(M.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:B.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:B.dependencies&&B.dependencies.length>0?B.dependencies.map(M=>{let ue=typeof M=="string"?M:M.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ue.slice(-4)]},ue)}):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:B.createdAt?new Date(B.createdAt).toLocaleString():"Unknown"})]})]}),f==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:M=>S(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:q,disabled:!k.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(M=>{let ue=s.find(X=>X.id===M.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:[ue&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ue.color},children:ue.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ue?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(M.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:M.content})]},M.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),f==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(M=>{let ue=s.find(X=>X.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.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:ue?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),f==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Dr,{cardId:e.id,attachments:n,onUpload:i?M=>i(e.id,M):void 0,onDelete:g,currentUserId:h,maxSizeMB:10,maxFiles:20})}),f==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ae,disabled:w||!v,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:ie,disabled:w||!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("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:J,disabled:w||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((M,ue)=>{let X=s.find($e=>$e.id===M.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},ue)})]}),W.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((M,ue)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},ue))]}),W.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(M=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var Em=["LOW","MEDIUM","HIGH","URGENT"],Pm=["todo","in-progress","review","done"];function gn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:m=[],onAddComment:c,onDeleteComment:n,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:g,availableColumns:v=[],availableLabels:y=[],onUploadCoverImage:x,unsplashAccessKey:h,theme:f,onSubtasksChange:u}){let N=Za(),T=f||N?.themeName||"dark",[b,D]=react.useState(e),[k,S]=react.useState(false),[w,U]=react.useState(e?.subtasks||[]),[W,A]=react.useState(false),[_,E]=react.useState(""),[z,q]=react.useState(""),[ae,ie]=react.useState("all"),[J,B]=react.useState(false),[R,M]=react.useState(false),[ue,X]=react.useState(false),[$e,Oe]=react.useState(false),[Ct,ve]=react.useState(false),[ut,It]=react.useState(false),ka=react.useRef(null),wa=react.useRef(null),ia=react.useRef(null),Kt=react.useRef(null),ga=react.useRef(null),Tt=react.useRef(null),la=react.useRef(null),gt=react.useRef(null);react.useEffect(()=>{e&&!b?(D({...e}),U(e.subtasks||[])):e&&b&&e.id!==b.id&&(D({...e}),U(e.subtasks||[]));},[e,b]),react.useEffect(()=>{let P=H=>{let me=H.target;Kt.current&&!Kt.current.contains(me)&&B(false),ga.current&&!ga.current.contains(me)&&M(false),Tt.current&&!Tt.current.contains(me)&&X(false),la.current&&!la.current.contains(me)&&Oe(false);};if(J||R||ue||$e)return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[J,R,ue,$e]),react.useEffect(()=>{if(!t)return;let P=H=>{let me=H.target,pe=me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.isContentEditable;if(H.key==="Escape"){H.preventDefault(),J||R||ue||$e||Ct||ut?(B(false),M(false),X(false),Oe(false),ve(false),It(false)):pe||a();return}if(pe&&H.key!=="Escape")return;let Dt=H.metaKey||H.ctrlKey;switch(H.key.toLowerCase()){case "s":H.preventDefault(),B(true);break;case "a":H.preventDefault(),X(true);break;case "p":H.preventDefault(),M(true);break;case "l":H.preventDefault(),Oe(true);break;case "d":Dt||(H.preventDefault(),ve(true),setTimeout(()=>gt.current?.focus(),0));break;case "e":Dt||(H.preventDefault(),It(true));break;case "i":H.preventDefault(),S(true),setTimeout(()=>wa.current?.focus(),0);break;case "t":H.preventDefault(),A(true);break;case "c":H.preventDefault(),ia.current?.focus();break}};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[t,a,J,R,ue,$e,Ct,ut]);let rt=react.useCallback(P=>{let H=P.currentTarget.textContent?.trim()||"";if(b&&H!==b.title){let me={...b,title:H};D(me),r?.(b.id,{title:H});}},[b,r]),Yt=react.useCallback(P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur()),P.key==="Escape"&&(P.preventDefault(),P.currentTarget.textContent=b?.title||"",P.currentTarget.blur());},[b]),Nt=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),S(false);},[b,e,r]),V=react.useCallback(P=>{if(b){let H={...b,columnId:P};D(H),r?.(b.id,{columnId:P}),B(false);}},[b,r]),L=react.useCallback(P=>{if(b){let H={...b,priority:P};D(H),r?.(b.id,{priority:P}),M(false);}},[b,r]),Z=react.useCallback(P=>{if(b){let H=b.assignedUserIds||[],me=H.includes(P)?H.filter(Dt=>Dt!==P):[...H,P],pe={...b,assignedUserIds:me};D(pe),r?.(b.id,{assignedUserIds:me});}},[b,r]),He=react.useCallback(P=>{if(b){let H=b.labels||[],me=H.includes(P)?H.filter(Dt=>Dt!==P):[...H,P],pe={...b,labels:me};D(pe),r?.(b.id,{labels:me});}},[b,r]),Ce=react.useCallback(P=>{if(b){let H=P.target.value,me={...b,endDate:H};D(me),r?.(b.id,{endDate:H}),ve(false);}},[b,r]),Rt=react.useCallback(P=>{if(b){let H={...b,estimatedTime:parseFloat(P)||0};D(H),r?.(b.id,{estimatedTime:parseFloat(P)||0});}},[b,r]),Ot=react.useCallback(()=>{if(_.trim()&&b){let P={id:`subtask-${Date.now()}`,title:_.trim(),completed:false,createdAt:new Date},H=[...w,P];U(H),E(""),A(false),u?.(b.id,H);}},[_,w,b,u]),ye=react.useCallback(P=>{let H=w.map(me=>me.id===P?{...me,completed:!me.completed,updatedAt:new Date}:me);U(H),b&&u?.(b.id,H);},[w,b,u]),fe=react.useCallback(P=>{let H=w.filter(me=>me.id!==P);U(H),b&&u?.(b.id,H);},[w,b,u]),Wt=react.useCallback(()=>{z.trim()&&b&&c&&(c(b.id,z.trim()),q(""));},[z,b,c]),j=react.useCallback(P=>{(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),Wt());},[Wt]),K=P=>jsxRuntime.jsx(Nm__default.default,{remarkPlugins:[Dm__default.default],rehypePlugins:[Sm__default.default],components:{a:({node:H,...me})=>jsxRuntime.jsx("a",{...me,target:"_blank",rel:"noopener noreferrer"})},children:P}),le=m.filter(P=>ae==="comments"?P.type.includes("COMMENT"):ae==="history"?!P.type.includes("COMMENT"):true);if(!t||!e)return null;let se=b||e,We=s.filter(P=>se.assignedUserIds?.includes(P.id)),ot=w.filter(P=>P.completed).length;return jsxRuntime.jsx(Be,{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:P=>P.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":T,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ka,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:rt,onKeyDown:Yt,children:se.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Kt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>B(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.columnId||"No status"})]}),J&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(v.length>0?v:Pm.map(P=>({id:P,title:P}))).map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${se.columnId===P.id?"active":""}`,onClick:()=>V(P.id),children:P.title},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Tt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>X(!ue),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:We.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:We.map(P=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:P.color},title:P.name,children:P.initials},P.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),ue&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:s.map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${se.assignedUserIds?.includes(P.id)?"active":""}`,onClick:()=>Z(P.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:P.color},children:P.initials}),P.name,se.assignedUserIds?.includes(P.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"})})]},P.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ga,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>M(!R),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.priority||"None"})]}),R&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Em.map(P=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${P.toLowerCase()} ${se.priority===P?"active":""}`,onClick:()=>L(P),children:P},P)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>L(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:la,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Oe(!$e),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.labels&&se.labels.length>0?jsxRuntime.jsx("span",{children:se.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),$e&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(P=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${se.labels?.includes(P)?"active":""}`,onClick:()=>He(P),children:[P,se.labels?.includes(P)&&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"})})]},P))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ve(!Ct),setTimeout(()=>gt.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.endDate?new Date(se.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:gt,type:"date",value:typeof se.endDate=="string"?se.endDate.split("T")[0]:se.endDate?(()=>{let P=new Date(se.endDate),H=P.getUTCFullYear(),me=String(P.getUTCMonth()+1).padStart(2,"0"),pe=String(P.getUTCDate()).padStart(2,"0");return `${H}-${me}-${pe}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>It(!ut),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.estimatedTime?`${se.estimatedTime}h`:"Not set"})]}),ut&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:se.estimatedTime||"",onChange:P=>Rt(P.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>It(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"})]}),k?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:se.description||"",onChange:P=>{if(b){let H={...b,description:P.target.value};D(H);}},onBlur:Nt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>S(true),children:se.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:K(se.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ot,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>A(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[w.map(P=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${P.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ye(P.id),children:P.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:P.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>fe(P.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"})]})})]},P.id)),W&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:_,onChange:P=>E(P.target.value),onKeyDown:P=>{P.key==="Enter"&&Ot(),P.key==="Escape"&&(A(false),E(""));},onBlur:Ot,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${ae==="all"?"active":""}`,onClick:()=>ie("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${ae==="comments"?"active":""}`,onClick:()=>ie("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${ae==="history"?"active":""}`,onClick:()=>ie("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ia,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:z,onChange:P=>q(P.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:Wt,disabled:!z.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[le.map(P=>{let H=s.find(pe=>pe.id===P.userId);if(P.type.includes("COMMENT")){let pe=l.find(Dt=>Dt.id===P.metadata?.commentId);return pe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[H&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:H.color},children:H.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:H?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:pe.content})]})]},P.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.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:H?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)}),le.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 Gm({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 bn({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((m,c)=>m+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Gm,{})}),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,m)=>l+m.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,m)=>l+m.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,m)=>l+(m.planned||0),0)})]})]})]})}function Km({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 hn({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,m=e[e.length-1]?.ideal||0,c=s>0?(s-l)/s*100:0,n=l<=m;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(Km,{})}),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:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color: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 ap={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Li=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function rp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,m=e+l*Math.cos(-a*(Math.PI/180)),c=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:m,y:c,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Bi({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 vn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,n)=>c+n.value,0),l=e.map(c=>({...c,totalValue:s,color:c.color||ap[c.name]||Li[e.indexOf(c)%Li.length]})),m=l.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?rp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((c,n)=>jsxRuntime.jsx(recharts.Cell,{fill:m[n]},`cell-${n}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Bi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,n)=>{let p=n.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.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(Bi,{})}),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((c,n)=>jsxRuntime.jsx(recharts.Cell,{fill:m[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((c,n)=>n.value>c.value?n:c).name})]})]})]})}var ro=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,m]=react.useState(false),[c,n]=react.useState(false),[p,d]=react.useState(false),[i,g]=react.useState(false);if(e.length===0)return null;let v=e.map(N=>N.id),y=N=>{r.onBulkUpdate?.(v,{priority:N}),m(false);},x=N=>{r.onBulkMove?.(v,N),n(false),a();},h=N=>{r.onBulkUpdate?.(v,{assignedUserIds:N}),d(false);},f=N=>{let T=new Set;e.forEach(D=>{D.labels?.forEach(k=>T.add(k));});let b=Array.from(new Set([...T,...N]));r.onBulkUpdate?.(v,{labels:b}),g(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),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:()=>m(!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(N=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(N),children:[jsxRuntime.jsx("span",{className:I("asakaa-priority-dot",N==="LOW"&&"bg-asakaa-priority-low",N==="MEDIUM"&&"bg-asakaa-priority-medium",N==="HIGH"&&"bg-asakaa-priority-high",N==="URGENT"&&"bg-asakaa-priority-urgent")}),N]},N))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(N=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(N.id),children:N.title},N.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(N=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([N.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:N.color},children:N.initials}),N.name]},N.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!i),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(N=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([N]),children:N},N))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:u,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"})})]})]})})});ro.displayName="BulkOperationsToolbar";function lp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,m,c,n;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let v=a?.find(y=>y.id===g);l=`assignee-${g}`,m=v?.name||`User ${g}`,c=v?.color,n=v?.avatar,r.has(l)||r.set(l,{id:l,title:m,groupValue:g,cardIds:[],color:c,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",m="Unassigned",c="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:c,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];m=i.title,c=i.color,r.has(l)||r.set(l,{id:l,title:m,groupValue:s,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{l=`label-${g}`,m=g,c="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:g,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);}):(l="label-none",m="No Labels",c="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:c}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function yn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=react.useState(new Set),m=react.useMemo(()=>lp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(n=>{l(p=>{let d=new Set(p);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Na,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:I("asakaa-swimlane-view",o),children:[m.map(n=>{let p=s.has(n.id),d=e.cards.filter(g=>n.cardIds.includes(g.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&&c(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":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Na,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),m.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 xn=[{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 kn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null),m=xn.find(n=>n.value===e)||xn[0];react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);};return jsxRuntime.jsxs("div",{className:I("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:I("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:xn.map(n=>jsxRuntime.jsxs("button",{onClick:()=>c(n.value),className:I("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 Sr=[{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 mp(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,m=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&l&&m&&c}function zi(e={}){let{shortcuts:t=Sr,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(c=>{o.current=[...o.current,c];},[]),m=react.useCallback(c=>{o.current=o.current.filter(n=>n.action!==c);},[]);return react.useEffect(()=>{function c(n){if(!s.current)return;let p=n.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(mp(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",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:l,unregisterShortcut:m,isEnabled:a}}function up(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function gp(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 fp(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=gp(e),r=t?up(t):"";return a?`${a} + ${r}`:r}function bp(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 wn({shortcuts:e=Sr,isOpen:t,onClose:a,className:r}){let[o,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.useEffect(()=>{function m(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let l=bp(e);return jsxRuntime.jsxs("div",{className:I("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(([m,c])=>c.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"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.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:fp(n)})]},n.action))})]},m))})}),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 Cn=[{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'),Fl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),Sm=require('react-markdown'),Em=require('remark-gfm'),Pm=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Fl__default=/*#__PURE__*/_interopDefault(Fl);var Sm__default=/*#__PURE__*/_interopDefault(Sm);var Em__default=/*#__PURE__*/_interopDefault(Em);var Pm__default=/*#__PURE__*/_interopDefault(Pm);var Vr=(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 jr=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 [jr.Translate.toString(e),jr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function A(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Kr(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 fc(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Ho(e,t){return e.length===0?1e3:t===0?Kr(null,e[0].position):t>=e.length?Kr(e[e.length-1].position,null):Kr(e[t-1].position,e[t].position)}function Ks(e,t=100){return e>t}var bc=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 hc(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function Yr(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:l=bc,onRetry:m}=t,c,s=0;for(let p=1;p<=a;p++){s=p;try{return {data:await e(),attempts:s,success:!0}}catch(i){if(c=i,p===a||!l(c,p))return {error:c,attempts:s,success:false};let u=hc(p,r,o,n);if(m)try{m(c,p,u);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,u));}}return {error:c||new Error("Unknown error"),attempts:s,success:false}}function vc(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 yc(e,t={}){return async(...a)=>Yr(()=>e(...a),t)}var Wo=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 Ys=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(Ys||{}),Ba=class Ba{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...l}=t,m=`[${a}] [${r}] [${n}]`,c=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(m,o,c?l:"");break;case "INFO":console.info(m,o,c?l:"");break;case "WARN":console.warn(m,o,c?l:"");break;case "ERROR":console.error(m,o,c?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",...Ba.globalOptions};}static configure(t){Ba.globalOptions={...Ba.globalOptions,...t};}child(t){return new Ba({...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 Xr((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Xr(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Ys[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ba.globalOptions={};var _o=Ba,Xr=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}},Xs=new _o;function kc(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 wc(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(n=>{let l=e.columns.find(m=>m.id===n.columnId);return [n.id,Vo(n.title),Vo(n.description||""),Vo(l?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
2
+ `)}async function Cc(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 Fl__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),m=l.toDataURL("image/png"),c=297,s=210,p=l.width/l.height,i=c-20,d=i/p;d>s-20&&(d=s-20,i=d*p);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,c,15,"F"),u.text(e.title||"Kanban Board",10,10);let v=(c-i)/2;return u.addImage(m,"PNG",v,20,i,d),u}catch(l){console.error("Error capturing board:",l);}let o=new jspdf.jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(l=>{let m=e.cards.filter(c=>c.columnId===l.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,n),n+=8,m.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):m.forEach(c=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,n),n+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(c.description,160);o.text(p,25,n),n+=p.length*5;}let s=[];if(c.priority&&s.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&s.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&s.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),s.push(p.join(" \u2192 "));}s.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(s.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function Vo(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Js(e,t,a,r){switch(t){case "json":return kc(e,r);case "csv":return wc(e);case "pdf":return await Cc(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Zs(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},m=new Blob([e],{type:l[t]}),c=URL.createObjectURL(m),s=document.createElement("a");s.href=c,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(c);}function Tc(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 Nc(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=Qs(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let m=Qs(t[l]||"");if(m.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-m.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let s={};a.forEach((u,v)=>{s[u]=m[v]||"";});let p=s.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let i=o.get(p),d={id:s["Card ID"]||`card-${l}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:s.Priority||void 0,labels:s.Labels?s.Labels.split(";").filter(Boolean):void 0,assignedUserIds:s["Assigned Users"]?s["Assigned Users"].split(";").filter(Boolean):void 0,startDate:s["Start Date"]?s["Start Date"]:void 0,endDate:s["End Date"]?s["End Date"]:void 0,createdAt:s["Created At"]?s["Created At"]:void 0,updatedAt:s["Updated At"]?s["Updated At"]:void 0};r.push(d),i.cardIds.push(d.id);}catch(m){n.push(`Line ${l+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Qs(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],l=e[o+1];n==='"'&&r&&l==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function ei(e,t){switch(t){case "json":return Tc(e);case "csv":return Nc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function ti(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 jo=react.createContext(null);function ai(){return react.useContext(jo)}var ri=react.createContext(null);function oi({children:e,themeName:t}){return jsxRuntime.jsx(ri.Provider,{value:{themeName:t},children:e})}function er(){return react.useContext(ri)}function Be({children:e,container:t}){let[a,r]=react.useState(false),o=ai(),n=er();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:m,themeName:c}=o,s={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:s,children:e}),l)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),l):reactDom.createPortal(e,l)}var li={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Fc="#BDC3C7",Lc=({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 Ra({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(r&&c.current){let d=c.current.getBoundingClientRect();l({top:d.bottom+window.scrollY+8,left:d.left+window.scrollX});}},[r]),react.useEffect(()=>{let d=u=>{m.current&&!m.current.contains(u.target)&&!c.current?.contains(u.target)&&o(false);};if(r)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]),react.useEffect(()=>{let d=u=>{u.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r]);let s=d=>{t(d),o(false);},p=e?li[e]:null,i=p?.color||Fc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>o(!r),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:p?.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(Be,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"absolute",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"160px",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(li).map(([d,u])=>jsxRuntime.jsxs("button",{onClick:()=>s(d),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:u.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(Lc,{color:u.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:u.label}),e===d&&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"})})]},d)),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:()=>s(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:d=>{d.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:d=>{d.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 Bc=[{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 yr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),c=react.useRef(null),s=react.useRef(null),d=(er()?.themeName||"dark")==="dark";react.useEffect(()=>{if(o&&s.current){let b=s.current.getBoundingClientRect();m({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[o]),react.useEffect(()=>{let b=g=>{c.current&&!c.current.contains(g.target)&&!s.current?.contains(g.target)&&n(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let u=b=>{let g=new Date,D=C=>{let M=C.getFullYear(),w=String(C.getMonth()+1).padStart(2,"0"),B=String(C.getDate()).padStart(2,"0");return `${M}-${w}-${B}`},h=D(g),f=new Date(g);f.setDate(f.getDate()+b);let N=D(f);a(h,N),n(false);},v=()=>{if(!e||!t)return "Set date";let b=f=>{if(f instanceof Date)return f;if(typeof f!="string"||!f.match(/^\d{4}-\d{2}-\d{2}$/))return null;let N=f.split("-").map(Number);if(N.length!==3||N.some(B=>isNaN(B)))return null;let C=N[0],M=N[1],w=N[2];return C===void 0||M===void 0||w===void 0?null:new Date(C,M-1,w)},g=b(e),D=b(t);if(!g||!D||isNaN(g.getTime())||isNaN(D.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[g.getMonth()]} ${g.getDate()} \u2013 ${h[D.getMonth()]} ${D.getDate()}`},x=e&&t,y=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,g=new Date;return g.setHours(0,0,0,0),b<g})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!o),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:x?`${v()}`:"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:v()})]}),o&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu absolute rounded-xl shadow-2xl border min-w-[320px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"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:d?"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:d?"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:Bc.map(b=>jsxRuntime.jsx("button",{onClick:()=>u(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",g.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:g=>{g.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",g.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"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:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ua({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,l]=react.useState(false),[m,c]=react.useState(""),[s,p]=react.useState({top:0,left:0}),i=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{if(n&&d.current){let y=d.current.getBoundingClientRect();p({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[n]),react.useEffect(()=>{let y=b=>{i.current&&!i.current.contains(b.target)&&!d.current?.contains(b.target)&&(l(false),c(""));};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),react.useEffect(()=>{let y=b=>{b.key==="Escape"&&(l(false),c(""));};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let u=y=>{let b=e.some(g=>g.id===y.id);a(b?e.filter(g=>g.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())),x=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>l(!n),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:[x.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):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"})]})})}),n&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:i,className:"user-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${s.top}px`,left:`${s.left}px`,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:m,onChange:y=>c(y.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:v.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"}):v.map(y=>{let b=e.some(g=>g.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>u(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:g=>{g.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:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),b&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},y.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 qr(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let s=c.dependencies.map(p=>{if(typeof p=="string")return p;let i=p;return i.taskId||i.targetId||""}).filter(Boolean);r.set(c.id,s);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,l=new Set,m=c=>{if(!n.has(c)){n.add(c),l.add(c);let s=r.get(c)||[];for(let p of s){if(!n.has(p)&&m(p))return true;if(l.has(p))return true}}return l.delete(c),false};return m(a)}function kr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:l}){let[m,c]=react.useState(false),[s,p]=react.useState(""),[i,d]=react.useState(t.length>0),[u,v]=react.useState({top:0,left:0}),[x,k]=react.useState(null),y=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(m&&b.current){let N=b.current.getBoundingClientRect();v({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[m]),react.useEffect(()=>{let N=C=>{y.current&&!y.current.contains(C.target)&&!b.current?.contains(C.target)&&(c(false),p(""));};if(m)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[m]),react.useEffect(()=>{let N=C=>{C.key==="Escape"&&(c(false),p(""));};if(m)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[m]);let g=N=>{let C=t.includes(N),M=a.find(w=>w.id===N);if(k(null),C){let w=t.filter(B=>B!==N);r(w),w.length===0&&d(false);}else {if(n&&qr(a,N,e)){let B=`Cannot add "${M?.title||N}" as dependency - would create circular reference`;k(B),l?.(N,M?.title||N),setTimeout(()=>k(null),3e3);return}r([...t,N]),d(true);}},D=()=>{let N=!i;d(N),N||r([]);},h=a.filter(N=>N.id!==e).filter(N=>N.title.toLowerCase().includes(s.toLowerCase())||N.id.toLowerCase().includes(s.toLowerCase())),f=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:b,onClick:()=>c(!m),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:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:f},children:t.length})]}),m&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:y,className:"dependencies-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${u.top}px`,left:`${u.left}px`,background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&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"})]})}),i&&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:s,onChange:N=>p(N.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:h.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"}):h.map(N=>{let C=t.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>g(N.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.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:C?"#3b82f6":"transparent",borderColor:C?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:C&&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:N.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:N.id})]})]},N.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var ba=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:l,availableUsers:m=[],allCards:c=[]})=>{let{attributes:s,listeners:p,setNodeRef:i,transform:d,transition:u,isDragging:v}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:jr.Transform.toString(d),transition:u};if(t)return jsxRuntime.jsx("div",{ref:i,style:x,...s,...p,onClick:()=>a?.(e),children:t(e)});let k=m.filter(g=>e.assignedUserIds?.includes(g.id)),y=e.progress===100,b={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:i,style:b,className:A("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...p,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:y?"line-through":"none",opacity:y?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Ra,{priority:e.priority,onChange:g=>l?.(e.id,{priority:g})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(yr,{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,D)=>l?.(e.id,{startDate:g,endDate:D})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Ua,{assignedUsers:k,availableUsers:m,onChange:g=>l?.(e.id,{assignedUserIds:g.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(kr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:c,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));ba.displayName="Card";var Jr={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"}},fi=({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 bi({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[l,m]=react.useState({top:0,left:0}),c=react.useRef(null),s=react.useRef(null),p=[...Object.entries(Jr).map(([x,k])=>({id:x,label:k.label,color:k.color,icon:k.icon})),...r.filter(x=>!Object.keys(Jr).includes(x.id)).map(x=>({id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let x=Jr[e];if(x)return {...x,id:e};let k=r.find(y=>y.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...Jr.todo,id:"todo"}};react.useEffect(()=>{if(o&&s.current){let x=s.current.getBoundingClientRect();m({top:x.bottom+window.scrollY+8,left:x.left+window.scrollX});}},[o]),react.useEffect(()=>{let x=k=>{c.current&&!c.current.contains(k.target)&&!s.current?.contains(k.target)&&n(false);};if(o)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{let x=k=>{k.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[o]);let d=x=>{t(x),n(false);},u=i(),v=u.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:s,onClick:()=>n(!o),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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:u.label,children:jsxRuntime.jsx(fi,{icon:u.icon,color:v})}),o&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",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:p.map(x=>jsxRuntime.jsxs("button",{onClick:()=>d(x.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:x.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(fi,{icon:x.icon,color:x.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:x.label}),e===x.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"})})]},x.id))})]})})]})}function hi({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,l]=react.useState(false),[m,c]=react.useState(false),[s,p]=react.useState(e),[i,d]=react.useState({top:0,left:0}),u=react.useRef(null),v=react.useRef(null),x=react.useRef(null);react.useEffect(()=>{if(n&&v.current){let g=v.current.getBoundingClientRect();d({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[n]),react.useEffect(()=>{let g=D=>{u.current&&!u.current.contains(D.target)&&!v.current?.contains(D.target)&&(l(false),c(false));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=D=>{D.key==="Escape"&&(l(false),c(false),p(e));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n,e]),react.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]);let k=()=>{c(true),p(e);},y=()=>{let g=s.trim();g&&g!==e&&t(g),c(false),l(false),p(e);},b=g=>{g.key==="Enter"?y():g.key==="Escape"&&(c(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:v,onClick:()=>l(!n),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"})]})}),n&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.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:m?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:x,type:"text",value:s,onChange:g=>p(g.target.value),onKeyDown:b,onBlur:y,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:k,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 rr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:l,onCardUpdate:m,availableUsers:c,allCards:s,enableVirtualization:p,cardHeight:i=120,isCollapsed:d,onToggleCollapse:u,onColumnRename:v,onColumnDelete:x,isDeletable:k=false,className:y})=>{let{setNodeRef:b,isOver:g}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),D=react.useRef(null),h=p??Ks(t.length),f=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>D.current,estimateSize:()=>i,enabled:h});if(a)return jsxRuntime.jsx("div",{ref:b,className:y,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let B=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:B}:B>=80?{state:"warning",percentage:B}:B>=60?{state:"approaching",percentage:B}:{state:"ok",percentage:B}})(),M=C.state==="exceeded",w=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:b,className:A("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",y),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:A(w()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),C.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),C.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),C.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||x)&&jsxRuntime.jsx(hi,{columnTitle:e.title,onRename:B=>v?.(e.id,B),onDelete:x?()=>x(e.id):void 0,isDeletable:k}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),!d&&jsxRuntime.jsx("div",{ref:D,className:"asakaa-column-cards",style:{maxHeight:h?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(B=>B.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):h?jsxRuntime.jsx("div",{style:{height:`${f.getTotalSize()}px`,position:"relative"},children:f.getVirtualItems().map(B=>{let H=t[B.index];return H?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${B.start}px)`},children:jsxRuntime.jsx(ba,{card:H,render:r,onClick:l,onUpdate:m,availableUsers:c,allCards:s})},H.id):null})}):t.map(B=>jsxRuntime.jsx(ba,{card:B,render:r,onClick:l,onUpdate:m,availableUsers:c,allCards:s},B.id))})})]})});rr.displayName="Column";function tn({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let c=()=>{let p=n.trim();p&&p!==e?t(p):l(e),o(false);},s=p=>{p.key==="Enter"?c():p.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:n,onChange:p=>l(p.target.value),onBlur:c,onKeyDown:s,className:A("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:A("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function rn(){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 Da({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:l,style:m,isLoading:c,error:s,children:p}){let[i,d]=rn(),u=o?.theme||"dark",x=u==="dark"||u==="neutral"?"dark":"",k=react.useCallback((w,B)=>{t.onCardUpdate?.(w,B);},[t]),y=react.useCallback((w,B)=>{t.onColumnUpdate?.(w,{title:B});},[t]),b=react.useCallback(w=>{t.onColumnDelete?.(w);},[t]),g=["todo","in-progress","completed"],D=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),h=react.useMemo(()=>{let w=new Map;return e.columns.forEach(B=>{let H=B.cardIds.map(I=>e.cards.find($=>$.id===I)).filter(I=>I!==void 0).sort((I,$)=>I.position-$.position);w.set(B.id,H);}),w},[e.cards,e.columns]),f=react.useCallback(w=>{let{active:B}=w,H=e.cards.find(I=>I.id===B.id);H&&d({isDragging:true,draggedCardId:H.id,sourceColumnId:H.columnId,targetColumnId:H.columnId});},[e.cards,d]),N=react.useCallback(w=>{let{active:B,over:H}=w;if(!H||!e.cards.find(S=>S.id===B.id))return;let $=null;H.data.current?.type==="column"?$=H.id:H.data.current?.type==="card"&&($=e.cards.find(z=>z.id===H.id)?.columnId||null),$&&$!==i.targetColumnId&&d({...i,targetColumnId:$});},[e.cards,i,d]),C=react.useCallback(async w=>{let{active:B,over:H}=w;if(d({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!H)return;let I=e.cards.find(V=>V.id===B.id);if(!I)return;let $,S;if(H.data.current?.type==="column"){$=H.id;let V=h.get($)||[];S=Ho(V,0);}else {let V=e.cards.find(J=>J.id===H.id);if(!V)return;$=V.columnId;let ae=h.get($)||[],ie=ae.findIndex(J=>J.id===H.id);S=Ho(ae,ie);}let z=e.columns.find(V=>V.id===$);if(z&&z.wipLimit&&z.wipLimitType==="hard"){let V=h.get($)||[];if(I.columnId!==$&&V.length>=z.wipLimit){t.onWipLimitExceeded?.(z,I);return}}(I.columnId!==$||I.position!==S)&&await t.onCardMove?.(I.id,$,S);},[e.cards,e.columns,h,t,d]),M=react.useCallback(w=>{a?.(w);},[a]);return c?jsxRuntime.jsx("div",{className:A("asakaa-board",x,l),style:m,children:jsxRuntime.jsx(nm,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:A("asakaa-board",x,l),style:m,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 s=="string"?s:s.message})]})})}):jsxRuntime.jsx(oi,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:D,collisionDetection:core$1.closestCorners,onDragStart:f,onDragOver:N,onDragEnd:C,children:[jsxRuntime.jsxs("div",{className:A("asakaa-board",x,l),style:m,"data-theme":u,children:[e.columns.sort((w,B)=>w.position-B.position).map(w=>{let B=h.get(w.id)||[],H=!g.includes(w.id);return jsxRuntime.jsx(rr,{column:w,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:M,onCardUpdate:k,onColumnRename:y,onColumnDelete:b,isDeletable:H,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},w.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(ba,{card:e.cards.find(w=>w.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function nm({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 cm={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)"},mm={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)"},pm={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},um={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function gm({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,l]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let s=p=>{m.current&&!m.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]);let c=s=>{t(s),l(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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((s,p)=>s.position-p.position).map((s,p)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(s.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s.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:s.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[s.cardIds.length," ",s.cardIds.length===1?"tarea":"tareas"]})]})]},s.id))]})})})]})}function fm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,l]=react.useState(false),[m,c]=react.useState(null),s=react.useRef(null);if(react.useEffect(()=>{let u=v=>{s.current&&!s.current.contains(v.target)&&l(false);};return n&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),!(a||r||o))return null;let i=[{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),d=async(u,v)=>{if(v){c(u);try{await v();}catch(x){console.error(`Export ${u} failed:`,x);}finally{c(null),l(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>l(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:i.map((u,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(u.id,u.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<i.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:m===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 bm({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 nn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:l,onExportJSON:m,onExportExcel:c,translations:s}){let p=r==="dark"?cm:mm,i={...o==="es"?pm:um,...s},d=l||m||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fm,{theme:p,t:i,onExportCSV:l,onExportJSON:m,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),t&&(n?jsxRuntime.jsx(gm,{columns:e,onSelect:t,theme:p,t:i,createTaskLabel:a}):jsxRuntime.jsx(bm,{onClick:()=>t(),label:a||i.newTask}))]})})}function ln({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,l]=react.useState(false),[m,c]=react.useState(""),s=react.useCallback(()=>{let d=m.trim();d&&(e(d),c(""),l(false));},[m,e]),p=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),s()):d.key==="Escape"&&(c(""),l(false));},[s]),i=react.useCallback(()=>{setTimeout(()=>{m.trim()||l(false);},150);},[m]);return n?jsxRuntime.jsx("div",{className:A("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:m,onChange:d=>c(d.target.value),onKeyDown:p,onBlur:i,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:s,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),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:A("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 dn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:l=false,theme:m="dark",locale:c="es"}){let[s,p]=react.useState(false),[i,d]=react.useState(false),[u,v]=react.useState(""),[x,k]=react.useState([]),[y,b]=react.useState(""),[g,D]=react.useState(""),[h,f]=react.useState(""),[N,C]=react.useState(false),[M,w]=react.useState(false),[B,H]=react.useState(false),I=react.useRef(null),$=react.useRef(null),S={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},z=react.useCallback(()=>{v(""),k([]),b(""),D(""),f(""),C(false),w(false),H(false),p(false);},[]);react.useEffect(()=>{s&&I.current&&I.current.focus();},[s]),react.useEffect(()=>{if(!s)return;let R=O=>{$.current&&!$.current.contains(O.target)&&(u.trim()||z());};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[s,u,z]);let V=react.useCallback(async()=>{let R=u.trim();if(!(!R||i)){d(true);try{await t({name:R,columnId:e,assigneeIds:x.length>0?x:void 0,startDate:y?new Date(y):void 0,endDate:g?new Date(g):void 0,priority:h||void 0}),v(""),k([]),b(""),D(""),f(""),C(!1),w(!1),H(!1),I.current?.focus();}catch(O){console.error("Error creating card:",O);}finally{d(false);}}},[u,e,x,y,g,h,t,i]),ae=react.useCallback(R=>{R.key==="Enter"&&!R.shiftKey?(R.preventDefault(),V()):R.key==="Escape"&&z();},[V,z]),ie=react.useCallback(R=>{k(O=>O.includes(R)?O.filter(P=>P!==R):[...O,R]);},[]),J=m==="dark";return s?jsxRuntime.jsxs("div",{ref:$,className:A("rounded-lg overflow-hidden shadow-lg",J?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:I,type:"text",value:u,onChange:R=>v(R.target.value),onKeyDown:ae,placeholder:S.placeholder,disabled:i,className:A("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",J?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>C(!N),className:A("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x.length>0?"bg-emerald-500/20 text-emerald-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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"})]}),x.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:x.length})]}),jsxRuntime.jsx("button",{onClick:()=>w(!M),className:A("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||y||g?"bg-blue-500/20 text-blue-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:()=>H(!B),className:A("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||h?h==="urgent"?"bg-red-500/20 text-red-400":h==="high"?"bg-orange-500/20 text-orange-400":h==="medium"?"bg-yellow-500/20 text-yellow-400":h==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":J?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:V,disabled:!u.trim()||i,className:A("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:i?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):S.save})]})]}),N&&a.length>0&&jsxRuntime.jsx("div",{className:A("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(R=>jsxRuntime.jsxs("button",{onClick:()=>ie(R.id),className:A("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",x.includes(R.id)?"bg-emerald-500 text-white":J?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[R.avatar?jsxRuntime.jsx("img",{src:R.avatar,alt:R.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:A("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",x.includes(R.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:R.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:R.name.split(" ")[0]})]},R.id))})}),M&&jsxRuntime.jsx("div",{className:A("px-3 pb-3 pt-0","border-t",J?"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:A("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:S.startDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:R=>b(R.target.value),className:A("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("block text-[10px] uppercase tracking-wide mb-1",J?"text-gray-500":"text-gray-400"),children:S.endDate}),jsxRuntime.jsx("input",{type:"date",value:g,onChange:R=>D(R.target.value),className:A("w-full px-2 py-1.5 rounded text-xs border",J?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),B&&jsxRuntime.jsx("div",{className:A("px-3 pb-3 pt-0","border-t",J?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(R=>jsxRuntime.jsx("button",{onClick:()=>f(h===R?"":R),className:A("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",h===R?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[R]} text-white`:J?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[R]},R))})})]}):jsxRuntime.jsxs("button",{onClick:()=>p(true),disabled:l,className:A("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",J?"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:S.buttonLabel})]})}var Dr=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(Da,{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(n=>n.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,n)=>{r.toBlob(l=>{l?o(l):n(new Error("Failed to create PNG blob"));},"image/png");})}};function Mi(e={}){return new Dr(e)}var or=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:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"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:n,componentName:l}=this.props;return a&&r?n?n(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 cn(e,t){let a=r=>jsxRuntime.jsx(or,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function pn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:l,onPredictRisks:m,onOpenAIUsage:c,shortcut:s="k",className:p=""}){let[i,d]=react.useState(false),[u,v]=react.useState(""),[x,k]=react.useState("home"),[y,b]=react.useState(""),[g,D]=react.useState("");react.useEffect(()=>{let C=M=>{(M.metaKey||M.ctrlKey)&&M.key===s&&(M.preventDefault(),d(w=>!w)),M.key==="Escape"&&(d(false),k("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),react.useEffect(()=>{i||(k("home"),v(""),b(""),D(""));},[i]);let h=react.useCallback(()=>{d(false);},[]),f=react.useCallback(C=>{let[M,w]=C.split(":");switch(M){case "create-card":k("create-card");break;case "create-card-in":b(w||"");break;case "navigate":w?(a?.(w),h()):k("navigate");break;case "search":r?.(u),h();break;case "priority":k("priority");break;case "set-priority":g&&w&&(o?.(g,w),h());break;case "assign":k("assign");break;case "assign-user":g&&w&&(n?.(g,w),h());break;case "ai":k("ai");break;case "ai-generate-plan":l?.(),h();break;case "ai-predict-risks":m?.(),h();break;case "ai-usage":c?.(),h();break;case "back":k("home");break;}},[u,g,t,a,r,o,n,l,m,c,h]),N=react.useCallback(()=>{y&&u.trim()&&(t?.(y,u.trim()),h());},[y,u,t,h]);return i?jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:h,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&y?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&x==="create-card"&&y&&N();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:f,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:f,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:f,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:f,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:f,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(M=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:M},M))})]},C.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:f,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.id}`,onSelect:f,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:f,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let M=e.columns.find(w=>w.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:f,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:M?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(w=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:w},w))})]},C.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:f,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:f,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:f,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:f,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 Tm(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 Nm(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,m]=react.useState(false),[c,s]=react.useState(false),[p,i]=react.useState(null),d=react.useRef(null),u=react.useCallback(f=>{let N=[],C=[];return e.length+f.length>n?(C.push(`Maximum ${n} files allowed`),{valid:N,errors:C}):(f.forEach(M=>{if(M.size/1048576>r){C.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>M.type.match(B))){C.push(`${M.name} has invalid file type`);return}N.push(M);}),{valid:N,errors:C})},[e.length,n,r,o]),v=react.useCallback(async f=>{let{valid:N,errors:C}=u(f);if(C.length>0){i(C.join(", ")),setTimeout(()=>i(null),5e3);return}if(N.length!==0){s(true),i(null);try{await t?.(N);}catch(M){i(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{s(false);}}},[u,t]),x=react.useCallback(f=>{f.preventDefault(),f.stopPropagation(),m(true);},[]),k=react.useCallback(f=>{f.preventDefault(),f.stopPropagation(),m(false);},[]),y=react.useCallback(f=>{f.preventDefault(),f.stopPropagation();},[]),b=react.useCallback(f=>{f.preventDefault(),f.stopPropagation(),m(false);let N=Array.from(f.dataTransfer.files);v(N);},[v]),g=react.useCallback(f=>{let N=f.target.files?Array.from(f.target.files):[];v(N),d.current&&(d.current.value="");},[v]),D=react.useCallback(()=>{d.current?.click();},[]),h=react.useCallback(f=>{confirm("Are you sure you want to delete this attachment?")&&a?.(f);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${c?"uploading":""}`,onDragEnter:x,onDragLeave:k,onDragOver:y,onDrop:b,onClick:D,children:[jsxRuntime.jsx("input",{ref:d,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children: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,"/",n," files"]})]})})]}),p&&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:p})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(f=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Nm(f.type)&&f.url?jsxRuntime.jsx("img",{src:f.thumbnailUrl||f.url,alt:f.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Tm(f.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:f.name,children:f.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Cm(f.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(f.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>h(f.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"})})})]},f.id))})]})}function gn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:m=[],aiInsights:c=[],attachments:s=[],onAddComment:p,onDeleteComment:i,onUploadAttachments:d,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:x,onEstimateEffort:k,currentUserId:y="user-1"}){let[b,g]=react.useState("details"),[D,h]=react.useState(false),[f,N]=react.useState({}),[C,M]=react.useState(""),[w,B]=react.useState(false),[H,I]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{h(false),N({}),g("details"),M(""),I({}),a();},[a]),S=react.useCallback(()=>{r&&Object.keys(f).length>0&&(r(e.id,f),N({}),h(false));},[e.id,f,r]),z=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),V=react.useCallback(()=>{p&&C.trim()&&(p(e.id,C.trim()),M(""));},[e.id,C,p]),ae=react.useCallback(async()=>{if(v){B(true);try{let P=await v(e);I(ue=>({...ue,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{B(false);}}},[e,v]),ie=react.useCallback(async()=>{if(x){B(true);try{let P=await x(e);I(ue=>({...ue,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{B(false);}}},[e,x]),J=react.useCallback(async()=>{if(k){B(true);try{let P=await k(e);I(ue=>({...ue,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{B(false);}}},[e,k]),R={...e,...f},O=n.filter(P=>R.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(Be,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.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:R.priority==="URGENT"?"#EF4444":R.priority==="HIGH"?"#F59E0B":R.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),D?jsxRuntime.jsx("input",{type:"text",value:f.title??R.title,onChange:P=>N({...f,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:R.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[D?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{h(false),N({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>h(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:z,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:$,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>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",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.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",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.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"}),D?jsxRuntime.jsx("textarea",{value:f.description??R.description??"",onChange:P=>N({...f,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:R.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),D?jsxRuntime.jsx("select",{multiple:true,value:f.assignedUserIds??R.assignedUserIds??[],onChange:P=>{let ue=Array.from(P.target.selectedOptions,q=>q.value);N({...f,assignedUserIds:ue});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:O.length>0?O.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.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"}),D?jsxRuntime.jsxs("select",{value:f.priority??R.priority??"",onChange:P=>N({...f,priority:P.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:R.priority==="URGENT"?"#EF4444":R.priority==="HIGH"?"#F59E0B":R.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:R.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:R.labels&&R.labels.length>0?R.labels.map(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):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"}),D?jsxRuntime.jsx("input",{type:"date",value:f.startDate?new Date(f.startDate).toISOString().split("T")[0]:R.startDate?new Date(R.startDate).toISOString().split("T")[0]:"",onChange:P=>N({...f,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:R.startDate?new Date(R.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),D?jsxRuntime.jsx("input",{type:"date",value:f.endDate?new Date(f.endDate).toISOString().split("T")[0]:R.endDate?new Date(R.endDate).toISOString().split("T")[0]:"",onChange:P=>N({...f,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:R.endDate?new Date(R.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),D?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:f.estimatedTime??R.estimatedTime??"",onChange:P=>N({...f,estimatedTime:P.target.value?parseFloat(P.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:R.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:R.dependencies&&R.dependencies.length>0?R.dependencies.map(P=>{let ue=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",ue.slice(-4)]},ue)}):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:R.createdAt?new Date(R.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:C,onChange:P=>M(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:V,disabled:!C.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(P=>{let ue=n.find(q=>q.id===P.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:[ue&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ue.color},children:ue.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:ue?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),i&&jsxRuntime.jsx("button",{onClick:()=>i(P.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:P.content})]},P.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:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(P=>{let ue=n.find(q=>q.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.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:ue?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.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(Er,{cardId:e.id,attachments:s,onUpload:d?P=>d(e.id,P):void 0,onDelete:u,currentUserId:y,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:w||!v,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:ie,disabled:w||!x,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:J,disabled:w||!k,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),H.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((P,ue)=>{let q=n.find($e=>$e.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:q?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},ue)})]}),H.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((P,ue)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},ue))]}),H.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:[H.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),c.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&c.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var Mm=["LOW","MEDIUM","HIGH","URGENT"],Im=["todo","in-progress","review","done"];function bn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:m=[],onAddComment:c,onDeleteComment:s,currentUser:p,onAIGenerateDescription:i,onAICreateSubtasks:d,onAIFindSimilar:u,availableColumns:v=[],availableLabels:x=[],onUploadCoverImage:k,unsplashAccessKey:y,theme:b,onSubtasksChange:g}){let D=er(),h=b||D?.themeName||"dark",[f,N]=react.useState(e),[C,M]=react.useState(false),[w,B]=react.useState(e?.subtasks||[]),[H,I]=react.useState(false),[$,S]=react.useState(""),[z,V]=react.useState(""),[ae,ie]=react.useState("all"),[J,R]=react.useState(false),[O,P]=react.useState(false),[ue,q]=react.useState(false),[$e,Oe]=react.useState(false),[Ct,ve]=react.useState(false),[ut,At]=react.useState(false),ka=react.useRef(null),wa=react.useRef(null),ia=react.useRef(null),Kt=react.useRef(null),ga=react.useRef(null),Tt=react.useRef(null),la=react.useRef(null),gt=react.useRef(null);react.useEffect(()=>{e&&!f?(N({...e}),B(e.subtasks||[])):e&&f&&e.id!==f.id&&(N({...e}),B(e.subtasks||[]));},[e,f]),react.useEffect(()=>{let E=_=>{let me=_.target;Kt.current&&!Kt.current.contains(me)&&R(false),ga.current&&!ga.current.contains(me)&&P(false),Tt.current&&!Tt.current.contains(me)&&q(false),la.current&&!la.current.contains(me)&&Oe(false);};if(J||O||ue||$e)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[J,O,ue,$e]),react.useEffect(()=>{if(!t)return;let E=_=>{let me=_.target,pe=me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.isContentEditable;if(_.key==="Escape"){_.preventDefault(),J||O||ue||$e||Ct||ut?(R(false),P(false),q(false),Oe(false),ve(false),At(false)):pe||a();return}if(pe&&_.key!=="Escape")return;let Dt=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),R(true);break;case "a":_.preventDefault(),q(true);break;case "p":_.preventDefault(),P(true);break;case "l":_.preventDefault(),Oe(true);break;case "d":Dt||(_.preventDefault(),ve(true),setTimeout(()=>gt.current?.focus(),0));break;case "e":Dt||(_.preventDefault(),At(true));break;case "i":_.preventDefault(),M(true),setTimeout(()=>wa.current?.focus(),0);break;case "t":_.preventDefault(),I(true);break;case "c":_.preventDefault(),ia.current?.focus();break}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[t,a,J,O,ue,$e,Ct,ut]);let rt=react.useCallback(E=>{let _=E.currentTarget.textContent?.trim()||"";if(f&&_!==f.title){let me={...f,title:_};N(me),r?.(f.id,{title:_});}},[f,r]),Yt=react.useCallback(E=>{E.key==="Enter"&&(E.preventDefault(),E.currentTarget.blur()),E.key==="Escape"&&(E.preventDefault(),E.currentTarget.textContent=f?.title||"",E.currentTarget.blur());},[f]),Nt=react.useCallback(()=>{f&&e&&f.description!==e.description&&r?.(f.id,{description:f.description}),M(false);},[f,e,r]),j=react.useCallback(E=>{if(f){let _={...f,columnId:E};N(_),r?.(f.id,{columnId:E}),R(false);}},[f,r]),L=react.useCallback(E=>{if(f){let _={...f,priority:E};N(_),r?.(f.id,{priority:E}),P(false);}},[f,r]),Z=react.useCallback(E=>{if(f){let _=f.assignedUserIds||[],me=_.includes(E)?_.filter(Dt=>Dt!==E):[..._,E],pe={...f,assignedUserIds:me};N(pe),r?.(f.id,{assignedUserIds:me});}},[f,r]),He=react.useCallback(E=>{if(f){let _=f.labels||[],me=_.includes(E)?_.filter(Dt=>Dt!==E):[..._,E],pe={...f,labels:me};N(pe),r?.(f.id,{labels:me});}},[f,r]),Ce=react.useCallback(E=>{if(f){let _=E.target.value,me={...f,endDate:_};N(me),r?.(f.id,{endDate:_}),ve(false);}},[f,r]),Ot=react.useCallback(E=>{if(f){let _={...f,estimatedTime:parseFloat(E)||0};N(_),r?.(f.id,{estimatedTime:parseFloat(E)||0});}},[f,r]),Ut=react.useCallback(()=>{if($.trim()&&f){let E={id:`subtask-${Date.now()}`,title:$.trim(),completed:false,createdAt:new Date},_=[...w,E];B(_),S(""),I(false),g?.(f.id,_);}},[$,w,f,g]),ye=react.useCallback(E=>{let _=w.map(me=>me.id===E?{...me,completed:!me.completed,updatedAt:new Date}:me);B(_),f&&g?.(f.id,_);},[w,f,g]),fe=react.useCallback(E=>{let _=w.filter(me=>me.id!==E);B(_),f&&g?.(f.id,_);},[w,f,g]),_t=react.useCallback(()=>{z.trim()&&f&&c&&(c(f.id,z.trim()),V(""));},[z,f,c]),K=react.useCallback(E=>{(E.metaKey||E.ctrlKey)&&E.key==="Enter"&&(E.preventDefault(),_t());},[_t]),Y=E=>jsxRuntime.jsx(Sm__default.default,{remarkPlugins:[Em__default.default],rehypePlugins:[Pm__default.default],components:{a:({node:_,...me})=>jsxRuntime.jsx("a",{...me,target:"_blank",rel:"noopener noreferrer"})},children:E}),le=m.filter(E=>ae==="comments"?E.type.includes("COMMENT"):ae==="history"?!E.type.includes("COMMENT"):true);if(!t||!e)return null;let se=f||e,We=n.filter(E=>se.assignedUserIds?.includes(E.id)),ot=w.filter(E=>E.completed).length;return jsxRuntime.jsx(Be,{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:E=>E.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":h,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:ka,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:rt,onKeyDown:Yt,children:se.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Kt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>R(!J),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.columnId||"No status"})]}),J&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(v.length>0?v:Im.map(E=>({id:E,title:E}))).map(E=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${se.columnId===E.id?"active":""}`,onClick:()=>j(E.id),children:E.title},E.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Tt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>q(!ue),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"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:We.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:We.map(E=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:E.color},title:E.name,children:E.initials},E.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),ue&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:n.map(E=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${se.assignedUserIds?.includes(E.id)?"active":""}`,onClick:()=>Z(E.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:E.color},children:E.initials}),E.name,se.assignedUserIds?.includes(E.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"})})]},E.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ga,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>P(!O),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.priority||"None"})]}),O&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[Mm.map(E=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${E.toLowerCase()} ${se.priority===E?"active":""}`,onClick:()=>L(E),children:E},E)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>L(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:la,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Oe(!$e),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.labels&&se.labels.length>0?jsxRuntime.jsx("span",{children:se.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),$e&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(E=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${se.labels?.includes(E)?"active":""}`,onClick:()=>He(E),children:[E,se.labels?.includes(E)&&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"})})]},E))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{ve(!Ct),setTimeout(()=>gt.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.endDate?new Date(se.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:gt,type:"date",value:typeof se.endDate=="string"?se.endDate.split("T")[0]:se.endDate?(()=>{let E=new Date(se.endDate),_=E.getUTCFullYear(),me=String(E.getUTCMonth()+1).padStart(2,"0"),pe=String(E.getUTCDate()).padStart(2,"0");return `${_}-${me}-${pe}`})():"",onChange:Ce,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>At(!ut),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:se.estimatedTime?`${se.estimatedTime}h`:"Not set"})]}),ut&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:se.estimatedTime||"",onChange:E=>Ot(E.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>At(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"})]}),C?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:se.description||"",onChange:E=>{if(f){let _={...f,description:E.target.value};N(_);}},onBlur:Nt,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>M(true),children:se.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Y(se.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),w.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ot,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>I(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:[w.map(E=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${E.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ye(E.id),children:E.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:E.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>fe(E.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"})]})})]},E.id)),H&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:$,onChange:E=>S(E.target.value),onKeyDown:E=>{E.key==="Enter"&&Ut(),E.key==="Escape"&&(I(false),S(""));},onBlur:Ut,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),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 ${ae==="all"?"active":""}`,onClick:()=>ie("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${ae==="comments"?"active":""}`,onClick:()=>ie("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${ae==="history"?"active":""}`,onClick:()=>ie("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[p&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ia,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:z,onChange:E=>V(E.target.value),onKeyDown:K,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:_t,disabled:!z.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[le.map(E=>{let _=n.find(pe=>pe.id===E.userId);if(E.type.includes("COMMENT")){let pe=l.find(Dt=>Dt.id===E.metadata?.commentId);return pe?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(E.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:pe.content})]})]},E.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-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("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.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:_?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:E.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)}),le.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 zm({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 vn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(l=>({...l,average:l.average??e.reduce((m,c)=>m+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"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(zm,{})}),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,m)=>l+m.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,m)=>l+m.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,m)=>l+(m.planned||0),0)})]})]})]})}function Xm({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 yn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,c=n>0?(n-l)/n*100:0,s=l<=m;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(Xm,{})}),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:s?"#10B981":"#EF4444",fill:s?"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:s?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:s?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:s?"#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:s?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:s?"#10B981":"#EF4444"},children:s?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var op={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Gi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function np({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,m=e+l*Math.cos(-a*(Math.PI/180)),c=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:m,y:c,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function zi({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 xn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((c,s)=>c+s.value,0),l=e.map(c=>({...c,totalValue:n,color:c.color||op[c.name]||Gi[e.indexOf(c)%Gi.length]})),m=l.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?np:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((c,s)=>jsxRuntime.jsx(recharts.Cell,{fill:m[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,s)=>{let p=s.payload,i=n>0?(p.value/n*100).toFixed(0):"0";return `${c} (${p.value} - ${i}%)`}})]}):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(zi,{})}),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((c,s)=>jsxRuntime.jsx(recharts.Cell,{fill:m[s]},`cell-${s}`))})]})}),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:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,s)=>s.value>c.value?s:c).name})]})]})]})}var oo=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,m]=react.useState(false),[c,s]=react.useState(false),[p,i]=react.useState(false),[d,u]=react.useState(false);if(e.length===0)return null;let v=e.map(D=>D.id),x=D=>{r.onBulkUpdate?.(v,{priority:D}),m(false);},k=D=>{r.onBulkMove?.(v,D),s(false),a();},y=D=>{r.onBulkUpdate?.(v,{assignedUserIds:D}),i(false);},b=D=>{let h=new Set;e.forEach(N=>{N.labels?.forEach(C=>h.add(C));});let f=Array.from(new Set([...h,...D]));r.onBulkUpdate?.(v,{labels:f}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),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:()=>m(!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(D=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(D),children:[jsxRuntime.jsx("span",{className:A("asakaa-priority-dot",D==="LOW"&&"bg-asakaa-priority-low",D==="MEDIUM"&&"bg-asakaa-priority-medium",D==="HIGH"&&"bg-asakaa-priority-high",D==="URGENT"&&"bg-asakaa-priority-urgent")}),D]},D))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(D=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(D.id),children:D.title},D.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!p),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(D=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([D.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:D.color},children:D.initials}),D.name]},D.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(D=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([D]),children:D},D))})]}),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"})})]})]})})});oo.displayName="BulkOperationsToolbar";function cp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,m,c,s;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(u=>{let v=a?.find(x=>x.id===u);l=`assignee-${u}`,m=v?.name||`User ${u}`,c=v?.color,s=v?.avatar,r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:c,icon:s}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",m="Unassigned",c="#6b7280",s="\u{1F464}",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:c,icon:s}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;let d={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"}}[n];m=d.title,c=d.color,r.has(l)||r.set(l,{id:l,title:m,groupValue:n,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{l=`label-${u}`,m=u,c="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:u,cardIds:[],color:c}),r.get(l).cardIds.push(o.id);}):(l="label-none",m="No Labels",c="#6b7280",r.has(l)||r.set(l,{id:l,title:m,groupValue:null,cardIds:[],color:c}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function kn({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,l]=react.useState(new Set),m=react.useMemo(()=>cp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=react.useCallback(s=>{l(p=>{let i=new Set(p);return i.has(s)?i.delete(s):i.add(s),i});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(Da,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:A("asakaa-swimlane-view",o),children:[m.map(s=>{let p=n.has(s.id),i=e.cards.filter(u=>s.cardIds.includes(u.id)),d={...e,cards:i};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(s.id),style:{borderLeft:s.color?`4px solid ${s.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[s.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:s.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:s.color},children:s.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",s.cardIds.length," ",s.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Da,{board:d,callbacks:r,availableUsers:a})})]},s.id)}),m.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 wn=[{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 Cn({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null),m=wn.find(s=>s.value===e)||wn[0];react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:A("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:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:A("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:n,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:wn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>c(s.value),className:A("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===s.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:s.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:s.label}),e===s.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:s.description})]})]},s.value))})]})]})}var Pr=[{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 up(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(s=>e.key===s||e.code===s))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return n&&l&&m&&c}function Vi(e={}){let{shortcuts:t=Pr,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let l=react.useCallback(c=>{o.current=[...o.current,c];},[]),m=react.useCallback(c=>{o.current=o.current.filter(s=>s.action!==c);},[]);return react.useEffect(()=>{function c(s){if(!n.current)return;let p=s.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let i of o.current)if(up(s,i)){r&&s.preventDefault();let d=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:l,unregisterShortcut:m,isEnabled:a}}function fp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function bp(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 hp(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=bp(e),r=t?fp(t):"";return a?`${a} + ${r}`:r}function vp(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 Tn({shortcuts:e=Pr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function m(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let l=vp(e);return jsxRuntime.jsxs("div",{className:A("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(([m,c])=>c.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"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(s=>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:s.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:hp(s)})]},s.action))})]},m))})}),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 Nn=[{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,10 +42,10 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Tn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);},c=e.reduce((n,p)=>{let d=p.category||"Other";return n[d]||(n[d]=[]),n[d].push(p),n},{});return jsxRuntime.jsxs("div",{className:I("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:I("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([n,p])=>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:p.map(d=>jsxRuntime.jsxs("button",{onClick:()=>m(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 Dn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,m]=react.useState("export"),[c,n]=react.useState("json"),[p,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let g=async()=>{let y=o?.current||void 0,x=await qs(e,c,y);Js(x,c);},v=async y=>{let x=y.target.files?.[0];if(x){try{let h=await ei(x),f=x.name.endsWith(".json")?"json":"csv",u=Qs(h,f);d(u),u.success&&r&&r(u,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:I("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:()=>m("export"),className:I("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:()=>m("import"),className:I("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(y=>jsxRuntime.jsxs("button",{onClick:()=>n(y),className:I("p-4 rounded-lg border-2 transition-all text-center",c===y?"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:[y==="json"&&"\u{1F4C4}",y==="csv"&&"\u{1F4CA}",y==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:y})]},y))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),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:v,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"})]})]}),p&&jsxRuntime.jsxs("div",{className:I("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:I("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((y,x)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},x))})]})]})]})]})]})}var kp=["URGENT","HIGH","MEDIUM","LOW"],wp=[{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"}],Cp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Sn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:m,availableUsers:c=[],availableLabels:n=[],availableColumns:p=[],showQuickFilters:d=true,compact:i=false,groupBy:g="none",onGroupByChange:v}){let[y,x]=react.useState(true),h=react.useCallback(b=>{a({search:b.target.value});},[a]),f=react.useCallback(b=>{a({dateFilter:b.target.value});},[a]),u=react.useCallback(b=>{r({by:b.target.value});},[r]),N=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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":""} ${y?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>x(!y),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:y?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.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:y?"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"}),T&&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)"]})]}),!y&&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"}),m&&jsxRuntime.jsx("button",{onClick:m,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:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let D=b.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),kp.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let D=b.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let D=b.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),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:u,className:"filter-bar__select filter-bar__select--sm",children:wp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:N,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:b=>v(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Cp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function En({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:m,onExportGanttCSV:c}){let[n,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&p(false);};return n&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[n]);let i=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:I("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>i(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Pn={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"}},Mn={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"}},In={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"}},za={dark:Pn,light:Mn,neutral:In},no="dark";var so=react.createContext(void 0),Fp="asakaa-theme";function Wi({children:e,defaultTheme:t=no,storageKey:a=Fp}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,c=za[r];Object.entries(c.colors).forEach(([p,d])=>{d&&m.style.setProperty(`--theme-${Lp(p)}`,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(([p,d])=>{let i=c.colors[p];i&&m.style.setProperty(d,i);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:za};return jsxRuntime.jsx(so.Provider,{value:l,children:e})}function ir(){let e=react.useContext(so);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Lp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function An({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ir();return e?jsxRuntime.jsxs("div",{className:I("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(za).map(([s,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:I("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}var Ne={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",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:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function _i(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ne[e]||Ne.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ne[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ne[e].bgSecondary),bgGrid:r("--theme-bg-card",Ne[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ne[e].bgWeekend),border:r("--theme-border-primary",Ne[e].border),borderLight:r("--theme-border-subtle",Ne[e].borderLight),textPrimary:r("--theme-text-primary",Ne[e].textPrimary),textSecondary:r("--theme-text-secondary",Ne[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ne[e].textTertiary),accent:r("--theme-accent-primary",Ne[e].accent),accentHover:r("--theme-accent-hover",Ne[e].accentHover),accentLight:r("--theme-accent-primary",Ne[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ne[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ne[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ne[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ne[e].dependency),dependencyHover:r("--theme-border-secondary",Ne[e].dependencyHover),criticalPath:r("--theme-error",Ne[e].criticalPath),criticalPathLight:r("--theme-error",Ne[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ne[e].today):e==="neutral"?r("--theme-text-primary",Ne[e].today):r("--theme-error",Ne[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ne[e].todayLight):e==="neutral"?r("--theme-text-primary",Ne[e].todayLight):r("--theme-error",Ne[e].todayLight),milestone:r("--theme-warning",Ne[e].milestone),milestoneLight:r("--theme-warning",Ne[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ne[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ne[e].statusInProgress),statusCompleted:r("--theme-success",Ne[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ne[e].hoverBg),focusRing:r("--theme-accent-primary",Ne[e].focusRing)}}var io={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"}},Vi={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"}},Fn={en:io,es:Vi};function ji(e){return Fn[e]||Fn.en}function Ln(e,t){let a=ji(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 dr=react.createContext(io);function Er(){return react.useContext(dr)}function Jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[m,c]=react.useState(false),[n,p]=react.useState(null),d=react.useRef(null),i=Er();if(react.useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&c(false);};return m&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[m]),!(t||a||r||o||s||l))return null;let v=[{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(x=>x.handler),y=async(x,h)=>{if(h){p(x);try{await h();}catch(f){console.error(`Export ${x} failed:`,f);}finally{p(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:v.map((x,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y(x.id,x.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:h<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.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===x.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"})}):x.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:x.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:x.description})]})]},x.id))})})})]})}function Zp({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 Qp({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 eu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),l=Er();react.useEffect(()=>{let n=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],c=m.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"}: ${c}`,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:m.map((n,p)=>{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:p<m.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:p*.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 lo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:m,onRowDensityChange:c,showThemeSelector:n=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:i,onExportPNG:g,onExportPDF:v,onExportExcel:y,onExportCSV:x,onExportJSON:h,onExportMSProject:f}){let u=Er(),N=g||v||y||x||h||f,T=[{value:"day",label:u.toolbar.day},{value:"week",label:u.toolbar.week},{value:"month",label:u.toolbar.month}],b=[{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(Qp,{options:T,value:t,onChange:D=>a(D),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(eu,{theme:e,value:m,onChange:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&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||u.toolbar.createTask})]}),(N||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),N&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jp,{theme:e,onExportPNG:g,onExportPDF:v,onExportExcel:y,onExportCSV:x,onExportJSON:h,onExportMSProject:f}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Zp,{options:b,value:s,onChange:D=>l(D),theme:e})]})]})}function co({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,l]=react.useState({x:0,y:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{m.current&&!m.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let n=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();l({x:p.left,y:p.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(Be,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.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:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function cr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=react.useRef(null),[m,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,i=8,g=window.innerWidth,v=window.innerHeight,y=t,x=a;t+p+i>g&&(y=t-p,y<i&&(y=i)),a+d+i>v&&(x=v-d-i,x<i&&(x=i)),c({x:y,y:x});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p: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:`${m.x}px`,top:`${m.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(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var Ke={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 nl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:m,onTaskOutdent:c,onTaskRename:n,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:i=true}){let g=react.useRef(false),v=react.useCallback(u=>{g.current=u;},[]),y=react.useCallback(u=>{let N=[],T=b=>{for(let D of b)N.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&T(D.subtasks);};return T(u),N},[]),x=react.useCallback(()=>{let u=y(e);for(let N of u)if(t.has(N.id))return N;return null},[e,t,y]),h=react.useCallback((u,N)=>{let T=y(e);if(T.length===0)return;let b=x();if(!b){a(T[0].id,false);return}let D=T.findIndex(w=>w.id===b.id);if(D===-1)return;let k=u==="up"?D-1:D+1;if(k<0||k>=T.length)return;let S=T[k];a(S.id,N);},[e,x,y,a]),f=react.useCallback(u=>{if(!i)return;let N=u.target;if(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.isContentEditable||g.current){u.key==="Escape"&&(N.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,k=Array.from(t),S=x();if(u.key==="ArrowUp"){u.preventDefault(),h("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),h("down",u.shiftKey);return}if(S&&(u.key==="ArrowRight"||u.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(u.preventDefault(),(u.key==="ArrowRight"&&!S.isExpanded||u.key==="ArrowLeft"&&S.isExpanded)&&p(S.id));return}if(u.altKey&&(u.key==="ArrowUp"||u.key==="ArrowDown")){k.length>0&&(u.preventDefault(),l(k,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){k.length>0&&(u.preventDefault(),m(k));return}if(u.key==="Tab"&&u.shiftKey){k.length>0&&(u.preventDefault(),c(k));return}if(u.key==="Enter"&&!u.shiftKey&&!D){S&&(u.preventDefault(),r(S.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!D){S&&(u.preventDefault(),r(S.id,"above"));return}if(u.key==="Enter"&&D){S&&(u.preventDefault(),d(S.id));return}if(u.key==="F2"){S&&(u.preventDefault(),n(S.id));return}if(u.key==="Delete"||u.key==="Backspace"&&D){k.length>0&&(u.preventDefault(),o(k));return}if(u.key==="d"&&D&&!u.shiftKey){k.length>0&&(u.preventDefault(),s(k));return}},[i,t,x,h,r,o,s,l,m,c,n,p,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[i,f]),{setIsEditing:v}}function il(){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 g=new Set(i);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),l=react.useCallback((d,i)=>{if(!a){o(d);return}let g=i.indexOf(a),v=i.indexOf(d);if(g===-1||v===-1){o(d);return}let y=Math.min(g,v),x=Math.max(g,v),h=i.slice(y,x+1);t(new Set(h)),r(d);},[a,o]),m=react.useCallback((d,i,g,v)=>{v?l(d,i):g?s(d):o(d);},[o,s,l]),c=react.useCallback((d,i)=>{i?t(g=>{let v=new Set(g);return v.add(d),v}):o(d);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:c,clearSelection:n,isTaskSelected:p}}function mr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:s,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,s+1);}};return a(e),t}function On(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=On(a.subtasks,t);if(r)return r}return null}function Gn(e,t){if(t.length===0)return e;let a=mr(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 g=[];return {tasks:d.filter(y=>{if(i.has(y.id))return g.push(y),false;if(y.subtasks){let x=l(y.subtasks,i);y.subtasks=x.tasks,g.push(...x.removed);}return true}),removed:g}},m=(d,i,g)=>d.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...g],isExpanded:true}:v.subtasks?{...v,subtasks:m(v.subtasks,i,g)}:v),c=new Set(t),{tasks:n,removed:p}=l(e,c);return m(n,s.id,p)}function Un(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=On(a,r);if(!o)continue;let s=On(a,o.id),l=(n,p,d)=>{for(let i=0;i<n.length;i++){let g=n[i];if(g.id===p&&g.subtasks){let v=g.subtasks.findIndex(y=>y.id===d);if(v!==-1){let[y]=g.subtasks.splice(v,1);return y}}if(g.subtasks){let v=l(g.subtasks,p,d);if(v)return v}}return null},m=(n,p,d)=>{let i=n.findIndex(g=>g.id===p);if(i!==-1)return n.splice(i+1,0,d),n;for(let g of n)g.subtasks&&m(g.subtasks,p,d);return n},c=l(a,o.id,r);c&&(s&&s.subtasks?m(s.subtasks,o.id,c):m(a,o.id,c));}return a}function zn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,m,c)=>{let n=l.findIndex(d=>d.id===m);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,m,c))return true;return false}let p=c==="up"?n-1:n+1;return p<0||p>=l.length?false:([l[n],l[p]]=[l[p],l[n]],true)};return s(r,o,a),r}function $n(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 Hn(e,t){let a=[...e];for(let r of t){let o=l=>{let m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let c=l[m],n={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks):void 0};return l.splice(m+1,0,n),true},s=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.subtasks):void 0}));o(a);}return a}function ll(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"},m=c=>{let n=c.findIndex(d=>d.id===t);if(n===-1){for(let d of c)if(d.subtasks&&m(d.subtasks))return true;return false}let p=a==="above"?n:n+1;return c.splice(p,0,l),true};return m(r),{tasks:r,newTask:l}}function Wn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Wn(r.subtasks,t,a)}:r)}function _n(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:_n(a.subtasks,t)}:a)}function Vn(e,t){let a=p=>{for(let d of p){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,m=r?.endDate||s,c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},n=p=>p.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,c],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:c}}var ml={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"}},pl=({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 ul({status:e="todo",onChange:t,className:a}){let[r,o]=react.useState(false),[s,l]=react.useState({top:0,left:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(r&&c.current){let i=c.current.getBoundingClientRect();l({top:i.bottom+window.scrollY+8,left:i.left+window.scrollX});}},[r]),react.useEffect(()=>{let i=g=>{m.current&&!m.current.contains(g.target)&&!c.current?.contains(g.target)&&o(false);};if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]),react.useEffect(()=>{let i=g=>{g.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]);let n=i=>{t(i),o(false);},p=ml[e],d=p.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>o(!r),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:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:p.label,children:jsxRuntime.jsx(pl,{icon:p.icon,color:d})}),r&&jsxRuntime.jsx(Be,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"absolute",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"180px",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:Object.entries(ml).map(([i,g])=>jsxRuntime.jsxs("button",{onClick:()=>n(i),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(pl,{icon:g.icon,color:g.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:g.label}),e===i&&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"})})]},i))})]})})]})}function mo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:c,scrollTop:n,columns:p,onToggleColumn:d,onColumnResize:i,onTaskUpdate:g,onTaskIndent:v,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:h,onTaskDuplicate:f,onTaskCreate:u,onTaskRename:N,onCreateSubtask:T,onOpenTaskModal:b,onDeleteRequest:D}){let k=react.useContext(dr),[S,w]=react.useState(null),[U,W]=react.useState(false),[A,_]=react.useState(null),[E,z]=react.useState(""),q=react.useRef(null),ae=react.useRef(null),[ie,J]=react.useState(null),[B,R]=react.useState(0),[M,ue]=react.useState(0),[X,$e]=react.useState({isOpen:false,x:0,y:0,type:"header"});react.useEffect(()=>{function V(L){q.current&&!q.current.contains(L.target)&&W(false);}if(U)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[U]),react.useEffect(()=>{A&&ae.current&&(ae.current.focus(),ae.current.select());},[A]),react.useEffect(()=>{if(!ie)return;let V=Z=>{let He=Z.clientX-B,Ce=M+He;i?.(ie,Ce);},L=()=>{J(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",L),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",L),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,B,M,i]);let{selectedTaskIds:Oe,handleTaskClick:Ct,isTaskSelected:ve}=il(),{setIsEditing:ut}=nl({tasks:e,selectedTaskIds:Oe,onTaskSelect:(V,L)=>{let He=mr(e).map(Ce=>Ce.id);Ct(V,He,L||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:V=>{let L=mr(e).find(Z=>Z.id===V);L&&Kt(L);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:V=>{let L=mr(e).find(Z=>Z.id===V);L&&b&&b(L);},enableKeyboard:true}),It=(V,L=0)=>{let Z=[];for(let He of V)Z.push({task:He,level:L}),He.subtasks&&He.subtasks.length>0&&He.isExpanded&&Z.push(...It(He.subtasks,L+1));return Z},ka=It(e),wa=48,ia=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,Kt=V=>{_(V.id),z(V.name),ut(true);},ga=V=>{E.trim()&&E!==e.find(L=>L.id===V)?.name&&N?.(V,E.trim()),_(null),z(""),ut(false);},Tt=()=>{_(null),z(""),ut(false);},la=(V,L)=>{L.stopPropagation(),T?.(V.id);},gt=(V,L,Z)=>{switch(V.id){case "name":let He=A===L.id,Ce=S===L.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[L.subtasks&&L.subtasks.length>0?jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),c?.(L.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:L.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:L.color||"#3B82F6",opacity:L.parentId?.6:1,borderColor:L.isMilestone?t.accent:"transparent",borderWidth:L.isMilestone?"2px":"0px"},title:L.isMilestone?"Milestone":L.parentId?"Subtask":"Task"}),He?jsxRuntime.jsx("input",{ref:ae,type:"text",value:E,onChange:K=>z(K.target.value),onKeyDown:K=>{K.key==="Enter"?ga(L.id):K.key==="Escape"&&Tt();},onBlur:()=>ga(L.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:K=>K.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Z===0?"14px":Z===1?"13px":"12px",fontWeight:L.isMilestone?600:L.subtasks&&L.subtasks.length>0?500:400,opacity:Z===0?1:Z===1?.95:.88},title:L.name,children:L.name}),Ce&&!He&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:K=>la(L,K),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:K=>{K.stopPropagation(),Kt(L);},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":let Rt=L.startDate?typeof L.startDate=="string"?L.startDate:L.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Rt||"",onChange:K=>{g?.(L.id,{startDate:K.target.value?new Date(K.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let Ot=L.endDate?typeof L.endDate=="string"?L.endDate:L.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Ot||"",onChange:K=>{g?.(L.id,{endDate:K.target.value?new Date(K.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:ia(L)})});case "assignees":let ye=r.filter(K=>L.assignees?.some(le=>le.name===K.name||le.initials===K.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsxRuntime.jsx(Oa,{assignedUsers:ye,availableUsers:r,onChange:K=>{let le=K.map(se=>({id:se.id,name:se.name,initials:se.initials,color:se.color}));g?.(L.id,{assignees:le.length>0?le:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsxRuntime.jsx(ul,{status:L.status||"todo",onChange:K=>{g?.(L.id,{status:K,progress:K==="completed"?100:L.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:`${L.progress}%`,backgroundColor:L.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:[L.progress,"%"]})]});case "priority":let fe={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Wt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},j=fe[L.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsxRuntime.jsx(Ba,{priority:j,onChange:K=>{K&&g?.(L.id,{priority:Wt[K]||"medium"});}})});default:return null}},rt=V=>[{id:"hide",label:"Hide Column",icon:Ke.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ke.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ke.SortDesc,onClick:()=>{}}],Yt=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:k?.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{T?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:k?.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{D?D(V.id,V.name):h?.([V.id]);}}]:[{id:"edit",label:k?.contextMenu?.editTask||"Edit Task",icon:Ke.Pencil,onClick:()=>{l?.(V);}},{id:"addSubtask",label:k?.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{T?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:k?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ke.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:k?.contextMenu?.setInProgress||"Set In Progress",icon:Ke.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:k?.contextMenu?.markComplete||"Mark Complete",icon:Ke.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:k?.contextMenu?.splitTask||"Split Task",icon:Ke.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:k?.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{D?D(V.id,V.name):h?.([V.id]);}}],Nt=p.filter(V=>V.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:`${wa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Nt.map((V,L)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${V.id==="name"?"justify-start":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.width}px`,maxWidth:`${V.width}px`,borderRight:L<Nt.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Z=>{Z.preventDefault(),$e({isOpen:true,x:Z.clientX,y:Z.clientY,type:"header",columnId:V.id});},onMouseEnter:Z=>{Z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Z=>{Z.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:V.label}),V.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:ie===V.id?t.accent:"transparent"},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation(),J(V.id),R(Z.clientX),ue(V.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},V.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",style:{position:"sticky",right:0,backgroundColor:t.bgGrid,zIndex:15,flexShrink:0},children:[jsxRuntime.jsx(co,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>W(!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"}),U&&jsxRuntime.jsxs("div",{ref:q,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:V=>V.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>W(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:ka.map(({task:V,level:L},Z)=>{let He=ve(V.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${a}px`,borderLeft:He?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:He?t.accentLight:Z%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>w(V.id),onMouseLeave:()=>w(null),onClick:Ce=>{let Ot=mr(e).map(Wt=>Wt.id),fe=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ce.metaKey:Ce.ctrlKey;Ct(V.id,Ot,fe,Ce.shiftKey),s?.(V);},onDoubleClick:Ce=>{Ce.stopPropagation(),l?.(V);},onContextMenu:Ce=>{Ce.preventDefault(),$e({isOpen:true,x:Ce.clientX,y:Ce.clientY,type:"task",task:V}),m?.(V,Ce);},whileHover:{backgroundColor:He?t.accentLight:t.hoverBg},children:Nt.map((Ce,Rt)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ce.id==="name"?"justify-start":"justify-center"} ${Rt<Nt.length-1?"border-r":""}`,style:{width:`${Ce.width}px`,minWidth:`${Ce.width}px`,maxWidth:`${Ce.width}px`,borderColor:S===V.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:gt(Ce,V,Ce.id==="name"?L:0)},`${V.id}-${Ce.id}`))},V.id)})}),jsxRuntime.jsx(cr,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?rt(X.columnId):X.type==="task"&&X.task?Yt(X.task):[],onClose:()=>$e({...X,isOpen:false}),theme:t})]})}function fl(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[l,m]=react.useState(e),[c,n]=react.useState(t),[p,d]=react.useState(null),[i,g]=react.useState(null),[v,y]=react.useState(null),[x,h]=react.useState(null),[f,u]=react.useState(0),[N,T]=react.useState(0),[b,D]=react.useState(null),[k,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:m,ghostWidth:c,setGhostWidth:n,connectionLine:p,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:g,activeZone:v,setActiveZone:y,draggedSegmentIndex:x,setDraggedSegmentIndex:h,draggedSegmentStartX:f,setDraggedSegmentStartX:u,segmentDragOffsetX:N,setSegmentDragOffsetX:T,hoveredSegmentIndex:b,setHoveredSegmentIndex:D,isHovered:k,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(_,E)=>{r("none"),d(null),g(null),m(_),n(E),T(0),h(null),u(0);}}}function po({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:m,onClick:c,onDoubleClick:n,onContextMenu:p,onDateChange:d,onDependencyCreate:i,allTaskPositions:g=[],onDragMove:v}){let y=fl(t,r),x=react.useRef(null),{dragMode:h,setDragMode:f,dragOffset:u,setDragOffset:N,ghostX:T,setGhostX:b,ghostWidth:D,setGhostWidth:k,connectionLine:S,setConnectionLine:w,hoveredTaskId:U,setHoveredTaskId:W,activeZone:A,setActiveZone:_,draggedSegmentIndex:E,setDraggedSegmentIndex:z,draggedSegmentStartX:q,setDraggedSegmentStartX:ae,segmentDragOffsetX:ie,setSegmentDragOffsetX:J,hoveredSegmentIndex:B,setHoveredSegmentIndex:R,isHovered:M,setIsHovered:ue,isDragging:X,isResizing:$e,isConnecting:Oe,resetDragState:Ct}=y,ve=32,ut=8,It=e.endDate&&e.endDate<new Date&&e.progress<100,ka=e.isCriticalPath,wa=o.name==="neutral"||o.today==="#1C1917",ia=e.status==="completed"||e.progress===100,Kt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Tt=e.isCriticalPath||It?"#DC2626":e.color?e.color:e.priority&&Kt[e.priority]?Kt[e.priority]:o.taskBarPrimary,gt=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),rt=r<50,Yt=r<40,Nt=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),V=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},L=j=>Math.round(j/s)*s,Z=j=>{let K=Math.round(j/s),le=new Date(l);return le.setDate(le.getDate()+K),le},He=(j,K)=>{for(let le of g){if(le.id===e.id)continue;let se=5;if(j>=le.x-se&&j<=le.x+le.width+se&&K>=le.y-se&&K<=le.y+le.height+se)return le.id}return null},Ce=react.useCallback((j,K,le)=>{j.preventDefault(),j.stopPropagation();let se=x.current?.ownerSVGElement;if(!se)return;let We=se.createSVGPoint();We.x=j.clientX,We.y=j.clientY;let ot=We.matrixTransform(se.getScreenCTM()?.inverse()),P=le!==void 0?le:t,H=K;if(!H){let me=ot.x-P;j.shiftKey?(H="connect",w({x:t+r,y:a+ve/2})):j.ctrlKey||j.metaKey?H="move":j.altKey?H=me<r/2?"resize-start":"resize-end":Yt?me<r/2?H="move":H="resize-end":rt?me<=gt/2?H="resize-start":me>=r-gt/2?H="resize-end":H="move":me<=gt?H="resize-start":me>=r-gt?H="resize-end":H="move";}f(H),ue(false),_(null),H==="move"?N(ot.x-P):H==="connect"?w({x:t+r,y:a+ve/2}):N(0),b(P),k(r);},[t,r,a,ve]),Rt=react.useCallback(j=>{if(h==="none")return;let K=x.current?.ownerSVGElement;if(!K)return;let le=K.createSVGPoint();le.x=j.clientX,le.y=j.clientY;let se=le.matrixTransform(K.getScreenCTM()?.inverse());if(h==="connect"){w({x:se.x,y:se.y});let We=He(se.x,se.y);W(We);}else if(h==="move"){let We=se.x-u,ot=L(We);b(ot),k(r);let P=Math.round((ot-t)/s);if(v?.(e.id,P,true),e.segments&&e.segments.length>0&&E!==null){let H=ot-q;J(H);}}else if(h==="resize-start"){let We=se.x,ot=L(We),P=t+r-ot;P>=s&&(b(ot),k(P));}else if(h==="resize-end"){let We=se.x,P=L(We)-t;P>=s&&k(P);}},[h,t,r,s,u,e,L,E,q,He,W,w,b,k,J,v]),Ot=react.useCallback(()=>{if(h!=="none"){if(h==="connect")U&&i&&i(e,U),w(null),W(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),K,le,se=true;if(h==="move"){if(K=Z(T),le=new Date(K.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let We=Math.round(ie/s),ot=e.segments.map((pe,Dt)=>{if(Dt===E){let Xa=new Date(pe.startDate),qa=new Date(pe.endDate);return Xa.setDate(Xa.getDate()+We),qa.setDate(qa.getDate()+We),{startDate:Xa,endDate:qa}}return pe}),P=ot.flatMap(pe=>[pe.startDate,pe.endDate]),H=new Date(Math.min(...P.map(pe=>pe.getTime()))),me=new Date(Math.max(...P.map(pe=>pe.getTime())));d?.({...e,segments:ot},H,me),Ct(t,r);return}}else h==="resize-start"?(K=Z(T),le=e.endDate,K>=le&&(console.warn("Invalid date range: start date must be before end date"),se=false)):h==="resize-end"?(K=e.startDate,le=Z(T+D),le<=K&&(console.warn("Invalid date range: end date must be after start date"),se=false)):se=false;se&&K&&le&&(le.getTime()-K.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,K,le));}v?.(e.id,0,false),Ct(t,r);}},[h,T,D,e,d,U,i,t,r,s,Z,ie,E,Ct,v]);react.useEffect(()=>{if(h==="none")return;let j=le=>{Rt(le);},K=()=>{Ot();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",K);}},[h,Rt,Ot]);let ye=X&&!Oe?T:t,fe=X&&!Oe?D:r,Wt=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!X&&ue(true),onMouseLeave:()=>{X||(ue(false),_(null));},onClick:()=>!X&&c?.(e),onDoubleClick:j=>{X||(j.stopPropagation(),n?.(e));},onContextMenu:j=>{j.preventDefault(),p?.(e,j);},children:[M&&!X&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:gt,height:ve,fill:A==="resize-start"?o.accent:"transparent",opacity:A==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-start"),onMouseDown:j=>Ce(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:a,width:r-gt*2,height:ve,fill:A==="move"?o.accent:"transparent",opacity:A==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>_("move"),onMouseDown:j=>Ce(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-gt,y:a,width:gt,height:ve,fill:A==="resize-end"?o.accent:"transparent",opacity:A==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-end"),onMouseDown:j=>Ce(j,"resize-end")})]}),M&&!X&&Yt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:A==="move"?o.accent:"transparent",opacity:A==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>_("move"),onMouseDown:j=>Ce(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:A==="resize-end"?o.accent:"transparent",opacity:A==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>_("resize-end"),onMouseDown:j=>Ce(j,"resize-end")}),M&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),X&&!Oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:T,y:a,width:D,height:ve,rx:ut,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:ye,y:a,width:fe,height:ve,rx:ut,fill:Tt,"data-task-class":Wt,initial:{opacity:0,scale:.95},animate:{opacity:X&&!Oe?.15:e.parentId?.6:M?.9:.8,scale:M&&!X?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Ce(j),style:{cursor:X?Oe?"crosshair":$e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe*(e.progress/100),height:ve,rx:ut,fill:Tt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,K)=>{let le=(j.startDate.getTime()-l.getTime())/864e5*s,We=(j.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-le+s,ot=X&&h==="move"&&E===K,P=B===K,H=ot?le+ie:le;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!X&&R(K),onMouseLeave:()=>!X&&R(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:H,y:a,width:We,height:ve,rx:ut,fill:Tt,initial:{opacity:0,scale:.95},animate:{opacity:ot||e.parentId?.6:P?.9:.8,scale:P&&!X?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:me=>{me.stopPropagation(),z(K),ae(le),Ce(me,void 0,le);},style:{cursor:X?Oe?"crosshair":$e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:H,y:a,width:We*(e.progress/100),height:ve,rx:ut,fill:Tt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),wa&&(It||ka)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ka&&!It&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe,height:ve,rx:ut,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),It&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe,height:ve,rx:ut,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),fe>60&&!e.segments&&(()=>{let j=m.taskLabel(e),K=typeof j=="string"?j:e.name,le=K.length>Math.floor(fe/8)?`${K.substring(0,Math.floor(fe/8))}...`:K;return jsxRuntime.jsx("text",{x:ye+12,y:a+ve/2,dominantBaseline:"middle",fill:ia?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ia?"line-through":"none"},children:le})})(),fe>100&&e.progress>0&&e.progress<100&&!X&&!e.segments&&jsxRuntime.jsxs("text",{x:ye+fe-12,y:a+ve/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&&fe>80&&!X&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ye+fe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ye+fe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(M||$e)&&!Oe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?ye-15:ye-10,y:a-5,width:rt?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>Ce(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ye-8:ye-3,y:a+6,width:rt?8:6,height:rt?ve-12:ve-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:ye+fe-10,y:a-5,width:rt?25:20,height:ve+10,fill:"transparent",onMouseDown:j=>Ce(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ye+fe:ye+fe-3,y:a+6,width:rt?8:6,height:rt?ve-12:ve-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:M&&!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+ve/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:j=>{j.stopPropagation(),Ce(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ve/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Oe&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:S.x,y2:S.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:S.x,cy:S.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:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(M||X)&&!Oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ye-2,y:a-2,width:fe+4,height:ve+4,rx:ut+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"}}),$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:T,y1:0,x2:T,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:T+D,y1:0,x2:T+D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&!X&&!e.segments&&(()=>{let le=a<100,se=le?a+ve+13:a-82-13,We=le?`M ${ye+fe/2-6} ${a+ve+3} L ${ye+fe/2} ${a+ve+13} L ${ye+fe/2+6} ${a+ve+3}`:`M ${ye+fe/2-6} ${a-13} L ${ye+fe/2} ${a-3} L ${ye+fe/2+6} ${a-13}`,ot=se+22,P=se+40,H=se+55,me=se+70,pe=le?se+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:le?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:le?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:We,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ye+fe/2-120,y:se,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:ye+fe/2,y:ot,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:ye+fe/2-110,y:P,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ye+fe/2-70,y:P,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.startDate)}),jsxRuntime.jsx("text",{x:ye+fe/2-110,y:H,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ye+fe/2-70,y:H,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.endDate)}),jsxRuntime.jsx("text",{x:ye+fe/2+10,y:P,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ye+fe/2+65,y:P,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:V()}),jsxRuntime.jsx("text",{x:ye+fe/2+10,y:H,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ye+fe/2+65,y:H,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:ye+fe/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ye+fe/2-50,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Dt=>Dt.name).join(", ").substring(0,30),e.assignees.map(Dt=>Dt.name).join(", ").length>30?"...":""]})]}),!le&&jsxRuntime.jsx("text",{x:ye+fe/2,y:pe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":rt?"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 go({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s}){let[l,m]=react.useState(false),c=a-e,n=r-t,p=e+c/2,d=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,i=6,g=Math.atan2(n,c),v=a-i*Math.cos(g-Math.PI/6),y=r-i*Math.sin(g-Math.PI/6),x=a-i*Math.cos(g+Math.PI/6),h=r-i*Math.sin(g+Math.PI/6),f=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?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 ${v} ${y} M ${a} ${r} L ${x} ${h}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:u=>{u.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function bo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=react.useState(false),m=16,c=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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Y={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(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,m=new Set,c=n=>{if(!l.has(n)){l.add(n),m.add(n);let p=r.get(n)||[];for(let d of p){if(!l.has(d)&&c(d))return true;if(m.has(d))return true}}return m.delete(n),false};return c(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=Y.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Y.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Y.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=Y.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=Y.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=Y.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)=>Y.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Y.findTaskById(e,t);return !a||!a.dependencies?[]:Y.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Y.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Y.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=Y.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=>Y.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=Y.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"]],m=s.map(c=>{let n=c.startDate&&c.endDate?Y.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Y.formatDate(c.startDate):"N/A",c.endDate?Y.formatDate(c.endDate):"N/A",n>0?`${n} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:l,body:m,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=Y.flattenTasks(e).map(c=>{let n=c.startDate&&c.endDate?Y.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?Y.formatDate(c.startDate):"","End Date":c.endDate?Y.formatDate(c.endDate):"","Duration (days)":n>0?n:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(p=>p.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.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 m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Y.flattenTasks(e),o=new Map;r.forEach((i,g)=>{o.set(i.id,g+1);});let s=i=>i.toISOString().replace("Z",""),l=Y.getEarliestStartDate(e)||new Date,m=Y.getLatestEndDate(e)||new Date,c=r.map((i,g)=>{let v=o.get(i.id),y=i.startDate&&i.endDate?Y.calculateDuration(i.startDate,i.endDate):0,x=(i.dependencies||[]).filter(h=>o.has(h)).map(h=>`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Dn({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{function s(p){n.current&&!n.current.contains(p.target)&&l.current&&!l.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=s=>{t(s),o(false);},c=e.reduce((s,p)=>{let i=p.category||"Other";return s[i]||(s[i]=[]),s[i].push(p),s},{});return jsxRuntime.jsxs("div",{className:A("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:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",s.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",s.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:A("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:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([s,p])=>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:s})}),jsxRuntime.jsx("div",{children:p.map(i=>jsxRuntime.jsxs("button",{onClick:()=>m(i),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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.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:i.name}),i.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.id))})]},s)),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 En({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,m]=react.useState("export"),[c,s]=react.useState("json"),[p,i]=react.useState(null),d=react.useRef(null);if(!t)return null;let u=async()=>{let x=o?.current||void 0,k=await Js(e,c,x);Zs(k,c);},v=async x=>{let k=x.target.files?.[0];if(k){try{let y=await ti(k),b=k.name.endsWith(".json")?"json":"csv",g=ei(y,b);i(g),g.success&&r&&r(g,y);}catch(y){i({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxRuntime.jsxs("div",{className:A("fixed inset-0 z-[9999] flex items-center justify-center",n),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:()=>m("export"),className:A("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:()=>m("import"),className:A("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(x=>jsxRuntime.jsxs("button",{onClick:()=>s(x),className:A("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick: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:d,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.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"})]})]}),p&&jsxRuntime.jsxs("div",{className:A("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:A("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((x,k)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},k))})]})]})]})]})]})}var Cp=["URGENT","HIGH","MEDIUM","LOW"],Tp=[{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"}],Np=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Pn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:m,availableUsers:c=[],availableLabels:s=[],availableColumns:p=[],showQuickFilters:i=true,compact:d=false,groupBy:u="none",onGroupByChange:v}){let[x,k]=react.useState(true),y=react.useCallback(f=>{a({search:f.target.value});},[a]),b=react.useCallback(f=>{a({dateFilter:f.target.value});},[a]),g=react.useCallback(f=>{r({by:f.target.value});},[r]),D=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),h=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 ${d?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>k(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),h&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[i&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,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"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:y,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange: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:f=>{let N=f.target.value;a({priorities:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Cp.map(f=>jsxRuntime.jsx("option",{value:f,children:f},f))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:f=>{let N=f.target.value;a({assignees:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(f=>jsxRuntime.jsx("option",{value:f.id,children:f.name},f.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:f=>{let N=f.target.value;a({labels:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(f=>jsxRuntime.jsx("option",{value:f,children:f},f))]})}),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:Tp.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:D,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:f=>v(f.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Np.map(f=>jsxRuntime.jsx("option",{value:f.value,children:f.label},f.value))})}),h&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Mn({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:m,onExportGanttCSV:c}){let[s,p]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let u=v=>{i.current&&!i.current.contains(v.target)&&p(false);};return s&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[s]);let d=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:A("relative",r),ref:i,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!s),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":s,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"})]}),s&&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:()=>d(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:()=>d(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>d(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:()=>d(async()=>await 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: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:()=>d(()=>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("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:()=>d(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:()=>d(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 In={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"}},An={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"}},Fn={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"}},Ha={dark:In,light:An,neutral:Fn},so="dark";var io=react.createContext(void 0),Bp="asakaa-theme";function Yi({children:e,defaultTheme:t=so,storageKey:a=Bp}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,c=Ha[r];Object.entries(c.colors).forEach(([p,i])=>{i&&m.style.setProperty(`--theme-${Rp(p)}`,i);}),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(([p,i])=>{let d=c.colors[p];d&&m.style.setProperty(i,d);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:Ha};return jsxRuntime.jsx(io.Provider,{value:l,children:e})}function lr(){let e=react.useContext(io);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Rp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ln({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=lr();return e?jsxRuntime.jsxs("div",{className:A("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(Ha).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:A("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"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:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}var Ne={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1C1F24",bgWeekend:"rgba(59, 130, 246, 0.02)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",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:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FDFEFE",bgWeekend:"rgba(37, 99, 235, 0.02)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FBFBFA",bgWeekend:"rgba(41, 37, 36, 0.015)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function Xi(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ne[e]||Ne.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",Ne[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ne[e].bgSecondary),bgGrid:r("--theme-bg-card",Ne[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ne[e].bgWeekend),border:r("--theme-border-primary",Ne[e].border),borderLight:r("--theme-border-subtle",Ne[e].borderLight),textPrimary:r("--theme-text-primary",Ne[e].textPrimary),textSecondary:r("--theme-text-secondary",Ne[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ne[e].textTertiary),accent:r("--theme-accent-primary",Ne[e].accent),accentHover:r("--theme-accent-hover",Ne[e].accentHover),accentLight:r("--theme-accent-primary",Ne[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ne[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ne[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ne[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ne[e].dependency),dependencyHover:r("--theme-border-secondary",Ne[e].dependencyHover),criticalPath:r("--theme-error",Ne[e].criticalPath),criticalPathLight:r("--theme-error",Ne[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ne[e].today):e==="neutral"?r("--theme-text-primary",Ne[e].today):r("--theme-error",Ne[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ne[e].todayLight):e==="neutral"?r("--theme-text-primary",Ne[e].todayLight):r("--theme-error",Ne[e].todayLight),milestone:r("--theme-warning",Ne[e].milestone),milestoneLight:r("--theme-warning",Ne[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ne[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ne[e].statusInProgress),statusCompleted:r("--theme-success",Ne[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ne[e].hoverBg),focusRing:r("--theme-accent-primary",Ne[e].focusRing)}}var lo={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"}},qi={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"}},Bn={en:lo,es:qi};function Ji(e){return Bn[e]||Bn.en}function Rn(e,t){let a=Ji(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 cr=react.createContext(lo);function Mr(){return react.useContext(cr)}function Qp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[m,c]=react.useState(false),[s,p]=react.useState(null),i=react.useRef(null),d=Mr();if(react.useEffect(()=>{let k=y=>{i.current&&!i.current.contains(y.target)&&c(false);};return m&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[m]),!(t||a||r||o||n||l))return null;let v=[{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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(k=>k.handler),x=async(k,y)=>{if(y){p(k);try{await y();}catch(b){console.error(`Export ${k} failed:`,b);}finally{p(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:d.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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:v.map((k,y)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(k.id,k.handler),disabled:s!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<v.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:s===k.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"})}):k.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:k.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:k.description})]})]},k.id))})})})]})}function eu({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(n=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function tu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 au({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=Mr();react.useEffect(()=>{let s=p=>{n.current&&!n.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let m=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],c=m.find(s=>s.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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"}: ${c}`,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:m.map((s,p)=>{let i=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(s.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:i?e.accentLight:"transparent",borderBottom:p<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:i?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500},children:s.label}),i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function co({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:m,onRowDensityChange:c,showThemeSelector:s=false,showCreateTaskButton:p=false,createTaskLabel:i,onCreateTask:d,onExportPNG:u,onExportPDF:v,onExportExcel:x,onExportCSV:k,onExportJSON:y,onExportMSProject:b}){let g=Mr(),D=u||v||x||k||y||b,h=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],f=[{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(tu,{options:h,value:t,onChange:N=>a(N),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(au,{theme:e,value:m,onChange:c})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:d,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:i||g.toolbar.createTask})]}),(D||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Qp,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:x,onExportCSV:k,onExportJSON:y,onExportMSProject:b}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(eu,{options:f,value:n,onChange:N=>l(N),theme:e})]})]})}function mo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),m=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=i=>{m.current&&!m.current.contains(i.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let s=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();l({x:p.left,y:p.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(Be,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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:`${n.x}px`,top:`${n.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"}),s.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.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:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function mr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null),[m,c]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,i=r.length*36+8,d=8,u=window.innerWidth,v=window.innerHeight,x=t,k=a;t+p+d>u&&(x=t-p,x<d&&(x=d)),a+i+d>v&&(k=v-i-d,k<d&&(k=d)),c({x,y:k});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o();},i=d=>{d.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",i);}},[e,o]),!e)return null;let s=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.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:`${m.x}px`,top:`${m.y}px`,backgroundColor:s(n.bgSecondary),border:`1px solid ${n.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(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:i=>{p.disabled||(i.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},p.id))})})})}var Ke={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 cl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:m,onTaskOutdent:c,onTaskRename:s,onTaskToggleExpand:p,onOpenTaskModal:i,enableKeyboard:d=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),x=react.useCallback(g=>{let D=[],h=f=>{for(let N of f)D.push(N),N.subtasks&&N.subtasks.length>0&&N.isExpanded&&h(N.subtasks);};return h(g),D},[]),k=react.useCallback(()=>{let g=x(e);for(let D of g)if(t.has(D.id))return D;return null},[e,t,x]),y=react.useCallback((g,D)=>{let h=x(e);if(h.length===0)return;let f=k();if(!f){a(h[0].id,false);return}let N=h.findIndex(w=>w.id===f.id);if(N===-1)return;let C=g==="up"?N-1:N+1;if(C<0||C>=h.length)return;let M=h[C];a(M.id,D);},[e,k,x,a]),b=react.useCallback(g=>{if(!d)return;let D=g.target;if(D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable||u.current){g.key==="Escape"&&(D.blur(),u.current=false);return}let N=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),M=k();if(g.key==="ArrowUp"){g.preventDefault(),y("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),y("down",g.shiftKey);return}if(M&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){M.subtasks&&M.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!M.isExpanded||g.key==="ArrowLeft"&&M.isExpanded)&&p(M.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),l(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),m(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Enter"&&!g.shiftKey&&!N){M&&(g.preventDefault(),r(M.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!N){M&&(g.preventDefault(),r(M.id,"above"));return}if(g.key==="Enter"&&N){M&&(g.preventDefault(),i(M.id));return}if(g.key==="F2"){M&&(g.preventDefault(),s(M.id));return}if(g.key==="Delete"||g.key==="Backspace"&&N){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&N&&!g.shiftKey){C.length>0&&(g.preventDefault(),n(C));return}},[d,t,k,y,r,o,n,l,m,c,s,p,i]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[d,b]),{setIsEditing:v}}function pl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(i=>{t(new Set([i])),r(i);},[]),n=react.useCallback(i=>{t(d=>{let u=new Set(d);return u.has(i)?u.delete(i):u.add(i),u}),r(i);},[]),l=react.useCallback((i,d)=>{if(!a){o(i);return}let u=d.indexOf(a),v=d.indexOf(i);if(u===-1||v===-1){o(i);return}let x=Math.min(u,v),k=Math.max(u,v),y=d.slice(x,k+1);t(new Set(y)),r(i);},[a,o]),m=react.useCallback((i,d,u,v)=>{v?l(i,d):u?n(i):o(i);},[o,n,l]),c=react.useCallback((i,d)=>{d?t(u=>{let v=new Set(u);return v.add(i),v}):o(i);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:m,handleKeyboardSelection:c,clearSelection:s,isTaskSelected:p}}function pr(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let m={...r[l],parentId:o,level:n,position:l};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function Gn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Gn(a.subtasks,t);if(r)return r}return null}function zn(e,t){if(t.length===0)return e;let a=pr(e),r=t[0],o=a.findIndex(i=>i.id===r);if(o<=0)return e;let n=a[o-1],l=(i,d)=>{let u=[];return {tasks:i.filter(x=>{if(d.has(x.id))return u.push(x),false;if(x.subtasks){let k=l(x.subtasks,d);x.subtasks=k.tasks,u.push(...k.removed);}return true}),removed:u}},m=(i,d,u)=>i.map(v=>v.id===d?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:m(v.subtasks,d,u)}:v),c=new Set(t),{tasks:s,removed:p}=l(e,c);return m(s,n.id,p)}function $n(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Gn(a,r);if(!o)continue;let n=Gn(a,o.id),l=(s,p,i)=>{for(let d=0;d<s.length;d++){let u=s[d];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(x=>x.id===i);if(v!==-1){let[x]=u.subtasks.splice(v,1);return x}}if(u.subtasks){let v=l(u.subtasks,p,i);if(v)return v}}return null},m=(s,p,i)=>{let d=s.findIndex(u=>u.id===p);if(d!==-1)return s.splice(d+1,0,i),s;for(let u of s)u.subtasks&&m(u.subtasks,p,i);return s},c=l(a,o.id,r);c&&(n&&n.subtasks?m(n.subtasks,o.id,c):m(a,o.id,c));}return a}function Hn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,m,c)=>{let s=l.findIndex(i=>i.id===m);if(s===-1){for(let i of l)if(i.subtasks&&n(i.subtasks,m,c))return true;return false}let p=c==="up"?s-1:s+1;return p<0||p>=l.length?false:([l[s],l[p]]=[l[p],l[s]],true)};return n(r,o,a),r}function Wn(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function _n(e,t){let a=[...e];for(let r of t){let o=l=>{let m=l.findIndex(p=>p.id===r);if(m===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let c=l[m],s={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?n(c.subtasks):void 0};return l.splice(m+1,0,s),true},n=l=>l.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function ul(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},m=c=>{let s=c.findIndex(i=>i.id===t);if(s===-1){for(let i of c)if(i.subtasks&&m(i.subtasks))return true;return false}let p=a==="above"?s:s+1;return c.splice(p,0,l),true};return m(r),{tasks:r,newTask:l}}function Vn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Vn(r.subtasks,t,a)}:r)}function jn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:jn(a.subtasks,t)}:a)}function Kn(e,t){let a=p=>{for(let i of p){if(i.id===t)return i;if(i.subtasks){let d=a(i.subtasks);if(d)return d}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,m=r?.endDate||n,c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(m),color:r?.color||"#3B82F6"},s=p=>p.map(i=>{if(i.id===t){let d=i.subtasks||[];return {...i,subtasks:[...d,c],isExpanded:true}}return i.subtasks?{...i,subtasks:s(i.subtasks)}:i});return {tasks:s(e),newTask:c}}function po({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:m,onTaskToggle:c,scrollTop:s,columns:p,onToggleColumn:i,onColumnResize:d,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:x,onTaskMove:k,onMultiTaskDelete:y,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:D,onCreateSubtask:h,onOpenTaskModal:f,onDeleteRequest:N}){let C=react.useContext(cr),[M,w]=react.useState(null),[B,H]=react.useState(false),[I,$]=react.useState(null),[S,z]=react.useState(""),V=react.useRef(null),ae=react.useRef(null),[ie,J]=react.useState(null),[R,O]=react.useState(0),[P,ue]=react.useState(0),[q,$e]=react.useState({isOpen:false,x:0,y:0,type:"header"});react.useEffect(()=>{function j(L){V.current&&!V.current.contains(L.target)&&H(false);}if(B)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[B]),react.useEffect(()=>{I&&ae.current&&(ae.current.focus(),ae.current.select());},[I]),react.useEffect(()=>{if(!ie)return;let j=Z=>{let He=Z.clientX-R,Ce=P+He;d?.(ie,Ce);},L=()=>{J(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",L),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",L),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,R,P,d]);let{selectedTaskIds:Oe,handleTaskClick:Ct,isTaskSelected:ve}=pl(),{setIsEditing:ut}=cl({tasks:e,selectedTaskIds:Oe,onTaskSelect:(j,L)=>{let He=pr(e).map(Ce=>Ce.id);Ct(j,He,L||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:k||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:j=>{let L=pr(e).find(Z=>Z.id===j);L&&Kt(L);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:j=>{let L=pr(e).find(Z=>Z.id===j);L&&f&&f(L);},enableKeyboard:true}),At=(j,L=0)=>{let Z=[];for(let He of j)Z.push({task:He,level:L}),He.subtasks&&He.subtasks.length>0&&He.isExpanded&&Z.push(...At(He.subtasks,L+1));return Z},ka=At(e),wa=48,ia=j=>!j.startDate||!j.endDate?"-":`${Math.ceil((j.endDate.getTime()-j.startDate.getTime())/(1e3*60*60*24))}d`,Kt=j=>{$(j.id),z(j.name),ut(true);},ga=j=>{S.trim()&&S!==e.find(L=>L.id===j)?.name&&D?.(j,S.trim()),$(null),z(""),ut(false);},Tt=()=>{$(null),z(""),ut(false);},la=(j,L)=>{L.stopPropagation(),h?.(j.id);},gt=(j,L,Z)=>{switch(j.id){case "name":let He=I===L.id,Ce=M===L.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[L.subtasks&&L.subtasks.length>0?jsxRuntime.jsx("button",{onClick:Y=>{Y.stopPropagation(),c?.(L.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:L.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:L.color||"#3B82F6",opacity:L.parentId?.6:1,borderColor:L.isMilestone?t.accent:"transparent",borderWidth:L.isMilestone?"2px":"0px"},title:L.isMilestone?"Milestone":L.parentId?"Subtask":"Task"}),He?jsxRuntime.jsx("input",{ref:ae,type:"text",value:S,onChange:Y=>z(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"?ga(L.id):Y.key==="Escape"&&Tt();},onBlur:()=>ga(L.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:Y=>Y.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Z===0?"14px":Z===1?"13px":"12px",fontWeight:L.isMilestone?600:L.subtasks&&L.subtasks.length>0?500:400,opacity:Z===0?1:Z===1?.95:.88},title:L.name,children:L.name}),Ce&&!He&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Y=>Y.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:Y=>la(L,Y),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:Y=>{Y.stopPropagation(),Kt(L);},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":let Ot=L.startDate?typeof L.startDate=="string"?L.startDate:L.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Ot||"",onChange:Y=>{u?.(L.id,{startDate:Y.target.value?new Date(Y.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let Ut=L.endDate?typeof L.endDate=="string"?L.endDate:L.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Ut||"",onChange:Y=>{u?.(L.id,{endDate:Y.target.value?new Date(Y.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:ia(L)})});case "assignees":let ye=r.filter(Y=>L.assignees?.some(le=>le.name===Y.name||le.initials===Y.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx(Ua,{assignedUsers:ye,availableUsers:r,onChange:Y=>{let le=Y.map(se=>({id:se.id,name:se.name,initials:se.initials,color:se.color}));u?.(L.id,{assignees:le.length>0?le:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx(bi,{status:L.status||"todo",onChange:Y=>{u?.(L.id,{status:Y,progress:Y==="completed"?100:L.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:`${L.progress}%`,backgroundColor:L.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:[L.progress,"%"]})]});case "priority":let fe={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},_t={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},K=fe[L.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsxRuntime.jsx(Ra,{priority:K,onChange:Y=>{Y&&u?.(L.id,{priority:_t[Y]||"medium"});}})});default:return null}},rt=j=>[{id:"hide",label:"Hide Column",icon:Ke.Hide,onClick:()=>i(j),disabled:j==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ke.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ke.SortDesc,onClick:()=>{}}],Yt=j=>j.subtasks&&j.subtasks.length>0?[{id:"addSubtask",label:C?.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{h?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:C?.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{N?N(j.id,j.name):y?.([j.id]);}}]:[{id:"edit",label:C?.contextMenu?.editTask||"Edit Task",icon:Ke.Pencil,onClick:()=>{l?.(j);}},{id:"addSubtask",label:C?.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{h?.(j.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:C?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ke.MarkIncomplete,onClick:()=>{u?.(j.id,{status:"todo",progress:0});},disabled:j.status==="todo"},{id:"setInProgress",label:C?.contextMenu?.setInProgress||"Set In Progress",icon:Ke.SetInProgress,onClick:()=>{u?.(j.id,{status:"in-progress"});},disabled:j.status==="in-progress"},{id:"markComplete",label:C?.contextMenu?.markComplete||"Mark Complete",icon:Ke.MarkComplete,onClick:()=>{u?.(j.id,{status:"completed",progress:100});},disabled:j.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:C?.contextMenu?.splitTask||"Split Task",icon:Ke.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:C?.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{N?N(j.id,j.name):y?.([j.id]);}}],Nt=p.filter(j=>j.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:`${wa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Nt.map((j,L)=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j.id==="name"?"justify-start":"justify-center"}`,style:{width:`${j.width}px`,minWidth:`${j.width}px`,maxWidth:`${j.width}px`,borderRight:L<Nt.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Z=>{Z.preventDefault(),$e({isOpen:true,x:Z.clientX,y:Z.clientY,type:"header",columnId:j.id});},onMouseEnter:Z=>{Z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Z=>{Z.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:j.label}),j.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:ie===j.id?t.accent:"transparent"},onMouseDown:Z=>{Z.preventDefault(),Z.stopPropagation(),J(j.id),O(Z.clientX),ue(j.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},j.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",style:{position:"sticky",right:0,backgroundColor:t.bgGrid,zIndex:15,flexShrink:0},children:[jsxRuntime.jsx(mo,{columns:p,onToggleColumn:i,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>H(!B),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"}),B&&jsxRuntime.jsxs("div",{ref:V,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:j=>j.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:()=>H(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:ka.map(({task:j,level:L},Z)=>{let He=ve(j.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${a}px`,borderLeft:He?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:He?t.accentLight:Z%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>w(j.id),onMouseLeave:()=>w(null),onClick:Ce=>{let Ut=pr(e).map(_t=>_t.id),fe=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ce.metaKey:Ce.ctrlKey;Ct(j.id,Ut,fe,Ce.shiftKey),n?.(j);},onDoubleClick:Ce=>{Ce.stopPropagation(),l?.(j);},onContextMenu:Ce=>{Ce.preventDefault(),$e({isOpen:true,x:Ce.clientX,y:Ce.clientY,type:"task",task:j}),m?.(j,Ce);},whileHover:{backgroundColor:He?t.accentLight:t.hoverBg},children:Nt.map((Ce,Ot)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ce.id==="name"?"justify-start":"justify-center"} ${Ot<Nt.length-1?"border-r":""}`,style:{width:`${Ce.width}px`,minWidth:`${Ce.width}px`,maxWidth:`${Ce.width}px`,borderColor:M===j.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:gt(Ce,j,Ce.id==="name"?L:0)},`${j.id}-${Ce.id}`))},j.id)})}),jsxRuntime.jsx(mr,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?rt(q.columnId):q.type==="task"&&q.task?Yt(q.task):[],onClose:()=>$e({...q,isOpen:false}),theme:t})]})}function fl(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,m]=react.useState(e),[c,s]=react.useState(t),[p,i]=react.useState(null),[d,u]=react.useState(null),[v,x]=react.useState(null),[k,y]=react.useState(null),[b,g]=react.useState(0),[D,h]=react.useState(0),[f,N]=react.useState(null),[C,M]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:m,ghostWidth:c,setGhostWidth:s,connectionLine:p,setConnectionLine:i,hoveredTaskId:d,setHoveredTaskId:u,activeZone:v,setActiveZone:x,draggedSegmentIndex:k,setDraggedSegmentIndex:y,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:D,setSegmentDragOffsetX:h,hoveredSegmentIndex:f,setHoveredSegmentIndex:N,isHovered:C,setIsHovered:M,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,S)=>{r("none"),i(null),u(null),m($),s(S),h(0),y(null),g(0);}}}function uo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:m,onClick:c,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:d,allTaskPositions:u=[],onDragMove:v}){let x=fl(t,r),k=react.useRef(null),{dragMode:y,setDragMode:b,dragOffset:g,setDragOffset:D,ghostX:h,setGhostX:f,ghostWidth:N,setGhostWidth:C,connectionLine:M,setConnectionLine:w,hoveredTaskId:B,setHoveredTaskId:H,activeZone:I,setActiveZone:$,draggedSegmentIndex:S,setDraggedSegmentIndex:z,draggedSegmentStartX:V,setDraggedSegmentStartX:ae,segmentDragOffsetX:ie,setSegmentDragOffsetX:J,hoveredSegmentIndex:R,setHoveredSegmentIndex:O,isHovered:P,setIsHovered:ue,isDragging:q,isResizing:$e,isConnecting:Oe,resetDragState:Ct}=x,ve=32,ut=8,At=e.endDate&&e.endDate<new Date&&e.progress<100,ka=e.isCriticalPath,wa=o.name==="neutral"||o.today==="#1C1917",ia=e.status==="completed"||e.progress===100,Kt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Tt=e.isCriticalPath||At?"#DC2626":e.color?e.color:e.priority&&Kt[e.priority]?Kt[e.priority]:o.taskBarPrimary,gt=(K=>K>=80?20:K>=60?15:K>=50?12:10)(r),rt=r<50,Yt=r<40,Nt=K=>K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),j=()=>{let K=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${K} day${K!==1?"s":""}`},L=K=>Math.round(K/n)*n,Z=K=>{let Y=Math.round(K/n),le=new Date(l);return le.setDate(le.getDate()+Y),le},He=(K,Y)=>{for(let le of u){if(le.id===e.id)continue;let se=5;if(K>=le.x-se&&K<=le.x+le.width+se&&Y>=le.y-se&&Y<=le.y+le.height+se)return le.id}return null},Ce=react.useCallback((K,Y,le)=>{K.preventDefault(),K.stopPropagation();let se=k.current?.ownerSVGElement;if(!se)return;let We=se.createSVGPoint();We.x=K.clientX,We.y=K.clientY;let ot=We.matrixTransform(se.getScreenCTM()?.inverse()),E=le!==void 0?le:t,_=Y;if(!_){let me=ot.x-E;K.shiftKey?(_="connect",w({x:t+r,y:a+ve/2})):K.ctrlKey||K.metaKey?_="move":K.altKey?_=me<r/2?"resize-start":"resize-end":Yt?me<r/2?_="move":_="resize-end":rt?me<=gt/2?_="resize-start":me>=r-gt/2?_="resize-end":_="move":me<=gt?_="resize-start":me>=r-gt?_="resize-end":_="move";}b(_),ue(false),$(null),_==="move"?D(ot.x-E):_==="connect"?w({x:t+r,y:a+ve/2}):D(0),f(E),C(r);},[t,r,a,ve]),Ot=react.useCallback(K=>{if(y==="none")return;let Y=k.current?.ownerSVGElement;if(!Y)return;let le=Y.createSVGPoint();le.x=K.clientX,le.y=K.clientY;let se=le.matrixTransform(Y.getScreenCTM()?.inverse());if(y==="connect"){w({x:se.x,y:se.y});let We=He(se.x,se.y);H(We);}else if(y==="move"){let We=se.x-g,ot=L(We);f(ot),C(r);let E=Math.round((ot-t)/n);if(v?.(e.id,E,true),e.segments&&e.segments.length>0&&S!==null){let _=ot-V;J(_);}}else if(y==="resize-start"){let We=se.x,ot=L(We),E=t+r-ot;E>=n&&(f(ot),C(E));}else if(y==="resize-end"){let We=se.x,E=L(We)-t;E>=n&&C(E);}},[y,t,r,n,g,e,L,S,V,He,H,w,f,C,J,v]),Ut=react.useCallback(()=>{if(y!=="none"){if(y==="connect")B&&d&&d(e,B),w(null),H(null);else {let K=e.endDate.getTime()-e.startDate.getTime(),Y,le,se=true;if(y==="move"){if(Y=Z(h),le=new Date(Y.getTime()+K),e.segments&&e.segments.length>0&&S!==null){let We=Math.round(ie/n),ot=e.segments.map((pe,Dt)=>{if(Dt===S){let Ja=new Date(pe.startDate),Za=new Date(pe.endDate);return Ja.setDate(Ja.getDate()+We),Za.setDate(Za.getDate()+We),{startDate:Ja,endDate:Za}}return pe}),E=ot.flatMap(pe=>[pe.startDate,pe.endDate]),_=new Date(Math.min(...E.map(pe=>pe.getTime()))),me=new Date(Math.max(...E.map(pe=>pe.getTime())));i?.({...e,segments:ot},_,me),Ct(t,r);return}}else y==="resize-start"?(Y=Z(h),le=e.endDate,Y>=le&&(console.warn("Invalid date range: start date must be before end date"),se=false)):y==="resize-end"?(Y=e.startDate,le=Z(h+N),le<=Y&&(console.warn("Invalid date range: end date must be after start date"),se=false)):se=false;se&&Y&&le&&(le.getTime()-Y.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):i?.(e,Y,le));}v?.(e.id,0,false),Ct(t,r);}},[y,h,N,e,i,B,d,t,r,n,Z,ie,S,Ct,v]);react.useEffect(()=>{if(y==="none")return;let K=le=>{Ot(le);},Y=()=>{Ut();};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",Y),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",Y);}},[y,Ot,Ut]);let ye=q&&!Oe?h:t,fe=q&&!Oe?N:r,_t=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!q&&ue(true),onMouseLeave:()=>{q||(ue(false),$(null));},onClick:()=>!q&&c?.(e),onDoubleClick:K=>{q||(K.stopPropagation(),s?.(e));},onContextMenu:K=>{K.preventDefault(),p?.(e,K);},children:[P&&!q&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:gt,height:ve,fill:I==="resize-start"?o.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:K=>Ce(K,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:a,width:r-gt*2,height:ve,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:K=>Ce(K,"move")}),jsxRuntime.jsx("rect",{x:t+r-gt,y:a,width:gt,height:ve,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:K=>Ce(K,"resize-end")})]}),P&&!q&&Yt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:K=>Ce(K,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:K=>Ce(K,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!Oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:N,height:ve,rx:ut,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:ye,y:a,width:fe,height:ve,rx:ut,fill:Tt,"data-task-class":_t,initial:{opacity:0,scale:.95},animate:{opacity:q&&!Oe?.15:e.parentId?.6:P?.9:.8,scale:P&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:K=>Ce(K),style:{cursor:q?Oe?"crosshair":$e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe*(e.progress/100),height:ve,rx:ut,fill:Tt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((K,Y)=>{let le=(K.startDate.getTime()-l.getTime())/864e5*n,We=(K.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-le+n,ot=q&&y==="move"&&S===Y,E=R===Y,_=ot?le+ie:le;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!q&&O(Y),onMouseLeave:()=>!q&&O(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:_,y:a,width:We,height:ve,rx:ut,fill:Tt,initial:{opacity:0,scale:.95},animate:{opacity:ot||e.parentId?.6:E?.9:.8,scale:E&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:me=>{me.stopPropagation(),z(Y),ae(le),Ce(me,void 0,le);},style:{cursor:q?Oe?"crosshair":$e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:_,y:a,width:We*(e.progress/100),height:ve,rx:ut,fill:Tt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Y}`)}),wa&&(At||ka)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ka&&!At&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe,height:ve,rx:ut,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),At&&jsxRuntime.jsx("rect",{x:ye,y:a,width:fe,height:ve,rx:ut,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),fe>60&&!e.segments&&(()=>{let K=m.taskLabel(e),Y=typeof K=="string"?K:e.name,le=Y.length>Math.floor(fe/8)?`${Y.substring(0,Math.floor(fe/8))}...`:Y;return jsxRuntime.jsx("text",{x:ye+12,y:a+ve/2,dominantBaseline:"middle",fill:ia?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ia?"line-through":"none"},children:le})})(),fe>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxRuntime.jsxs("text",{x:ye+fe-12,y:a+ve/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&&fe>80&&!q&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ye+fe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ye+fe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||$e)&&!Oe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?ye-15:ye-10,y:a-5,width:rt?25:20,height:ve+10,fill:"transparent",onMouseDown:K=>Ce(K,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ye-8:ye-3,y:a+6,width:rt?8:6,height:rt?ve-12:ve-16,rx:3,fill:y==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="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:ye+fe-10,y:a-5,width:rt?25:20,height:ve+10,fill:"transparent",onMouseDown:K=>Ce(K,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?ye+fe:ye+fe-3,y:a+6,width:rt?8:6,height:rt?ve-12:ve-16,rx:3,fill:y==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:y==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!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+ve/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(),Ce(K,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+ve/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Oe&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:M.x,y2:M.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(P||q)&&!Oe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ye-2,y:a-2,width:fe+4,height:ve+4,rx:ut+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"}}),$e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+N,y1:0,x2:h+N,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!q&&!e.segments&&(()=>{let le=a<100,se=le?a+ve+13:a-82-13,We=le?`M ${ye+fe/2-6} ${a+ve+3} L ${ye+fe/2} ${a+ve+13} L ${ye+fe/2+6} ${a+ve+3}`:`M ${ye+fe/2-6} ${a-13} L ${ye+fe/2} ${a-3} L ${ye+fe/2+6} ${a-13}`,ot=se+22,E=se+40,_=se+55,me=se+70,pe=le?se+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:le?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:le?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:We,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ye+fe/2-120,y:se,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:ye+fe/2,y:ot,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:ye+fe/2-110,y:E,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ye+fe/2-70,y:E,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.startDate)}),jsxRuntime.jsx("text",{x:ye+fe/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ye+fe/2-70,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.endDate)}),jsxRuntime.jsx("text",{x:ye+fe/2+10,y:E,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ye+fe/2+65,y:E,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:j()}),jsxRuntime.jsx("text",{x:ye+fe/2+10,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ye+fe/2+65,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:ye+fe/2-110,y:me,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ye+fe/2-50,y:me,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Dt=>Dt.name).join(", ").substring(0,30),e.assignees.map(Dt=>Dt.name).join(", ").length>30?"...":""]})]}),!le&&jsxRuntime.jsx("text",{x:ye+fe/2,y:pe,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":rt?"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 fo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,m]=react.useState(false),c=a-e,s=r-t,p=e+c/2,i=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,d=6,u=Math.atan2(s,c),v=a-d*Math.cos(u-Math.PI/6),x=r-d*Math.sin(u-Math.PI/6),k=a-d*Math.cos(u+Math.PI/6),y=r-d*Math.sin(u+Math.PI/6),b=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[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:b,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:l?1:.6,strokeWidth:l?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 ${v} ${x} M ${a} ${r} L ${k} ${y}`,fill:"none",stroke:b,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:l?1:.6,scale:l?1.1:1,strokeWidth:l?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:b,initial:{scale:0},animate:{scale:l?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),l&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:g=>{g.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:p,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:p-4,y1:(t+r)/2-4,x2:p+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:p+4,y1:(t+r)/2-4,x2:p-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function ho({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),m=16,c=s=>s.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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var X={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=s=>{s.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let l=new Set,m=new Set,c=s=>{if(!l.has(s)){l.add(s),m.add(s);let p=r.get(s)||[];for(let i of p){if(!l.has(i)&&c(i))return true;if(m.has(i))return true}}return m.delete(s),false};return c(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=X.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=X.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=X.findTaskById(e,o);if(n)a.unshift(n),o=n.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=X.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.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=X.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=X.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)=>X.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=X.findTaskById(e,t);return !a||!a.dependencies?[]:X.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>X.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>X.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=X.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>X.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,n=X.flattenTasks(e);if(n.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"]],m=n.map(c=>{let s=c.startDate&&c.endDate?X.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?X.formatDate(c.startDate):"N/A",c.endDate?X.formatDate(c.endDate):"N/A",s>0?`${s} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:l,body:m,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=X.flattenTasks(e).map(c=>{let s=c.startDate&&c.endDate?X.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?X.formatDate(c.startDate):"","End Date":c.endDate?X.formatDate(c.endDate):"","Duration (days)":s>0?s:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(p=>p.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),n=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}];n["!cols"]=l;let m=a.utils.book_new();a.utils.book_append_sheet(m,n,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=X.flattenTasks(e),o=new Map;r.forEach((d,u)=>{o.set(d.id,u+1);});let n=d=>d.toISOString().replace("Z",""),l=X.getEarliestStartDate(e)||new Date,m=X.getLatestEndDate(e)||new Date,c=r.map((d,u)=>{let v=o.get(d.id),x=d.startDate&&d.endDate?X.calculateDuration(d.startDate,d.endDate):0,k=(d.dependencies||[]).filter(y=>o.has(y)).map(y=>`
47
47
  <PredecessorLink>
48
- <PredecessorUID>${o.get(h)}</PredecessorUID>
48
+ <PredecessorUID>${o.get(y)}</PredecessorUID>
49
49
  <Type>1</Type>
50
50
  <CrossProject>0</CrossProject>
51
51
  <LinkLag>0</LinkLag>
@@ -53,37 +53,37 @@
53
53
  </PredecessorLink>`).join("");return `
54
54
  <Task>
55
55
  <UID>${v}</UID>
56
- <ID>${g+1}</ID>
57
- <Name>${i.name.replace(/[<>&'"]/g,h=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[h]||h)}</Name>
56
+ <ID>${u+1}</ID>
57
+ <Name>${d.name.replace(/[<>&'"]/g,y=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[y]||y)}</Name>
58
58
  <Type>0</Type>
59
59
  <IsNull>0</IsNull>
60
- <CreateDate>${s(new Date)}</CreateDate>
61
- <WBS>${g+1}</WBS>
62
- <OutlineNumber>${g+1}</OutlineNumber>
63
- <OutlineLevel>${i.level||0}</OutlineLevel>
60
+ <CreateDate>${n(new Date)}</CreateDate>
61
+ <WBS>${u+1}</WBS>
62
+ <OutlineNumber>${u+1}</OutlineNumber>
63
+ <OutlineLevel>${d.level||0}</OutlineLevel>
64
64
  <Priority>500</Priority>
65
- <Start>${i.startDate?s(i.startDate):""}</Start>
66
- <Finish>${i.endDate?s(i.endDate):""}</Finish>
67
- <Duration>PT${y*8}H0M0S</Duration>
65
+ <Start>${d.startDate?n(d.startDate):""}</Start>
66
+ <Finish>${d.endDate?n(d.endDate):""}</Finish>
67
+ <Duration>PT${x*8}H0M0S</Duration>
68
68
  <DurationFormat>7</DurationFormat>
69
- <Work>PT${y*8}H0M0S</Work>
70
- <Stop>${i.endDate?s(i.endDate):""}</Stop>
71
- <Resume>${i.startDate?s(i.startDate):""}</Resume>
69
+ <Work>PT${x*8}H0M0S</Work>
70
+ <Stop>${d.endDate?n(d.endDate):""}</Stop>
71
+ <Resume>${d.startDate?n(d.startDate):""}</Resume>
72
72
  <ResumeValid>0</ResumeValid>
73
73
  <EffortDriven>1</EffortDriven>
74
74
  <Recurring>0</Recurring>
75
75
  <OverAllocated>0</OverAllocated>
76
76
  <Estimated>0</Estimated>
77
- <Milestone>${i.isMilestone?"1":"0"}</Milestone>
78
- <Summary>${i.subtasks&&i.subtasks.length>0?"1":"0"}</Summary>
79
- <Critical>${i.isCriticalPath?"1":"0"}</Critical>
77
+ <Milestone>${d.isMilestone?"1":"0"}</Milestone>
78
+ <Summary>${d.subtasks&&d.subtasks.length>0?"1":"0"}</Summary>
79
+ <Critical>${d.isCriticalPath?"1":"0"}</Critical>
80
80
  <IsSubproject>0</IsSubproject>
81
81
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
82
82
  <ExternalTask>0</ExternalTask>
83
- <EarlyStart>${i.startDate?s(i.startDate):""}</EarlyStart>
84
- <EarlyFinish>${i.endDate?s(i.endDate):""}</EarlyFinish>
85
- <LateStart>${i.startDate?s(i.startDate):""}</LateStart>
86
- <LateFinish>${i.endDate?s(i.endDate):""}</LateFinish>
83
+ <EarlyStart>${d.startDate?n(d.startDate):""}</EarlyStart>
84
+ <EarlyFinish>${d.endDate?n(d.endDate):""}</EarlyFinish>
85
+ <LateStart>${d.startDate?n(d.startDate):""}</LateStart>
86
+ <LateFinish>${d.endDate?n(d.endDate):""}</LateFinish>
87
87
  <StartVariance>0</StartVariance>
88
88
  <FinishVariance>0</FinishVariance>
89
89
  <WorkVariance>0</WorkVariance>
@@ -91,22 +91,22 @@
91
91
  <TotalSlack>0</TotalSlack>
92
92
  <FixedCost>0</FixedCost>
93
93
  <FixedCostAccrual>3</FixedCostAccrual>
94
- <PercentComplete>${i.progress}</PercentComplete>
95
- <PercentWorkComplete>${i.progress}</PercentWorkComplete>
94
+ <PercentComplete>${d.progress}</PercentComplete>
95
+ <PercentWorkComplete>${d.progress}</PercentWorkComplete>
96
96
  <Cost>0</Cost>
97
97
  <OvertimeCost>0</OvertimeCost>
98
98
  <OvertimeWork>PT0H0M0S</OvertimeWork>
99
- <ActualStart>${i.progress>0&&i.startDate?s(i.startDate):""}</ActualStart>
100
- <ActualFinish>${i.progress===100&&i.endDate?s(i.endDate):""}</ActualFinish>
101
- <ActualDuration>PT${Math.round(y*i.progress/100)*8}H0M0S</ActualDuration>
99
+ <ActualStart>${d.progress>0&&d.startDate?n(d.startDate):""}</ActualStart>
100
+ <ActualFinish>${d.progress===100&&d.endDate?n(d.endDate):""}</ActualFinish>
101
+ <ActualDuration>PT${Math.round(x*d.progress/100)*8}H0M0S</ActualDuration>
102
102
  <ActualCost>0</ActualCost>
103
103
  <ActualOvertimeCost>0</ActualOvertimeCost>
104
- <ActualWork>PT${Math.round(y*i.progress/100)*8}H0M0S</ActualWork>
104
+ <ActualWork>PT${Math.round(x*d.progress/100)*8}H0M0S</ActualWork>
105
105
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
106
- <RegularWork>PT${y*8}H0M0S</RegularWork>
107
- <RemainingDuration>PT${Math.round(y*(100-i.progress)/100)*8}H0M0S</RemainingDuration>
106
+ <RegularWork>PT${x*8}H0M0S</RegularWork>
107
+ <RemainingDuration>PT${Math.round(x*(100-d.progress)/100)*8}H0M0S</RemainingDuration>
108
108
  <RemainingCost>0</RemainingCost>
109
- <RemainingWork>PT${Math.round(y*(100-i.progress)/100)*8}H0M0S</RemainingWork>
109
+ <RemainingWork>PT${Math.round(x*(100-d.progress)/100)*8}H0M0S</RemainingWork>
110
110
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
111
111
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
112
112
  <ACWP>0</ACWP>
@@ -125,17 +125,17 @@
125
125
  <PhysicalPercentComplete>0</PhysicalPercentComplete>
126
126
  <EarnedValueMethod>0</EarnedValueMethod>
127
127
  <IsPublished>1</IsPublished>
128
- <CommitmentType>0</CommitmentType>${x}
129
- </Task>`}).join(""),n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
128
+ <CommitmentType>0</CommitmentType>${k}
129
+ </Task>`}).join(""),s=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
130
130
  <Project xmlns="http://schemas.microsoft.com/project">
131
131
  <SaveVersion>14</SaveVersion>
132
- <Name>${t.replace(/[<>&'"]/g,i=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[i]||i)}</Name>
133
- <Title>${t.replace(/[<>&'"]/g,i=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[i]||i)}</Title>
134
- <CreationDate>${s(new Date)}</CreationDate>
135
- <LastSaved>${s(new Date)}</LastSaved>
132
+ <Name>${t.replace(/[<>&'"]/g,d=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[d]||d)}</Name>
133
+ <Title>${t.replace(/[<>&'"]/g,d=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[d]||d)}</Title>
134
+ <CreationDate>${n(new Date)}</CreationDate>
135
+ <LastSaved>${n(new Date)}</LastSaved>
136
136
  <ScheduleFromStart>1</ScheduleFromStart>
137
- <StartDate>${s(l)}</StartDate>
138
- <FinishDate>${s(m)}</FinishDate>
137
+ <StartDate>${n(l)}</StartDate>
138
+ <FinishDate>${n(m)}</FinishDate>
139
139
  <FYStartDate>1</FYStartDate>
140
140
  <CriticalSlackLimit>0</CriticalSlackLimit>
141
141
  <CurrencyDigits>2</CurrencyDigits>
@@ -172,13 +172,13 @@
172
172
  <MoveCompletedEndsForward>0</MoveCompletedEndsForward>
173
173
  <BaselineForEarnedValue>0</BaselineForEarnedValue>
174
174
  <AutoAddNewResourcesAndTasks>1</AutoAddNewResourcesAndTasks>
175
- <CurrentDate>${s(new Date)}</CurrentDate>
175
+ <CurrentDate>${n(new Date)}</CurrentDate>
176
176
  <MicrosoftProjectServerURL>1</MicrosoftProjectServerURL>
177
177
  <Autolink>1</Autolink>
178
178
  <NewTaskStartDate>0</NewTaskStartDate>
179
179
  <DefaultTaskEVMethod>0</DefaultTaskEVMethod>
180
180
  <ProjectExternallyEdited>0</ProjectExternallyEdited>
181
- <ExtendedCreationDate>${s(new Date)}</ExtendedCreationDate>
181
+ <ExtendedCreationDate>${n(new Date)}</ExtendedCreationDate>
182
182
  <ActualsInSync>0</ActualsInSync>
183
183
  <RemoveFileProperties>0</RemoveFileProperties>
184
184
  <AdminProject>0</AdminProject>
@@ -273,9 +273,9 @@
273
273
  </Calendars>
274
274
  <Tasks>${c}
275
275
  </Tasks>
276
- </Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Y.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 p=n.startDate&&n.endDate?Y.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let g of n.dependencies){let v=t.find(y=>y.id===g);if(v){o(v);let y=r.get(g)?.ef||0;d=Math.max(d,y);}}let i=d+p;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,m=n=>{if(l.has(n.id))return;let p=n.startDate&&n.endDate?Y.calculateDuration(n.startDate,n.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(d.length>0)for(let v of d){m(v);let y=l.get(v.id)?.ls||0;i=Math.min(i,y);}let g=i-p;l.set(n.id,{ls:g,lf:i});};a.forEach(m);let c=[];for(let n of a){let p=r.get(n.id),d=l.get(n.id);if(p&&d){let i=d.ls-p.es;Math.abs(i)<.01&&c.push(n.id);}}return c},calculateSlack:(e,t)=>{let a=Y.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Y.calculateCriticalPath(e).includes(t))return 0;let o=Y.getDependentTasks(e,t);if(o.length===0){let m=Y.getLatestEndDate(e);if(!m)return null;let c=Y.calculateDuration(a.endDate,m);return Math.max(0,c)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,c)=>m-c)[0];if(!s)return null;let l=Y.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>Y.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Y.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Y.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=Y.calculateDuration(l.startDate,l.endDate),c;a!==void 0?(c=new Date(l.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let n=Y.calculateEndDate(c,m),p=d=>d.map(i=>i.id===l.id?{...i,startDate:c,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=Y.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,m)=>{if(a===0)return [];let c=[],n=o.getTime(),p=1e3*60*60*24,d=Y.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(g,v,y=new Set)=>{if(y.has(g))return;y.add(g);let x=Y.getDependentTasks(e,g);for(let h of x){if(!h.startDate||!h.endDate)continue;let f=r.findIndex(U=>U.id===h.id);if(f===-1)continue;let u=h.startDate.getTime(),T=(h.endDate.getTime()-u)/p,D=(u-n)/p*s,k=D+v*s,S=Math.max(T*s,s),w=m+f*l+12;c.push({taskId:h.id,taskName:h.name,originalX:D,previewX:k,width:S,y:w,rowIndex:f,daysDelta:v,color:h.color}),i(h.id,v,y);}};return i(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Y.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:m}],n=p=>p.map(d=>d.id===o.id?{...d,endDate:m,segments:c}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function yo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:m,onTaskClick:c,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:g}){let[y,x]=react.useState([]),h=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),f=r==="day"?60:r==="week"?20:8,u=h*f*l,N=E=>{let z=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),q=z.getUTCDay()||7;z.setUTCDate(z.getUTCDate()+4-q);let ae=new Date(Date.UTC(z.getUTCFullYear(),0,1));return Math.ceil(((z.getTime()-ae.getTime())/864e5+1)/7)},T=E=>{let z=E.getDay();return z===0||z===6},b=react.useCallback(E=>{let z=Math.round(E/(f*l)),q=new Date(o);return q.setDate(q.getDate()+z),q},[o,f,l]),D=react.useCallback((E,z)=>{if(z.startDate&&z.endDate)return;let q=E.currentTarget.ownerSVGElement;if(!q)return;let ae=q.createSVGPoint();ae.x=E.clientX,ae.y=E.clientY;let ie=ae.matrixTransform(q.getScreenCTM()?.inverse()),J=b(ie.x),B=new Date(J);B.setDate(B.getDate()+1),d?.(z,J,B);},[b,d]),k=react.useMemo(()=>{let E=ie=>ie.map(J=>{if(J.subtasks&&J.subtasks.length>0){let B=E(J.subtasks),R=B.filter(M=>M.startDate&&M.endDate);if(R.length>0){let M=R.map(Oe=>Oe.startDate.getTime()),ue=R.map(Oe=>Oe.endDate.getTime()),X=new Date(Math.min(...M)),$e=new Date(Math.max(...ue));return {...J,subtasks:B,startDate:X,endDate:$e}}return {...J,subtasks:B}}return J}),z=(ie,J=[])=>{for(let B of ie)J.push(B),B.subtasks&&B.subtasks.length>0&&(B.isExpanded===void 0||B.isExpanded)&&z(B.subtasks,J);return J},q=E(e);return z(q)},[e]),S=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let z=E.startDate.getTime(),q=E.endDate.getTime(),ae=o.getTime(),ie=(z-ae)/(1e3*60*60*24),J=(q-z)/(1e3*60*60*24),B=ie*f*l,R=Math.max(f*l,40),M=Math.max(J*f*l,R);return {x:B,width:M}},[o,f,l]),w=react.useMemo(()=>k.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:z,width:q}=S(E),ie=k.findIndex(J=>J.id===E.id)*a+12;return {id:E.id,x:z,y:ie,width:q,height:32}}),[k,S]),U=react.useCallback((E,z,q)=>{if(!q||z===0){x([]);return}let ae=Y.calculateCascadePreview(e,E,z,k,o,f*l,a,48);x(ae);},[e,k,o,f,l,a,48]),W=react.useMemo(()=>{let E=[],z=new Date(o);for(;z<=s;){let ie=(z.getTime()-o.getTime())/864e5*f*l;if(r==="day")E.push({date:new Date(z),label:z.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:ie}),z.setDate(z.getDate()+1);else if(r==="week"){let J=N(z);E.push({date:new Date(z),label:`Week ${J}`,x:ie}),z.setDate(z.getDate()+7);}else E.push({date:new Date(z),label:z.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:ie}),z.setMonth(z.getMonth()+1);}return E},[o,s,r,f,l]),A=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*f*l,[o,f,l]),_=Math.max(k.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(u,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(u,1e3),height:48,fill:t.bgGrid}),W.map((E,z)=>jsxRuntime.jsxs("g",{children:[z>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},`header-${z}`)),A>=0&&A<=u&&jsxRuntime.jsx("circle",{cx:A,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(u,1e3),height:_,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(u,1e3),height:_,fill:t.bgPrimary}),W.map((E,z)=>{let q=W[z+1]?.x||u,ae=T(E.date);return jsxRuntime.jsxs("g",{children:[ae&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:q-E.x,height:k.length*a,fill:t.bgWeekend,opacity:1}),z>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:k.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},z)}),A>=0&&A<=u&&jsxRuntime.jsx("line",{x1:A,y1:0,x2:A,y2:k.length*a,stroke:t.today,strokeWidth:2,opacity:1}),k.map((E,z)=>{let q=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:z*a,width:u,height:a,fill:z%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:z*a,width:u,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ae=>D(ae,E),onMouseEnter:ae=>{ae.currentTarget.setAttribute("fill",t.accentLight),ae.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:ae=>{ae.currentTarget.setAttribute("fill","transparent"),ae.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:A>0?A:100,y:z*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),k.map((E,z)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(q=>{let ae=k.find(R=>R.id===q);if(!ae||!ae.startDate||!ae.endDate)return null;let ie=k.findIndex(R=>R.id===q),J=S(ae),B=S(E);return jsxRuntime.jsx(go,{x1:J.x+J.width,y1:ie*a+a/2,x2:B.x,y2:z*a+a/2,theme:t,onDelete:()=>g?.(E.id,q)},`dep-${q}-${E.id}`)})),k.map((E,z)=>{if(!E.startDate||!E.endDate)return null;let{x:q,width:ae}=S(E),ie=z*a+12,J=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(bo,{task:E,x:q+ae/2,y:ie+16,theme:t,onClick:c},E.id):J?jsxRuntime.jsxs("g",{onClick:()=>c?.(E),onContextMenu:B=>{B.preventDefault(),B.stopPropagation(),p?.(E,B);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:q,y:ie,width:ae,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:q,y1:ie,x2:q+ae,y2:ie,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:q,y1:ie,x2:q,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:q+ae,y1:ie,x2:q+ae,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:q,y1:ie+32,x2:q+ae,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),ae>60&&jsxRuntime.jsx("text",{x:q+12,y:ie+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(po,{task:E,x:q,y:ie,width:ae,theme:t,dayWidth:f*l,startDate:o,templates:m,onClick:c,onDoubleClick:n,onContextMenu:p,onDateChange:d,onDependencyCreate:i,allTaskPositions:w,onDragMove:U},E.id)}),y.map(E=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:E.previewX,y:E.y-48,width:E.width,height:32,rx:8,fill:E.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(E.daysDelta)>0&&jsxRuntime.jsx("text",{x:E.previewX+E.width/2,y:E.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:E.daysDelta>0?`+${E.daysDelta}d`:`${E.daysDelta}d`})]},`cascade-preview-${E.taskId}`))]})]})}var yl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function xl({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:yl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:yl.find(r=>r.value===e)?.name||"Personalizado"})]})}function xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:m=a?"edit":"create",theme:c="dark"}){let n=Ne[c]||Ne.dark,p={backgroundColor:n.bgSecondary,border:`1px solid ${n.borderLight}`,color:n.textPrimary},d={color:n.textSecondary},[i,g]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[v,y]=react.useState({});react.useEffect(()=>{g(a?{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||[]}:{name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[a,e]);let x=()=>{let u={};return i.name.trim()||(u.name="El nombre es requerido"),i.startDate&&i.endDate&&i.startDate>i.endDate&&(u.endDate="La fecha de fin debe ser posterior a la de inicio"),y(u),Object.keys(u).length===0},h=async u=>{if(u.preventDefault(),!!x())try{await s(i),t();}catch(N){console.error("Error submitting task:",N);}},f=(u,N)=>{g(T=>{let b={...T,[u]:N};if(u==="progress"){let D=typeof N=="number"?N:parseInt(N,10);D===100&&T.status!=="completed"?b.status="completed":D>0&&D<100&&T.status==="todo"?b.status="in-progress":D===0&&T.status!=="todo"&&(b.status="todo");}return b}),v[u]&&y(T=>{let b={...T};return delete b[u],b});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`},onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${n.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:n.textPrimary},children:m==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:n.textSecondary},onMouseEnter:u=>u.currentTarget.style.backgroundColor=n.hoverBg,onMouseLeave:u=>u.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:h,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:i.name,onChange:u=>f("name",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,onFocus:u=>u.currentTarget.style.borderColor=n.accent,onBlur:u=>u.currentTarget.style.borderColor=n.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l}),v.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),v.name]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),"Descripci\xF3n"]}),jsxRuntime.jsx("textarea",{value:i.description||"",onChange:u=>f("description",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none",style:p,onFocus:u=>u.currentTarget.style.borderColor=n.accent,onBlur:u=>u.currentTarget.style.borderColor=n.borderLight,placeholder:"Describe los detalles de la tarea...",rows:3,disabled:l})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:i.startDate?i.startDate.toISOString().split("T")[0]:"",onChange:u=>f("startDate",u.target.value?new Date(u.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:l||i.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:i.endDate?i.endDate.toISOString().split("T")[0]:"",onChange:u=>f("endDate",u.target.value?new Date(u.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:l||i.isMilestone}),v.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),v.endDate]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:i.status,onChange:u=>f("status",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:l,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:i.priority||"medium",onChange:u=>f("priority",u.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:p,disabled:l,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(xl,{value:i.color,onChange:u=>f("color",u),disabled:l}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:n.textTertiary},children:a?.parentId?"Esta subtarea hereda el color de su tarea padre":a?.subtasks&&a.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:i.progress<30?"#EF4444":i.progress<70?"#F59E0B":"#10B981",backgroundColor:i.progress<30?"rgba(239, 68, 68, 0.1)":i.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[i.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:i.progress,onChange:u=>f("progress",parseInt(u.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:n.bgSecondary,accentColor:i.progress<30?"#EF4444":i.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${i.progress}%`,backgroundColor:i.progress<30?"rgba(239, 68, 68, 0.3)":i.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:n.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>f("progress",u),disabled:l,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:i.progress===u?u<30?"#EF4444":u<70?"#F59E0B":"#10B981":n.bgSecondary,color:i.progress===u?"#FFFFFF":n.textSecondary,border:`1px solid ${i.progress===u?u<30?"#EF4444":u<70?"#F59E0B":"#10B981":n.borderLight}`},children:[u,"%"]},u))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:n.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:n.bgSecondary,border:`1px solid ${n.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:i.isMilestone,onChange:u=>f("isMilestone",u.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:n.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:n.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),o.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:n.bgSecondary,border:`1px solid ${n.borderLight}`},children:o.map(u=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=n.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:i.assignees?.some(N=>N.name===u.name),onChange:N=>{let T=N.target.checked?[...i.assignees||[],{id:u.id,name:u.name,avatar:u.avatar,initials:u.name.split(" ").map(b=>b[0]).join("").toUpperCase().slice(0,2),color:n.accent}]:(i.assignees||[]).filter(b=>b.name!==u.name);f("assignees",T);},className:"w-4 h-4 rounded",style:{accentColor:n.accent},disabled:l}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:n.accent},children:u.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n.textPrimary},children:u.name})]})]},u.id))})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:n.bgSecondary,border:`1px solid ${n.borderLight}`},children:r.filter(u=>u.id!==a?.id).map(u=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=n.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:i.dependencies?.includes(u.id),onChange:N=>{let T=N.target.checked?[...i.dependencies||[],u.id]:(i.dependencies||[]).filter(b=>b!==u.id);f("dependencies",T);},className:"w-4 h-4 rounded",style:{accentColor:n.accent},disabled:l}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:n.textPrimary},children:u.name})]},u.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${n.border}`,backgroundColor:n.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:n.textSecondary},onMouseEnter:u=>{u.currentTarget.style.color=n.textPrimary,u.currentTarget.style.backgroundColor=n.hoverBg;},onMouseLeave:u=>{u.currentTarget.style.color=n.textSecondary,u.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:h,disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:n.accent,color:"#FFFFFF"},onMouseEnter:u=>!l&&(u.currentTarget.style.backgroundColor=n.accentHover),onMouseLeave:u=>!l&&(u.currentTarget.style.backgroundColor=n.accent),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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var ag=['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"'],Sl=()=>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"})]}),rg=()=>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"})}),og=()=>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"})}),ng=()=>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"})}),sg=()=>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 ko({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:m,onDependencyDelete:c}){let[n,p]=react.useState(false),[d,i]=react.useState(false),[g,v]=react.useState([]),[y,x]=react.useState(""),[h,f]=react.useState(false),[u,N]=react.useState(true),T=react.useRef(null),b=react.useRef(null),D=react.useRef(null),{enabled:k=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:w="bottom-right",onCommand:U,suggestions:W=ag,maxHistory:A=50,persistHistory:_}=a,E=_?.storageKey||"gantt-ai-history",z=_?.maxMessages??5;react.useEffect(()=>{if(_?.enabled)try{let R=localStorage.getItem(E);if(R){let ue=JSON.parse(R).map(X=>({...X,timestamp:new Date(X.timestamp)}));v(ue.slice(-z));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[_?.enabled,E,z]),react.useEffect(()=>{if(_?.enabled&&g.length>0)try{let R=g.filter(M=>!M.isLoading).slice(-z);localStorage.setItem(E,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[g,_?.enabled,E,z]),react.useEffect(()=>{b.current&&b.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{n&&!d&&T.current&&setTimeout(()=>T.current?.focus(),100);},[n,d]);let q=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&l?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&c?.(R.taskId,R.dependencyFrom);break}},[o,s,l,m,c]),ae=react.useCallback(async R=>{if(!R.trim()||h)return;let M={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};v(X=>[...X.slice(-(A-1)),M]),x(""),N(false),f(true);let ue={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(X=>[...X,ue]);try{if(U){let X=await U(R,e);v($e=>{let Oe=$e.filter(ve=>!ve.isLoading),Ct={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...Oe,Ct]}),q(X);}else v(X=>[...X.filter(Oe=>!Oe.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(X){v($e=>[...$e.filter(Ct=>!Ct.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[h,A,U,e,q]),ie=R=>{R.preventDefault(),ae(y);},J=R=>{x(R),T.current?.focus();};if(react.useEffect(()=>{let R=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(ue=>!ue),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n]),react.useEffect(()=>{if(!n)return;let R=ue=>{let X=ue.target;D.current&&!D.current.contains(X)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",R);}},[n]),!k)return null;let B={"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(Be,{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 ${B[w]} 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:()=>p(true),children:[jsxRuntime.jsx(Sl,{}),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:D,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 ${B[w]} 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(Sl,{}),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(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ng,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(og,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&u&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,M)=>jsxRuntime.jsx("button",{onClick:()=>J(R),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:R.length>30?R.slice(0,30)+"...":R},M))})]}),g.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(sg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:b})]}),jsxRuntime.jsxs("form",{onSubmit:ie,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:T,type:"text",value:y,onChange:R=>x(R.target.value),placeholder:S,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!y.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:y.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:y.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(rg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function El(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!p)return {...d,present:i};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:i,future:[]}});},[t]),l=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=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:p,future:[n.present,...n.future]}});},[]),m=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:d}});},[]),c=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Pl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=m?l.metaKey:l.ctrlKey;if(c&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&c&&l.key==="y"){l.preventDefault(),t();return}if(m&&c&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var cg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Y.formatDate(e.startDate)} - ${Y.formatDate(e.endDate)}`);let a=Y.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=>Y.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ml(e){return {...cg,...e}}var hg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},Fl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:m="comfortable",showThemeSelector:c=true,showExportButton:n=true,availableUsers:p=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:g,locale:v="en",customTranslations:y,showCreateTaskButton:x=false,createTaskLabel:h,onCreateTask:f,onThemeChange:u,onTaskClick:N,onTaskDblClick:T,onTaskContextMenu:b,onTaskUpdate:D,onProgressChange:k,onTaskEdit:S,onTaskAddSubtask:w,onTaskMarkIncomplete:U,onTaskSetInProgress:W,onDependencyCreate:A,onDependencyDelete:_,onBeforeTaskAdd:E,onAfterTaskAdd:z,onBeforeTaskUpdate:q,onAfterTaskUpdate:ae,onBeforeTaskDelete:ie,onAfterTaskDelete:J}=a,R=react.useContext(so)?.theme,[M,ue]=react.useState(R||s||"dark"),[X,$e]=react.useState(l),[Oe,Ct]=react.useState(m),[ve,ut]=react.useState(1),[It,ka]=react.useState(0),[wa,ia]=react.useState(false),[Kt,ga]=react.useState(null),[Tt,la]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,rt]=react.useState(null),[Yt,Nt]=react.useState(null);react.useEffect(()=>{R&&R!==M&&ue(R);},[R]),react.useEffect(()=>{s&&s!==M&&ue(s);},[s]);let V=react.useCallback(C=>{ue(C),u?.(C);},[u]),{state:L,setState:Z,undo:He,redo:Ce,canUndo:Rt,canRedo:Ot,clearHistory:ye}=El(t,50);react.useEffect(()=>{Z(t);},[t,Z]);let fe=react.useRef(t),Wt=react.useRef(true);react.useEffect(()=>{if(Wt.current){Wt.current=false,fe.current=L;return}if(!r)return;let C=JSON.stringify(fe.current),F=JSON.stringify(L);C!==F&&(fe.current=L,r(L));},[L,r]);let j=react.useMemo(()=>Ln(v,y),[v,y]),K=react.useCallback(C=>[{id:"name",label:C.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:C.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:C.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:C.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:C.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:C.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:C.columns.progress,width:120,visible:false,sortable:true},{id:"priority",label:C.columns.priority,width:90,visible:false,sortable:true}],[]),[le,se]=react.useState(()=>K(j));react.useEffect(()=>{se(C=>C.map(F=>({...F,label:j.columns[F.id==="name"?"taskName":F.id]||F.label})));},[j]);let We=react.useMemo(()=>le.filter(C=>C.visible).reduce((C,F)=>C+F.width,0)+60,[le]),ot=Kt||We,P=react.useRef(null),H=react.useRef(null),me=react.useRef(null),pe=react.useMemo(()=>_i(M),[M]),Dt=react.useMemo(()=>({theme:pe,themeName:M}),[pe,M]),Xa=react.useMemo(()=>Ml(d),[d]),qa=react.useMemo(()=>{if(!i)return L;let C=Y.calculateCriticalPath(L),F=$=>$.map(te=>({...te,isCriticalPath:C.includes(te.id),subtasks:te.subtasks?F(te.subtasks):void 0}));return F(L)},[L,i]),Wr=hg(Oe);Pl({undo:He,redo:Ce,canUndo:Rt,canRedo:Ot,enabled:true}),react.useImperativeHandle(o,()=>({getTask:C=>Y.findTaskById(L,C),addTask:(C,F)=>{Z($=>{if(!F)return [...$,{...C,level:0}];let te=oe=>oe.map(de=>de.id===F?{...de,subtasks:[...de.subtasks||[],{...C,parentId:F,level:(de.level||0)+1}],isExpanded:true}:de.subtasks?{...de,subtasks:te(de.subtasks)}:de);return te($)});},updateTask:(C,F)=>{Z($=>{let te=oe=>oe.map(de=>de.id===C?{...de,...F}:de.subtasks?{...de,subtasks:te(de.subtasks)}:de);return te($)});},deleteTask:C=>{Z(F=>{let $=te=>te.filter(oe=>oe.id===C?false:(oe.subtasks&&(oe.subtasks=$(oe.subtasks)),true));return $(F)});},deleteTasks:C=>{Z(F=>$n(F,C));},duplicateTask:C=>{Z(F=>Hn(F,[C]));},splitTask:(C,F,$=3)=>{Z(te=>Y.splitTask(te,C,F,$));},calculateEndDate:Y.calculateEndDate,calculateDuration:Y.calculateDuration,validateDependency:(C,F)=>!Y.validateDependencies(L,C,F),getAllTasks:()=>Y.flattenTasks(L),getTasksByStatus:C=>Y.flattenTasks(L).filter(F=>F.status===C),getTasksByParent:C=>C?Y.findTaskById(L,C)?.subtasks||[]:L.filter($=>!$.parentId),getCriticalPath:()=>Y.flattenTasks(L).filter(C=>C.isCriticalPath),indentTask:C=>{Z(F=>Gn(F,[C]));},outdentTask:C=>{Z(F=>Un(F,[C]));},moveTask:(C,F)=>{Z($=>zn($,[C],F));},createSubtask:async C=>{let{tasks:F,newTask:$}=Vn(L,C);if(E){let te=E({...$,parentId:C});if((te instanceof Promise?await te:te)===false)return}Z(F),z&&z({...$,parentId:C});},scrollToTask:C=>{let $=Y.flattenTasks(L).findIndex(te=>te.id===C);if($!==-1&&P.current){let te=$*Wr;P.current.scrollTo({top:te,behavior:"smooth"}),H.current&&H.current.scrollTo({top:te,behavior:"smooth"});}},highlightTask:(C,F=2e3)=>{},expandTask:C=>{Z(F=>{let $=te=>te.map(oe=>oe.id===C?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:$(oe.subtasks)}:oe);return $(F)});},collapseTask:C=>{Z(F=>{let $=te=>te.map(oe=>oe.id===C?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:$(oe.subtasks)}:oe);return $(F)});},expandAll:()=>{Z(C=>{let F=$=>$.map(te=>({...te,isExpanded:true,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(C)});},collapseAll:()=>{Z(C=>{let F=$=>$.map(te=>({...te,isExpanded:false,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(C)});},undo:He,redo:Ce,canUndo:()=>Rt,canRedo:()=>Ot,clearHistory:ye,exportToPNG:async()=>{if(!me.current)throw new Error("Gantt container not found");let C=await Al__default.default(me.current,{backgroundColor:pe.bgPrimary,scale:2});return new Promise((F,$)=>{C.toBlob(te=>{te?F(te):$(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async C=>{await Y.exportToPDF(L,C);},exportToExcel:async C=>{await Y.exportToExcel(L,C);},exportToJSON:()=>Y.exportToJSON(L),exportToCSV:()=>Y.exportToCSV(L),importFromJSON:C=>{let F=Y.importFromJSON(C);Z(F);},getTasks:()=>L,refresh:()=>{Z(C=>[...C]);},clearAll:()=>{Z([]);}}),[L,He,Ce,Rt,Ot,ye,pe,Wr]);let Vd=react.useCallback(C=>{se(F=>F.map($=>$.id===C?{...$,visible:!$.visible}:$));},[]),jd=react.useCallback((C,F)=>{se($=>$.map(te=>{if(te.id!==C)return te;let oe=te.minWidth??100,de=te.maxWidth??800,it=Math.max(oe,Math.min(de,F));return {...te,width:it}}));},[]),Kd=react.useCallback(C=>{Z(F=>_n(F,C)),a.onTaskToggleExpand?.(C);},[a]),Ja=react.useCallback((C,F)=>{if(q&&q(C,F)===false)return;let te=Y.findTaskById(L,C)?.progress,oe=it=>it.map(kt=>kt.id===C?{...kt,...F}:kt.subtasks?{...kt,subtasks:oe(kt.subtasks)}:kt);Z(oe(L));let de=Y.findTaskById(oe(L),C);de&&(D?.(de),ae?.(de),F.progress!==void 0&&te!==void 0&&F.progress!==te&&k?.(C,te,F.progress));},[L,D,q,ae,k]),Yd=react.useCallback(C=>{C.length!==0&&(Z(F=>Gn(F,C)),a.onTaskIndent?.(C[0]));},[a]),Xd=react.useCallback(C=>{C.length!==0&&(Z(F=>Un(F,C)),a.onTaskOutdent?.(C[0]));},[a]),qd=react.useCallback((C,F)=>{C.length!==0&&(Z($=>zn($,C,F)),a.onTaskMove?.(C[0],F));},[a]),Uo=react.useCallback(async C=>{let F=[];for(let $ of C)ie&&await Promise.resolve(ie($))===false||F.push($);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Z($=>$n($,F)),F.forEach($=>a.onTaskDelete?.($))),J&&F.forEach($=>J($)));},[a,ie,J]),Jd=react.useCallback(C=>{Z(F=>Hn(F,C)),C.forEach(F=>a.onTaskDuplicate?.(F));},[a]),Zd=react.useCallback((C,F)=>{Z($=>{let{tasks:te,newTask:oe}=ll($,C,F);return E&&E(oe)===false?$:(a.onTaskCreate?.(oe.parentId,oe.position||0),z?.(oe),te)});},[a,E,z]),Qd=react.useCallback((C,F)=>{Z($=>Wn($,C,F)),a.onTaskRename?.(C,F);},[a]),zo=react.useCallback(C=>{Z(F=>{let{tasks:$}=Vn(F,C);return a.onTaskCreate?.(C,0),$});},[a]),ec=react.useCallback((C,F,$)=>{let te=C.startDate?Math.round((F.getTime()-C.startDate.getTime())/864e5):0,oe=kt=>kt.map(Xt=>Xt.id===C.id?{...Xt,startDate:F,endDate:$,...C.segments&&{segments:C.segments}}:Xt.subtasks?{...Xt,subtasks:oe(Xt.subtasks)}:Xt),de=oe(L);de=Y.autoScheduleDependents(de,C.id,te),Z(de);let it={...C,startDate:F,endDate:$};D?.(it);},[L,D]),tc=react.useCallback((C,F)=>{b?.(C,F),la({isOpen:true,x:F.clientX,y:F.clientY,task:C});},[b]),ac=react.useCallback((C,F)=>{let $=Y.splitTask(L,C.id,F);Z($),la({isOpen:false,x:0,y:0,task:null});},[L]),Hs=react.useCallback(C=>{T?.(C),S||rt(C);},[T,S]),Ws=react.useCallback((C,F,$)=>{let te=new Map,oe=qt=>{qt.forEach(fa=>{fa.dependencies&&te.set(fa.id,fa.dependencies),fa.subtasks&&oe(fa.subtasks);});};oe($);let de=te.get(F)||[];te.set(F,[...de,C]);let it=new Set,kt=new Set,Xt=qt=>{if(!it.has(qt)){it.add(qt),kt.add(qt);let fa=te.get(qt)||[];for(let hr of fa){if(!it.has(hr)&&Xt(hr))return true;if(kt.has(hr))return true}}return kt.delete(qt),false};return Xt(F)},[]),_s=react.useCallback((C,F)=>{if(Ws(C.id,F,L)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,p=new Blob([s],{type:"application/xml;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(p),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=X.flattenTasks(e),a=t.filter(s=>s.startDate&&s.endDate);if(a.length===0)return [];let r=new Map,o=s=>{if(r.has(s.id))return;let p=s.startDate&&s.endDate?X.calculateDuration(s.startDate,s.endDate):0,i=0;if(s.dependencies&&s.dependencies.length>0)for(let u of s.dependencies){let v=t.find(x=>x.id===u);if(v){o(v);let x=r.get(u)?.ef||0;i=Math.max(i,x);}}let d=i+p;r.set(s.id,{es:i,ef:d});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),l=new Map,m=s=>{if(l.has(s.id))return;let p=s.startDate&&s.endDate?X.calculateDuration(s.startDate,s.endDate):0,i=t.filter(v=>v.dependencies&&v.dependencies.includes(s.id)),d=n;if(i.length>0)for(let v of i){m(v);let x=l.get(v.id)?.ls||0;d=Math.min(d,x);}let u=d-p;l.set(s.id,{ls:u,lf:d});};a.forEach(m);let c=[];for(let s of a){let p=r.get(s.id),i=l.get(s.id);if(p&&i){let d=i.ls-p.es;Math.abs(d)<.01&&c.push(s.id);}}return c},calculateSlack:(e,t)=>{let a=X.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(X.calculateCriticalPath(e).includes(t))return 0;let o=X.getDependentTasks(e,t);if(o.length===0){let m=X.getLatestEndDate(e);if(!m)return null;let c=X.calculateDuration(a.endDate,m);return Math.max(0,c)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,c)=>m-c)[0];if(!n)return null;let l=X.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>X.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=X.findTaskById(e,t);if(!r||!r.endDate)return e;let o=X.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let m=X.calculateDuration(l.startDate,l.endDate),c;a!==void 0?(c=new Date(l.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let s=X.calculateEndDate(c,m),p=i=>i.map(d=>d.id===l.id?{...d,startDate:c,endDate:s}:d.subtasks?{...d,subtasks:p(d.subtasks)}:d);n=p(n),n=X.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,m)=>{if(a===0)return [];let c=[],s=o.getTime(),p=1e3*60*60*24,i=X.findTaskById(e,t);if(!i||!i.endDate)return [];let d=(u,v,x=new Set)=>{if(x.has(u))return;x.add(u);let k=X.getDependentTasks(e,u);for(let y of k){if(!y.startDate||!y.endDate)continue;let b=r.findIndex(B=>B.id===y.id);if(b===-1)continue;let g=y.startDate.getTime(),h=(y.endDate.getTime()-g)/p,N=(g-s)/p*n,C=N+v*n,M=Math.max(h*n,n),w=m+b*l+12;c.push({taskId:y.id,taskName:y.name,originalX:N,previewX:C,width:M,y:w,rowIndex:b,daysDelta:v,color:y.color}),d(y.id,v,x);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let o=X.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 n=new Date(a);n.setDate(n.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:m}],s=p=>p.map(i=>i.id===o.id?{...i,endDate:m,segments:c}:i.subtasks?{...i,subtasks:s(i.subtasks)}:i);return s(e)}};function xo({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:m,onTaskClick:c,onTaskDblClick:s,onTaskContextMenu:p,onTaskDateChange:i,onDependencyCreate:d,onDependencyDelete:u}){let[x,k]=react.useState([]),y=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),b=r==="day"?60:r==="week"?20:8,g=y*b*l,D=S=>{let z=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),V=z.getUTCDay()||7;z.setUTCDate(z.getUTCDate()+4-V);let ae=new Date(Date.UTC(z.getUTCFullYear(),0,1));return Math.ceil(((z.getTime()-ae.getTime())/864e5+1)/7)},h=S=>{let z=S.getDay();return z===0||z===6},f=react.useCallback(S=>{let z=Math.round(S/(b*l)),V=new Date(o);return V.setDate(V.getDate()+z),V},[o,b,l]),N=react.useCallback((S,z)=>{if(z.startDate&&z.endDate)return;let V=S.currentTarget.ownerSVGElement;if(!V)return;let ae=V.createSVGPoint();ae.x=S.clientX,ae.y=S.clientY;let ie=ae.matrixTransform(V.getScreenCTM()?.inverse()),J=f(ie.x),R=new Date(J);R.setDate(R.getDate()+1),i?.(z,J,R);},[f,i]),C=react.useMemo(()=>{let S=ie=>ie.map(J=>{if(J.subtasks&&J.subtasks.length>0){let R=S(J.subtasks),O=R.filter(P=>P.startDate&&P.endDate);if(O.length>0){let P=O.map(Oe=>Oe.startDate.getTime()),ue=O.map(Oe=>Oe.endDate.getTime()),q=new Date(Math.min(...P)),$e=new Date(Math.max(...ue));return {...J,subtasks:R,startDate:q,endDate:$e}}return {...J,subtasks:R}}return J}),z=(ie,J=[])=>{for(let R of ie)J.push(R),R.subtasks&&R.subtasks.length>0&&(R.isExpanded===void 0||R.isExpanded)&&z(R.subtasks,J);return J},V=S(e);return z(V)},[e]),M=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let z=S.startDate.getTime(),V=S.endDate.getTime(),ae=o.getTime(),ie=(z-ae)/(1e3*60*60*24),J=(V-z)/(1e3*60*60*24),R=ie*b*l,O=Math.max(b*l,40),P=Math.max(J*b*l,O);return {x:R,width:P}},[o,b,l]),w=react.useMemo(()=>C.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:z,width:V}=M(S),ie=C.findIndex(J=>J.id===S.id)*a+12;return {id:S.id,x:z,y:ie,width:V,height:32}}),[C,M]),B=react.useCallback((S,z,V)=>{if(!V||z===0){k([]);return}let ae=X.calculateCascadePreview(e,S,z,C,o,b*l,a,48);k(ae);},[e,C,o,b,l,a,48]),H=react.useMemo(()=>{let S=[],z=new Date(o);for(;z<=n;){let ie=(z.getTime()-o.getTime())/864e5*b*l;if(r==="day")S.push({date:new Date(z),label:z.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:ie}),z.setDate(z.getDate()+1);else if(r==="week"){let J=D(z);S.push({date:new Date(z),label:`Week ${J}`,x:ie}),z.setDate(z.getDate()+7);}else S.push({date:new Date(z),label:z.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:ie}),z.setMonth(z.getMonth()+1);}return S},[o,n,r,b,l]),I=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*b*l,[o,b,l]),$=Math.max(C.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(g,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(g,1e3),height:48,fill:t.bgGrid}),H.map((S,z)=>jsxRuntime.jsxs("g",{children:[z>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${z}`)),I>=0&&I<=g&&jsxRuntime.jsx("circle",{cx:I,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(g,1e3),height:$,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(g,1e3),height:$,fill:t.bgPrimary}),H.map((S,z)=>{let V=H[z+1]?.x||g,ae=h(S.date);return jsxRuntime.jsxs("g",{children:[ae&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:V-S.x,height:C.length*a,fill:t.bgWeekend,opacity:1}),z>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:C.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},z)}),I>=0&&I<=g&&jsxRuntime.jsx("line",{x1:I,y1:0,x2:I,y2:C.length*a,stroke:t.today,strokeWidth:2,opacity:1}),C.map((S,z)=>{let V=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:z*a,width:g,height:a,fill:z%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!V&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:z*a,width:g,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ae=>N(ae,S),onMouseEnter:ae=>{ae.currentTarget.setAttribute("fill",t.accentLight),ae.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:ae=>{ae.currentTarget.setAttribute("fill","transparent"),ae.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:I>0?I:100,y:z*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${S.id}`)]})]},`row-group-${S.id}`)}),C.map((S,z)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(V=>{let ae=C.find(O=>O.id===V);if(!ae||!ae.startDate||!ae.endDate)return null;let ie=C.findIndex(O=>O.id===V),J=M(ae),R=M(S);return jsxRuntime.jsx(fo,{x1:J.x+J.width,y1:ie*a+a/2,x2:R.x,y2:z*a+a/2,theme:t,onDelete:()=>u?.(S.id,V)},`dep-${V}-${S.id}`)})),C.map((S,z)=>{if(!S.startDate||!S.endDate)return null;let{x:V,width:ae}=M(S),ie=z*a+12,J=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(ho,{task:S,x:V+ae/2,y:ie+16,theme:t,onClick:c},S.id):J?jsxRuntime.jsxs("g",{onClick:()=>c?.(S),onContextMenu:R=>{R.preventDefault(),R.stopPropagation(),p?.(S,R);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:V,y:ie,width:ae,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:V,y1:ie,x2:V+ae,y2:ie,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:ie,x2:V,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V+ae,y1:ie,x2:V+ae,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:V,y1:ie+32,x2:V+ae,y2:ie+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),ae>60&&jsxRuntime.jsx("text",{x:V+12,y:ie+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(uo,{task:S,x:V,y:ie,width:ae,theme:t,dayWidth:b*l,startDate:o,templates:m,onClick:c,onDoubleClick:s,onContextMenu:p,onDateChange:i,onDependencyCreate:d,allTaskPositions:w,onDragMove:B},S.id)}),x.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`))]})]})}var yl=[{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:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function xl({value:e="#6366F1",onChange:t,disabled:a=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:yl.map(r=>{let o=e===r.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!a&&t(r.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:r.value,boxShadow:o?`0 0 0 2px #FFFFFF, 0 0 0 4px ${r.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:a?.5:1,cursor:a?"not-allowed":"pointer"},whileHover:a?{}:{scale:1.1},whileTap:a?{}:{scale:.95},title:r.name,disabled:a,children:o&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},r.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:yl.find(r=>r.value===e)?.name||"Personalizado"})]})}var Dl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}];function ko({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:m=a?"edit":"create",theme:c="dark",customStatuses:s=[]}){let p=[...Dl,...s.filter(h=>!Dl.some(f=>f.id===h.id))],i=Ne[c]||Ne.dark,d={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},u={color:i.textSecondary},[v,x]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[k,y]=react.useState({});react.useEffect(()=>{x(a?{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||[]}:{name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[a,e]);let b=()=>{let h={};return v.name.trim()||(h.name="El nombre es requerido"),v.startDate&&v.endDate&&v.startDate>v.endDate&&(h.endDate="La fecha de fin debe ser posterior a la de inicio"),y(h),Object.keys(h).length===0},g=async h=>{if(h.preventDefault(),!!b())try{await n(v),t();}catch(f){console.error("Error submitting task:",f);}},D=(h,f)=>{x(N=>{let C={...N,[h]:f};if(h==="progress"){let M=typeof f=="number"?f:parseInt(f,10);M===100&&N.status!=="completed"?C.status="completed":M>0&&M<100&&N.status==="todo"?C.status="in-progress":M===0&&N.status!=="todo"&&(C.status="todo");}return C}),k[h]&&y(N=>{let C={...N};return delete C[h],C});};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/50 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:.2,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-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:m==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:h=>h.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:h=>h.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:g,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:u,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:v.name,onChange:h=>D("name",h.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:d,onFocus:h=>h.currentTarget.style.borderColor=i.accent,onBlur:h=>h.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l}),k.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),k.name]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),"Descripci\xF3n"]}),jsxRuntime.jsx("textarea",{value:v.description||"",onChange:h=>D("description",h.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent resize-none",style:d,onFocus:h=>h.currentTarget.style.borderColor=i.accent,onBlur:h=>h.currentTarget.style.borderColor=i.borderLight,placeholder:"Describe los detalles de la tarea...",rows:3,disabled:l})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:v.startDate?v.startDate.toISOString().split("T")[0]:"",onChange:h=>D("startDate",h.target.value?new Date(h.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:d,disabled:l||v.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:v.endDate?v.endDate.toISOString().split("T")[0]:"",onChange:h=>D("endDate",h.target.value?new Date(h.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:d,disabled:l||v.isMilestone}),k.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),k.endDate]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsx("select",{value:v.status,onChange:h=>D("status",h.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:d,disabled:l,children:p.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.title},h.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),"Prioridad"]}),jsxRuntime.jsxs("select",{value:v.priority||"medium",onChange:h=>D("priority",h.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:d,disabled:l,children:[jsxRuntime.jsx("option",{value:"low",children:"\u{1F7E2} Baja"}),jsxRuntime.jsx("option",{value:"medium",children:"\u{1F7E1} Media"}),jsxRuntime.jsx("option",{value:"high",children:"\u{1F7E0} Alta"}),jsxRuntime.jsx("option",{value:"urgent",children:"\u{1F534} Urgente"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(xl,{value:v.color,onChange:h=>D("color",h),disabled:l}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:a?.parentId?"Esta subtarea hereda el color de su tarea padre":a?.subtasks&&a.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:u,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981",backgroundColor:v.progress<30?"rgba(239, 68, 68, 0.1)":v.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[v.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:v.progress,onChange:h=>D("progress",parseInt(h.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:v.progress<30?"#EF4444":v.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${v.progress}%`,backgroundColor:v.progress<30?"rgba(239, 68, 68, 0.3)":v.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(h=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>D("progress",h),disabled:l,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:v.progress===h?h<30?"#EF4444":h<70?"#F59E0B":"#10B981":i.bgSecondary,color:v.progress===h?"#FFFFFF":i.textSecondary,border:`1px solid ${v.progress===h?h<30?"#EF4444":h<70?"#F59E0B":"#10B981":i.borderLight}`},children:[h,"%"]},h))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:v.isMilestone,onChange:h=>D("isMilestone",h.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),o.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:o.map(h=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.assignees?.some(f=>f.name===h.name),onChange:f=>{let N=f.target.checked?[...v.assignees||[],{id:h.id,name:h.name,avatar:h.avatar,initials:h.name.split(" ").map(C=>C[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(v.assignees||[]).filter(C=>C.name!==h.name);D("assignees",N);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:l}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:h.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:h.name})]})]},h.id))})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:u,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:r.filter(h=>h.id!==a?.id).map(h=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:f=>f.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:f=>f.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v.dependencies?.includes(h.id),onChange:f=>{let N=f.target.checked?[...v.dependencies||[],h.id]:(v.dependencies||[]).filter(C=>C!==h.id);D("dependencies",N);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:l}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:h.name})]},h.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:h=>{h.currentTarget.style.color=i.textPrimary,h.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:h=>{h.currentTarget.style.color=i.textSecondary,h.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:g,disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:h=>!l&&(h.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:h=>!l&&(h.currentTarget.style.backgroundColor=i.accent),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.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),m==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var og=['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"'],El=()=>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"})]}),ng=()=>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"})}),sg=()=>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"})}),ig=()=>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"})}),lg=()=>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 wo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:m,onDependencyDelete:c}){let[s,p]=react.useState(false),[i,d]=react.useState(false),[u,v]=react.useState([]),[x,k]=react.useState(""),[y,b]=react.useState(false),[g,D]=react.useState(true),h=react.useRef(null),f=react.useRef(null),N=react.useRef(null),{enabled:C=true,placeholder:M='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:w="bottom-right",onCommand:B,suggestions:H=og,maxHistory:I=50,persistHistory:$}=a,S=$?.storageKey||"gantt-ai-history",z=$?.maxMessages??5;react.useEffect(()=>{if($?.enabled)try{let O=localStorage.getItem(S);if(O){let ue=JSON.parse(O).map(q=>({...q,timestamp:new Date(q.timestamp)}));v(ue.slice(-z));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[$?.enabled,S,z]),react.useEffect(()=>{if($?.enabled&&u.length>0)try{let O=u.filter(P=>!P.isLoading).slice(-z);localStorage.setItem(S,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[u,$?.enabled,S,z]),react.useEffect(()=>{f.current&&f.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{s&&!i&&h.current&&setTimeout(()=>h.current?.focus(),100);},[s,i]);let V=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&o?.(O.taskId,O.updates);break;case "create_task":O.newTask&&n?.(O.newTask);break;case "delete_task":O.taskId&&l?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&m?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&c?.(O.taskId,O.dependencyFrom);break}},[o,n,l,m,c]),ae=react.useCallback(async O=>{if(!O.trim()||y)return;let P={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};v(q=>[...q.slice(-(I-1)),P]),k(""),D(false),b(true);let ue={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(q=>[...q,ue]);try{if(B){let q=await B(O,e);v($e=>{let Oe=$e.filter(ve=>!ve.isLoading),Ct={id:`assistant-${Date.now()}`,role:"assistant",content:q.message,timestamp:new Date,command:q};return [...Oe,Ct]}),V(q);}else v(q=>[...q.filter(Oe=>!Oe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(q){v($e=>[...$e.filter(Ct=>!Ct.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${q instanceof Error?q.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[y,I,B,e,V]),ie=O=>{O.preventDefault(),ae(x);},J=O=>{k(O),h.current?.focus();};if(react.useEffect(()=>{let O=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),p(ue=>!ue),s||d(false)),P.key==="Escape"&&s&&p(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[s]),react.useEffect(()=>{if(!s)return;let O=ue=>{let q=ue.target;N.current&&!N.current.contains(q)&&p(false);},P=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",O);}},[s]),!C)return null;let R={"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(Be,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&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 ${R[w]} 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:()=>p(true),children:[jsxRuntime.jsx(El,{}),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:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:N,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${R[w]} 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(El,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>d(O=>!O),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(ig,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(sg,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&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&&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:H.slice(0,4).map((O,P)=>jsxRuntime.jsx("button",{onClick:()=>J(O),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:O.length>30?O.slice(0,30)+"...":O},P))})]}),u.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:O.role==="user"?"white":t.textPrimary},children:[O.isLoading?jsxRuntime.jsx(lg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:O.command.success?"#10B981":"#EF4444"},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:f})]}),jsxRuntime.jsxs("form",{onSubmit:ie,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:h,type:"text",value:x,onChange:O=>k(O.target.value),placeholder:M,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:x.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:x.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(ng,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Pl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,p=true)=>{r(i=>{let d=typeof s=="function"?s(i.present):s;if(o.current)return {...i,present:d};if(!p)return {...i,present:d};let u=[...i.past,i.present];return u.length>t&&u.shift(),{past:u,present:d,future:[]}});},[t]),l=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let p=s.past[s.past.length-1],i=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:p,future:[s.present,...s.future]}});},[]),m=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let p=s.future[0],i=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:p,future:i}});},[]),c=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Ml({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=m?l.metaKey:l.ctrlKey;if(c&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!m&&c&&l.key==="y"){l.preventDefault(),t();return}if(m&&c&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var pg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${X.formatDate(e.startDate)} - ${X.formatDate(e.endDate)}`);let a=X.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=>X.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Il(e){return {...pg,...e}}var yg=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},Ll=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:m="comfortable",showThemeSelector:c=true,showExportButton:s=true,availableUsers:p=[],templates:i,enableAutoCriticalPath:d=true,aiAssistant:u,locale:v="en",customTranslations:x,showCreateTaskButton:k=false,createTaskLabel:y,onCreateTask:b,onThemeChange:g,onTaskClick:D,onTaskDblClick:h,onTaskContextMenu:f,onTaskUpdate:N,onProgressChange:C,onTaskEdit:M,onTaskAddSubtask:w,onTaskMarkIncomplete:B,onTaskSetInProgress:H,onDependencyCreate:I,onDependencyDelete:$,onBeforeTaskAdd:S,onAfterTaskAdd:z,onBeforeTaskUpdate:V,onAfterTaskUpdate:ae,onBeforeTaskDelete:ie,onAfterTaskDelete:J}=a,O=react.useContext(io)?.theme,[P,ue]=react.useState(O||n||"dark"),[q,$e]=react.useState(l),[Oe,Ct]=react.useState(m),[ve,ut]=react.useState(1),[At,ka]=react.useState(0),[wa,ia]=react.useState(false),[Kt,ga]=react.useState(null),[Tt,la]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,rt]=react.useState(null),[Yt,Nt]=react.useState(null);react.useEffect(()=>{O&&O!==P&&ue(O);},[O]),react.useEffect(()=>{n&&n!==P&&ue(n);},[n]);let j=react.useCallback(T=>{ue(T),g?.(T);},[g]),{state:L,setState:Z,undo:He,redo:Ce,canUndo:Ot,canRedo:Ut,clearHistory:ye}=Pl(t,50);react.useEffect(()=>{Z(t);},[t,Z]);let fe=react.useRef(t),_t=react.useRef(true);react.useEffect(()=>{if(_t.current){_t.current=false,fe.current=L;return}if(!r)return;let T=JSON.stringify(fe.current),F=JSON.stringify(L);T!==F&&(fe.current=L,r(L));},[L,r]);let K=react.useMemo(()=>Rn(v,x),[v,x]),Y=react.useCallback(T=>[{id:"name",label:T.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:T.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:T.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:T.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:T.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:T.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:T.columns.progress,width:120,visible:false,sortable:true},{id:"priority",label:T.columns.priority,width:90,visible:false,sortable:true}],[]),[le,se]=react.useState(()=>Y(K));react.useEffect(()=>{se(T=>T.map(F=>({...F,label:K.columns[F.id==="name"?"taskName":F.id]||F.label})));},[K]);let We=react.useMemo(()=>le.filter(T=>T.visible).reduce((T,F)=>T+F.width,0)+60,[le]),ot=Kt||We,E=react.useRef(null),_=react.useRef(null),me=react.useRef(null),pe=react.useMemo(()=>Xi(P),[P]),Dt=react.useMemo(()=>({theme:pe,themeName:P}),[pe,P]),Ja=react.useMemo(()=>Il(i),[i]),Za=react.useMemo(()=>{if(!d)return L;let T=X.calculateCriticalPath(L),F=W=>W.map(te=>({...te,isCriticalPath:T.includes(te.id),subtasks:te.subtasks?F(te.subtasks):void 0}));return F(L)},[L,d]),_r=yg(Oe);Ml({undo:He,redo:Ce,canUndo:Ot,canRedo:Ut,enabled:true}),react.useImperativeHandle(o,()=>({getTask:T=>X.findTaskById(L,T),addTask:(T,F)=>{Z(W=>{if(!F)return [...W,{...T,level:0}];let te=oe=>oe.map(de=>de.id===F?{...de,subtasks:[...de.subtasks||[],{...T,parentId:F,level:(de.level||0)+1}],isExpanded:true}:de.subtasks?{...de,subtasks:te(de.subtasks)}:de);return te(W)});},updateTask:(T,F)=>{Z(W=>{let te=oe=>oe.map(de=>de.id===T?{...de,...F}:de.subtasks?{...de,subtasks:te(de.subtasks)}:de);return te(W)});},deleteTask:T=>{Z(F=>{let W=te=>te.filter(oe=>oe.id===T?false:(oe.subtasks&&(oe.subtasks=W(oe.subtasks)),true));return W(F)});},deleteTasks:T=>{Z(F=>Wn(F,T));},duplicateTask:T=>{Z(F=>_n(F,[T]));},splitTask:(T,F,W=3)=>{Z(te=>X.splitTask(te,T,F,W));},calculateEndDate:X.calculateEndDate,calculateDuration:X.calculateDuration,validateDependency:(T,F)=>!X.validateDependencies(L,T,F),getAllTasks:()=>X.flattenTasks(L),getTasksByStatus:T=>X.flattenTasks(L).filter(F=>F.status===T),getTasksByParent:T=>T?X.findTaskById(L,T)?.subtasks||[]:L.filter(W=>!W.parentId),getCriticalPath:()=>X.flattenTasks(L).filter(T=>T.isCriticalPath),indentTask:T=>{Z(F=>zn(F,[T]));},outdentTask:T=>{Z(F=>$n(F,[T]));},moveTask:(T,F)=>{Z(W=>Hn(W,[T],F));},createSubtask:async T=>{let{tasks:F,newTask:W}=Kn(L,T);if(S){let te=S({...W,parentId:T});if((te instanceof Promise?await te:te)===false)return}Z(F),z&&z({...W,parentId:T});},scrollToTask:T=>{let W=X.flattenTasks(L).findIndex(te=>te.id===T);if(W!==-1&&E.current){let te=W*_r;E.current.scrollTo({top:te,behavior:"smooth"}),_.current&&_.current.scrollTo({top:te,behavior:"smooth"});}},highlightTask:(T,F=2e3)=>{},expandTask:T=>{Z(F=>{let W=te=>te.map(oe=>oe.id===T?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(F)});},collapseTask:T=>{Z(F=>{let W=te=>te.map(oe=>oe.id===T?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe);return W(F)});},expandAll:()=>{Z(T=>{let F=W=>W.map(te=>({...te,isExpanded:true,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(T)});},collapseAll:()=>{Z(T=>{let F=W=>W.map(te=>({...te,isExpanded:false,subtasks:te.subtasks?F(te.subtasks):void 0}));return F(T)});},undo:He,redo:Ce,canUndo:()=>Ot,canRedo:()=>Ut,clearHistory:ye,exportToPNG:async()=>{if(!me.current)throw new Error("Gantt container not found");let T=await Fl__default.default(me.current,{backgroundColor:pe.bgPrimary,scale:2});return new Promise((F,W)=>{T.toBlob(te=>{te?F(te):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async T=>{await X.exportToPDF(L,T);},exportToExcel:async T=>{await X.exportToExcel(L,T);},exportToJSON:()=>X.exportToJSON(L),exportToCSV:()=>X.exportToCSV(L),importFromJSON:T=>{let F=X.importFromJSON(T);Z(F);},getTasks:()=>L,refresh:()=>{Z(T=>[...T]);},clearAll:()=>{Z([]);}}),[L,He,Ce,Ot,Ut,ye,pe,_r]);let jd=react.useCallback(T=>{se(F=>F.map(W=>W.id===T?{...W,visible:!W.visible}:W));},[]),Kd=react.useCallback((T,F)=>{se(W=>W.map(te=>{if(te.id!==T)return te;let oe=te.minWidth??100,de=te.maxWidth??800,it=Math.max(oe,Math.min(de,F));return {...te,width:it}}));},[]),Yd=react.useCallback(T=>{Z(F=>jn(F,T)),a.onTaskToggleExpand?.(T);},[a]),Qa=react.useCallback((T,F)=>{if(V&&V(T,F)===false)return;let te=X.findTaskById(L,T)?.progress,oe=it=>it.map(kt=>kt.id===T?{...kt,...F}:kt.subtasks?{...kt,subtasks:oe(kt.subtasks)}:kt);Z(oe(L));let de=X.findTaskById(oe(L),T);de&&(N?.(de),ae?.(de),F.progress!==void 0&&te!==void 0&&F.progress!==te&&C?.(T,te,F.progress));},[L,N,V,ae,C]),Xd=react.useCallback(T=>{T.length!==0&&(Z(F=>zn(F,T)),a.onTaskIndent?.(T[0]));},[a]),qd=react.useCallback(T=>{T.length!==0&&(Z(F=>$n(F,T)),a.onTaskOutdent?.(T[0]));},[a]),Jd=react.useCallback((T,F)=>{T.length!==0&&(Z(W=>Hn(W,T,F)),a.onTaskMove?.(T[0],F));},[a]),zo=react.useCallback(async T=>{let F=[];for(let W of T)ie&&await Promise.resolve(ie(W))===false||F.push(W);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Z(W=>Wn(W,F)),F.forEach(W=>a.onTaskDelete?.(W))),J&&F.forEach(W=>J(W)));},[a,ie,J]),Zd=react.useCallback(T=>{Z(F=>_n(F,T)),T.forEach(F=>a.onTaskDuplicate?.(F));},[a]),Qd=react.useCallback((T,F)=>{Z(W=>{let{tasks:te,newTask:oe}=ul(W,T,F);return S&&S(oe)===false?W:(a.onTaskCreate?.(oe.parentId,oe.position||0),z?.(oe),te)});},[a,S,z]),ec=react.useCallback((T,F)=>{Z(W=>Vn(W,T,F)),a.onTaskRename?.(T,F);},[a]),$o=react.useCallback(T=>{Z(F=>{let{tasks:W}=Kn(F,T);return a.onTaskCreate?.(T,0),W});},[a]),tc=react.useCallback((T,F,W)=>{let te=T.startDate?Math.round((F.getTime()-T.startDate.getTime())/864e5):0,oe=kt=>kt.map(Xt=>Xt.id===T.id?{...Xt,startDate:F,endDate:W,...T.segments&&{segments:T.segments}}:Xt.subtasks?{...Xt,subtasks:oe(Xt.subtasks)}:Xt),de=oe(L);de=X.autoScheduleDependents(de,T.id,te),Z(de);let it={...T,startDate:F,endDate:W};N?.(it);},[L,N]),ac=react.useCallback((T,F)=>{f?.(T,F),la({isOpen:true,x:F.clientX,y:F.clientY,task:T});},[f]),rc=react.useCallback((T,F)=>{let W=X.splitTask(L,T.id,F);Z(W),la({isOpen:false,x:0,y:0,task:null});},[L]),Ws=react.useCallback(T=>{h?.(T),M||rt(T);},[h,M]),_s=react.useCallback((T,F,W)=>{let te=new Map,oe=qt=>{qt.forEach(fa=>{fa.dependencies&&te.set(fa.id,fa.dependencies),fa.subtasks&&oe(fa.subtasks);});};oe(W);let de=te.get(F)||[];te.set(F,[...de,T]);let it=new Set,kt=new Set,Xt=qt=>{if(!it.has(qt)){it.add(qt),kt.add(qt);let fa=te.get(qt)||[];for(let vr of fa){if(!it.has(vr)&&Xt(vr))return true;if(kt.has(vr))return true}}return kt.delete(qt),false};return Xt(F)},[]),Vs=react.useCallback((T,F)=>{if(_s(T.id,F,L)){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 $=te=>te.map(oe=>{if(oe.id===F){let de=oe.dependencies||[];if(!de.includes(C.id))return {...oe,dependencies:[...de,C.id]}}return oe.subtasks?{...oe,subtasks:$(oe.subtasks)}:oe});Z($(L)),A?.(C.id,F);},[L,A,Ws]),Vs=react.useCallback((C,F)=>{let $=te=>te.map(oe=>{if(oe.id===C&&oe.dependencies){let de=oe.dependencies.filter(it=>it!==F);return {...oe,dependencies:de}}return oe.subtasks?{...oe,subtasks:$(oe.subtasks)}:oe});Z($(L)),_?.(C,F);},[L,_]),{startDate:rc,endDate:oc}=react.useMemo(()=>{let C=L.filter(de=>de.startDate&&de.endDate);if(C.length===0){let de=new Date,it=new Date(de);it.setDate(it.getDate()-30);let kt=new Date(de);return kt.setDate(kt.getDate()+60),{startDate:it,endDate:kt}}let F=C.flatMap(de=>[de.startDate,de.endDate]).filter(de=>de!==void 0),$=new Date(Math.min(...F.map(de=>de.getTime()))),te=new Date(Math.max(...F.map(de=>de.getTime()))),oe=X==="day"?7:X==="week"?14:30;return $.setDate($.getDate()-oe),te.setDate(te.getDate()+oe),{startDate:$,endDate:te}},[L,X]),nc=react.useCallback(async()=>{if(!me.current)return;let C=await Al__default.default(me.current,{backgroundColor:pe.bgPrimary,scale:2}),F=document.createElement("a");F.download="gantt-chart.png",F.href=C.toDataURL("image/png"),F.click();},[pe]),sc=react.useCallback(async()=>{await Y.exportToPDF(L);},[L]),ic=react.useCallback(async()=>{await Y.exportToExcel(L);},[L]),lc=react.useCallback(()=>{let C=Y.exportToCSV(L),F=new Blob([C],{type:"text/csv;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(F),$.download="gantt-chart.csv",$.click(),URL.revokeObjectURL($.href);},[L]),dc=react.useCallback(()=>{let C=Y.exportToJSON(L),F=new Blob([C],{type:"application/json;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(F),$.download="gantt-chart.json",$.click(),URL.revokeObjectURL($.href);},[L]),cc=react.useCallback(()=>{Y.exportToMSProject(L,"Gantt Project","project.xml");},[L]),mc=C=>{C.preventDefault(),ia(true);};return react.useEffect(()=>{let C=H.current,F=P.current;if(!C||!F)return;let $=F.querySelector(".gantt-taskgrid-content"),te=()=>{let it=C.scrollTop;ka(it),$&&($.style.transform=`translateY(-${it}px)`);},oe=it=>{if(wa&&F){let Xt=F.parentElement?.getBoundingClientRect()?.left||0,qt=it.clientX-Xt,fa=200,hr=Math.min(window.innerWidth-300,800);qt>=fa&&qt<=hr&&ga(qt);}},de=()=>{ia(false);};return C.addEventListener("scroll",te),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",de),()=>{C.removeEventListener("scroll",te),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",de);}},[wa]),jsxRuntime.jsx(dr.Provider,{value:j,children:jsxRuntime.jsx(Vo.Provider,{value:Dt,children:jsxRuntime.jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:pe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(lo,{theme:pe,timeScale:X,onTimeScaleChange:$e,zoom:ve,onZoomChange:ut,currentTheme:M,onThemeChange:V,rowDensity:Oe,onRowDensityChange:Ct,showThemeSelector:c,showCreateTaskButton:x,createTaskLabel:h,onCreateTask:f,onExportPNG:n?nc:void 0,onExportPDF:n?sc:void 0,onExportExcel:n?ic:void 0,onExportCSV:n?lc:void 0,onExportJSON:n?dc:void 0,onExportMSProject:n?cc:void 0}),jsxRuntime.jsxs("div",{ref:P,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:ot,overflow:"hidden"},children:jsxRuntime.jsx(mo,{tasks:qa,theme:pe,rowHeight:Wr,availableUsers:p,templates:Xa,onTaskClick:N,onTaskDblClick:Hs,onTaskContextMenu:b,onTaskToggle:Kd,scrollTop:It,columns:le,onToggleColumn:Vd,onColumnResize:jd,onTaskUpdate:Ja,onTaskIndent:Yd,onTaskOutdent:Xd,onTaskMove:qd,onMultiTaskDelete:Uo,onTaskDuplicate:Jd,onTaskCreate:Zd,onTaskRename:Qd,onCreateSubtask:zo,onOpenTaskModal:N?C=>N(C):void 0,onDeleteRequest:(C,F)=>Nt({taskId:C,taskName:F})})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:mc}),jsxRuntime.jsx("div",{ref:H,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(yo,{tasks:qa,theme:pe,rowHeight:Wr,timeScale:X,startDate:rc,endDate:oc,zoom:ve,templates:Xa,onTaskClick:N,onTaskDblClick:Hs,onTaskContextMenu:tc,onTaskDateChange:ec,onDependencyCreate:_s,onDependencyDelete:Vs})})]}),Tt.task&&jsxRuntime.jsx(cr,{isOpen:Tt.isOpen,x:Tt.x,y:Tt.y,theme:pe,onClose:()=>la({isOpen:false,x:0,y:0,task:null}),items:(()=>{let C=Tt.task;return C?C.subtasks&&C.subtasks.length>0?[{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{w?w(C):zo(C.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{Nt({taskId:C.id,taskName:C.name});}}]:[{id:"edit",label:j.contextMenu?.editTask||"Edit Task",icon:Ke.Pencil,onClick:()=>{S?S(C):rt(C);}},{id:"addSubtask",label:j.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{w?w(C):zo(C.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:j.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ke.MarkIncomplete,onClick:()=>{U?U(C):Ja(C.id,{status:"todo",progress:0});},disabled:C.status==="todo"},{id:"setInProgress",label:j.contextMenu?.setInProgress||"Set In Progress",icon:Ke.SetInProgress,onClick:()=>{W?W(C):Ja(C.id,{status:"in-progress"});},disabled:C.status==="in-progress"},{id:"markComplete",label:j.contextMenu?.markComplete||"Mark Complete",icon:Ke.MarkComplete,onClick:()=>{Ja(C.id,{status:"completed",progress:100});},disabled:C.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:j.contextMenu?.splitTask||"Split Task",icon:Ke.Split,onClick:()=>{if(!C.startDate||!C.endDate){console.warn("Cannot split task without dates");return}let $=C.startDate.getTime(),te=C.endDate.getTime(),oe=$+(te-$)/2,de=new Date(oe);ac(C,de);},disabled:!C.startDate||!C.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:j.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{Nt({taskId:C.id,taskName:C.name});}}]:[]})()}),gt&&jsxRuntime.jsx(xo,{isOpen:true,onClose:()=>rt(null),task:gt,onSubmit:C=>{Ja(gt.id,C),rt(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Yt&&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:()=>Nt(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:C=>C.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:pe.bgSecondary,border:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${pe.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:pe.textPrimary,fontFamily:"Inter, sans-serif"},children:[j.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="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:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:pe.textPrimary},children:['"',Yt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:pe.bgPrimary,borderTop:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Nt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=pe.hoverBg;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Uo([Yt.taskId]),Nt(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:C=>{C.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsxRuntime.jsx(ko,{tasks:L,theme:pe,config:g,onTasksUpdate:Z,onTaskUpdate:Ja,onTaskCreate:C=>{Z(F=>[...F,C]);},onTaskDelete:C=>{Uo([C]);},onDependencyCreate:(C,F)=>{let $=Y.findTaskById(L,C);$&&_s($,F);},onDependencyDelete:Vs})]})})})});var Ll=`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 W=te=>te.map(oe=>{if(oe.id===F){let de=oe.dependencies||[];if(!de.includes(T.id))return {...oe,dependencies:[...de,T.id]}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});Z(W(L)),I?.(T.id,F);},[L,I,_s]),js=react.useCallback((T,F)=>{let W=te=>te.map(oe=>{if(oe.id===T&&oe.dependencies){let de=oe.dependencies.filter(it=>it!==F);return {...oe,dependencies:de}}return oe.subtasks?{...oe,subtasks:W(oe.subtasks)}:oe});Z(W(L)),$?.(T,F);},[L,$]),{startDate:oc,endDate:nc}=react.useMemo(()=>{let T=L.filter(de=>de.startDate&&de.endDate);if(T.length===0){let de=new Date,it=new Date(de);it.setDate(it.getDate()-30);let kt=new Date(de);return kt.setDate(kt.getDate()+60),{startDate:it,endDate:kt}}let F=T.flatMap(de=>[de.startDate,de.endDate]).filter(de=>de!==void 0),W=new Date(Math.min(...F.map(de=>de.getTime()))),te=new Date(Math.max(...F.map(de=>de.getTime()))),oe=q==="day"?7:q==="week"?14:30;return W.setDate(W.getDate()-oe),te.setDate(te.getDate()+oe),{startDate:W,endDate:te}},[L,q]),sc=react.useCallback(async()=>{if(!me.current)return;let T=await Fl__default.default(me.current,{backgroundColor:pe.bgPrimary,scale:2}),F=document.createElement("a");F.download="gantt-chart.png",F.href=T.toDataURL("image/png"),F.click();},[pe]),ic=react.useCallback(async()=>{await X.exportToPDF(L);},[L]),lc=react.useCallback(async()=>{await X.exportToExcel(L);},[L]),dc=react.useCallback(()=>{let T=X.exportToCSV(L),F=new Blob([T],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(F),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[L]),cc=react.useCallback(()=>{let T=X.exportToJSON(L),F=new Blob([T],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(F),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[L]),mc=react.useCallback(()=>{X.exportToMSProject(L,"Gantt Project","project.xml");},[L]),pc=T=>{T.preventDefault(),ia(true);};return react.useEffect(()=>{let T=_.current,F=E.current;if(!T||!F)return;let W=F.querySelector(".gantt-taskgrid-content"),te=()=>{let it=T.scrollTop;ka(it),W&&(W.style.transform=`translateY(-${it}px)`);},oe=it=>{if(wa&&F){let Xt=F.parentElement?.getBoundingClientRect()?.left||0,qt=it.clientX-Xt,fa=200,vr=Math.min(window.innerWidth-300,800);qt>=fa&&qt<=vr&&ga(qt);}},de=()=>{ia(false);};return T.addEventListener("scroll",te),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",de),()=>{T.removeEventListener("scroll",te),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",de);}},[wa]),jsxRuntime.jsx(cr.Provider,{value:K,children:jsxRuntime.jsx(jo.Provider,{value:Dt,children:jsxRuntime.jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:pe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(co,{theme:pe,timeScale:q,onTimeScaleChange:$e,zoom:ve,onZoomChange:ut,currentTheme:P,onThemeChange:j,rowDensity:Oe,onRowDensityChange:Ct,showThemeSelector:c,showCreateTaskButton:k,createTaskLabel:y,onCreateTask:b,onExportPNG:s?sc:void 0,onExportPDF:s?ic:void 0,onExportExcel:s?lc:void 0,onExportCSV:s?dc:void 0,onExportJSON:s?cc:void 0,onExportMSProject:s?mc:void 0}),jsxRuntime.jsxs("div",{ref:E,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:ot,overflow:"hidden"},children:jsxRuntime.jsx(po,{tasks:Za,theme:pe,rowHeight:_r,availableUsers:p,templates:Ja,onTaskClick:D,onTaskDblClick:Ws,onTaskContextMenu:f,onTaskToggle:Yd,scrollTop:At,columns:le,onToggleColumn:jd,onColumnResize:Kd,onTaskUpdate:Qa,onTaskIndent:Xd,onTaskOutdent:qd,onTaskMove:Jd,onMultiTaskDelete:zo,onTaskDuplicate:Zd,onTaskCreate:Qd,onTaskRename:ec,onCreateSubtask:$o,onOpenTaskModal:D?T=>D(T):void 0,onDeleteRequest:(T,F)=>Nt({taskId:T,taskName:F})})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:pc}),jsxRuntime.jsx("div",{ref:_,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(xo,{tasks:Za,theme:pe,rowHeight:_r,timeScale:q,startDate:oc,endDate:nc,zoom:ve,templates:Ja,onTaskClick:D,onTaskDblClick:Ws,onTaskContextMenu:ac,onTaskDateChange:tc,onDependencyCreate:Vs,onDependencyDelete:js})})]}),Tt.task&&jsxRuntime.jsx(mr,{isOpen:Tt.isOpen,x:Tt.x,y:Tt.y,theme:pe,onClose:()=>la({isOpen:false,x:0,y:0,task:null}),items:(()=>{let T=Tt.task;return T?T.subtasks&&T.subtasks.length>0?[{id:"addSubtask",label:K.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{w?w(T):$o(T.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:K.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{Nt({taskId:T.id,taskName:T.name});}}]:[{id:"edit",label:K.contextMenu?.editTask||"Edit Task",icon:Ke.Pencil,onClick:()=>{M?M(T):rt(T);}},{id:"addSubtask",label:K.contextMenu?.addSubtask||"Add Subtask",icon:Ke.Add,onClick:()=>{w?w(T):$o(T.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:K.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ke.MarkIncomplete,onClick:()=>{B?B(T):Qa(T.id,{status:"todo",progress:0});},disabled:T.status==="todo"},{id:"setInProgress",label:K.contextMenu?.setInProgress||"Set In Progress",icon:Ke.SetInProgress,onClick:()=>{H?H(T):Qa(T.id,{status:"in-progress"});},disabled:T.status==="in-progress"},{id:"markComplete",label:K.contextMenu?.markComplete||"Mark Complete",icon:Ke.MarkComplete,onClick:()=>{Qa(T.id,{status:"completed",progress:100});},disabled:T.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:K.contextMenu?.splitTask||"Split Task",icon:Ke.Split,onClick:()=>{if(!T.startDate||!T.endDate){console.warn("Cannot split task without dates");return}let W=T.startDate.getTime(),te=T.endDate.getTime(),oe=W+(te-W)/2,de=new Date(oe);rc(T,de);},disabled:!T.startDate||!T.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:K.contextMenu?.deleteTask||"Delete Task",icon:Ke.Delete,onClick:()=>{Nt({taskId:T.id,taskName:T.name});}}]:[]})()}),gt&&jsxRuntime.jsx(ko,{isOpen:true,onClose:()=>rt(null),task:gt,onSubmit:T=>{Qa(gt.id,T),rt(null);},mode:"edit",theme:P}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Yt&&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:()=>Nt(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:T=>T.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:pe.bgSecondary,border:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${pe.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:pe.textPrimary,fontFamily:"Inter, sans-serif"},children:[K.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="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:pe.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:pe.textPrimary},children:['"',Yt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:pe.bgPrimary,borderTop:`1px solid ${pe.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Nt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:pe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=pe.hoverBg;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{zo([Yt.taskId]),Nt(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:T=>{T.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(wo,{tasks:L,theme:pe,config:u,onTasksUpdate:Z,onTaskUpdate:Qa,onTaskCreate:T=>{Z(F=>[...F,T]);},onTaskDelete:T=>{zo([T]);},onDependencyCreate:(T,F)=>{let W=X.findTaskById(L,T);W&&Vs(W,F);},onDependencyDelete:js})]})})})});var Bl=`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
@@ -316,39 +316,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
316
316
 
317
317
  Always try to match task names case-insensitively and handle partial matches.
318
318
  If you can't find a task by name, search through the provided task list.
319
- If ambiguous, ask for clarification in the message field.`;function Bl(e){return `CURRENT TASKS:
320
- ${Rl(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(`
319
+ If ambiguous, ask for clarification in the message field.`;function Rl(e){return `CURRENT TASKS:
320
+ ${Ol(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=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 ${n}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
321
321
  `)}
322
322
 
323
- Today's date: ${new Date().toISOString().split("T")[0]}`}function Rl(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xa(e,t){let a=Rl(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let s=a.find(m=>m.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(m=>{let c=m.name.toLowerCase();return l.every(n=>c.includes(n))})}function Qn(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 g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let v=new Date(r),y=v.getDay(),x=g-y;return x<=0&&(x+=7),v.setDate(v.getDate()+x),v}}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),g=s[2].toLowerCase(),v=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?v.setDate(v.getDate()+i):g==="week"||g==="semana"||g==="semanas"?v.setDate(v.getDate()+i*7):(g==="month"||g==="mes"||g==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let i=parseInt(m[1],10),g=parseInt(m[2],10)-1,v=parseInt(m[3],10);return new Date(v,g,i)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},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),g=c[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(g!==void 0)return new Date(v,g,i)}let p={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=p[d[1].toLowerCase()],g=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,g)}return null}function es(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 ts(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 Ol(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 Gl(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(),p=r[2].trim(),d=xa(t,n),i=Qn(p);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 "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:v},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(),p=o[2].trim(),d=xa(t,n),i=es(p);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 "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${i} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),p=s[2].trim(),d=xa(t,n),i=ts(p);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,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(),p=l[2].trim(),d=xa(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let n=m[1].trim(),p=m[2].trim(),d=xa(t,n),i=xa(t,p);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:p,message:`Could not find a task named "${p}".`,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 c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let n=c[1].trim(),p=xa(t,n);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.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 Ul(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 vg(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 yg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Co(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(i=>i.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Co(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let l=p=>{if(p)return typeof p=="string"?new Date(p):p},m=l(e.startDate),c=l(e.endDate),n=e.metadata?.isMilestone===true||m&&c&&Math.abs(c.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:c,progress:e.progress||0,status:vg(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 zl(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:yg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $l(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Co(r,e,t))}var as={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"}},rs={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"}},To={en:as,es:rs};function os(e){return To[e]||To.en}function No(e,t){let a=os(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 Vl(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(...Vl(r.subtasks,t+1));return a}function Mg({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 jl({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:m="dark",locale:c="en",customTranslations:n,showSearch:p=true,showHierarchy:d=true}=t,i=No(c,n),g=m==="dark",[v,y]=react.useState(new Set),[x,h]=react.useState("startDate"),[f,u]=react.useState("asc"),[N,T]=react.useState("");react.useMemo(()=>{let w=new Set;function U(W){for(let A of W)A.subtasks?.length&&(w.add(A.id),U(A.subtasks));}U(e),y(w);},[e]);let b=react.useCallback(w=>{y(U=>{let W=new Set(U);return W.has(w)?W.delete(w):W.add(w),W}),a.onTaskToggleExpand?.(w);},[a]),D=react.useCallback(w=>{x===w?u(U=>U==="asc"?"desc":"asc"):(h(w),u("asc")),a.onSortChange?.({column:w,direction:f==="asc"?"desc":"asc"});},[x,f,a]),k=react.useMemo(()=>{let w=Vl(e);if(N.trim()){let W=N.toLowerCase();w=w.filter(A=>A.name.toLowerCase().includes(W));}let U=[];for(let W of w){let A=W.level===0;W.level>0&&(A=true),(A||N.trim())&&U.push(W);}return N.trim()&&U.sort((W,A)=>{let _,E;switch(x){case "name":_=W.name.toLowerCase(),E=A.name.toLowerCase();break;case "startDate":_=W.startDate?.getTime()||0,E=A.startDate?.getTime()||0;break;case "endDate":_=W.endDate?.getTime()||0,E=A.endDate?.getTime()||0;break;case "progress":_=W.progress||0,E=A.progress||0;break;case "status":_=W.status||"todo",E=A.status||"todo";break;default:return 0}return _<E?f==="asc"?-1:1:_>E?f==="asc"?1:-1:0}),U},[e,N,x,f]),S=w=>w?(w instanceof Date?w:new Date(w)).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",g?"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:I("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",g?"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:I("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:I("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",g?"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:I("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:I("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:I("flex-1 flex flex-col w-full h-full overflow-hidden",g?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsxRuntime.jsx("div",{className:I("flex-shrink-0 px-6 py-4 border-b",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:I("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:N,onChange:w=>T(w.target.value),placeholder:i.toolbar.searchPlaceholder,className:I("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",g?"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:I("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:I("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",g?"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:()=>D("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:()=>D("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:()=>D("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:()=>D("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:()=>D("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k.map((w,U)=>{let W=v.has(w.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:U*.02},className:I("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",g?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+w.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(w),onDoubleClick:()=>a.onTaskDoubleClick?.(w),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&w.hasChildren&&jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),b(w.id);},className:I("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsxRuntime.jsx(lucideReact.ChevronDown,{className:I("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:I("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")})}),d&&!w.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:A=>{A.stopPropagation(),a.onTaskUpdate?.({...w,progress:w.progress===100?0:100,status:w.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Mg,{status:w.status,progress:w.progress})}),jsxRuntime.jsx("span",{className:I("truncate",g?"text-white":"text-gray-900",w.progress===100&&(g?"line-through text-[#6B7280]":"line-through text-gray-400")),children:w.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:I("px-2 py-1 rounded-full text-xs font-medium",w.progress===100||w.status==="completed"?"bg-green-500/10 text-green-500":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/10 text-blue-500":g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:w.progress===100||w.status==="completed"?i.status.completed:w.progress&&w.progress>0||w.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:I("col-span-2 flex items-center gap-1 text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),S(w.startDate)]}),jsxRuntime.jsxs("div",{className:I("col-span-2 flex items-center gap-1 text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),S(w.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:I("flex-1 h-1.5 rounded-full overflow-hidden",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:I("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:I("text-xs w-8",g?"text-[#9CA3AF]":"text-gray-500"),children:[w.progress||0,"%"]})]})})]},w.id)})}),k.length===0&&N&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:I("w-12 h-12 mx-auto mb-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:I(g?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var ns={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"},ss={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"},is={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"},So={dark:ns,light:ss,neutral:is};function Kl(e){return So[e]||So.dark}var ls={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"}},ds={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"}},Eo={en:ls,es:ds};function Br(e){return Eo[e]||Eo.en}function Po(e,t){let a=Br(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 Yl(e){let t=Br(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 Xl(e,t=0,a=true){let r=Br(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 Ug(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 ms(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function zg({task:e}){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 Zl({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:m}){let{theme:c="dark",locale:n="en",customTranslations:p}=t,d=Po(n,p),i=c==="dark",[g,v]=react.useState(r||new Date),[y,x]=react.useState(null),h=react.useCallback(()=>{v(new Date(g.getFullYear(),g.getMonth()-1,1));},[g]),f=react.useCallback(()=>{v(new Date(g.getFullYear(),g.getMonth()+1,1));},[g]),u=react.useCallback(()=>{v(new Date);},[]),N=react.useMemo(()=>{let k=g.getFullYear(),S=g.getMonth(),w=new Date(k,S,1),U=new Date(k,S+1,0),W=w.getDay(),A=U.getDate(),_=Ug(e),E=new Date;E.setHours(0,0,0,0);let z=[],q=W,ae=new Date(k,S,0).getDate();for(let J=q-1;J>=0;J--){let B=new Date(k,S-1,ae-J);z.push({date:B,isCurrentMonth:false,isToday:false,isWeekend:B.getDay()===0||B.getDay()===6,events:_.filter(R=>ms(B,R)).map(R=>({id:R.id,title:R.name,start:R.startDate,end:R.endDate,task:R}))});}for(let J=1;J<=A;J++){let B=new Date(k,S,J),R=B.getTime()===E.getTime();z.push({date:B,isCurrentMonth:true,isToday:R,isWeekend:B.getDay()===0||B.getDay()===6,events:_.filter(M=>ms(B,M)).map(M=>({id:M.id,title:M.name,start:M.startDate,end:M.endDate,task:M}))});}let ie=42-z.length;for(let J=1;J<=ie;J++){let B=new Date(k,S+1,J);z.push({date:B,isCurrentMonth:false,isToday:false,isWeekend:B.getDay()===0||B.getDay()===6,events:_.filter(R=>ms(B,R)).map(R=>({id:R.id,title:R.name,start:R.startDate,end:R.endDate,task:R}))});}return z},[g,e]),T=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],b=g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),D=react.useCallback(k=>{let S=k.progress===100?0:100,w=S===100?"completed":"todo";a.onTaskUpdate?.({...k,status:w,progress:S});},[a]);return o?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:m,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:I("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:m,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:I("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:I("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:I("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:m,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:I("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:I("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:I("flex-1 flex flex-col w-full h-full overflow-hidden",i?"bg-[#0F1117]":"bg-white",l),style:m,children:[jsxRuntime.jsx("div",{className:I("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:I("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:b}),jsxRuntime.jsx("button",{onClick:u,className:I("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:h,className:I("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:I("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:f,className:I("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:I("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:T.map(k=>jsxRuntime.jsx("div",{className:I("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:k},k))}),jsxRuntime.jsx("div",{className:I("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",i?"bg-white/5":"bg-gray-200"),children:N.map((k,S)=>jsxRuntime.jsxs("div",{className:I("min-h-[100px] p-2 transition-colors",i?"bg-[#0F1117]":"bg-white",!k.isCurrentMonth&&(i?"bg-[#0F1117]/50":"bg-gray-50"),k.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:I("text-sm font-medium mb-1",k.isToday?"text-[#3B82F6]":k.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:k.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[k.events.slice(0,3).map(w=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(w.task),a.onEventClick?.(w);},whileHover:{scale:1.02},className:I("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",w.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(zg,{task:w.task}),jsxRuntime.jsx("span",{className:"truncate",children:w.title})]},w.id)),k.events.length>3&&jsxRuntime.jsxs("div",{className:I("text-xs px-1.5",i?"text-[#6B7280]":"text-gray-400"),children:["+",k.events.length-3," ",n==="es"?"m\xE1s":"more"]})]})]},S))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:I("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",i?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:I("p-4 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:I("font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>x(null),className:I("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("div",{className:"p-4 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:I("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:I("font-medium",i?"text-white":"text-gray-900"),children:y.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:I("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:I("text-sm",i?"text-white":"text-gray-900"),children:y.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:I("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:I("text-sm",i?"text-white":"text-gray-900"),children:y.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:I("text-xs uppercase mb-2 block",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:I("flex-1 h-2 rounded-full overflow-hidden",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:I("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:I("text-sm font-medium w-10",i?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{D(y),x(null);},className:I("w-full py-2 rounded-lg font-medium transition-colors",y.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:y.progress===100?n==="es"?"Marcar como pendiente":"Mark as pending":n==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>x(null),className:"fixed inset-0 bg-black/20 z-40"})})]})}var ps={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"},us={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"},gs={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"},Io={dark:ps,light:us,neutral:gs};function Ql(e){return Io[e]||Io.dark}function Hg({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:m}){let[c,n]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,v=new Set(p.flatMap(h=>h.assignedUserIds||[])).size,y=p.map(h=>h.priority).filter(Boolean),x=new Set(p.flatMap(h=>h.labels||[])).size;return {totalCards:g,uniqueAssignees:v,priorities:y,labels:x}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:I("card-stack",!e.isExpanded&&"card-stack-collapsed",m),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:I("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),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:p.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:p.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var td={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Rr(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 Or(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 ad(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 rd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:m}){let c=react.useMemo(()=>({...td,...l}),[l]),[n,p]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let f=new Map;return e.forEach(u=>{let N=u.timestamp.toISOString().split("T")[0],T=f.get(N);T?T.push(u):f.set(N,[u]);}),Array.from(f.entries()).sort((u,N)=>N[0].localeCompare(u[0])).map(([u,N])=>({date:new Date(u),events:N.sort((T,b)=>b.timestamp.getTime()-T.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:v}=react.useMemo(()=>{let f=new Set,u=new Set;return e.forEach(N=>{f.add(N.userId),u.add(N.type);}),{uniqueUsers:Array.from(f),uniqueTypes:Array.from(u)}},[e]),y=f=>{p(u=>{let N=new Set(u);return N.has(f)?N.delete(f):N.add(f),N});},x=f=>{let N=new Date().getTime()-f.getTime(),T=Math.floor(N/6e4),b=Math.floor(N/36e5),D=Math.floor(N/864e5);return T<1?"just now":T<60?`${T}m ago`:b<24?`${b}h ago`:D<7?`${D}d ago`:f.toLocaleDateString()},h=react.useMemo(()=>{let f=0;return t.types&&t.types.length>0&&f++,t.users&&t.users.length>0&&f++,t.dateRange&&f++,t.searchTerm&&f++,f},[t]);return react.useEffect(()=>{if(s&&d.current){let f=d.current.querySelector(`[data-event-id="${s}"]`);f&&f.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:I("history-timeline-empty",m),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:I("history-timeline",c.compact&&"compact",m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:f=>{let u=f.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(f=>jsxRuntime.jsxs("option",{value:f,children:[Or(f)," ",f.replace("_"," ")]},f))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:f=>{let u=f.target.value;a({...t,users:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(f=>jsxRuntime.jsx("option",{value:f,children:f},f))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:f=>a({...t,searchTerm:f.target.value})})]}),h>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(f=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&f.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:f.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[f.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:f.events.map((u,N)=>{let T=n.has(u.id),b=s===u.id,D=ad(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:I("history-timeline-event",T&&"expanded",b&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Or(u.type)})}),N<f.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&u.userAvatar&&jsxRuntime.jsx("img",{src:u.userAvatar,alt:u.userName||u.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:u.userName||u.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Rr(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?x(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),y(u.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([k,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},k)),u.metadata&&Object.keys(u.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(u.metadata).map(([k,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},k))]})]})]})]},u.id)})})]},f.date?.toISOString()||"all"))})]})}function nd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:m,onSpeedChange:c,className:n}){let p=[.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:I("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:I("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Or(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Rr(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>m(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,v)=>jsxRuntime.jsx("div",{className:I("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>m(v),title:Rr(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick: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:p.map(g=>jsxRuntime.jsxs("button",{className:I("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:I("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 fs(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 bs(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 sd(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 id(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Yg(e,t,a,r,o,s=100){let l=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(l.map(c=>[c.id,c]));for(let c=0;c<s;c++){let n=1-c/s;l.forEach(p=>{let d=a/2,i=r/2;p.vx+=(d-p.x)*o.centerForce*n,p.vy+=(i-p.y)*o.centerForce*n,l.forEach(g=>{if(p.id===g.id)return;let v=p.x-g.x,y=p.y-g.y,x=Math.sqrt(v*v+y*y)||1,h=o.chargeStrength*n/(x*x);p.vx+=v/x*h,p.vy+=y/x*h;});}),t.forEach(p=>{let d=m.get(typeof p.source=="string"?p.source:p.source.id),i=m.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!i)return;let g=i.x-d.x,v=i.y-d.y,y=Math.sqrt(g*g+v*v)||1,x=(y-o.linkDistance)/y*o.forceStrength*n;d.vx+=g*x,d.vy+=v*x,i.vx-=g*x,i.vy-=v*x;}),l.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return l}function ld({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:m,className:c}){let n=react.useRef(null),[p,d]=react.useState([]),[i,g]=react.useState(null),[v,y]=react.useState(null),[x,h]=react.useState(null),[f,u]=react.useState(1),[N,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let A=Yg(e,t,a.width,a.height,a,150);d(A);},[e,t,a]);let b=react.useCallback((A,_)=>{a.enableDragging&&(_.stopPropagation(),g(A));},[a.enableDragging]),D=react.useCallback(A=>{if(!i||!n.current)return;let E=n.current.getBoundingClientRect(),z=(A.clientX-E.left-N.x)/f,q=(A.clientY-E.top-N.y)/f;d(ae=>ae.map(ie=>ie.id===i?{...ie,x:z,y:q,fx:z,fy:q}:ie));},[i,f,N]),k=react.useCallback(()=>{g(null);},[]),S=react.useCallback((A,_)=>{_.stopPropagation(),m?.({type:"node-click",node:A,position:{x:_.clientX,y:_.clientY}});},[m]),w=react.useCallback((A,_)=>{_.stopPropagation(),m?.({type:"edge-click",edge:A,position:{x:_.clientX,y:_.clientY}});},[m]),U=react.useCallback(A=>{let _=p.find(E=>E.id===A);return _?{x:_.x,y:_.y}:{x:0,y:0}},[p]),W=react.useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let _=A.card.priority;return _==="URGENT"?"#ef4444":_==="HIGH"?"#f59e0b":_==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:I("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:I("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children: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:()=>u(A=>Math.min(A+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(f*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>u(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),T({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:fs(A)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[sd(A)," ",bs(A)]})]},A))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${N.x}, ${N.y}) scale(${f})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let _=U(typeof A.source=="string"?A.source:A.source.id),E=U(typeof A.target=="string"?A.target:A.target.id),z=id(A.type),q=x===A.id,ae=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:I("relationships-graph-edge",q&&"hovered",ae&&"critical"),onMouseEnter:()=>h(A.id),onMouseLeave:()=>h(null),onClick:ie=>w(A,ie),children:[jsxRuntime.jsx("line",{x1:_.x,y1:_.y,x2:E.x,y2:E.y,stroke:fs(A.type),strokeWidth:ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:q?1:.6,markerEnd:z?"url(#arrowhead)":void 0}),a.showEdgeLabels&&q&&jsxRuntime.jsx("text",{x:(_.x+E.x)/2,y:(_.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:bs(A.type)})]},A.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(A=>{let _=v===A.id,E=A.onCriticalPath;return jsxRuntime.jsxs("g",{className:I("relationships-graph-node",_&&"hovered",E&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:z=>b(A.id,z),onMouseEnter:()=>y(A.id),onMouseLeave:()=>y(null),onClick:z=>S(A,z),children:[jsxRuntime.jsx("circle",{r:E?a.nodeSize*1.2:a.nodeSize,fill:W(A),stroke:E?"#fbbf24":"#ffffff",strokeWidth:E?3:2,opacity:_?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 md({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=react.useState(""),[m,c]=react.useState(false),[n,p]=react.useState(null),[d,i]=react.useState(null),g=react.useRef(null),v=m||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let f=u=>{u.key==="Escape"&&!v&&y();};if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,v]);let y=()=>{v||(l(""),p(null),i(null),t());},x=async()=>{if(!(!s.trim()||v)){c(true),p(null),i(null);try{let f=await r(s.trim());i(f);}catch(f){p(f instanceof Error?f.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{d&&(a(d),y());};return e?jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:f=>f.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:y,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((f,u)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:f.title},u))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((f,u)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:f.title}),f.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:f.description})]}),f.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${f.priority==="URGENT"?"bg-red-500/20 text-red-400":f.priority==="HIGH"?"bg-orange-500/20 text-orange-400":f.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:f.priority})]})},u)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:g,value:s,onChange:f=>l(f.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),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((f,u)=>jsxRuntime.jsx("button",{onClick:()=>l(f),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:f},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:y,disabled:v,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:h,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:x,disabled:!s.trim()||v,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:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var hs={"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 qg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Jg={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 Zg(e,t,a){let r=hs[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Gr(e){return `$${e.toFixed(4)}`}var vs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Zg(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),m=a.filter(d=>d.success),c=a.reduce((d,i)=>d+i.duration,0),n={},p={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?m.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 m=this.operations.filter(p=>p.timestamp>=l).length,c=Math.max(0,o-m),n=m/o*100;return {used:m,limit:o,remaining:c,percentUsed:n,isExceeded:m>=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)}},Va=new vs;function gd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Va.getStats()),[s,l]=react.useState(Va.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Va.getStats()),l(Va.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let m=Va.getRecentOperations(5);return jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Gr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,n])=>{let p=r.costsByFeature[c]||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:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Gr(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Gr(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function hd({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,m]=react.useState(""),[c,n]=react.useState(""),[p,d]=react.useState(""),[i,g]=react.useState(false),[v,y]=react.useState(null),[x,h]=react.useState(null),[f,u]=react.useState(null),N=react.useRef(null),T=i||o;react.useEffect(()=>{e&&N.current&&N.current.focus();},[e]),react.useEffect(()=>{let w=U=>{U.key==="Escape"&&!T&&b();};if(e)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,T]);let b=()=>{T||(m(""),n(""),d(""),y(null),h(null),u(null),t());},D=async()=>{if(!(!l.trim()||T)){g(true),y(null),h(null),u(null);try{let w=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});h(w.tasks.tasks),u({from_cache:w.from_cache,tokens_used:w.tokens_used,mock_mode:w.mock_mode,similarity:w.similarity,tokens_saved:w.tokens_saved});}catch(w){y(w instanceof Error?w.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{x&&(a(x),b());};if(!e)return null;let S=f?.similarity?((f.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Be,{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-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:w=>w.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:b,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:x?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[f?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),f?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",S,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[f?.tokens_used||0," tokens"]}),f?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[f.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[x.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:x.map((w,U)=>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:["#",U+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:w.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"})]}),w.start," \u2192 ",w.end]}),jsxRuntime.jsxs("span",{children:[w.duration," days"]}),w.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",w.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${w.priority==="high"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:w.priority})]})},w.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:N,value:l,onChange:w=>m(w.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:T}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:w=>n(w.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:T})]}),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:p,onChange:w=>d(w.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:T})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((w,U)=>jsxRuntime.jsx("button",{onClick:()=>m(w),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:w},U))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:T,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),x?jsxRuntime.jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:D,disabled:!l.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Lo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(x=>{t&&Kr(()=>Promise.resolve(t(x)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,f,u)=>{console.warn(`Retry attempt ${f} after ${u}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=react.useCallback(async(x,h,f)=>{r(u=>{let N=u.cards.find(w=>w.id===x);if(!N)return u;let T=N.columnId,b={...N,columnId:h,position:f},D=u.cards.map(w=>w.id===x?b:w),k=u.columns.map(w=>{if(w.id===T)return {...w,cardIds:w.cardIds.filter(U=>U!==x)};if(w.id===h){let U=D.filter(W=>W.columnId===h).sort((W,A)=>W.position-A.position);return {...w,cardIds:U.map(W=>W.id)}}return w}),S={...u,cards:D,columns:k};return o(S),S});},[o]),l=react.useCallback(async(x,h)=>{r(f=>{let u=f.cards.map(T=>T.id===x?{...T,...h}:T),N={...f,cards:u};return o(N),N});},[o]),m=react.useCallback(async x=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let u={...x,id:h},N=f.columns.map(b=>b.id===x.columnId?{...b,cardIds:[...b.cardIds,h]}:b),T={...f,cards:[...f.cards,u],columns:N};return o(T),T});},[o]),c=react.useCallback(async x=>{r(h=>{let f=h.cards.find(b=>b.id===x);if(!f)return h;let u=h.cards.filter(b=>b.id!==x),N=h.columns.map(b=>b.id===f.columnId?{...b,cardIds:b.cardIds.filter(D=>D!==x)}:b),T={...h,cards:u,columns:N};return o(T),T});},[o]),n=react.useCallback(async x=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let u={...x,id:h,cardIds:[]},N={...f,columns:[...f.columns,u]};return o(N),N});},[o]),p=react.useCallback(async(x,h)=>{r(f=>{let u=f.columns.map(T=>T.id===x?{...T,...h}:T),N={...f,columns:u};return o(N),N});},[o]),d=react.useCallback(async x=>{r(h=>{let f=h.cards.filter(T=>T.columnId!==x),u=h.columns.filter(T=>T.id!==x),N={...h,cards:f,columns:u};return o(N),N});},[o]),i=react.useCallback(x=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(x),h},[m]),g=react.useCallback(x=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(x),h},[n]),v=react.useCallback(()=>{r(x=>{let h={...x,cards:[],columns:[]};return o(h),h});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:m,onCardDelete:c,onColumnCreate:n,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:v}}}function yd({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Lo({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(c,n,p={})=>{s.addCard({title:n,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,n)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:n??p+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 Ur={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},kd={by:"none",order:"asc"};function wd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Ur,...e}),[s,l]=react.useState({...kd,...t}),m=react.useCallback(y=>{o(x=>({...x,...y}));},[]),c=react.useCallback(y=>{l(x=>({...x,...y}));},[]),n=react.useCallback(()=>{o(Ur),l(kd);},[]),p=react.useCallback(()=>{a&&o({...Ur,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Ur,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Ur,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(y=>{let x=[...y];if(r.search){let h=r.search.toLowerCase();x=x.filter(f=>f.title.toLowerCase().includes(h)||f.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,f=h.getFullYear(),u=String(h.getMonth()+1).padStart(2,"0"),N=String(h.getDate()).padStart(2,"0"),T=`${f}-${u}-${N}`;x=x.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let D=b.endDate||b.dueDate;if(!D)return false;let k;if(typeof D=="string")k=D.split("T")[0]||D;else {let S=D.getUTCFullYear(),w=String(D.getUTCMonth()+1).padStart(2,"0"),U=String(D.getUTCDate()).padStart(2,"0");k=`${S}-${w}-${U}`;}switch(r.dateFilter){case "overdue":return k<T;case "today":return k===T;case "this-week":let S=new Date(T+"T00:00:00"),w=new Date(k+"T00:00:00"),U=new Date(S);return U.setDate(U.getDate()+7),w>=S&&w<=U;case "custom":if(r.dateRange){let W=typeof D=="string"?new Date(D):D;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(x=x.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(x=x.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(x=x.filter(h=>h.labels&&h.labels.some(f=>r.labels.includes(f)))),r.columns.length>0&&(x=x.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&x.sort((h,f)=>{let u=0;switch(s.by){case "created":let N=h.createdAt?new Date(h.createdAt).getTime():0,T=f.createdAt?new Date(f.createdAt).getTime():0;u=N-T;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=b[h.priority||"LOW"],k=b[f.priority||"LOW"];u=D-k;break;case "dueDate":let S=h.endDate||h.dueDate,w=f.endDate||f.dueDate;if(!S)return 1;if(!w)return -1;let U=typeof S=="string"?new Date(S).getTime():S.getTime(),W=typeof w=="string"?new Date(w).getTime():w.getTime();u=U-W;break;case "title":u=h.title.localeCompare(f.title);break;case "estimate":let A=h.estimatedTime||0,_=f.estimatedTime||0;u=A-_;break;default:u=0;}return s.order==="asc"?u:-u}),x},[r,s]);return {filters:r,sort:s,setFilters:m,setSort:c,resetFilters:n,filterMyTasks:p,filterOverdue:d,filterHighPriority:i,applyFilters:v,hasActiveFilters:g}}var Td,Nd;if(typeof window<"u")try{let e=_r("ai");Td=e.generateObject,Nd=e.generateText;}catch{}function Dd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Td&&Nd&&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 g=i instanceof Error?i:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let g=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let g=i instanceof Error?i:new Error("Failed to predict risks");throw o(g),g}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 g=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(g),g}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("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let g=i instanceof Error?i:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:m,onPredictRisks:c,onGenerateSubtasks:n,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function xs(){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 Sd(e){let{cards:t}=e,[a,r]=xs(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=i.ctrlKey||i.metaKey,v=i.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(y=>y!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let y=t.find(h=>h.id===d),x=t.find(h=>h.id===a.lastSelectedCardId);if(y&&x&&y.columnId===x.columnId){let h=t.filter(k=>k.columnId===y.columnId).sort((k,S)=>k.position-S.position),f=h.findIndex(k=>k.id===a.lastSelectedCardId),u=h.findIndex(k=>k.id===d),[N,T]=f<u?[f,u]:[u,f],b=h.slice(N,T+1).map(k=>k.id),D=Array.from(new Set([...a.selectedCardIds,...b]));r({selectedCardIds:D,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]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),p=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:m,selectAll:c,toggleCard:n,getSelectedCards:p}}var Ed={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Pd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Ed,...a}),[a]),[s,l]=react.useState([]),m=react.useCallback((y,x,h,f,u)=>{if(x.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let N={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:x,columnId:h,strategy:f,color:u,isExpanded:true,position:s.filter(T=>T.columnId===h).length,createdAt:new Date};l(T=>[...T,N]);},[o.minCardsPerStack,s]),c=react.useCallback(y=>{l(x=>x.filter(h=>h.id!==y));},[]),n=react.useCallback(y=>{l(x=>x.map(h=>h.id===y?{...h,isExpanded:!h.isExpanded}:h));},[]),p=react.useCallback((y,x)=>{l(h=>h.map(f=>f.id===y&&!f.cardIds.includes(x)?{...f,cardIds:[...f.cardIds,x]}:f));},[]),d=react.useCallback((y,x)=>{l(h=>h.map(f=>{if(f.id===y){let u=f.cardIds.filter(N=>N!==x);return u.length<o.minCardsPerStack?null:{...f,cardIds:u}}return f}).filter(f=>f!==null));},[o.minCardsPerStack]),i=react.useCallback(y=>s.filter(x=>x.columnId===y).sort((x,h)=>x.position-h.position),[s]),g=react.useCallback(async y=>{let x=t.filter(T=>T.columnId===y);if(x.length<o.minCardsPerStack*2)return [];let h=[],f=new Map;x.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(b=>{f.has(b)||f.set(b,[]),f.get(b).push(T);});}),f.forEach((T,b)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:T.map(D=>D.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${b}"`,confidence:.85});});let u=new Map;x.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(b=>{u.has(b)||u.set(b,[]),u.get(b).push(T);});}),u.forEach((T,b)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:T.map(D=>D.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let N=new Map;if(x.forEach(T=>{T.priority&&(N.has(T.priority)||N.set(T.priority,[]),N.get(T.priority).push(T));}),N.forEach((T,b)=>{if(T.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";h.push({stack:{title:`${D} ${b} Priority`,cardIds:T.map(k=>k.id),columnId:y,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${b} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of x){let D=(await r.findSimilar(T,x)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let k=[T.id,...D.map(w=>w.card.id)],S=D.reduce((w,U)=>w+U.similarity,0)/D.length;h.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:k,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:S});}}return h.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,b)=>b.confidence-T.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(y=>{m(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(x=>x.columnId)).forEach(async x=>{let h=await g(x),f=h[0];h.length>0&&f&&f.confidence>=.9&&v(f);});},[]),{stacks:s,createStack:m,deleteStack:c,toggleStack:n,addToStack:p,removeFromStack:d,getStacksForColumn:i,getSuggestions:g,applySuggestion:v,config:o}}var Md=react.createContext(null);function Id({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(c=>{let{Column:n}=_r("@libxai/core");s.set(c.id,new n(c));}),t?.cards?.forEach(c=>{let{Card:n}=_r("@libxai/core");l.set(c.id,new n(c));});let m=null;if(t?.board){let{Board:c}=_r("@libxai/core");m=new c(t.board);}r.current=new core.BoardStore({board:m,columns:s,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Md.Provider,{value:{store:o},children:e})}function Bo(){let e=react.useContext(Md);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function $r(){let e=Bo(),[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 m=react.useCallback(f=>{e.updateBoard(f);},[e]),c=react.useCallback(f=>{e.addColumn(f);},[e]),n=react.useCallback((f,u)=>{e.updateColumn(f,u);},[e]),p=react.useCallback(f=>{e.deleteColumn(f);},[e]),d=react.useCallback(f=>e.getColumn(f),[e]),i=react.useCallback(f=>{e.addCard(f);},[e]),g=react.useCallback((f,u)=>{e.updateCard(f,u);},[e]),v=react.useCallback(f=>{e.deleteCard(f);},[e]),y=react.useCallback((f,u,N)=>{e.moveCard(f,u,N);},[e]),x=react.useCallback(f=>e.getCard(f),[e]),h=react.useCallback(f=>e.getCardsByColumn(f),[e]);return {board:t,columns:r,cards:s,updateBoard:m,addColumn:c,updateColumn:n,deleteColumn:p,getColumn:d,addCard:i,updateCard:g,deleteCard:v,moveCard:y,getCard:x,getCardsByColumn:h}}function Fd(e){let{cards:t}=$r();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 Ld(e="position",t="asc"){let{cards:a}=$r();return react.useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?m[o.priority]:0,n=s.priority?m[s.priority]:0;l=c-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 Ro=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ys.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 m=await Promise.resolve(l.apply(s,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,m,{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);}},bf=new Ro;function Rd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:m=0,getItemKey:c}){let n=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:m}),d=p.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=l?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(v=>{let y=e[v.index];if(!y)return null;let x=c?c(y,v.index):v.index,h={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsxRuntime.jsx("div",{style:h,"data-index":v.index,children:r(y,v.index)},x)})})})}function Od(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 Ud({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:m=16,getItemKey:c,horizontal:n=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:l,gap:m}),i=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:o(x,y.index)},h)})})})}function zd(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 $d(e,t=10){return e>t}var Ts={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ns={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ds={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ss={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Es={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ps={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ms={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Is={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)"},As={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)"},Fs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Ls={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}},Bs={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}},Oo={spacing:Ts,borderRadius:Ns,fontSize:Ds,fontWeight:Ss,lineHeight:Es,zIndex:Ps,duration:Ms,easing:Is,shadows:As,opacity:Fs,kanban:Ls,gantt:Bs};function Hd(e,t,a){return e[t]??a}function Rs(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)?Rs(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function yf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Os(e="asakaa"){let t=Rs(Oo),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=yf(o);a.push(` ${s}: ${l};`);}return `:root {
323
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Ol(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xa(e,t){let a=Ol(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let n=a.find(m=>m.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(m=>{let c=m.name.toLowerCase();return l.every(s=>c.includes(s))})}function es(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 d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}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 v=new Date(r),x=v.getDay(),k=u-x;return k<=0&&(k+=7),v.setDate(v.getDate()+k),v}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let d=parseInt(n[1],10),u=n[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+d):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+d*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+d),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let d=parseInt(m[1],10),u=parseInt(m[2],10)-1,v=parseInt(m[3],10);return new Date(v,u,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},s=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(s&&s[1]&&s[2]){let d=parseInt(s[1],10),u=c[s[2].toLowerCase()],v=s[3]?parseInt(s[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,d)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=p[i[1].toLowerCase()],u=parseInt(i[2],10),v=i[3]?parseInt(i[3],10):r.getFullYear();if(d!==void 0)return new Date(v,d,u)}return null}function ts(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 as(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 Ul(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 Gl(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 s=r[1].trim(),p=r[2].trim(),i=xa(t,s),d=es(p);if(!i)return {type:"move_task",taskName:s,message:`Could not find a task named "${s}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:i.id,taskName:i.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(d);return v.setDate(v.getDate()+u),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:d,endDate:v},message:`Moved "${i.name}" to ${d.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),p=o[2].trim(),i=xa(t,s),d=ts(p);if(!i)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!d||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(i.endDate);return u.setDate(u.getDate()+d),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:u},message:`Extended "${i.name}" by ${d} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let s=n[1].trim(),p=n[2].trim(),i=xa(t,s),d=as(p);return i?d===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:d},message:`Set "${i.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,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 s=l[1].trim(),p=l[2].trim(),i=xa(t,s);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:p},message:`Renamed "${i.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let s=m[1].trim(),p=m[2].trim(),i=xa(t,s),d=xa(t,p);return i?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:i.id,dependencyTo:d.id,message:`Linked "${i.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let s=c[1].trim(),p=xa(t,s);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}return null}function zl(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 xg(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 kg(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function To(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let i=a.find(d=>d.id===p);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>To(p,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let l=p=>{if(p)return typeof p=="string"?new Date(p):p},m=l(e.startDate),c=l(e.endDate),s=e.metadata?.isMilestone===true||m&&c&&Math.abs(c.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:c,progress:e.progress||0,status:xg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:s,isCriticalPath:e.metadata?.isCriticalPath===true}}function $l(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:kg(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Hl(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>To(r,e,t))}var rs={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"}},os={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"}},No={en:rs,es:os};function ns(e){return No[e]||No.en}function Do(e,t){let a=ns(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 jl(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(...jl(r.subtasks,t+1));return a}function Ag({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 Kl({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:l}){let{theme:m="dark",locale:c="en",customTranslations:s,showSearch:p=true,showHierarchy:i=true}=t,d=Do(c,s),u=m==="dark",[v,x]=react.useState(new Set),[k,y]=react.useState("startDate"),[b,g]=react.useState("asc"),[D,h]=react.useState("");react.useMemo(()=>{let w=new Set;function B(H){for(let I of H)I.subtasks?.length&&(w.add(I.id),B(I.subtasks));}B(e),x(w);},[e]);let f=react.useCallback(w=>{x(B=>{let H=new Set(B);return H.has(w)?H.delete(w):H.add(w),H}),a.onTaskToggleExpand?.(w);},[a]),N=react.useCallback(w=>{k===w?g(B=>B==="asc"?"desc":"asc"):(y(w),g("asc")),a.onSortChange?.({column:w,direction:b==="asc"?"desc":"asc"});},[k,b,a]),C=react.useMemo(()=>{let w=jl(e);if(D.trim()){let H=D.toLowerCase();w=w.filter(I=>I.name.toLowerCase().includes(H));}let B=[];for(let H of w){let I=H.level===0;H.level>0&&(I=true),(I||D.trim())&&B.push(H);}return D.trim()&&B.sort((H,I)=>{let $,S;switch(k){case "name":$=H.name.toLowerCase(),S=I.name.toLowerCase();break;case "startDate":$=H.startDate?.getTime()||0,S=I.startDate?.getTime()||0;break;case "endDate":$=H.endDate?.getTime()||0,S=I.endDate?.getTime()||0;break;case "progress":$=H.progress||0,S=I.progress||0;break;case "status":$=H.status||"todo",S=I.status||"todo";break;default:return 0}return $<S?b==="asc"?-1:1:$>S?b==="asc"?1:-1:0}),B},[e,D,k,b]),M=w=>w?(w instanceof Date?w:new Date(w)).toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:A("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:A("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:A("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsxRuntime.jsx("p",{className:A("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:A("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:A("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:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:A("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:D,onChange:w=>h(w.target.value),placeholder:d.toolbar.searchPlaceholder,className:A("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:A("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",d.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:A("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:()=>N("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>N("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>N("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>N("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>N("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:C.map((w,B)=>{let H=v.has(w.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:B*.02},className:A("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:i?`${24+w.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(w),onDoubleClick:()=>a.onTaskDoubleClick?.(w),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[i&&w.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),f(w.id);},className:A("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:H?jsxRuntime.jsx(lucideReact.ChevronDown,{className:A("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:A("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),i&&!w.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...w,progress:w.progress===100?0:100,status:w.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(Ag,{status:w.status,progress:w.progress})}),jsxRuntime.jsx("span",{className:A("truncate",u?"text-white":"text-gray-900",w.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:w.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:A("px-2 py-1 rounded-full text-xs font-medium",w.progress===100||w.status==="completed"?"bg-green-500/10 text-green-500":w.progress&&w.progress>0||w.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:w.progress===100||w.status==="completed"?d.status.completed:w.progress&&w.progress>0||w.status==="in-progress"?d.status.inProgress:d.status.todo})}),jsxRuntime.jsxs("div",{className:A("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"}),M(w.startDate)]}),jsxRuntime.jsxs("div",{className:A("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"}),M(w.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:A("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:A("h-full rounded-full transition-all",w.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${w.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:A("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[w.progress||0,"%"]})]})})]},w.id)})}),C.length===0&&D&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:A("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:A(u?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.noResults})]})})]})]})}var ss={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"},is={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"},ls={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"},Eo={dark:ss,light:is,neutral:ls};function Yl(e){return Eo[e]||Eo.dark}var ds={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"}},cs={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"}},Po={en:ds,es:cs};function Rr(e){return Po[e]||Po.en}function Mo(e,t){let a=Rr(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 Xl(e){let t=Rr(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 ql(e,t=0,a=true){let r=Rr(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 $g(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 ps(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 Hg({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 Ql({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:m}){let{theme:c="dark",locale:s="en",customTranslations:p}=t,i=Mo(s,p),d=c==="dark",[u,v]=react.useState(r||new Date),[x,k]=react.useState(null),y=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),b=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),g=react.useCallback(()=>{v(new Date);},[]),D=react.useMemo(()=>{let C=u.getFullYear(),M=u.getMonth(),w=new Date(C,M,1),B=new Date(C,M+1,0),H=w.getDay(),I=B.getDate(),$=$g(e),S=new Date;S.setHours(0,0,0,0);let z=[],V=H,ae=new Date(C,M,0).getDate();for(let J=V-1;J>=0;J--){let R=new Date(C,M-1,ae-J);z.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:$.filter(O=>ps(R,O)).map(O=>({id:O.id,title:O.name,start:O.startDate,end:O.endDate,task:O}))});}for(let J=1;J<=I;J++){let R=new Date(C,M,J),O=R.getTime()===S.getTime();z.push({date:R,isCurrentMonth:true,isToday:O,isWeekend:R.getDay()===0||R.getDay()===6,events:$.filter(P=>ps(R,P)).map(P=>({id:P.id,title:P.name,start:P.startDate,end:P.endDate,task:P}))});}let ie=42-z.length;for(let J=1;J<=ie;J++){let R=new Date(C,M+1,J);z.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:$.filter(O=>ps(R,O)).map(O=>({id:O.id,title:O.name,start:O.startDate,end:O.endDate,task:O}))});}return z},[u,e]),h=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],f=u.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),N=react.useCallback(C=>{let M=C.progress===100?0:100,w=M===100?"completed":"todo";a.onTaskUpdate?.({...C,status:w,progress:M});},[a]);return o?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),style:m,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:A("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:[i.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),style:m,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:A("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:A("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:A("flex-1 flex items-center justify-center",d?"bg-[#0F1117]":"bg-white",l),style:m,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:A("text-lg font-semibold mb-2",d?"text-white":"text-gray-900"),children:i.labels.noEvents}),jsxRuntime.jsx("p",{className:A("text-sm",d?"text-[#9CA3AF]":"text-gray-600"),children:i.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:A("flex-1 flex flex-col w-full h-full overflow-hidden",d?"bg-[#0F1117]":"bg-white",l),style:m,children:[jsxRuntime.jsx("div",{className:A("flex-shrink-0 px-6 py-4 border-b",d?"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:A("text-xl font-semibold capitalize",d?"text-white":"text-gray-900"),children:f}),jsxRuntime.jsx("button",{onClick:g,className:A("px-3 py-1.5 text-sm rounded-lg transition-colors",d?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:i.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:y,className:A("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:A("w-5 h-5",d?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:b,className:A("p-2 rounded-lg transition-colors",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:A("w-5 h-5",d?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 overflow-auto",children:jsxRuntime.jsxs("div",{className:"h-full flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:h.map(C=>jsxRuntime.jsx("div",{className:A("py-2 text-center text-xs font-medium uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:C},C))}),jsxRuntime.jsx("div",{className:A("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",d?"bg-white/5":"bg-gray-200"),children:D.map((C,M)=>jsxRuntime.jsxs("div",{className:A("min-h-[100px] p-2 transition-colors",d?"bg-[#0F1117]":"bg-white",!C.isCurrentMonth&&(d?"bg-[#0F1117]/50":"bg-gray-50"),C.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:A("text-sm font-medium mb-1",C.isToday?"text-[#3B82F6]":C.isCurrentMonth?d?"text-white":"text-gray-900":d?"text-[#6B7280]":"text-gray-400"),children:C.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[C.events.slice(0,3).map(w=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{k(w.task),a.onEventClick?.(w);},whileHover:{scale:1.02},className:A("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",w.task.progress===100?d?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":d?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Hg,{task:w.task}),jsxRuntime.jsx("span",{className:"truncate",children:w.title})]},w.id)),C.events.length>3&&jsxRuntime.jsxs("div",{className:A("text-xs px-1.5",d?"text-[#6B7280]":"text-gray-400"),children:["+",C.events.length-3," ",s==="es"?"m\xE1s":"more"]})]})]},M))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:A("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",d?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:A("p-4 border-b flex items-center justify-between",d?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:A("font-semibold",d?"text-white":"text-gray-900"),children:s==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>k(null),className:A("p-1 rounded",d?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("div",{className:"p-4 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:A("font-medium",d?"text-white":"text-gray-900"),children:x.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:A("text-sm",d?"text-white":"text-gray-900"),children:x.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:A("text-sm",d?"text-white":"text-gray-900"),children:x.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:A("text-xs uppercase mb-2 block",d?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:A("flex-1 h-2 rounded-full overflow-hidden",d?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:A("h-full rounded-full transition-all",x.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${x.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:A("text-sm font-medium w-10",d?"text-white":"text-gray-900"),children:[x.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{N(x),k(null);},className:A("w-full py-2 rounded-lg font-medium transition-colors",x.progress===100?"bg-gray-500/10 text-gray-500 hover:bg-gray-500/20":"bg-green-500/10 text-green-500 hover:bg-green-500/20"),children:x.progress===100?s==="es"?"Marcar como pendiente":"Mark as pending":s==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>k(null),className:"fixed inset-0 bg-black/20 z-40"})})]})}var us={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"},gs={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"},fs={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"},Ao={dark:us,light:gs,neutral:fs};function ed(e){return Ao[e]||Ao.dark}function _g({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:m}){let[c,s]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),i=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(y=>y.assignedUserIds||[])).size,x=p.map(y=>y.priority).filter(Boolean),k=new Set(p.flatMap(y=>y.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:x,labels:k}},[p]),d=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:A("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:d,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:A("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:i.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick: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:[i.uniqueAssignees," assignees"]})]}),i.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:[i.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:p.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:p.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:v=>{v.stopPropagation(),n?.(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 ad={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Or(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 Ur(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 rd(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 od({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:l,className:m}){let c=react.useMemo(()=>({...ad,...l}),[l]),[s,p]=react.useState(new Set),i=react.useRef(null),d=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let D=g.timestamp.toISOString().split("T")[0],h=b.get(D);h?h.push(g):b.set(D,[g]);}),Array.from(b.entries()).sort((g,D)=>D[0].localeCompare(g[0])).map(([g,D])=>({date:new Date(g),events:D.sort((h,f)=>f.timestamp.getTime()-h.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(D=>{b.add(D.userId),g.add(D.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),x=b=>{p(g=>{let D=new Set(g);return D.has(b)?D.delete(b):D.add(b),D});},k=b=>{let D=new Date().getTime()-b.getTime(),h=Math.floor(D/6e4),f=Math.floor(D/36e5),N=Math.floor(D/864e5);return h<1?"just now":h<60?`${h}m ago`:f<24?`${f}h ago`:N<7?`${N}d ago`:b.toLocaleDateString()},y=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(n&&i.current){let b=i.current.querySelector(`[data-event-id="${n}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:A("history-timeline-empty",m),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:A("history-timeline",c.compact&&"compact",m),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"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Ur(b)," ",b.replace("_"," ")]},b))]}),u.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"}),u.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})})]}),y>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:i,children:d.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,D)=>{let h=s.has(g.id),f=n===g.id,N=rd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:A("history-timeline-event",h&&"expanded",f&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:N},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ur(g.type)})}),D<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:N}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&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:Or(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?k(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),x(g.id);},children:[h?"\u25BC":"\u25B6"," Show changes"]}),h&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([C,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(M.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(M.to)})]})]},C)),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(([C,M])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(M)})]},C))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function sd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:m,onSpeedChange:c,className:s}){let p=[.5,1,1.5,2,3],i=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:A("history-replay-empty",s),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:A("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:i&&Ur(i.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:i&&Or(i)}),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:i&&i.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=>m(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:A("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>m(v),title:Or(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:p.map(u=>jsxRuntime.jsxs("button",{className:A("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>c(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:i&&i.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:A("history-replay-start",s),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 bs(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 hs(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 id(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 ld(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function qg(e,t,a,r,o,n=100){let l=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(l.map(c=>[c.id,c]));for(let c=0;c<n;c++){let s=1-c/n;l.forEach(p=>{let i=a/2,d=r/2;p.vx+=(i-p.x)*o.centerForce*s,p.vy+=(d-p.y)*o.centerForce*s,l.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,x=p.y-u.y,k=Math.sqrt(v*v+x*x)||1,y=o.chargeStrength*s/(k*k);p.vx+=v/k*y,p.vy+=x/k*y;});}),t.forEach(p=>{let i=m.get(typeof p.source=="string"?p.source:p.source.id),d=m.get(typeof p.target=="string"?p.target:p.target.id);if(!i||!d)return;let u=d.x-i.x,v=d.y-i.y,x=Math.sqrt(u*u+v*v)||1,k=(x-o.linkDistance)/x*o.forceStrength*s;i.vx+=u*k,i.vy+=v*k,d.vx-=u*k,d.vy-=v*k;}),l.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return l}function dd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:m,className:c}){let s=react.useRef(null),[p,i]=react.useState([]),[d,u]=react.useState(null),[v,x]=react.useState(null),[k,y]=react.useState(null),[b,g]=react.useState(1),[D,h]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=qg(e,t,a.width,a.height,a,150);i(I);},[e,t,a]);let f=react.useCallback((I,$)=>{a.enableDragging&&($.stopPropagation(),u(I));},[a.enableDragging]),N=react.useCallback(I=>{if(!d||!s.current)return;let S=s.current.getBoundingClientRect(),z=(I.clientX-S.left-D.x)/b,V=(I.clientY-S.top-D.y)/b;i(ae=>ae.map(ie=>ie.id===d?{...ie,x:z,y:V,fx:z,fy:V}:ie));},[d,b,D]),C=react.useCallback(()=>{u(null);},[]),M=react.useCallback((I,$)=>{$.stopPropagation(),m?.({type:"node-click",node:I,position:{x:$.clientX,y:$.clientY}});},[m]),w=react.useCallback((I,$)=>{$.stopPropagation(),m?.({type:"edge-click",edge:I,position:{x:$.clientX,y:$.clientY}});},[m]),B=react.useCallback(I=>{let $=p.find(S=>S.id===I);return $?{x:$.x,y:$.y}:{x:0,y:0}},[p]),H=react.useCallback(I=>{if(I.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return I.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=I.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return I.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:A("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:A("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children: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"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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(I=>Math.min(I+.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(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),h({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(I=>I.type))).map(I=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:bs(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[id(I)," ",hs(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:N,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${D.x}, ${D.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let $=B(typeof I.source=="string"?I.source:I.source.id),S=B(typeof I.target=="string"?I.target:I.target.id),z=ld(I.type),V=k===I.id,ae=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:A("relationships-graph-edge",V&&"hovered",ae&&"critical"),onMouseEnter:()=>y(I.id),onMouseLeave:()=>y(null),onClick:ie=>w(I,ie),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:S.x,y2:S.y,stroke:bs(I.type),strokeWidth:ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:V?1:.6,markerEnd:z?"url(#arrowhead)":void 0}),a.showEdgeLabels&&V&&jsxRuntime.jsx("text",{x:($.x+S.x)/2,y:($.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:hs(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(I=>{let $=v===I.id,S=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:A("relationships-graph-node",$&&"hovered",S&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:z=>f(I.id,z),onMouseEnter:()=>x(I.id),onMouseLeave:()=>x(null),onClick:z=>M(I,z),children:[jsxRuntime.jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(I),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:$?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:I.card.title.length>20?I.card.title.substring(0,20)+"...":I.card.title})]},I.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 pd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[m,c]=react.useState(false),[s,p]=react.useState(null),[i,d]=react.useState(null),u=react.useRef(null),v=m||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let x=()=>{v||(l(""),p(null),d(null),t());},k=async()=>{if(!(!n.trim()||v)){c(true),p(null),d(null);try{let b=await r(n.trim());d(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},y=()=>{i&&(a(i),x());};return e?jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:v,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:i?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!"})]}),i.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:i.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:i.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 (",i.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.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)),i.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.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:n,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:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),s&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:s}),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:v,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:v&&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:v,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"}),i?jsxRuntime.jsx("button",{onClick:y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||v,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:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vs={"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 Zg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Qg={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 ef(e,t,a){let r=vs[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Gr(e){return `$${e.toFixed(4)}`}var ys=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=ef(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(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,d)=>i+d.cost,0),n=a.reduce((i,d)=>i+d.inputTokens,0),l=a.reduce((i,d)=>i+d.outputTokens,0),m=a.filter(i=>i.success),c=a.reduce((i,d)=>i+d.duration,0),s={},p={};return a.forEach(i=>{s[i.feature]=(s[i.feature]||0)+1,p[i.feature]=(p[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:s,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?m.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],n=new Date,l=new Date;a==="month"?l.setMonth(n.getMonth()-1):l.setDate(n.getDate()-1);let m=this.operations.filter(p=>p.timestamp>=l).length,c=Math.max(0,o-m),s=m/o*100;return {used:m,limit:o,remaining:c,percentUsed:s,isExceeded:m>=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)}},Ka=new ys;function fd({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Ka.getStats()),[n,l]=react.useState(Ka.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(Ka.getStats()),l(Ka.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let m=Ka.getRecentOperations(5);return jsxRuntime.jsxs(Be,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Gr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,s])=>{let p=r.costsByFeature[c]||0,i=r.totalOperations>0?s/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Gr(p)})]})]}),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:`${i}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Gr(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function vd({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[l,m]=react.useState(""),[c,s]=react.useState(""),[p,i]=react.useState(""),[d,u]=react.useState(false),[v,x]=react.useState(null),[k,y]=react.useState(null),[b,g]=react.useState(null),D=react.useRef(null),h=d||o;react.useEffect(()=>{e&&D.current&&D.current.focus();},[e]),react.useEffect(()=>{let w=B=>{B.key==="Escape"&&!h&&f();};if(e)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,h]);let f=()=>{h||(m(""),s(""),i(""),x(null),y(null),g(null),t());},N=async()=>{if(!(!l.trim()||h)){u(true),x(null),y(null),g(null);try{let w=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});y(w.tasks.tasks),g({from_cache:w.from_cache,tokens_used:w.tokens_used,mock_mode:w.mock_mode,similarity:w.similarity,tokens_saved:w.tokens_saved});}catch(w){x(w instanceof Error?w.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{k&&(a(k),f());};if(!e)return null;let M=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Be,{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-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:w=>w.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:f,disabled:h,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:k?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 (",M,"% 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:[k.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:k.map((w,B)=>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:["#",B+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:w.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"})]}),w.start," \u2192 ",w.end]}),jsxRuntime.jsxs("span",{children:[w.duration," days"]}),w.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",w.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${w.priority==="high"?"bg-red-500/20 text-red-400":w.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:w.priority})]})},w.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:D,value:l,onChange:w=>m(w.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:h}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:w=>s(w.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:h})]}),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:p,onChange:w=>i(w.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:h})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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((w,B)=>jsxRuntime.jsx("button",{onClick:()=>m(w),disabled:h,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:w},B))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:h&&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:h,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"}),k?jsxRuntime.jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:N,disabled:!l.trim()||h,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:h?"Generating...":"Generate Tasks"})]})]})]})})]})}function Bo({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(k=>{t&&Yr(()=>Promise.resolve(t(k)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),n=react.useCallback(async(k,y,b)=>{r(g=>{let D=g.cards.find(w=>w.id===k);if(!D)return g;let h=D.columnId,f={...D,columnId:y,position:b},N=g.cards.map(w=>w.id===k?f:w),C=g.columns.map(w=>{if(w.id===h)return {...w,cardIds:w.cardIds.filter(B=>B!==k)};if(w.id===y){let B=N.filter(H=>H.columnId===y).sort((H,I)=>H.position-I.position);return {...w,cardIds:B.map(H=>H.id)}}return w}),M={...g,cards:N,columns:C};return o(M),M});},[o]),l=react.useCallback(async(k,y)=>{r(b=>{let g=b.cards.map(h=>h.id===k?{...h,...y}:h),D={...b,cards:g};return o(D),D});},[o]),m=react.useCallback(async k=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...k,id:y},D=b.columns.map(f=>f.id===k.columnId?{...f,cardIds:[...f.cardIds,y]}:f),h={...b,cards:[...b.cards,g],columns:D};return o(h),h});},[o]),c=react.useCallback(async k=>{r(y=>{let b=y.cards.find(f=>f.id===k);if(!b)return y;let g=y.cards.filter(f=>f.id!==k),D=y.columns.map(f=>f.id===b.columnId?{...f,cardIds:f.cardIds.filter(N=>N!==k)}:f),h={...y,cards:g,columns:D};return o(h),h});},[o]),s=react.useCallback(async k=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...k,id:y,cardIds:[]},D={...b,columns:[...b.columns,g]};return o(D),D});},[o]),p=react.useCallback(async(k,y)=>{r(b=>{let g=b.columns.map(h=>h.id===k?{...h,...y}:h),D={...b,columns:g};return o(D),D});},[o]),i=react.useCallback(async k=>{r(y=>{let b=y.cards.filter(h=>h.columnId!==k),g=y.columns.filter(h=>h.id!==k),D={...y,cards:b,columns:g};return o(D),D});},[o]),d=react.useCallback(k=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(k),y},[m]),u=react.useCallback(k=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(k),y},[s]),v=react.useCallback(()=>{r(k=>{let y={...k,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:m,onCardDelete:c,onColumnCreate:s,onColumnUpdate:p,onColumnDelete:i},setBoard:r,helpers:{addCard:d,addColumn:u,deleteCard:c,deleteColumn:i,clearBoard:v}}}function xd({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Bo({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(c,s,p={})=>{n.addCard({title:s,columnId:c,position:r.cards.filter(i=>i.columnId===c).length,...p});},addColumn:(c,s)=>{let p=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;n.addColumn({title:c,position:s??p+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var zr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},wd={by:"none",order:"asc"};function Cd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...zr,...e}),[n,l]=react.useState({...wd,...t}),m=react.useCallback(x=>{o(k=>({...k,...x}));},[]),c=react.useCallback(x=>{l(k=>({...k,...x}));},[]),s=react.useCallback(()=>{o(zr),l(wd);},[]),p=react.useCallback(()=>{a&&o({...zr,assignees:[a]});},[a]),i=react.useCallback(()=>{o({...zr,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{o({...zr,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!==""||n.by!=="none",[r,n]),v=react.useCallback(x=>{let k=[...x];if(r.search){let y=r.search.toLowerCase();k=k.filter(b=>b.title.toLowerCase().includes(y)||b.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,b=y.getFullYear(),g=String(y.getMonth()+1).padStart(2,"0"),D=String(y.getDate()).padStart(2,"0"),h=`${b}-${g}-${D}`;k=k.filter(f=>{if(!f.endDate&&!f.dueDate)return false;let N=f.endDate||f.dueDate;if(!N)return false;let C;if(typeof N=="string")C=N.split("T")[0]||N;else {let M=N.getUTCFullYear(),w=String(N.getUTCMonth()+1).padStart(2,"0"),B=String(N.getUTCDate()).padStart(2,"0");C=`${M}-${w}-${B}`;}switch(r.dateFilter){case "overdue":return C<h;case "today":return C===h;case "this-week":let M=new Date(h+"T00:00:00"),w=new Date(C+"T00:00:00"),B=new Date(M);return B.setDate(B.getDate()+7),w>=M&&w<=B;case "custom":if(r.dateRange){let H=typeof N=="string"?new Date(N):N;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(k=k.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(k=k.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(k=k.filter(y=>y.labels&&y.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(k=k.filter(y=>r.columns.includes(y.columnId))),n.by!=="none"&&k.sort((y,b)=>{let g=0;switch(n.by){case "created":let D=y.createdAt?new Date(y.createdAt).getTime():0,h=b.createdAt?new Date(b.createdAt).getTime():0;g=D-h;break;case "priority":let f={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},N=f[y.priority||"LOW"],C=f[b.priority||"LOW"];g=N-C;break;case "dueDate":let M=y.endDate||y.dueDate,w=b.endDate||b.dueDate;if(!M)return 1;if(!w)return -1;let B=typeof M=="string"?new Date(M).getTime():M.getTime(),H=typeof w=="string"?new Date(w).getTime():w.getTime();g=B-H;break;case "title":g=y.title.localeCompare(b.title);break;case "estimate":let I=y.estimatedTime||0,$=b.estimatedTime||0;g=I-$;break;default:g=0;}return n.order==="asc"?g:-g}),k},[r,n]);return {filters:r,sort:n,setFilters:m,setSort:c,resetFilters:s,filterMyTasks:p,filterOverdue:i,filterHighPriority:d,applyFilters:v,hasActiveFilters:u}}var Nd,Dd;if(typeof window<"u")try{let e=Vr("ai");Nd=e.generateObject,Dd=e.generateText;}catch{}function Sd(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(Nd&&Dd&&e.apiKey),l=react.useCallback(async i=>{if(!n)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:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let u=d instanceof Error?d:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let u=d instanceof Error?d:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async i=>{if(!n)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(d){let u=d instanceof Error?d:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),s=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(d){let u=d instanceof Error?d:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),p=react.useCallback(async i=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(d){let u=d instanceof Error?d:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:m,onPredictRisks:c,onGenerateSubtasks:s,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function ks(){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 Ed(e){let{cards:t}=e,[a,r]=ks(),o=react.useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),n=react.useCallback((i,d)=>{if(!d){r({selectedCardIds:[i],lastSelectedCardId:i});return}let u=d.ctrlKey||d.metaKey,v=d.shiftKey;if(u)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(v&&a.lastSelectedCardId){let x=t.find(y=>y.id===i),k=t.find(y=>y.id===a.lastSelectedCardId);if(x&&k&&x.columnId===k.columnId){let y=t.filter(C=>C.columnId===x.columnId).sort((C,M)=>C.position-M.position),b=y.findIndex(C=>C.id===a.lastSelectedCardId),g=y.findIndex(C=>C.id===i),[D,h]=b<g?[b,g]:[g,b],f=y.slice(D,h+1).map(C=>C.id),N=Array.from(new Set([...a.selectedCardIds,...f]));r({selectedCardIds:N,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),l=react.useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=react.useCallback(i=>{a.selectedCardIds.includes(i)?l(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,l,r]),p=react.useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:l,clearSelection:m,selectAll:c,toggleCard:s,getSelectedCards:p}}var Pd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Md(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...Pd,...a}),[a]),[n,l]=react.useState([]),m=react.useCallback((x,k,y,b,g)=>{if(k.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let D={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:k,columnId:y,strategy:b,color:g,isExpanded:true,position:n.filter(h=>h.columnId===y).length,createdAt:new Date};l(h=>[...h,D]);},[o.minCardsPerStack,n]),c=react.useCallback(x=>{l(k=>k.filter(y=>y.id!==x));},[]),s=react.useCallback(x=>{l(k=>k.map(y=>y.id===x?{...y,isExpanded:!y.isExpanded}:y));},[]),p=react.useCallback((x,k)=>{l(y=>y.map(b=>b.id===x&&!b.cardIds.includes(k)?{...b,cardIds:[...b.cardIds,k]}:b));},[]),i=react.useCallback((x,k)=>{l(y=>y.map(b=>{if(b.id===x){let g=b.cardIds.filter(D=>D!==k);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),d=react.useCallback(x=>n.filter(k=>k.columnId===x).sort((k,y)=>k.position-y.position),[n]),u=react.useCallback(async x=>{let k=t.filter(h=>h.columnId===x);if(k.length<o.minCardsPerStack*2)return [];let y=[],b=new Map;k.forEach(h=>{h.labels&&h.labels.length>0&&h.labels.forEach(f=>{b.has(f)||b.set(f,[]),b.get(f).push(h);});}),b.forEach((h,f)=>{h.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${f}`,cardIds:h.map(N=>N.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${h.length} cards with label "${f}"`,confidence:.85});});let g=new Map;k.forEach(h=>{h.assignedUserIds&&h.assignedUserIds.length>0&&h.assignedUserIds.forEach(f=>{g.has(f)||g.set(f,[]),g.get(f).push(h);});}),g.forEach((h,f)=>{h.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${f.slice(-4)}`,cardIds:h.map(N=>N.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${h.length} cards assigned to the same user`,confidence:.8});});let D=new Map;if(k.forEach(h=>{h.priority&&(D.has(h.priority)||D.set(h.priority,[]),D.get(h.priority).push(h));}),D.forEach((h,f)=>{if(h.length>=o.minCardsPerStack){let N={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[f.toLowerCase()]||"\u26AA";y.push({stack:{title:`${N} ${f} Priority`,cardIds:h.map(C=>C.id),columnId:x,strategy:"priority",color:f==="high"||f==="urgent"?"#ef4444":"#10b981"},reason:`${h.length} cards with ${f} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let h of k){let N=(await r.findSimilar(h,k)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(N.length>=o.minCardsPerStack-1){let C=[h.id,...N.map(w=>w.card.id)],M=N.reduce((w,B)=>w+B.similarity,0)/N.length;y.push({stack:{title:`\u2728 Similar to "${h.title.substring(0,30)}${h.title.length>30?"...":""}"`,cardIds:C,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${N.length+1} similar tasks`,confidence:M});}}return y.filter(h=>h.confidence>=o.autoStackConfidenceThreshold).sort((h,f)=>f.confidence-h.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(x=>{m(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(k=>k.columnId)).forEach(async k=>{let y=await u(k),b=y[0];y.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:n,createStack:m,deleteStack:c,toggleStack:s,addToStack:p,removeFromStack:i,getStacksForColumn:d,getSuggestions:u,applySuggestion:v,config:o}}var Id=react.createContext(null);function Ad({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,l=new Map;t?.columns?.forEach(c=>{let{Column:s}=Vr("@libxai/core");n.set(c.id,new s(c));}),t?.cards?.forEach(c=>{let{Card:s}=Vr("@libxai/core");l.set(c.id,new s(c));});let m=null;if(t?.board){let{Board:c}=Vr("@libxai/core");m=new c(t.board);}r.current=new core.BoardStore({board:m,columns:n,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Id.Provider,{value:{store:o},children:e})}function Ro(){let e=react.useContext(Id);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Hr(){let e=Ro(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,l]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let m=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),s=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),i=react.useCallback(b=>e.getColumn(b),[e]),d=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,g,D)=>{e.moveCard(b,g,D);},[e]),k=react.useCallback(b=>e.getCard(b),[e]),y=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:n,updateBoard:m,addColumn:c,updateColumn:s,deleteColumn:p,getColumn:i,addCard:d,updateCard:u,deleteCard:v,moveCard:x,getCard:k,getCardsByColumn:y}}function Ld(e){let{cards:t}=Hr();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 Bd(e="position",t="asc"){let{cards:a}=Hr();return react.useMemo(()=>[...a].sort((o,n)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(n.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?m[o.priority]:0,s=n.priority?m[n.priority]:0;l=c-s;break}case "createdAt":l=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":l=o.position-n.position;break}return t==="asc"?l:-l}),[a,e,t])}var Oo=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Xs.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let l=n[t];if(typeof l=="function")try{let m=await Promise.resolve(l.apply(n,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,m,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},vf=new Oo;function Od({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:m=0,getItemKey:c}){let s=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:m}),i=p.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=l?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:d,className:o,children:jsxRuntime.jsx("div",{style:u,children:i.map(v=>{let x=e[v.index];if(!x)return null;let k=c?c(x,v.index):v.index,y={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:r(x,v.index)},k)})})})}function Ud(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 zd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:l=3,gap:m=16,getItemKey:c,horizontal:s=true}){let p=react.useRef(null),i=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:l,gap:m}),d=i.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:n,children:jsxRuntime.jsx("div",{style:v,children:d.map(x=>{let k=e[x.index];if(!k)return null;let y=c?c(k,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(k,x.index)},y)})})})}function $d(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 Hd(e,t=10){return e>t}var Ns={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ds={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ss={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Es={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ps={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ms={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Is={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},As={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)"},Fs={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)"},Ls={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Bs={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}},Rs={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}},Uo={spacing:Ns,borderRadius:Ds,fontSize:Ss,fontWeight:Es,lineHeight:Ps,zIndex:Ms,duration:Is,easing:As,shadows:Fs,opacity:Ls,kanban:Bs,gantt:Rs};function Wd(e,t,a){return e[t]??a}function Os(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Os(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function kf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Us(e="asakaa"){let t=Os(Uo),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=kf(o);a.push(` ${n}: ${l};`);}return `:root {
324
324
  ${a.join(`
325
325
  `)}
326
- }`}function Hr(e,t="asakaa"){let a=[],r=Rs(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
326
+ }`}function Wr(e,t="asakaa"){let a=[],r=Os(e);for(let[o,n]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${n};`);}return `:root {
327
327
  ${a.join(`
328
328
  `)}
329
- }`}var Go={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Gs={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Us={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function zs(e=Go,t="asakaa"){let a=Os(t),r=Hr(e,t);return `${a}
329
+ }`}var Go={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Gs={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},zs={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function $s(e=Go,t="asakaa"){let a=Us(t),r=Wr(e,t);return `${a}
330
330
 
331
- ${r}`}function Wd(){return `/**
331
+ ${r}`}function _d(){return `/**
332
332
  * ASAKAA Design Tokens
333
333
  * Auto-generated from design-tokens.ts
334
334
  * Do not edit this file directly
335
335
  */
336
336
 
337
- ${zs(Go)}
337
+ ${$s(Go)}
338
338
 
339
339
  /* Light theme */
340
340
  [data-theme="light"] {
341
- ${Hr(Gs,"asakaa").split(`
341
+ ${Wr(Gs,"asakaa").split(`
342
342
  `).slice(1,-1).join(`
343
343
  `)}
344
344
  }
345
345
 
346
346
  /* Neutral theme */
347
347
  [data-theme="neutral"] {
348
- ${Hr(Us,"asakaa").split(`
348
+ ${Wr(zs,"asakaa").split(`
349
349
  `).slice(1,-1).join(`
350
350
  `)}
351
351
  }
352
- `}var xf=({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 _d({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=ir();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,m])=>{let c=l,n=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":n,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(xf,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},c)})})}
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=gd;exports.AI_FEATURES=Jg;exports.AI_MODELS=hs;exports.AddCardButton=sn;exports.AddColumnButton=nn;exports.AttachmentUploader=Dr;exports.BoardProvider=Id;exports.BulkOperationsToolbar=ro;exports.BurnDownChart=hn;exports.CalendarBoard=Zl;exports.Card=ba;exports.CardDetailModal=pn;exports.CardDetailModalV2=gn;exports.CardHistoryReplay=nd;exports.CardHistoryTimeline=rd;exports.CardRelationshipsGraph=ld;exports.CardStack=Hg;exports.CardTemplateSelector=Tn;exports.CircuitBreaker=Ho;exports.Column=tr;exports.ColumnManager=co;exports.CommandPalette=cn;exports.ConfigMenu=En;exports.ContextMenu=cr;exports.DEFAULT_SHORTCUTS=Sr;exports.DEFAULT_TEMPLATES=Cn;exports.DateRangePicker=vr;exports.DependenciesSelector=xr;exports.DependencyLine=go;exports.DistributionCharts=vn;exports.EditableColumnTitle=Qo;exports.ErrorBoundary=rr;exports.ExportImportModal=Dn;exports.FilterBar=Sn;exports.GANTT_AI_SYSTEM_PROMPT=Ll;exports.GanttAIAssistant=ko;exports.GanttBoard=Fl;exports.GanttI18nContext=dr;exports.GanttMilestone=bo;exports.GanttToolbar=lo;exports.GenerateGanttTasksDialog=hd;exports.GeneratePlanModal=md;exports.GroupBySelector=kn;exports.KanbanBoard=Na;exports.KanbanToolbar=rn;exports.KanbanViewAdapter=Tr;exports.KeyboardShortcutsHelp=wn;exports.ListView=jl;exports.MenuIcons=Ke;exports.PluginManager=Ro;exports.PrioritySelector=Ba;exports.RATE_LIMITS=qg;exports.SwimlaneBoardView=yn;exports.TaskBar=po;exports.TaskFormModal=xo;exports.TaskGrid=mo;exports.ThemeModal=An;exports.ThemeProvider=Wi;exports.ThemeSwitcher=_d;exports.Timeline=yo;exports.UserAssignmentSelector=Oa;exports.VelocityChart=bn;exports.VirtualGrid=Ud;exports.VirtualList=Rd;exports.aiUsageTracker=Va;exports.borderRadius=Ns;exports.calculatePosition=jr;exports.calendarDarkTheme=ps;exports.calendarEnTranslations=ls;exports.calendarEsTranslations=ds;exports.calendarLightTheme=us;exports.calendarNeutralTheme=gs;exports.calendarThemes=Io;exports.calendarTranslations=Eo;exports.cardToGanttTask=Co;exports.cardsToGanttTasks=$l;exports.cn=I;exports.createKanbanView=Ni;exports.createRetryWrapper=vc;exports.darkTheme=Pn;exports.darkTokenTheme=Go;exports.defaultTheme=no;exports.designTokens=Oo;exports.duration=Ms;exports.easing=Is;exports.exportTokensToCSS=Wd;exports.findTaskByName=xa;exports.fontSize=Ds;exports.fontWeight=Ss;exports.formatCost=Gr;exports.ganttEnTranslations=io;exports.ganttEsTranslations=Vi;exports.ganttTaskToCardUpdate=zl;exports.ganttThemes=Ne;exports.ganttTokens=Bs;exports.ganttTranslations=Fn;exports.ganttUtils=Y;exports.generateCSSVariables=Os;exports.generateCompleteCSS=zs;exports.generateInitialPositions=gc;exports.generateTasksContext=Bl;exports.generateThemeVariables=Hr;exports.getCalendarTheme=Ql;exports.getCalendarTranslations=Br;exports.getListViewTheme=Kl;exports.getListViewTranslations=os;exports.getMonthNames=Yl;exports.getToken=Hd;exports.getTranslations=ji;exports.getWeekdayNames=Xl;exports.kanbanTokens=Ls;exports.lightTheme=Mn;exports.lightTokenTheme=Gs;exports.lineHeight=Es;exports.listViewDarkTheme=ns;exports.listViewEnTranslations=as;exports.listViewEsTranslations=rs;exports.listViewLightTheme=ss;exports.listViewNeutralTheme=is;exports.listViewThemes=So;exports.listViewTranslations=To;exports.mergeCalendarTranslations=Po;exports.mergeListViewTranslations=No;exports.mergeTranslations=Ln;exports.neutralTheme=In;exports.neutralTokenTheme=Us;exports.opacity=Fs;exports.parseLocalCommand=Gl;exports.parseNaturalDate=Qn;exports.parseNaturalDuration=es;exports.parseProgress=ts;exports.parseStatus=Ol;exports.pluginManager=bf;exports.retrySyncOperation=hc;exports.retryWithBackoff=Kr;exports.shadows=As;exports.shouldVirtualizeGrid=$d;exports.spacing=Ts;exports.themes=za;exports.useAI=Dd;exports.useBoard=yd;exports.useBoardCore=$r;exports.useBoardStore=Bo;exports.useCardStacking=Pd;exports.useDragState=tn;exports.useFilteredCards=Fd;exports.useFilters=wd;exports.useGanttI18n=Er;exports.useKanbanState=Lo;exports.useKeyboardShortcuts=zi;exports.useMultiSelect=Sd;exports.useSelectionState=xs;exports.useSortedCards=Ld;exports.useTheme=ir;exports.useVirtualGrid=zd;exports.useVirtualList=Od;exports.validateAIResponse=Ul;exports.withErrorBoundary=ln;exports.wouldCreateCircularDependency=Xr;exports.zIndex=Ps;//# sourceMappingURL=index.cjs.map
352
+ `}var wf=({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 Vd({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=lr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([l,m])=>{let c=l,s=c===r;return jsxRuntime.jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${s?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${m.displayName} theme`,"aria-pressed":s,title:m.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(wf,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:m.displayName})]},c)})})}
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=fd;exports.AI_FEATURES=Qg;exports.AI_MODELS=vs;exports.AddCardButton=dn;exports.AddColumnButton=ln;exports.AttachmentUploader=Er;exports.BoardProvider=Ad;exports.BulkOperationsToolbar=oo;exports.BurnDownChart=yn;exports.CalendarBoard=Ql;exports.Card=ba;exports.CardDetailModal=gn;exports.CardDetailModalV2=bn;exports.CardHistoryReplay=sd;exports.CardHistoryTimeline=od;exports.CardRelationshipsGraph=dd;exports.CardStack=_g;exports.CardTemplateSelector=Dn;exports.CircuitBreaker=Wo;exports.Column=rr;exports.ColumnManager=mo;exports.CommandPalette=pn;exports.ConfigMenu=Mn;exports.ContextMenu=mr;exports.DEFAULT_SHORTCUTS=Pr;exports.DEFAULT_TEMPLATES=Nn;exports.DateRangePicker=yr;exports.DependenciesSelector=kr;exports.DependencyLine=fo;exports.DistributionCharts=xn;exports.EditableColumnTitle=tn;exports.ErrorBoundary=or;exports.ExportImportModal=En;exports.FilterBar=Pn;exports.GANTT_AI_SYSTEM_PROMPT=Bl;exports.GanttAIAssistant=wo;exports.GanttBoard=Ll;exports.GanttI18nContext=cr;exports.GanttMilestone=ho;exports.GanttToolbar=co;exports.GenerateGanttTasksDialog=vd;exports.GeneratePlanModal=pd;exports.GroupBySelector=Cn;exports.KanbanBoard=Da;exports.KanbanToolbar=nn;exports.KanbanViewAdapter=Dr;exports.KeyboardShortcutsHelp=Tn;exports.ListView=Kl;exports.MenuIcons=Ke;exports.PluginManager=Oo;exports.PrioritySelector=Ra;exports.RATE_LIMITS=Zg;exports.SwimlaneBoardView=kn;exports.TaskBar=uo;exports.TaskFormModal=ko;exports.TaskGrid=po;exports.ThemeModal=Ln;exports.ThemeProvider=Yi;exports.ThemeSwitcher=Vd;exports.Timeline=xo;exports.UserAssignmentSelector=Ua;exports.VelocityChart=vn;exports.VirtualGrid=zd;exports.VirtualList=Od;exports.aiUsageTracker=Ka;exports.borderRadius=Ds;exports.calculatePosition=Kr;exports.calendarDarkTheme=us;exports.calendarEnTranslations=ds;exports.calendarEsTranslations=cs;exports.calendarLightTheme=gs;exports.calendarNeutralTheme=fs;exports.calendarThemes=Ao;exports.calendarTranslations=Po;exports.cardToGanttTask=To;exports.cardsToGanttTasks=Hl;exports.cn=A;exports.createKanbanView=Mi;exports.createRetryWrapper=yc;exports.darkTheme=In;exports.darkTokenTheme=Go;exports.defaultTheme=so;exports.designTokens=Uo;exports.duration=Is;exports.easing=As;exports.exportTokensToCSS=_d;exports.findTaskByName=xa;exports.fontSize=Ss;exports.fontWeight=Es;exports.formatCost=Gr;exports.ganttEnTranslations=lo;exports.ganttEsTranslations=qi;exports.ganttTaskToCardUpdate=$l;exports.ganttThemes=Ne;exports.ganttTokens=Rs;exports.ganttTranslations=Bn;exports.ganttUtils=X;exports.generateCSSVariables=Us;exports.generateCompleteCSS=$s;exports.generateInitialPositions=fc;exports.generateTasksContext=Rl;exports.generateThemeVariables=Wr;exports.getCalendarTheme=ed;exports.getCalendarTranslations=Rr;exports.getListViewTheme=Yl;exports.getListViewTranslations=ns;exports.getMonthNames=Xl;exports.getToken=Wd;exports.getTranslations=Ji;exports.getWeekdayNames=ql;exports.kanbanTokens=Bs;exports.lightTheme=An;exports.lightTokenTheme=Gs;exports.lineHeight=Ps;exports.listViewDarkTheme=ss;exports.listViewEnTranslations=rs;exports.listViewEsTranslations=os;exports.listViewLightTheme=is;exports.listViewNeutralTheme=ls;exports.listViewThemes=Eo;exports.listViewTranslations=No;exports.mergeCalendarTranslations=Mo;exports.mergeListViewTranslations=Do;exports.mergeTranslations=Rn;exports.neutralTheme=Fn;exports.neutralTokenTheme=zs;exports.opacity=Ls;exports.parseLocalCommand=Gl;exports.parseNaturalDate=es;exports.parseNaturalDuration=ts;exports.parseProgress=as;exports.parseStatus=Ul;exports.pluginManager=vf;exports.retrySyncOperation=vc;exports.retryWithBackoff=Yr;exports.shadows=Fs;exports.shouldVirtualizeGrid=Hd;exports.spacing=Ns;exports.themes=Ha;exports.useAI=Sd;exports.useBoard=xd;exports.useBoardCore=Hr;exports.useBoardStore=Ro;exports.useCardStacking=Md;exports.useDragState=rn;exports.useFilteredCards=Ld;exports.useFilters=Cd;exports.useGanttI18n=Mr;exports.useKanbanState=Bo;exports.useKeyboardShortcuts=Vi;exports.useMultiSelect=Ed;exports.useSelectionState=ks;exports.useSortedCards=Bd;exports.useTheme=lr;exports.useVirtualGrid=$d;exports.useVirtualList=Ud;exports.validateAIResponse=zl;exports.withErrorBoundary=cn;exports.wouldCreateCircularDependency=qr;exports.zIndex=Ms;//# sourceMappingURL=index.cjs.map
354
354
  //# sourceMappingURL=index.cjs.map