@libxai/board 0.17.15 → 0.17.16
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 +51 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +51 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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'),
|
|
2
|
-
`)}async function Qd(e,t,a){let r=t;if(!r){let
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function Os(e,t,a,r){switch(t){case "json":return Jd(e,r);case "csv":return Zd(e);case "pdf":return await Qd(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
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Us(t[0]),r=[],o=new Map,n=[];for(let i=1;i<t.length;i++)try{let c=Us(t[i]||"");if(c.length>a.length){n.push(`Line ${i+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${i+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let s={};a.forEach((u,k)=>{s[u]=c[k]||"";});let m=s.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),l={id:s["Card ID"]||`card-${i}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:d.id,position:d.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(l),d.cardIds.push(l.id);}catch(c){n.push(`Line ${i+1}: ${c instanceof Error?c.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 Us(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],i=e[o+1];n==='"'&&r&&i==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function Gs(e,t){switch(t){case "json":return ec(e);case "csv":return tc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function $s(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 Lo=react.createContext(null);function Ws(){return react.useContext(Lo)}var Hs=react.createContext(null);function _s({children:e,themeName:t}){return jsxRuntime.jsx(Hs.Provider,{value:{themeName:t},children:e})}function Or(){return react.useContext(Hs)}function Ge({children:e,container:t}){let[a,r]=react.useState(false),o=Ws(),n=Or();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let i=t||(typeof document<"u"?document.body:null);if(!i)return null;if(o){let{theme:c,themeName:p}=o,s={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:s,children:e}),i)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),i):reactDom.createPortal(e,i)}var Ys={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},dc="#BDC3C7",cc=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function dr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(r&&p.current){let l=p.current.getBoundingClientRect();i({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[r]),react.useEffect(()=>{let l=u=>{c.current&&!c.current.contains(u.target)&&!p.current?.contains(u.target)&&o(false);};if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),react.useEffect(()=>{let l=u=>{u.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r]);let s=l=>{t(l),o(false);},m=e?Ys[e]:null,d=m?.color||dc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,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:m?.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(Ge,{children:jsxRuntime.jsxs("div",{ref:c,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(Ys).map(([l,u])=>jsxRuntime.jsxs("button",{onClick:()=>s(l),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: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(cc,{color:u.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:u.label}),e===l&&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"})})]},l)),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:l=>{l.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:l=>{l.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 pc=[{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 cr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[i,c]=react.useState({top:0,left:0}),p=react.useRef(null),s=react.useRef(null);react.useEffect(()=>{if(o&&s.current){let y=s.current.getBoundingClientRect();c({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[o]),react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!s.current?.contains(x.target)&&n(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let m=y=>{let x=new Date,f=w=>{let v=w.getFullYear(),P=String(w.getMonth()+1).padStart(2,"0"),C=String(w.getDate()).padStart(2,"0");return `${v}-${P}-${C}`},h=f(x),g=new Date(x);g.setDate(g.getDate()+y);let b=f(g);a(h,b),n(false);},d=()=>{if(!e||!t)return "Set date";let y=g=>{if(g instanceof Date)return g;if(typeof g!="string"||!g.match(/^\d{4}-\d{2}-\d{2}$/))return null;let b=g.split("-").map(Number);if(b.length!==3||b.some(C=>isNaN(C)))return null;let w=b[0],v=b[1],P=b[2];return w===void 0||v===void 0||P===void 0?null:new Date(w,v-1,P)},x=y(e),f=y(t);if(!x||!f||isNaN(x.getTime())||isNaN(f.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[x.getMonth()]} ${x.getDate()} \u2013 ${h[f.getMonth()]} ${f.getDate()}`},l=e&&t,k=(()=>{if(!t)return false;let y=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),y<x})();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 ${k?"asakaa-date-overdue":"asakaa-date"}`,title:l?`${d()}`:"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:d()})]}),o&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:p,className:"drp-menu",style:{top:`${i.top}px`,left:`${i.left}px`},children:[jsxRuntime.jsxs("div",{className:"drp-section drp-section-border",children:[jsxRuntime.jsx("span",{className:"drp-label",children:"Quick Select"}),jsxRuntime.jsx("div",{className:"drp-grid",children:pc.map(y=>jsxRuntime.jsx("button",{onClick:()=>m(y.days),className:"drp-btn",children:y.label},y.label))})]}),jsxRuntime.jsxs("div",{className:"drp-section",children:[jsxRuntime.jsx("span",{className:"drp-label",children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"drp-inputs",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:y=>a(y.target.value,t),className:"drp-input"}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:y=>a(e,y.target.value),className:"drp-input"})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(false);},className:"drp-clear-btn",children:"Clear Dates"})]})]})})]})}function La({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,i]=react.useState(false),[c,p]=react.useState(""),[s,m]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useRef(null);react.useEffect(()=>{if(n&&l.current){let f=l.current.getBoundingClientRect();m({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=h=>{d.current&&!d.current.contains(h.target)&&!l.current?.contains(h.target)&&(i(false),p(""));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=h=>{h.key==="Escape"&&(i(false),p(""));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n]);let u=f=>{let h=e.some(g=>g.id===f.id);a(h?e.filter(g=>g.id!==f.id):[...e,f]);},k=t.filter(f=>f.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>i(!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:[y.map(f=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:f.name,children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"asakaa-avatar-img"}):f.initials},f.id)),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"})]})})}),n&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:d,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:c,onChange:f=>p(f.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:k.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):k.map(f=>{let h=e.some(g=>g.id===f.id);return jsxRuntime.jsxs("button",{onClick:()=>u(f),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter: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:f.color,color:"#fff"},children:f.avatar?jsxRuntime.jsx("img",{src:f.avatar,alt:f.name,className:"w-full h-full rounded-full object-cover"}):f.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:f.name}),h&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},f.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),i(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 pr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o}){let[n,i]=react.useState(false),[c,p]=react.useState(""),[s,m]=react.useState(t.length>0),[d,l]=react.useState({top:0,left:0}),u=react.useRef(null),k=react.useRef(null);react.useEffect(()=>{if(n&&k.current){let g=k.current.getBoundingClientRect();l({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[n]),react.useEffect(()=>{let g=b=>{u.current&&!u.current.contains(b.target)&&!k.current?.contains(b.target)&&(i(false),p(""));};if(n)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),react.useEffect(()=>{let g=b=>{b.key==="Escape"&&(i(false),p(""));};if(n)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]);let y=g=>{if(t.includes(g)){let w=t.filter(v=>v!==g);r(w),w.length===0&&m(false);}else r([...t,g]),m(true);},x=()=>{let g=!s;m(g),g||r([]);},f=a.filter(g=>g.id!==e).filter(g=>g.title.toLowerCase().includes(c.toLowerCase())||g.id.toLowerCase().includes(c.toLowerCase())),h=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:k,onClick:()=>i(!n),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:h,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:h},children:t.length})]}),n&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:u,className:"dependencies-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${d.top}px`,left:`${d.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-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:s?"#3b82f6":"transparent",borderColor:s?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:s&&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"})]})}),s&&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:c,onChange:g=>p(g.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:f.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"}):f.map(g=>{let b=t.includes(g.id);return jsxRuntime.jsxs("button",{onClick:()=>y(g.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:b?"#3b82f6":"transparent",borderColor:b?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:b&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:g.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:g.id})]})]},g.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),m(false),i(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 ga=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:i,availableUsers:c=[],allCards:p=[]})=>{let{attributes:s,listeners:m,setNodeRef:d,transform:l,transition:u,isDragging:k}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),y={transform:Ar.Transform.toString(l),transition:u};if(t)return jsxRuntime.jsx("div",{ref:d,style:y,...s,...m,onClick:()=>a?.(e),children:t(e)});let x=c.filter(f=>e.assignedUserIds?.includes(f.id));return jsxRuntime.jsxs("div",{ref:d,style:y,className:F("asakaa-card",k&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...m,onClick:f=>{f.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:f=>{f.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(dr,{priority:e.priority,onChange:f=>i?.(e.id,{priority:f})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(cr,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(f,h)=>i?.(e.id,{startDate:f,endDate:h})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(La,{assignedUsers:x,availableUsers:c,onChange:f=>i?.(e.id,{assignedUserIds:f.map(h=>h.id)})})}),jsxRuntime.jsx("div",{onClick:f=>f.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(pr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(f=>typeof f=="string"?f:f.taskId):[],availableTasks:p,onChange:f=>i?.(e.id,{dependencies:f})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(f=>jsxRuntime.jsx("span",{className:"asakaa-label",children:f},f))})]})},(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.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));ga.displayName="Card";function ei({columnTitle:e,onRename:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState(false),[c,p]=react.useState(e),[s,m]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useRef(null),u=react.useRef(null);react.useEffect(()=>{if(r&&l.current){let f=l.current.getBoundingClientRect();m({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[r]),react.useEffect(()=>{let f=h=>{d.current&&!d.current.contains(h.target)&&!l.current?.contains(h.target)&&(o(false),i(false));};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=h=>{h.key==="Escape"&&(o(false),i(false),p(e));};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r,e]),react.useEffect(()=>{n&&u.current&&(u.current.focus(),u.current.select());},[n]);let k=()=>{i(true),p(e);},y=()=>{let f=c.trim();f&&f!==e&&t(f),i(false),o(false),p(e);},x=f=>{f.key==="Enter"?y():f.key==="Escape"&&(i(false),p(e));};return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,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(Ge,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.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:n?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:u,type:"text",value:c,onChange:f=>p(f.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: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"})]})})})})]})}var Ka=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:i,onCardUpdate:c,availableUsers:p,allCards:s,enableVirtualization:m,cardHeight:d=120,isCollapsed:l,onToggleCollapse:u,onColumnRename:k,className:y})=>{let{setNodeRef:x,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),h=react.useRef(null),g=m??As(t.length),b=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>h.current,estimateSize:()=>d,enabled:g});if(a)return jsxRuntime.jsx("div",{ref:x,className:y,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),P=v.state==="exceeded",C=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:F("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",P&&"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:F(C()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.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"})]}),v.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"})]}),v.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"})}),v.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"})]})]}),k&&jsxRuntime.jsx(ei,{columnTitle:e.title,onRename:E=>k(e.id,E)}),u&&jsxRuntime.jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":l?"Expand column":"Collapse column",children:l?"\u25B6":"\u25BC"})]})]}),!l&&jsxRuntime.jsx("div",{ref:h,className:"asakaa-column-cards",style:{maxHeight:g?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(E=>E.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"})}):g?jsxRuntime.jsx("div",{style:{height:`${b.getTotalSize()}px`,position:"relative"},children:b.getVirtualItems().map(E=>{let T=t[E.index];return T?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsxRuntime.jsx(ga,{card:T,render:r,onClick:i,onUpdate:c,availableUsers:p,allCards:s})},T.id):null})}):t.map(E=>jsxRuntime.jsx(ga,{card:E,render:r,onClick:i,onUpdate:c,availableUsers:p,allCards:s},E.id))})})]})});Ka.displayName="Column";function Go({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=n.trim();m&&m!==e?t(m):i(e),o(false);},s=m=>{m.key==="Enter"?p():m.key==="Escape"&&(i(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:n,onChange:m=>i(m.target.value),onBlur:p,onKeyDown:s,className:F("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:F("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Wo(){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 ka({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:i,style:c,isLoading:p,error:s,children:m}){let[d,l]=Wo(),u=o?.theme||"dark",y=u==="dark"||u==="neutral"?"dark":"",x=react.useCallback((C,E)=>{t.onCardUpdate?.(C,E);},[t]),f=react.useCallback((C,E)=>{t.onColumnUpdate?.(C,{title:E});},[t]),h=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),g=react.useMemo(()=>{let C=new Map;return e.columns.forEach(E=>{let T=E.cardIds.map(U=>e.cards.find(O=>O.id===U)).filter(U=>U!==void 0).sort((U,O)=>U.position-O.position);C.set(E.id,T);}),C},[e.cards,e.columns]),b=react.useCallback(C=>{let{active:E}=C,T=e.cards.find(U=>U.id===E.id);T&&l({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,l]),w=react.useCallback(C=>{let{active:E,over:T}=C;if(!T||!e.cards.find(I=>I.id===E.id))return;let O=null;T.data.current?.type==="column"?O=T.id:T.data.current?.type==="card"&&(O=e.cards.find($=>$.id===T.id)?.columnId||null),O&&O!==d.targetColumnId&&l({...d,targetColumnId:O});},[e.cards,d,l]),v=react.useCallback(async C=>{let{active:E,over:T}=C;if(l({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let U=e.cards.find(S=>S.id===E.id);if(!U)return;let O,I;if(T.data.current?.type==="column"){O=T.id;let S=g.get(O)||[];I=Eo(S,0);}else {let S=e.cards.find(ee=>ee.id===T.id);if(!S)return;O=S.columnId;let z=g.get(O)||[],Y=z.findIndex(ee=>ee.id===T.id);I=Eo(z,Y);}let $=e.columns.find(S=>S.id===O);if($&&$.wipLimit&&$.wipLimitType==="hard"){let S=g.get(O)||[];if(U.columnId!==O&&S.length>=$.wipLimit){t.onWipLimitExceeded?.($,U);return}}(U.columnId!==O||U.position!==I)&&await t.onCardMove?.(U.id,O,I);},[e.cards,e.columns,g,t,l]),P=react.useCallback(C=>{a?.(C);},[a]);return p?jsxRuntime.jsx("div",{className:F("asakaa-board",y,i),style:c,children:jsxRuntime.jsx(Fc,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:F("asakaa-board",y,i),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof s=="string"?s:s.message})]})})}):jsxRuntime.jsx(_s,{themeName:u,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:h,collisionDetection:core$1.closestCorners,onDragStart:b,onDragOver:w,onDragEnd:v,children:[jsxRuntime.jsxs("div",{className:F("asakaa-board",y,i),style:c,"data-theme":u,children:[e.columns.sort((C,E)=>C.position-E.position).map(C=>{let E=g.get(C.id)||[];return jsxRuntime.jsx(Ka,{column:C,cards:E,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:P,onCardUpdate:x,onColumnRename:f,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},C.id)}),m]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(ga,{card:e.cards.find(C=>C.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Fc({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 ur=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(ka,{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(i=>{i?o(i):n(new Error("Failed to create PNG blob"));},"image/png");})}};function oi(e={}){return new ur(e)}var Hc=5*1024*1024,Ho="asakaa-recent-uploads",si=10;function _o({coverImage:e,onUpload:t,onChange:a,onRemove:r,unsplashAccessKey:o,maxFileSize:n=Hc,showRecentUploads:i=true}){let[c,p]=react.useState("upload"),[s,m]=react.useState(false),[d,l]=react.useState(0),[u,k]=react.useState(""),[y,x]=react.useState(""),[f,h]=react.useState([]),[g,b]=react.useState(false),[w,v]=react.useState([]),[P,C]=react.useState(false),[E,T]=react.useState(0),[U,O]=react.useState(null),I=react.useRef(null);react.useEffect(()=>{try{let N=localStorage.getItem(Ho);if(N){let Z=JSON.parse(N);v(Z.slice(0,si));}}catch(N){console.error("Failed to load recent uploads:",N);}},[]);let $=react.useCallback((N,Z)=>{let te={url:N,thumbnail:Z||N,uploadedAt:new Date,usedCount:1};v(Be=>{if(Be.find(we=>we.url===N)){let pt=Be.map(je=>je.url===N?{...je,usedCount:je.usedCount+1}:je).sort((je,Ut)=>je.usedCount!==Ut.usedCount?Ut.usedCount-je.usedCount:new Date(Ut.uploadedAt).getTime()-new Date(je.uploadedAt).getTime());return localStorage.setItem(Ho,JSON.stringify(pt)),pt}let Ft=[te,...Be].slice(0,si);return localStorage.setItem(Ho,JSON.stringify(Ft)),Ft});},[]),S=react.useCallback(async N=>{if(O(null),N.size>n){O(`File too large. Max size: ${n/(1024*1024)}MB`);return}if(!N.type.startsWith("image/")){O("Please upload an image file (JPG, PNG, GIF, WebP)");return}m(true),l(0);try{let Z;t?Z=await t(N):Z=await _c(N);for(let te=0;te<=100;te+=10)l(te),await new Promise(Be=>setTimeout(Be,50));a(Z),$(Z),m(!1),l(0);}catch(Z){console.error("Upload failed:",Z),O("Upload failed. Please try again."),m(false),l(0);}},[n,t,a,$]),{getRootProps:z,getInputProps:Y,isDragActive:ee,isDragReject:R}=reactDropzone.useDropzone({onDrop:N=>{N.length>0&&N[0]&&S(N[0]);},accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp"]},maxSize:n,multiple:false,noClick:true});react.useEffect(()=>{let N=async Z=>{let te=Z.clipboardData?.items;if(te){for(let Be of te)if(Be.type.startsWith("image/")){let $e=Be.getAsFile();if($e){await S($e);break}}}};return window.addEventListener("paste",N),()=>window.removeEventListener("paste",N)},[S]);let J=react.useCallback(()=>{if(u.trim())try{new URL(u),a(u),$(u),k(""),O(null);}catch{O("Please enter a valid URL");}},[u,a,$]),G=react.useCallback(async N=>{if(!o){O("Unsplash integration not configured");return}if(N.trim()){b(true),O(null);try{let Z=await fetch(`https://api.unsplash.com/search/photos?query=${encodeURIComponent(N)}&per_page=12`,{headers:{Authorization:`Client-ID ${o}`}});if(!Z.ok)throw new Error("Unsplash search failed");let te=await Z.json();h(te.results||[]);}catch(Z){console.error("Unsplash search failed:",Z),O("Failed to search Unsplash. Please try again.");}finally{b(false);}}},[o]),se=react.useCallback(N=>{a(N.urls.regular),$(N.urls.regular,N.urls.thumb);},[a,$]);return e&&!P?jsxRuntime.jsxs("div",{className:"cover-image-preview",children:[jsxRuntime.jsx("div",{className:"cover-image-preview-container",children:jsxRuntime.jsx("img",{src:e,alt:"Cover",style:{transform:`translateY(${E}%)`},onError:N=>{N.currentTarget.src="https://via.placeholder.com/600x200?text=Image+Not+Found";}})}),jsxRuntime.jsxs("div",{className:"cover-image-actions",children:[jsxRuntime.jsxs("button",{className:"cover-image-button",onClick:()=>C(true),children:[jsxRuntime.jsx(Kc,{}),"Reposition"]}),jsxRuntime.jsxs("button",{className:"cover-image-button",onClick:()=>{C(false),T(0),r();},children:[jsxRuntime.jsx(Yc,{}),"Change"]}),jsxRuntime.jsxs("button",{className:"cover-image-button cover-image-button-danger",onClick:r,children:[jsxRuntime.jsx(Xc,{}),"Remove"]})]})]}):jsxRuntime.jsxs("div",{className:"cover-image-manager",children:[jsxRuntime.jsxs("div",{className:"cover-image-tabs",role:"tablist",children:[jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="upload",className:F("cover-image-tab",{"cover-image-tab-active":c==="upload"}),onClick:()=>p("upload"),children:[jsxRuntime.jsx(ii,{}),"Upload"]}),jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="link",className:F("cover-image-tab",{"cover-image-tab-active":c==="link"}),onClick:()=>p("link"),children:[jsxRuntime.jsx(Vc,{}),"Link"]}),o&&jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="unsplash",className:F("cover-image-tab",{"cover-image-tab-active":c==="unsplash"}),onClick:()=>p("unsplash"),children:[jsxRuntime.jsx(jc,{}),"Unsplash"]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:U&&jsxRuntime.jsx(framerMotion.motion.div,{className:"cover-image-error",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:U})}),jsxRuntime.jsxs("div",{className:"cover-image-panels",children:[c==="upload"&&jsxRuntime.jsxs("div",{className:"cover-image-panel",children:[jsxRuntime.jsxs("div",{...z(),className:F("cover-image-dropzone",{"cover-image-dropzone-active":ee,"cover-image-dropzone-reject":R}),children:[jsxRuntime.jsx("input",{...Y(),ref:I}),s?jsxRuntime.jsxs("div",{className:"cover-image-uploading",children:[jsxRuntime.jsx("div",{className:"cover-image-progress",children:jsxRuntime.jsx("div",{className:"cover-image-progress-bar",style:{width:`${d}%`}})}),jsxRuntime.jsxs("p",{children:["Uploading... ",d,"%"]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ii,{size:48}),jsxRuntime.jsx("h3",{children:"Drop image here"}),jsxRuntime.jsx("p",{className:"cover-image-hint",children:"or paste from clipboard (Cmd/Ctrl+V)"}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:()=>I.current?.click(),children:"Browse files"}),jsxRuntime.jsxs("p",{className:"cover-image-meta",children:["Max ",n/(1024*1024),"MB \xB7 JPG, PNG, GIF, WebP"]})]})]}),i&&w.length>0&&jsxRuntime.jsxs("div",{className:"cover-image-recent",children:[jsxRuntime.jsx("h4",{children:"Recent uploads"}),jsxRuntime.jsx("div",{className:"cover-image-recent-grid",children:w.slice(0,4).map((N,Z)=>jsxRuntime.jsx("button",{className:"cover-image-recent-item",onClick:()=>a(N.url),style:{backgroundImage:`url(${N.thumbnail})`},title:"Click to use this image"},Z))})]})]}),c==="link"&&jsxRuntime.jsx("div",{className:"cover-image-panel",children:jsxRuntime.jsxs("div",{className:"cover-image-url-input",children:[jsxRuntime.jsx("input",{type:"url",placeholder:"Paste image URL...",value:u,onChange:N=>k(N.target.value),onKeyDown:N=>{N.key==="Enter"&&J();}}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:J,disabled:!u.trim(),children:"Add image"})]})}),c==="unsplash"&&o&&jsxRuntime.jsxs("div",{className:"cover-image-panel",children:[jsxRuntime.jsxs("div",{className:"cover-image-search",children:[jsxRuntime.jsx("input",{type:"search",placeholder:"Search Unsplash...",value:y,onChange:N=>x(N.target.value),onKeyDown:N=>{N.key==="Enter"&&G(y);}}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:()=>G(y),disabled:g||!y.trim(),children:g?"Searching...":"Search"})]}),f.length>0&&jsxRuntime.jsx("div",{className:"cover-image-unsplash-grid",children:f.map(N=>jsxRuntime.jsx("button",{className:"cover-image-unsplash-item",onClick:()=>se(N),style:{backgroundImage:`url(${N.urls.small})`},title:`Photo by ${N.user.name}`},N.id))})]})]})]})}function _c(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=a,r.readAsDataURL(e);})}function ii({size:e=20}){return jsxRuntime.jsxs("svg",{width:e,height:e,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-4"}),jsxRuntime.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}function Vc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function jc(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M7.5 6.5H16.5V0H7.5V6.5ZM16.5 9H24V24H0V9H7.5V16.5H16.5V9Z"})})}function Kc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"7 13 12 8 17 13"}),jsxRuntime.jsx("polyline",{points:"7 17 12 12 17 17"})]})}function Yc(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"})})}function Xc(){return 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 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}var Xa=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(i){console.error("Error in error handler:",i);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:i}=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:i?`Error in ${i}`:"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 Vo(e,t){let a=r=>jsxRuntime.jsx(Xa,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ko({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:i,onPredictRisks:c,onOpenAIUsage:p,shortcut:s="k",className:m=""}){let[d,l]=react.useState(false),[u,k]=react.useState(""),[y,x]=react.useState("home"),[f,h]=react.useState(""),[g,b]=react.useState("");react.useEffect(()=>{let C=E=>{(E.metaKey||E.ctrlKey)&&E.key===s&&(E.preventDefault(),l(T=>!T)),E.key==="Escape"&&(l(false),x("home"),k(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]),react.useEffect(()=>{d||(x("home"),k(""),h(""),b(""));},[d]);let w=react.useCallback(()=>{l(false);},[]),v=react.useCallback(C=>{let[E,T]=C.split(":");switch(E){case "create-card":x("create-card");break;case "create-card-in":h(T||"");break;case "navigate":T?(a?.(T),w()):x("navigate");break;case "search":r?.(u),w();break;case "priority":x("priority");break;case "set-priority":g&&T&&(o?.(g,T),w());break;case "assign":x("assign");break;case "assign-user":g&&T&&(n?.(g,T),w());break;case "ai":x("ai");break;case "ai-generate-plan":i?.(),w();break;case "ai-predict-risks":c?.(),w();break;case "ai-usage":p?.(),w();break;case "back":x("home");break;}},[u,g,t,a,r,o,n,i,c,p,w]),P=react.useCallback(()=>{f&&u.trim()&&(t?.(f,u.trim()),w());},[f,u,t,w]);return d?jsxRuntime.jsx(Ge,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:w,children:jsxRuntime.jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:u,onValueChange:k,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"&&f?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&y==="create-card"&&f&&P();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),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:v,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:v,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:v,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:v,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:v,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(E=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:E},E))})]},C.id))})]}),y==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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:v,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))})]}),y==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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 E=e.columns.find(T=>T.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:v,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:E?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),y==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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:v,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:v,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:v,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 Qc(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 ep(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 tp(e){return e.startsWith("image/")}function hr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[i,c]=react.useState(false),[p,s]=react.useState(false),[m,d]=react.useState(null),l=react.useRef(null),u=react.useCallback(v=>{let P=[],C=[];return e.length+v.length>n?(C.push(`Maximum ${n} files allowed`),{valid:P,errors:C}):(v.forEach(E=>{if(E.size/1048576>r){C.push(`${E.name} is too large (max ${r}MB)`);return}if(o&&!o.some(U=>E.type.match(U))){C.push(`${E.name} has invalid file type`);return}P.push(E);}),{valid:P,errors:C})},[e.length,n,r,o]),k=react.useCallback(async v=>{let{valid:P,errors:C}=u(v);if(C.length>0){d(C.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){s(true),d(null);try{await t?.(P);}catch(E){d(E instanceof Error?E.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{s(false);}}},[u,t]),y=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),h=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let P=Array.from(v.dataTransfer.files);k(P);},[k]),g=react.useCallback(v=>{let P=v.target.files?Array.from(v.target.files):[];k(P),l.current&&(l.current.value="");},[k]),b=react.useCallback(()=>{l.current?.click();},[]),w=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${i?"dragging":""} ${p?"uploading":""}`,onDragEnter:y,onDragLeave:x,onDragOver:f,onDrop:h,onClick:b,children:[jsxRuntime.jsx("input",{ref:l,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:i?"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"]})]})})]}),m&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:tp(v.type)&&v.url?jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:ep(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Qc(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>w(v.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"})})})]},v.id))})]})}function Xo({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:c=[],aiInsights:p=[],attachments:s=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:l,onDeleteAttachment:u,onSuggestAssignee:k,onGenerateSubtasks:y,onEstimateEffort:x,currentUserId:f="user-1"}){let[h,g]=react.useState("details"),[b,w]=react.useState(false),[v,P]=react.useState({}),[C,E]=react.useState(""),[T,U]=react.useState(false),[O,I]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{w(false),P({}),g("details"),E(""),I({}),a();},[a]),S=react.useCallback(()=>{r&&Object.keys(v).length>0&&(r(e.id,v),P({}),w(false));},[e.id,v,r]),z=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),Y=react.useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),E(""));},[e.id,C,m]),ee=react.useCallback(async()=>{if(k){U(true);try{let N=await k(e);I(Z=>({...Z,assignees:N}));}catch(N){console.error("Failed to suggest assignee:",N);}finally{U(false);}}},[e,k]),R=react.useCallback(async()=>{if(y){U(true);try{let N=await y(e);I(Z=>({...Z,subtasks:N}));}catch(N){console.error("Failed to generate subtasks:",N);}finally{U(false);}}},[e,y]),J=react.useCallback(async()=>{if(x){U(true);try{let N=await x(e);I(Z=>({...Z,effort:N}));}catch(N){console.error("Failed to estimate effort:",N);}finally{U(false);}}},[e,x]),G={...e,...v},se=n.filter(N=>G.assignedUserIds?.includes(N.id));return jsxRuntime.jsx(Ge,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:N=>N.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),b?jsxRuntime.jsx("input",{type:"text",value:v.title??G.title,onChange:N=>P({...v,title:N.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:G.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{w(false),P({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>w(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 ${h==="details"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),b?jsxRuntime.jsx("textarea",{value:v.description??G.description??"",onChange:N=>P({...v,description:N.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:G.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),b?jsxRuntime.jsx("select",{multiple:true,value:v.assignedUserIds??G.assignedUserIds??[],onChange:N=>{let Z=Array.from(N.target.selectedOptions,te=>te.value);P({...v,assignedUserIds:Z});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:se.length>0?se.map(N=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:N.color},children:N.initials}),jsxRuntime.jsx("span",{children:N.name})]},N.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"}),b?jsxRuntime.jsxs("select",{value:v.priority??G.priority??"",onChange:N=>P({...v,priority:N.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:G.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:G.labels&&G.labels.length>0?G.labels.map(N=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:N},N)):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"}),b?jsxRuntime.jsx("input",{type:"date",value:v.startDate?new Date(v.startDate).toISOString().split("T")[0]:G.startDate?new Date(G.startDate).toISOString().split("T")[0]:"",onChange:N=>P({...v,startDate:N.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.startDate?new Date(G.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),b?jsxRuntime.jsx("input",{type:"date",value:v.endDate?new Date(v.endDate).toISOString().split("T")[0]:G.endDate?new Date(G.endDate).toISOString().split("T")[0]:"",onChange:N=>P({...v,endDate:N.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.endDate?new Date(G.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),b?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:v.estimatedTime??G.estimatedTime??"",onChange:N=>P({...v,estimatedTime:N.target.value?parseFloat(N.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:G.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:G.dependencies&&G.dependencies.length>0?G.dependencies.map(N=>{let Z=typeof N=="string"?N:N.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Z.slice(-4)]},Z)}):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:G.createdAt?new Date(G.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:C,onChange:N=>E(N.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Y,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:i.length>0?i.map(N=>{let Z=n.find(te=>te.id===N.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:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Z?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(N.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(N.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:N.content})]},N.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(N=>{let Z=n.find(te=>te.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[N.type.includes("CREATED")&&"\u2795",N.type.includes("UPDATED")&&"\u270F\uFE0F",N.type.includes("MOVED")&&"\u27A1\uFE0F",N.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",N.type.includes("COMMENT")&&"\u{1F4AC}",N.type.includes("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",N.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:Z?.name||"Unknown"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:N.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(hr,{cardId:e.id,attachments:s,onUpload:l?N=>l(e.id,N):void 0,onDelete:u,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ee,disabled:T||!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("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:R,disabled:T||!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:T||!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"]})]}),O.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),O.assignees.map((N,Z)=>{let te=n.find(Be=>Be.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:N.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(N.confidence*100).toFixed(0),"%"]})]})]},Z)})]}),O.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),O.subtasks.map((N,Z)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:N.title}),N.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:N.description}),N.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",N.estimatedTime,"h"]})]},Z))]}),O.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[O.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(O.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(N=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${N.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:N.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:N.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:N.description}),N.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",N.suggestedAction]})]},N.id))]}),!O.assignees&&!O.subtasks&&!O.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var sp=["LOW","MEDIUM","HIGH","URGENT"],ip=["todo","in-progress","review","done"];function Jo({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:c=[],onAddComment:p,onDeleteComment:s,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:l,onAIFindSimilar:u,availableColumns:k=[],availableLabels:y=[],onUploadCoverImage:x,unsplashAccessKey:f}){let g=Or()?.themeName||"dark",[b,w]=react.useState(e),[v,P]=react.useState(false),[C,E]=react.useState([]),[T,U]=react.useState(false),[O,I]=react.useState(""),[$,S]=react.useState(""),[z,Y]=react.useState("all"),[ee,R]=react.useState(false),[J,G]=react.useState(false),[se,N]=react.useState(false),[Z,te]=react.useState(false),[Be,$e]=react.useState(false),[Ft,we]=react.useState(false),[pt,je]=react.useState(false),Ut=react.useRef(null),Pa=react.useRef(null),ya=react.useRef(null),ue=react.useRef(null),tt=react.useRef(null),Gt=react.useRef(null),$t=react.useRef(null),ma=react.useRef(null);react.useEffect(()=>{e&&!b?w({...e}):e&&b&&e.id!==b.id&&w({...e});},[e,b]),react.useEffect(()=>{let M=ae=>{let Ue=ae.target;ue.current&&!ue.current.contains(Ue)&&G(false),tt.current&&!tt.current.contains(Ue)&&N(false),Gt.current&&!Gt.current.contains(Ue)&&te(false),$t.current&&!$t.current.contains(Ue)&&$e(false);};if(J||se||Z||Be)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[J,se,Z,Be]),react.useEffect(()=>{if(!t)return;let M=ae=>{let Ue=ae.target,ht=Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.isContentEditable;if(ae.key==="Escape"){ae.preventDefault(),J||se||Z||Be||Ft||pt?(G(false),N(false),te(false),$e(false),we(false),je(false)):ht||a();return}if(ht&&ae.key!=="Escape")return;let ia=ae.metaKey||ae.ctrlKey;switch(ae.key.toLowerCase()){case "s":ae.preventDefault(),G(true);break;case "a":ae.preventDefault(),te(true);break;case "p":ae.preventDefault(),N(true);break;case "l":ae.preventDefault(),$e(true);break;case "d":ia||(ae.preventDefault(),we(true),setTimeout(()=>ma.current?.focus(),0));break;case "e":ia||(ae.preventDefault(),je(true));break;case "i":ae.preventDefault(),P(true),setTimeout(()=>Pa.current?.focus(),0);break;case "t":ae.preventDefault(),U(true);break;case "c":ae.preventDefault(),ya.current?.focus();break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,a,J,se,Z,Be,Ft,pt]);let ie=react.useCallback(M=>{let ae=M.currentTarget.textContent?.trim()||"";if(b&&ae!==b.title){let Ue={...b,title:ae};w(Ue),r?.(b.id,{title:ae});}},[b,r]),pe=react.useCallback(M=>{M.key==="Enter"&&(M.preventDefault(),M.currentTarget.blur()),M.key==="Escape"&&(M.preventDefault(),M.currentTarget.textContent=b?.title||"",M.currentTarget.blur());},[b]),V=react.useCallback(()=>{b&&e&&b.description!==e.description&&r?.(b.id,{description:b.description}),P(false);},[b,e,r]),H=react.useCallback(M=>{if(b){let ae={...b,columnId:M};w(ae),r?.(b.id,{columnId:M}),G(false);}},[b,r]),Te=react.useCallback(M=>{if(b){let ae={...b,priority:M};w(ae),r?.(b.id,{priority:M}),N(false);}},[b,r]),Ke=react.useCallback(M=>{if(b){let ae=b.assignedUserIds||[],Ue=ae.includes(M)?ae.filter(ia=>ia!==M):[...ae,M],ht={...b,assignedUserIds:Ue};w(ht),r?.(b.id,{assignedUserIds:Ue});}},[b,r]),oe=react.useCallback(M=>{if(b){let ae=b.labels||[],Ue=ae.includes(M)?ae.filter(ia=>ia!==M):[...ae,M],ht={...b,labels:Ue};w(ht),r?.(b.id,{labels:Ue});}},[b,r]),de=react.useCallback(M=>{if(b){let ae=M.target.value,Ue={...b,endDate:ae};w(Ue),r?.(b.id,{endDate:ae}),we(false);}},[b,r]),sa=react.useCallback(M=>{if(b){let ae={...b,estimatedTime:parseFloat(M)||0};w(ae),r?.(b.id,{estimatedTime:parseFloat(M)||0});}},[b,r]),_t=react.useCallback(()=>{if(O.trim()){let M={id:`subtask-${Date.now()}`,title:O.trim(),completed:false};E([...C,M]),I(""),U(false);}},[O,C]),ge=react.useCallback(M=>{E(C.map(ae=>ae.id===M?{...ae,completed:!ae.completed}:ae));},[C]),j=react.useCallback(M=>{E(C.filter(ae=>ae.id!==M));},[C]),be=react.useCallback(()=>{$.trim()&&b&&p&&(p(b.id,$.trim()),S(""));},[$,b,p]),ve=react.useCallback(M=>{(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),be());},[be]),ze=react.useCallback(M=>{if(b){let ae={...b,coverImage:M};w(ae),r?.(b.id,{coverImage:M}),R(false);}},[b,r]),He=react.useCallback(()=>{if(b){let M={...b,coverImage:void 0};w(M),r?.(b.id,{coverImage:void 0});}},[b,r]),Ae=M=>jsxRuntime.jsx(rp__default.default,{remarkPlugins:[op__default.default],rehypePlugins:[np__default.default],components:{a:({node:ae,...Ue})=>jsxRuntime.jsx("a",{...Ue,target:"_blank",rel:"noopener noreferrer"})},children:M}),it=c.filter(M=>z==="comments"?M.type.includes("COMMENT"):z==="history"?!M.type.includes("COMMENT"):true);if(!t||!e)return null;let le=b||e,Tt=n.filter(M=>le.assignedUserIds?.includes(M.id)),Nt=C.filter(M=>M.completed).length;return jsxRuntime.jsx(Ge,{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:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":g,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ut,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ie,onKeyDown:pe,children:le.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-cover-section",children:[!ee&&!le.coverImage&&jsxRuntime.jsxs("button",{className:"modal-v2-add-cover-button",onClick:()=>R(true),children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]}),"Add cover image"]}),!ee&&le.coverImage&&jsxRuntime.jsxs("div",{className:"modal-v2-cover-preview-wrapper",children:[jsxRuntime.jsx("img",{src:le.coverImage,alt:`Cover for ${le.title}`,className:"modal-v2-cover-image",onError:M=>{M.currentTarget.style.display="none";}}),jsxRuntime.jsxs("div",{className:"modal-v2-cover-actions",children:[jsxRuntime.jsx("button",{className:"modal-v2-cover-action-button",onClick:()=>R(true),children:"Change"}),jsxRuntime.jsx("button",{className:"modal-v2-cover-action-button danger",onClick:He,children:"Remove"})]})]}),ee&&jsxRuntime.jsxs("div",{className:"modal-v2-cover-manager-wrapper",children:[jsxRuntime.jsxs("div",{className:"modal-v2-cover-manager-header",children:[jsxRuntime.jsx("h3",{children:"Cover Image"}),jsxRuntime.jsx("button",{className:"modal-v2-cover-manager-close",onClick:()=>R(false),children:jsxRuntime.jsxs("svg",{width:"16",height:"16",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.jsx(_o,{coverImage:le.coverImage,onUpload:x,onChange:ze,onRemove:He,unsplashAccessKey:f,showRecentUploads:true})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ue,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>G(!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:le.columnId||"No status"})]}),J&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(k.length>0?k:ip.map(M=>({id:M,title:M}))).map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${le.columnId===M.id?"active":""}`,onClick:()=>H(M.id),children:M.title},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Gt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>te(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Tt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Tt.map(M=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:M.color},title:M.name,children:M.initials},M.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Z&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:n.map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.assignedUserIds?.includes(M.id)?"active":""}`,onClick:()=>Ke(M.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:M.color},children:M.initials}),M.name,le.assignedUserIds?.includes(M.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"})})]},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:tt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>N(!se),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.priority||"None"})]}),se&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[sp.map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${M.toLowerCase()} ${le.priority===M?"active":""}`,onClick:()=>Te(M),children:M},M)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Te(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:$t,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>$e(!Be),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:le.labels&&le.labels.length>0?jsxRuntime.jsx("span",{children:le.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Be&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.labels?.includes(M)?"active":""}`,onClick:()=>oe(M),children:[M,le.labels?.includes(M)&&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"})})]},M))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{we(!Ft),setTimeout(()=>ma.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:le.endDate?new Date(le.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:ma,type:"date",value:typeof le.endDate=="string"?le.endDate.split("T")[0]:le.endDate?(()=>{let M=new Date(le.endDate),ae=M.getUTCFullYear(),Ue=String(M.getUTCMonth()+1).padStart(2,"0"),ht=String(M.getUTCDate()).padStart(2,"0");return `${ae}-${Ue}-${ht}`})():"",onChange:de,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>je(!pt),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:le.estimatedTime?`${le.estimatedTime}h`:"Not set"})]}),pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:le.estimatedTime||"",onChange:M=>sa(M.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>je(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"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",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 Assist"]})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:le.description||"",onChange:M=>{if(b){let ae={...b,description:M.target.value};w(ae);}},onBlur:V,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>P(true),children:le.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ae(le.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"}),C.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Nt,"/",C.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>U(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:[C.map(M=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${M.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ge(M.id),children:M.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:M.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>j(M.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"})]})})]},M.id)),T&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:O,onChange:M=>I(M.target.value),onKeyDown:M=>{M.key==="Enter"&&_t(),M.key==="Escape"&&(U(false),I(""));},onBlur:_t,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 ${z==="all"?"active":""}`,onClick:()=>Y("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>Y("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>Y("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ya,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:$,onChange:M=>S(M.target.value),onKeyDown:ve,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:be,disabled:!$.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[it.map(M=>{let ae=n.find(ht=>ht.id===M.userId);if(M.type.includes("COMMENT")){let ht=i.find(ia=>ia.id===M.metadata?.commentId);return ht?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ae&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ae.color},children:ae.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:ae?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(M.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:ht.content})]})]},M.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-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("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.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:ae?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)}),it.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 hp({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 Qo({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(i=>({...i,average:i.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data: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(hp,{})}),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((i,c)=>i+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((i,c)=>i+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(i=>i.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((i,c)=>i+(c.planned||0),0)})]})]})]})}function Np({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 en({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),i=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=n>0?(n-i)/n*100:0,s=i<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Np,{})}),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:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:s?"#10B981":"#EF4444"},children:i})]}),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 Fp={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},hi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Bp({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let i=r+(o-r)*.5,c=e+i*Math.cos(-a*(Math.PI/180)),p=t+i*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*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 tn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((p,s)=>p+s.value,0),i=e.map(p=>({...p,totalValue:n,color:p.color||Fp[p.name]||hi[e.indexOf(p)%hi.length]})),c=i.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:i,cx:"50%",cy:"50%",labelLine:false,label:o?Bp:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:i.map((p,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(bi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,s)=>{let m=s.payload,d=n>0?(m.value/n*100).toFixed(0):"0";return `${p} (${m.value} - ${d}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:i,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:i.map((p,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[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((p,s)=>s.value>p.value?s:p).name})]})]})]})}var Vr=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[i,c]=react.useState(false),[p,s]=react.useState(false),[m,d]=react.useState(false),[l,u]=react.useState(false);if(e.length===0)return null;let k=e.map(b=>b.id),y=b=>{r.onBulkUpdate?.(k,{priority:b}),c(false);},x=b=>{r.onBulkMove?.(k,b),s(false),a();},f=b=>{r.onBulkUpdate?.(k,{assignedUserIds:b}),d(false);},h=b=>{let w=new Set;e.forEach(P=>{P.labels?.forEach(C=>w.add(C));});let v=Array.from(new Set([...w,...b]));r.onBulkUpdate?.(k,{labels:v}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(k),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!i),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(b=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(b),children:[jsxRuntime.jsx("span",{className:F("asakaa-priority-dot",b==="LOW"&&"bg-asakaa-priority-low",b==="MEDIUM"&&"bg-asakaa-priority-medium",b==="HIGH"&&"bg-asakaa-priority-high",b==="URGENT"&&"bg-asakaa-priority-urgent")}),b]},b))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(b=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(b.id),children:b.title},b.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(b=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([b.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:b.color},children:b.initials}),b.name]},b.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!l),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(b=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([b]),children:b},b))})]}),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"})})]})]})})});Vr.displayName="BulkOperationsToolbar";function Gp(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,i,c,p,s;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let k=a?.find(y=>y.id===u);i=`assignee-${u}`,c=k?.name||`User ${u}`,p=k?.color,s=k?.avatar,r.has(i)||r.set(i,{id:i,title:c,groupValue:u,cardIds:[],color:p,icon:s}),r.get(i).cardIds.push(o.id);}):(i="assignee-unassigned",c="Unassigned",p="#6b7280",s="\u{1F464}",r.has(i)||r.set(i,{id:i,title:c,groupValue:null,cardIds:[],color:p,icon:s}),r.get(i).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",i=`priority-${n}`;let l={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];c=l.title,p=l.color,r.has(i)||r.set(i,{id:i,title:c,groupValue:n,cardIds:[],color:p}),r.get(i).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{i=`label-${u}`,c=u,p="#6b7280",r.has(i)||r.set(i,{id:i,title:c,groupValue:u,cardIds:[],color:p}),r.get(i).cardIds.push(o.id);}):(i="label-none",c="No Labels",p="#6b7280",r.has(i)||r.set(i,{id:i,title:c,groupValue:null,cardIds:[],color:p}),r.get(i).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function an({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,i]=react.useState(new Set),c=react.useMemo(()=>Gp(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(s=>{i(m=>{let d=new Set(m);return d.has(s)?d.delete(s):d.add(s),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(ka,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:F("asakaa-swimlane-view",o),children:[c.map(s=>{let m=n.has(s.id),d=e.cards.filter(u=>s.cardIds.includes(u.id)),l={...e,cards:d};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(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":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(ka,{board:l,callbacks:r,availableUsers:a})})]},s.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var rn=[{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 on({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null),c=rn.find(s=>s.value===e)||rn[0];react.useEffect(()=>{function s(m){n.current&&!n.current.contains(m.target)&&i.current&&!i.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let p=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:F("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:F("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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:rn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>p(s.value),className:F("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 br=[{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 Hp(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,i=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return n&&i&&c&&p}function wi(e={}){let{shortcuts:t=br,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 i=react.useCallback(p=>{o.current=[...o.current,p];},[]),c=react.useCallback(p=>{o.current=o.current.filter(s=>s.action!==p);},[]);return react.useEffect(()=>{function p(s){if(!n.current)return;let m=s.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&s.key!=="Escape"&&!s.ctrlKey&&!s.metaKey)){for(let d of o.current)if(Hp(s,d)){r&&s.preventDefault();let l=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(l);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:i,unregisterShortcut:c,isEnabled:a}}function Vp(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function jp(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 Kp(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=jp(e),r=t?Vp(t):"";return a?`${a} + ${r}`:r}function Yp(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 nn({shortcuts:e=br,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let i=Yp(e);return jsxRuntime.jsxs("div",{className:F("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 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(i).map(([c,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(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:Kp(s)})]},s.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var sn=[{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'),pl=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),reactDropzone=require('react-dropzone'),framerMotion=require('framer-motion'),cmdk=require('cmdk'),rm=require('react-markdown'),om=require('remark-gfm'),nm=require('rehype-sanitize'),recharts=require('recharts'),lucideReact=require('lucide-react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var pl__default=/*#__PURE__*/_interopDefault(pl);var rm__default=/*#__PURE__*/_interopDefault(rm);var om__default=/*#__PURE__*/_interopDefault(om);var nm__default=/*#__PURE__*/_interopDefault(nm);var Ar=(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 Fr=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 [Fr.Translate.toString(e),Fr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function F(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function Br(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 Vd(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Eo(e,t){return e.length===0?1e3:t===0?Br(null,e[0].position):t>=e.length?Br(e[e.length-1].position,null):Br(e[t-1].position,e[t].position)}function As(e,t=100){return e>t}var jd=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 Kd(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 Rr(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:l=jd,onRetry:c}=t,m,s=0;for(let p=1;p<=a;p++){s=p;try{return {data:await e(),attempts:s,success:!0}}catch(d){if(m=d,p===a||!l(m,p))return {error:m,attempts:s,success:false};let g=Kd(p,r,o,n);if(c)try{c(m,p,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:m||new Error("Unknown error"),attempts:s,success:false}}function Yd(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 Xd(e,t={}){return async(...a)=>Rr(()=>e(...a),t)}var Po=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 Fs=(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))(Fs||{}),Ma=class Ma{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...l}=t,c=`[${a}] [${r}] [${n}]`,m=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(c,o,m?l:"");break;case "INFO":console.info(c,o,m?l:"");break;case "WARN":console.warn(c,o,m?l:"");break;case "ERROR":console.error(c,o,m?l:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Ma.globalOptions};}static configure(t){Ma.globalOptions={...Ma.globalOptions,...t};}child(t){return new Ma({...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 Or((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Or(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Fs[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Ma.globalOptions={};var Mo=Ma,Or=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}},Bs=new Mo;function Jd(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 Zd(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(c=>c.id===n.columnId);return [n.id,Io(n.title),Io(n.description||""),Io(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 Qd(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 pl__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),c=l.toDataURL("image/png"),m=297,s=210,p=l.width/l.height,d=m-20,i=d/p;i>s-20&&(i=s-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,m,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(m-d)/2;return g.addImage(c,"PNG",y,20,d,i),g}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 c=e.cards.filter(m=>m.columnId===l.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,n),n+=8,c.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):c.forEach(m=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,n),n+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let p=o.splitTextToSize(m.description,160);o.text(p,25,n),n+=p.length*5;}let s=[];if(m.priority&&s.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&s.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&s.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let p=[];m.startDate&&p.push(`Start: ${m.startDate}`),m.endDate&&p.push(`End: ${m.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 Io(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Os(e,t,a,r){switch(t){case "json":return Jd(e,r);case "csv":return Zd(e);case "pdf":return await Qd(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"},c=new Blob([e],{type:l[t]}),m=URL.createObjectURL(c),s=document.createElement("a");s.href=m,s.download=n,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(m);}function ec(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=Us(t[0]),r=[],o=new Map,n=[];for(let l=1;l<t.length;l++)try{let c=Us(t[l]||"");if(c.length>a.length){n.push(`Line ${l+1}: Too many columns`);continue}if(a.length-c.length>3){n.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let s={};a.forEach((g,y)=>{s[g]=c[y]||"";});let p=s.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:s["Card ID"]||`card-${l}`,title:s.Title||"Untitled",description:s.Description?s.Description:void 0,columnId:d.id,position:d.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(i),d.cardIds.push(i.id);}catch(c){n.push(`Line ${l+1}: ${c instanceof Error?c.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 Us(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 Gs(e,t){switch(t){case "json":return ec(e);case "csv":return tc(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function $s(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 Lo=react.createContext(null);function Ws(){return react.useContext(Lo)}var Hs=react.createContext(null);function _s({children:e,themeName:t}){return jsxRuntime.jsx(Hs.Provider,{value:{themeName:t},children:e})}function Va(){return react.useContext(Hs)}function Ge({children:e,container:t}){let[a,r]=react.useState(false),o=Ws(),n=Va();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:c,themeName:m}=o,s={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"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 Ys={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},dc="#BDC3C7",cc=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function cr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(r&&m.current){let i=m.current.getBoundingClientRect();l({top:i.bottom+window.scrollY+8,left:i.left+window.scrollX});}},[r]),react.useEffect(()=>{let i=g=>{c.current&&!c.current.contains(g.target)&&!m.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 s=i=>{t(i),o(false);},p=e?Ys[e]:null,d=p?.color||dc;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,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(Ge,{children:jsxRuntime.jsxs("div",{ref:c,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(Ys).map(([i,g])=>jsxRuntime.jsxs("button",{onClick:()=>s(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(cc,{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:()=>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: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 mc=[{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 mr({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[l,c]=react.useState({top:0,left:0}),m=react.useRef(null),s=react.useRef(null),i=(Va()?.themeName||"dark")==="dark";react.useEffect(()=>{if(o&&s.current){let f=s.current.getBoundingClientRect();c({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[o]),react.useEffect(()=>{let f=u=>{m.current&&!m.current.contains(u.target)&&!s.current?.contains(u.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=u=>{u.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let g=f=>{let u=new Date,h=w=>{let S=w.getFullYear(),T=String(w.getMonth()+1).padStart(2,"0"),O=String(w.getDate()).padStart(2,"0");return `${S}-${T}-${O}`},C=h(u),v=new Date(u);v.setDate(v.getDate()+f);let P=h(v);a(C,P),n(false);},y=()=>{if(!e||!t)return "Set date";let f=v=>{if(v instanceof Date)return v;if(typeof v!="string"||!v.match(/^\d{4}-\d{2}-\d{2}$/))return null;let P=v.split("-").map(Number);if(P.length!==3||P.some(O=>isNaN(O)))return null;let w=P[0],S=P[1],T=P[2];return w===void 0||S===void 0||T===void 0?null:new Date(w,S-1,T)},u=f(e),h=f(t);if(!u||!h||isNaN(u.getTime())||isNaN(h.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[u.getMonth()]} ${u.getDate()} \u2013 ${C[h.getMonth()]} ${h.getDate()}`},k=e&&t,b=(()=>{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: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 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:k?`${y()}`:"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:y()})]}),o&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu absolute rounded-xl shadow-2xl border min-w-[320px]",style:{top:`${l.top}px`,left:`${l.left}px`,background:i?"#222326":"#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.7)":"rgba(0, 0, 0, 0.6)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:mc.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 border",style:{color:i?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.85)",borderColor:i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.12)",background:i?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.04)"},onMouseEnter:u=>{u.currentTarget.style.background=i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.08)",u.currentTarget.style.borderColor=i?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.2)";},onMouseLeave:u=>{u.currentTarget.style.background=i?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.04)",u.currentTarget.style.borderColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.12)";},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.7)":"rgba(0, 0, 0, 0.6)"},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.08)":"rgba(0, 0, 0, 0.04)",borderColor:i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.12)",color:i?"rgba(255, 255, 255, 0.9)":"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.08)":"rgba(0, 0, 0, 0.04)",borderColor:i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.12)",color:i?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"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: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 La({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,l]=react.useState(false),[c,m]=react.useState(""),[s,p]=react.useState({top:0,left:0}),d=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{if(n&&i.current){let b=i.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[n]),react.useEffect(()=>{let b=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(l(false),m(""));};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&(l(false),m(""));};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let g=b=>{let f=e.some(u=>u.id===b.id);a(f?e.filter(u=>u.id!==b.id):[...e,b]);},y=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),k=e.slice(0,o),x=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,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:[k.map(b=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),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"})]})})}),n&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:d,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:c,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:y.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"}):y.map(b=>{let f=e.some(u=>u.id===b.id);return jsxRuntime.jsxs("button",{onClick:()=>g(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter: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:b.color,color:"#fff"},children:b.avatar?jsxRuntime.jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),f&&jsxRuntime.jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},b.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function pr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o}){let[n,l]=react.useState(false),[c,m]=react.useState(""),[s,p]=react.useState(t.length>0),[d,i]=react.useState({top:0,left:0}),g=react.useRef(null),y=react.useRef(null);react.useEffect(()=>{if(n&&y.current){let u=y.current.getBoundingClientRect();i({top:u.bottom+window.scrollY+8,left:u.left+window.scrollX});}},[n]),react.useEffect(()=>{let u=h=>{g.current&&!g.current.contains(h.target)&&!y.current?.contains(h.target)&&(l(false),m(""));};if(n)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),react.useEffect(()=>{let u=h=>{h.key==="Escape"&&(l(false),m(""));};if(n)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let k=u=>{if(t.includes(u)){let C=t.filter(v=>v!==u);r(C),C.length===0&&p(false);}else r([...t,u]),p(true);},x=()=>{let u=!s;p(u),u||r([]);},b=a.filter(u=>u.id!==e).filter(u=>u.title.toLowerCase().includes(c.toLowerCase())||u.id.toLowerCase().includes(c.toLowerCase())),f=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l(!n),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})]}),n&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:g,className:"dependencies-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${d.top}px`,left:`${d.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-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:x,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:s?"#3b82f6":"transparent",borderColor:s?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:s&&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"})]})}),s&&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:c,onChange:u=>m(u.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:b.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"}):b.map(u=>{let h=t.includes(u.id);return jsxRuntime.jsxs("button",{onClick:()=>k(u.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:C=>{C.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:h?"#3b82f6":"transparent",borderColor:h?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:h&&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:u.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:u.id})]})]},u.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),p(false),l(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 ga=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:l,availableUsers:c=[],allCards:m=[]})=>{let{attributes:s,listeners:p,setNodeRef:d,transform:i,transition:g,isDragging:y}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Fr.Transform.toString(i),transition:g};if(t)return jsxRuntime.jsx("div",{ref:d,style:k,...s,...p,onClick:()=>a?.(e),children:t(e)});let x=c.filter(b=>e.assignedUserIds?.includes(b.id));return jsxRuntime.jsxs("div",{ref:d,style:k,className:F("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...s,...p,onClick:b=>{b.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:b=>{b.currentTarget.style.display="none";}})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",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:b=>b.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(cr,{priority:e.priority,onChange:b=>l?.(e.id,{priority:b})})}),jsxRuntime.jsx("div",{onClick:b=>b.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(mr,{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:(b,f)=>l?.(e.id,{startDate:b,endDate:f})})}),c.length>0&&jsxRuntime.jsx("div",{onClick:b=>b.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(La,{assignedUsers:x,availableUsers:c,onChange:b=>l?.(e.id,{assignedUserIds:b.map(f=>f.id)})})}),jsxRuntime.jsx("div",{onClick:b=>b.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(pr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(b=>typeof b=="string"?b:b.taskId):[],availableTasks:m,onChange:b=>l?.(e.id,{dependencies:b})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(b=>jsxRuntime.jsx("span",{className:"asakaa-label",children:b},b))})]})},(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.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));ga.displayName="Card";function ei({columnTitle:e,onRename:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(false),[c,m]=react.useState(e),[s,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 b=i.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[r]),react.useEffect(()=>{let b=f=>{d.current&&!d.current.contains(f.target)&&!i.current?.contains(f.target)&&(o(false),l(false));};if(r)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r]),react.useEffect(()=>{let b=f=>{f.key==="Escape"&&(o(false),l(false),m(e));};if(r)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r,e]),react.useEffect(()=>{n&&g.current&&(g.current.focus(),g.current.select());},[n]);let y=()=>{l(true),m(e);},k=()=>{let b=c.trim();b&&b!==e&&t(b),l(false),o(false),m(e);},x=b=>{b.key==="Enter"?k():b.key==="Escape"&&(l(false),m(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(Ge,{children:jsxRuntime.jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.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:n?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:c,onChange:b=>m(b.target.value),onKeyDown:x,onBlur:k,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:y,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 Ya=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:l,onCardUpdate:c,availableUsers:m,allCards:s,enableVirtualization:p,cardHeight:d=120,isCollapsed:i,onToggleCollapse:g,onColumnRename:y,className:k})=>{let{setNodeRef:x,isOver:b}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),f=react.useRef(null),u=p??As(t.length),h=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>f.current,estimateSize:()=>d,enabled:u});if(a)return jsxRuntime.jsx("div",{ref:x,className:k,children:a(e,t)});let v=(()=>{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}})(),P=v.state==="exceeded",w=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:x,className:F("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",P&&"ring-2 ring-asakaa-accent-red",k),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:F(w()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.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"})]}),v.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"})]}),v.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"})}),v.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),y&&jsxRuntime.jsx(ei,{columnTitle:e.title,onRename:S=>y(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?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):u?jsxRuntime.jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map(S=>{let T=t[S.index];return T?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsxRuntime.jsx(ga,{card:T,render:r,onClick:l,onUpdate:c,availableUsers:m,allCards:s})},T.id):null})}):t.map(S=>jsxRuntime.jsx(ga,{card:S,render:r,onClick:l,onUpdate:c,availableUsers:m,allCards:s},S.id))})})]})});Ya.displayName="Column";function Go({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState(e),c=react.useRef(null);react.useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let m=()=>{let p=n.trim();p&&p!==e?t(p):l(e),o(false);},s=p=>{p.key==="Enter"?m():p.key==="Escape"&&(l(e),o(false));};return r?jsxRuntime.jsx("input",{ref:c,type:"text",value:n,onChange:p=>l(p.target.value),onBlur:m,onKeyDown:s,className:F("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:F("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Wo(){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 ka({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:l,style:c,isLoading:m,error:s,children:p}){let[d,i]=Wo(),g=o?.theme||"dark",k=g==="dark"||g==="neutral"?"dark":"",x=react.useCallback((w,S)=>{t.onCardUpdate?.(w,S);},[t]),b=react.useCallback((w,S)=>{t.onColumnUpdate?.(w,{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 w=new Map;return e.columns.forEach(S=>{let T=S.cardIds.map(O=>e.cards.find(z=>z.id===O)).filter(O=>O!==void 0).sort((O,z)=>O.position-z.position);w.set(S.id,T);}),w},[e.cards,e.columns]),h=react.useCallback(w=>{let{active:S}=w,T=e.cards.find(O=>O.id===S.id);T&&i({isDragging:true,draggedCardId:T.id,sourceColumnId:T.columnId,targetColumnId:T.columnId});},[e.cards,i]),C=react.useCallback(w=>{let{active:S,over:T}=w;if(!T||!e.cards.find(I=>I.id===S.id))return;let z=null;T.data.current?.type==="column"?z=T.id:T.data.current?.type==="card"&&(z=e.cards.find($=>$.id===T.id)?.columnId||null),z&&z!==d.targetColumnId&&i({...d,targetColumnId:z});},[e.cards,d,i]),v=react.useCallback(async w=>{let{active:S,over:T}=w;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!T)return;let O=e.cards.find(E=>E.id===S.id);if(!O)return;let z,I;if(T.data.current?.type==="column"){z=T.id;let E=u.get(z)||[];I=Eo(E,0);}else {let E=e.cards.find(ee=>ee.id===T.id);if(!E)return;z=E.columnId;let U=u.get(z)||[],Y=U.findIndex(ee=>ee.id===T.id);I=Eo(U,Y);}let $=e.columns.find(E=>E.id===z);if($&&$.wipLimit&&$.wipLimitType==="hard"){let E=u.get(z)||[];if(O.columnId!==z&&E.length>=$.wipLimit){t.onWipLimitExceeded?.($,O);return}}(O.columnId!==z||O.position!==I)&&await t.onCardMove?.(O.id,z,I);},[e.cards,e.columns,u,t,i]),P=react.useCallback(w=>{a?.(w);},[a]);return m?jsxRuntime.jsx("div",{className:F("asakaa-board",k,l),style:c,children:jsxRuntime.jsx(Fc,{columnCount:3})}):s?jsxRuntime.jsx("div",{className:F("asakaa-board",k,l),style:c,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof s=="string"?s:s.message})]})})}):jsxRuntime.jsx(_s,{themeName:g,children:jsxRuntime.jsxs(core$1.DndContext,{sensors:f,collisionDetection:core$1.closestCorners,onDragStart:h,onDragOver:C,onDragEnd:v,children:[jsxRuntime.jsxs("div",{className:F("asakaa-board",k,l),style:c,"data-theme":g,children:[e.columns.sort((w,S)=>w.position-S.position).map(w=>{let S=u.get(w.id)||[];return jsxRuntime.jsx(Ya,{column:w,cards:S,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:P,onCardUpdate:x,onColumnRename:b,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},w.id)}),p]}),jsxRuntime.jsx(core$1.DragOverlay,{children:d.draggedCardId?jsxRuntime.jsx(ga,{card:e.cards.find(w=>w.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Fc({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 gr=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(ka,{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 oi(e={}){return new gr(e)}var Hc=5*1024*1024,Ho="asakaa-recent-uploads",si=10;function _o({coverImage:e,onUpload:t,onChange:a,onRemove:r,unsplashAccessKey:o,maxFileSize:n=Hc,showRecentUploads:l=true}){let[c,m]=react.useState("upload"),[s,p]=react.useState(false),[d,i]=react.useState(0),[g,y]=react.useState(""),[k,x]=react.useState(""),[b,f]=react.useState([]),[u,h]=react.useState(false),[C,v]=react.useState([]),[P,w]=react.useState(false),[S,T]=react.useState(0),[O,z]=react.useState(null),I=react.useRef(null);react.useEffect(()=>{try{let N=localStorage.getItem(Ho);if(N){let Z=JSON.parse(N);v(Z.slice(0,si));}}catch(N){console.error("Failed to load recent uploads:",N);}},[]);let $=react.useCallback((N,Z)=>{let te={url:N,thumbnail:Z||N,uploadedAt:new Date,usedCount:1};v(Be=>{if(Be.find(we=>we.url===N)){let mt=Be.map(je=>je.url===N?{...je,usedCount:je.usedCount+1}:je).sort((je,Ut)=>je.usedCount!==Ut.usedCount?Ut.usedCount-je.usedCount:new Date(Ut.uploadedAt).getTime()-new Date(je.uploadedAt).getTime());return localStorage.setItem(Ho,JSON.stringify(mt)),mt}let Ft=[te,...Be].slice(0,si);return localStorage.setItem(Ho,JSON.stringify(Ft)),Ft});},[]),E=react.useCallback(async N=>{if(z(null),N.size>n){z(`File too large. Max size: ${n/(1024*1024)}MB`);return}if(!N.type.startsWith("image/")){z("Please upload an image file (JPG, PNG, GIF, WebP)");return}p(true),i(0);try{let Z;t?Z=await t(N):Z=await _c(N);for(let te=0;te<=100;te+=10)i(te),await new Promise(Be=>setTimeout(Be,50));a(Z),$(Z),p(!1),i(0);}catch(Z){console.error("Upload failed:",Z),z("Upload failed. Please try again."),p(false),i(0);}},[n,t,a,$]),{getRootProps:U,getInputProps:Y,isDragActive:ee,isDragReject:R}=reactDropzone.useDropzone({onDrop:N=>{N.length>0&&N[0]&&E(N[0]);},accept:{"image/*":[".png",".jpg",".jpeg",".gif",".webp"]},maxSize:n,multiple:false,noClick:true});react.useEffect(()=>{let N=async Z=>{let te=Z.clipboardData?.items;if(te){for(let Be of te)if(Be.type.startsWith("image/")){let $e=Be.getAsFile();if($e){await E($e);break}}}};return window.addEventListener("paste",N),()=>window.removeEventListener("paste",N)},[E]);let J=react.useCallback(()=>{if(g.trim())try{new URL(g),a(g),$(g),y(""),z(null);}catch{z("Please enter a valid URL");}},[g,a,$]),G=react.useCallback(async N=>{if(!o){z("Unsplash integration not configured");return}if(N.trim()){h(true),z(null);try{let Z=await fetch(`https://api.unsplash.com/search/photos?query=${encodeURIComponent(N)}&per_page=12`,{headers:{Authorization:`Client-ID ${o}`}});if(!Z.ok)throw new Error("Unsplash search failed");let te=await Z.json();f(te.results||[]);}catch(Z){console.error("Unsplash search failed:",Z),z("Failed to search Unsplash. Please try again.");}finally{h(false);}}},[o]),se=react.useCallback(N=>{a(N.urls.regular),$(N.urls.regular,N.urls.thumb);},[a,$]);return e&&!P?jsxRuntime.jsxs("div",{className:"cover-image-preview",children:[jsxRuntime.jsx("div",{className:"cover-image-preview-container",children:jsxRuntime.jsx("img",{src:e,alt:"Cover",style:{transform:`translateY(${S}%)`},onError:N=>{N.currentTarget.src="https://via.placeholder.com/600x200?text=Image+Not+Found";}})}),jsxRuntime.jsxs("div",{className:"cover-image-actions",children:[jsxRuntime.jsxs("button",{className:"cover-image-button",onClick:()=>w(true),children:[jsxRuntime.jsx(Kc,{}),"Reposition"]}),jsxRuntime.jsxs("button",{className:"cover-image-button",onClick:()=>{w(false),T(0),r();},children:[jsxRuntime.jsx(Yc,{}),"Change"]}),jsxRuntime.jsxs("button",{className:"cover-image-button cover-image-button-danger",onClick:r,children:[jsxRuntime.jsx(Xc,{}),"Remove"]})]})]}):jsxRuntime.jsxs("div",{className:"cover-image-manager",children:[jsxRuntime.jsxs("div",{className:"cover-image-tabs",role:"tablist",children:[jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="upload",className:F("cover-image-tab",{"cover-image-tab-active":c==="upload"}),onClick:()=>m("upload"),children:[jsxRuntime.jsx(ii,{}),"Upload"]}),jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="link",className:F("cover-image-tab",{"cover-image-tab-active":c==="link"}),onClick:()=>m("link"),children:[jsxRuntime.jsx(Vc,{}),"Link"]}),o&&jsxRuntime.jsxs("button",{role:"tab","aria-selected":c==="unsplash",className:F("cover-image-tab",{"cover-image-tab-active":c==="unsplash"}),onClick:()=>m("unsplash"),children:[jsxRuntime.jsx(jc,{}),"Unsplash"]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsx(framerMotion.motion.div,{className:"cover-image-error",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},children:O})}),jsxRuntime.jsxs("div",{className:"cover-image-panels",children:[c==="upload"&&jsxRuntime.jsxs("div",{className:"cover-image-panel",children:[jsxRuntime.jsxs("div",{...U(),className:F("cover-image-dropzone",{"cover-image-dropzone-active":ee,"cover-image-dropzone-reject":R}),children:[jsxRuntime.jsx("input",{...Y(),ref:I}),s?jsxRuntime.jsxs("div",{className:"cover-image-uploading",children:[jsxRuntime.jsx("div",{className:"cover-image-progress",children:jsxRuntime.jsx("div",{className:"cover-image-progress-bar",style:{width:`${d}%`}})}),jsxRuntime.jsxs("p",{children:["Uploading... ",d,"%"]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ii,{size:48}),jsxRuntime.jsx("h3",{children:"Drop image here"}),jsxRuntime.jsx("p",{className:"cover-image-hint",children:"or paste from clipboard (Cmd/Ctrl+V)"}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:()=>I.current?.click(),children:"Browse files"}),jsxRuntime.jsxs("p",{className:"cover-image-meta",children:["Max ",n/(1024*1024),"MB \xB7 JPG, PNG, GIF, WebP"]})]})]}),l&&C.length>0&&jsxRuntime.jsxs("div",{className:"cover-image-recent",children:[jsxRuntime.jsx("h4",{children:"Recent uploads"}),jsxRuntime.jsx("div",{className:"cover-image-recent-grid",children:C.slice(0,4).map((N,Z)=>jsxRuntime.jsx("button",{className:"cover-image-recent-item",onClick:()=>a(N.url),style:{backgroundImage:`url(${N.thumbnail})`},title:"Click to use this image"},Z))})]})]}),c==="link"&&jsxRuntime.jsx("div",{className:"cover-image-panel",children:jsxRuntime.jsxs("div",{className:"cover-image-url-input",children:[jsxRuntime.jsx("input",{type:"url",placeholder:"Paste image URL...",value:g,onChange:N=>y(N.target.value),onKeyDown:N=>{N.key==="Enter"&&J();}}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:J,disabled:!g.trim(),children:"Add image"})]})}),c==="unsplash"&&o&&jsxRuntime.jsxs("div",{className:"cover-image-panel",children:[jsxRuntime.jsxs("div",{className:"cover-image-search",children:[jsxRuntime.jsx("input",{type:"search",placeholder:"Search Unsplash...",value:k,onChange:N=>x(N.target.value),onKeyDown:N=>{N.key==="Enter"&&G(k);}}),jsxRuntime.jsx("button",{className:"cover-image-button-primary",onClick:()=>G(k),disabled:u||!k.trim(),children:u?"Searching...":"Search"})]}),b.length>0&&jsxRuntime.jsx("div",{className:"cover-image-unsplash-grid",children:b.map(N=>jsxRuntime.jsx("button",{className:"cover-image-unsplash-item",onClick:()=>se(N),style:{backgroundImage:`url(${N.urls.small})`},title:`Photo by ${N.user.name}`},N.id))})]})]})]})}function _c(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=a,r.readAsDataURL(e);})}function ii({size:e=20}){return jsxRuntime.jsxs("svg",{width:e,height:e,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-4"}),jsxRuntime.jsx("polyline",{points:"17 8 12 3 7 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]})}function Vc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),jsxRuntime.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function jc(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M7.5 6.5H16.5V0H7.5V6.5ZM16.5 9H24V24H0V9H7.5V16.5H16.5V9Z"})})}function Kc(){return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"7 13 12 8 17 13"}),jsxRuntime.jsx("polyline",{points:"7 17 12 12 17 17"})]})}function Yc(){return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"})})}function Xc(){return 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 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}var qa=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 Vo(e,t){let a=r=>jsxRuntime.jsx(qa,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ko({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:l,onPredictRisks:c,onOpenAIUsage:m,shortcut:s="k",className:p=""}){let[d,i]=react.useState(false),[g,y]=react.useState(""),[k,x]=react.useState("home"),[b,f]=react.useState(""),[u,h]=react.useState("");react.useEffect(()=>{let w=S=>{(S.metaKey||S.ctrlKey)&&S.key===s&&(S.preventDefault(),i(T=>!T)),S.key==="Escape"&&(i(false),x("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[s]),react.useEffect(()=>{d||(x("home"),y(""),f(""),h(""));},[d]);let C=react.useCallback(()=>{i(false);},[]),v=react.useCallback(w=>{let[S,T]=w.split(":");switch(S){case "create-card":x("create-card");break;case "create-card-in":f(T||"");break;case "navigate":T?(a?.(T),C()):x("navigate");break;case "search":r?.(g),C();break;case "priority":x("priority");break;case "set-priority":u&&T&&(o?.(u,T),C());break;case "assign":x("assign");break;case "assign-user":u&&T&&(n?.(u,T),C());break;case "ai":x("ai");break;case "ai-generate-plan":l?.(),C();break;case "ai-predict-risks":c?.(),C();break;case "ai-usage":m?.(),C();break;case "back":x("home");break;}},[g,u,t,a,r,o,n,l,c,m,C]),P=react.useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),C());},[b,g,t,C]);return d?jsxRuntime.jsx(Ge,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:C,children:jsxRuntime.jsx("div",{className:`command-palette ${p}`,onClick:w=>w.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:k==="create-card"&&b?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&b&&P();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),k==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:v,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:v,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:v,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:v,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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:v,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},w.id))})]}),k==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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(w=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${w.id}`,onSelect:v,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:w.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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(w=>{let S=e.columns.find(T=>T.id===w.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${w.id}`,onSelect:v,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:w.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),w.labels&&w.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(T=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:T},T))})]},w.id)})})]}),k==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:v,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:v,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:v,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:v,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 Qc(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 em(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 tm(e){return e.startsWith("image/")}function hr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[l,c]=react.useState(false),[m,s]=react.useState(false),[p,d]=react.useState(null),i=react.useRef(null),g=react.useCallback(v=>{let P=[],w=[];return e.length+v.length>n?(w.push(`Maximum ${n} files allowed`),{valid:P,errors:w}):(v.forEach(S=>{if(S.size/1048576>r){w.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>S.type.match(O))){w.push(`${S.name} has invalid file type`);return}P.push(S);}),{valid:P,errors:w})},[e.length,n,r,o]),y=react.useCallback(async v=>{let{valid:P,errors:w}=g(v);if(w.length>0){d(w.join(", ")),setTimeout(()=>d(null),5e3);return}if(P.length!==0){s(true),d(null);try{await t?.(P);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{s(false);}}},[g,t]),k=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(true);},[]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);},[]),b=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),f=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),c(false);let P=Array.from(v.dataTransfer.files);y(P);},[y]),u=react.useCallback(v=>{let P=v.target.files?Array.from(v.target.files):[];y(P),i.current&&(i.current.value="");},[y]),h=react.useCallback(()=>{i.current?.click();},[]),C=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${m?"uploading":""}`,onDragEnter:k,onDragLeave:x,onDragOver:b,onDrop:f,onClick:h,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:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",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(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:tm(v.type)&&v.url?jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}):jsxRuntime.jsx("div",{className:"attachment-icon",children:em(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Qc(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>C(v.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"})})})]},v.id))})]})}function Xo({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:c=[],aiInsights:m=[],attachments:s=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:k,onEstimateEffort:x,currentUserId:b="user-1"}){let[f,u]=react.useState("details"),[h,C]=react.useState(false),[v,P]=react.useState({}),[w,S]=react.useState(""),[T,O]=react.useState(false),[z,I]=react.useState({});if(!t||!e)return null;let $=react.useCallback(()=>{C(false),P({}),u("details"),S(""),I({}),a();},[a]),E=react.useCallback(()=>{r&&Object.keys(v).length>0&&(r(e.id,v),P({}),C(false));},[e.id,v,r]),U=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),Y=react.useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),S(""));},[e.id,w,p]),ee=react.useCallback(async()=>{if(y){O(true);try{let N=await y(e);I(Z=>({...Z,assignees:N}));}catch(N){console.error("Failed to suggest assignee:",N);}finally{O(false);}}},[e,y]),R=react.useCallback(async()=>{if(k){O(true);try{let N=await k(e);I(Z=>({...Z,subtasks:N}));}catch(N){console.error("Failed to generate subtasks:",N);}finally{O(false);}}},[e,k]),J=react.useCallback(async()=>{if(x){O(true);try{let N=await x(e);I(Z=>({...Z,effort:N}));}catch(N){console.error("Failed to estimate effort:",N);}finally{O(false);}}},[e,x]),G={...e,...v},se=n.filter(N=>G.assignedUserIds?.includes(N.id));return jsxRuntime.jsx(Ge,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:N=>N.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),h?jsxRuntime.jsx("input",{type:"text",value:v.title??G.title,onChange:N=>P({...v,title:N.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:G.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[h?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:E,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{C(false),P({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:U,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",c.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:c.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",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.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"}),h?jsxRuntime.jsx("textarea",{value:v.description??G.description??"",onChange:N=>P({...v,description:N.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:G.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),h?jsxRuntime.jsx("select",{multiple:true,value:v.assignedUserIds??G.assignedUserIds??[],onChange:N=>{let Z=Array.from(N.target.selectedOptions,te=>te.value);P({...v,assignedUserIds:Z});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:se.length>0?se.map(N=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:N.color},children:N.initials}),jsxRuntime.jsx("span",{children:N.name})]},N.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"}),h?jsxRuntime.jsxs("select",{value:v.priority??G.priority??"",onChange:N=>P({...v,priority:N.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:G.priority==="URGENT"?"#EF4444":G.priority==="HIGH"?"#F59E0B":G.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:G.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:G.labels&&G.labels.length>0?G.labels.map(N=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:N},N)):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"}),h?jsxRuntime.jsx("input",{type:"date",value:v.startDate?new Date(v.startDate).toISOString().split("T")[0]:G.startDate?new Date(G.startDate).toISOString().split("T")[0]:"",onChange:N=>P({...v,startDate:N.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.startDate?new Date(G.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),h?jsxRuntime.jsx("input",{type:"date",value:v.endDate?new Date(v.endDate).toISOString().split("T")[0]:G.endDate?new Date(G.endDate).toISOString().split("T")[0]:"",onChange:N=>P({...v,endDate:N.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:G.endDate?new Date(G.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),h?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:v.estimatedTime??G.estimatedTime??"",onChange:N=>P({...v,estimatedTime:N.target.value?parseFloat(N.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:G.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:G.dependencies&&G.dependencies.length>0?G.dependencies.map(N=>{let Z=typeof N=="string"?N:N.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Z.slice(-4)]},Z)}):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:G.createdAt?new Date(G.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:w,onChange:N=>S(N.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:Y,disabled:!w.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(N=>{let Z=n.find(te=>te.id===N.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:[Z&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Z?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(N.createdAt).toLocaleString()})]})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(N.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:N.content})]},N.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:c.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:c.map(N=>{let Z=n.find(te=>te.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[N.type.includes("CREATED")&&"\u2795",N.type.includes("UPDATED")&&"\u270F\uFE0F",N.type.includes("MOVED")&&"\u27A1\uFE0F",N.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",N.type.includes("COMMENT")&&"\u{1F4AC}",N.type.includes("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",N.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:Z?.name||"Unknown"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:N.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.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(hr,{cardId:e.id,attachments:s,onUpload:i?N=>i(e.id,N):void 0,onDelete:g,currentUserId:b,maxSizeMB:10,maxFiles:20})}),f==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:ee,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:R,disabled:T||!k,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:J,disabled:T||!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"]})]}),z.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((N,Z)=>{let te=n.find(Be=>Be.id===N.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:N.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(N.confidence*100).toFixed(0),"%"]})]})]},Z)})]}),z.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((N,Z)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:N.title}),N.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:N.description}),N.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",N.estimatedTime,"h"]})]},Z))]}),z.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[z.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(N=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${N.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:N.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:N.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:N.description}),N.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",N.suggestedAction]})]},N.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var sm=["LOW","MEDIUM","HIGH","URGENT"],im=["todo","in-progress","review","done"];function Jo({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:l=[],activities:c=[],onAddComment:m,onDeleteComment:s,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:g,availableColumns:y=[],availableLabels:k=[],onUploadCoverImage:x,unsplashAccessKey:b}){let u=Va()?.themeName||"dark",[h,C]=react.useState(e),[v,P]=react.useState(false),[w,S]=react.useState([]),[T,O]=react.useState(false),[z,I]=react.useState(""),[$,E]=react.useState(""),[U,Y]=react.useState("all"),[ee,R]=react.useState(false),[J,G]=react.useState(false),[se,N]=react.useState(false),[Z,te]=react.useState(false),[Be,$e]=react.useState(false),[Ft,we]=react.useState(false),[mt,je]=react.useState(false),Ut=react.useRef(null),Pa=react.useRef(null),ya=react.useRef(null),ue=react.useRef(null),tt=react.useRef(null),Gt=react.useRef(null),$t=react.useRef(null),pa=react.useRef(null);react.useEffect(()=>{e&&!h?C({...e}):e&&h&&e.id!==h.id&&C({...e});},[e,h]),react.useEffect(()=>{let M=ae=>{let Ue=ae.target;ue.current&&!ue.current.contains(Ue)&&G(false),tt.current&&!tt.current.contains(Ue)&&N(false),Gt.current&&!Gt.current.contains(Ue)&&te(false),$t.current&&!$t.current.contains(Ue)&&$e(false);};if(J||se||Z||Be)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[J,se,Z,Be]),react.useEffect(()=>{if(!t)return;let M=ae=>{let Ue=ae.target,bt=Ue.tagName==="INPUT"||Ue.tagName==="TEXTAREA"||Ue.isContentEditable;if(ae.key==="Escape"){ae.preventDefault(),J||se||Z||Be||Ft||mt?(G(false),N(false),te(false),$e(false),we(false),je(false)):bt||a();return}if(bt&&ae.key!=="Escape")return;let ia=ae.metaKey||ae.ctrlKey;switch(ae.key.toLowerCase()){case "s":ae.preventDefault(),G(true);break;case "a":ae.preventDefault(),te(true);break;case "p":ae.preventDefault(),N(true);break;case "l":ae.preventDefault(),$e(true);break;case "d":ia||(ae.preventDefault(),we(true),setTimeout(()=>pa.current?.focus(),0));break;case "e":ia||(ae.preventDefault(),je(true));break;case "i":ae.preventDefault(),P(true),setTimeout(()=>Pa.current?.focus(),0);break;case "t":ae.preventDefault(),O(true);break;case "c":ae.preventDefault(),ya.current?.focus();break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,a,J,se,Z,Be,Ft,mt]);let ie=react.useCallback(M=>{let ae=M.currentTarget.textContent?.trim()||"";if(h&&ae!==h.title){let Ue={...h,title:ae};C(Ue),r?.(h.id,{title:ae});}},[h,r]),me=react.useCallback(M=>{M.key==="Enter"&&(M.preventDefault(),M.currentTarget.blur()),M.key==="Escape"&&(M.preventDefault(),M.currentTarget.textContent=h?.title||"",M.currentTarget.blur());},[h]),V=react.useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),P(false);},[h,e,r]),H=react.useCallback(M=>{if(h){let ae={...h,columnId:M};C(ae),r?.(h.id,{columnId:M}),G(false);}},[h,r]),Te=react.useCallback(M=>{if(h){let ae={...h,priority:M};C(ae),r?.(h.id,{priority:M}),N(false);}},[h,r]),Ke=react.useCallback(M=>{if(h){let ae=h.assignedUserIds||[],Ue=ae.includes(M)?ae.filter(ia=>ia!==M):[...ae,M],bt={...h,assignedUserIds:Ue};C(bt),r?.(h.id,{assignedUserIds:Ue});}},[h,r]),oe=react.useCallback(M=>{if(h){let ae=h.labels||[],Ue=ae.includes(M)?ae.filter(ia=>ia!==M):[...ae,M],bt={...h,labels:Ue};C(bt),r?.(h.id,{labels:Ue});}},[h,r]),de=react.useCallback(M=>{if(h){let ae=M.target.value,Ue={...h,endDate:ae};C(Ue),r?.(h.id,{endDate:ae}),we(false);}},[h,r]),sa=react.useCallback(M=>{if(h){let ae={...h,estimatedTime:parseFloat(M)||0};C(ae),r?.(h.id,{estimatedTime:parseFloat(M)||0});}},[h,r]),_t=react.useCallback(()=>{if(z.trim()){let M={id:`subtask-${Date.now()}`,title:z.trim(),completed:false};S([...w,M]),I(""),O(false);}},[z,w]),ge=react.useCallback(M=>{S(w.map(ae=>ae.id===M?{...ae,completed:!ae.completed}:ae));},[w]),j=react.useCallback(M=>{S(w.filter(ae=>ae.id!==M));},[w]),he=react.useCallback(()=>{$.trim()&&h&&m&&(m(h.id,$.trim()),E(""));},[$,h,m]),ve=react.useCallback(M=>{(M.metaKey||M.ctrlKey)&&M.key==="Enter"&&(M.preventDefault(),he());},[he]),ze=react.useCallback(M=>{if(h){let ae={...h,coverImage:M};C(ae),r?.(h.id,{coverImage:M}),R(false);}},[h,r]),He=react.useCallback(()=>{if(h){let M={...h,coverImage:void 0};C(M),r?.(h.id,{coverImage:void 0});}},[h,r]),Ae=M=>jsxRuntime.jsx(rm__default.default,{remarkPlugins:[om__default.default],rehypePlugins:[nm__default.default],components:{a:({node:ae,...Ue})=>jsxRuntime.jsx("a",{...Ue,target:"_blank",rel:"noopener noreferrer"})},children:M}),it=c.filter(M=>U==="comments"?M.type.includes("COMMENT"):U==="history"?!M.type.includes("COMMENT"):true);if(!t||!e)return null;let le=h||e,Tt=n.filter(M=>le.assignedUserIds?.includes(M.id)),Nt=w.filter(M=>M.completed).length;return jsxRuntime.jsx(Ge,{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:M=>M.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":u,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:Ut,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ie,onKeyDown:me,children:le.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-cover-section",children:[!ee&&!le.coverImage&&jsxRuntime.jsxs("button",{className:"modal-v2-add-cover-button",onClick:()=>R(true),children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]}),"Add cover image"]}),!ee&&le.coverImage&&jsxRuntime.jsxs("div",{className:"modal-v2-cover-preview-wrapper",children:[jsxRuntime.jsx("img",{src:le.coverImage,alt:`Cover for ${le.title}`,className:"modal-v2-cover-image",onError:M=>{M.currentTarget.style.display="none";}}),jsxRuntime.jsxs("div",{className:"modal-v2-cover-actions",children:[jsxRuntime.jsx("button",{className:"modal-v2-cover-action-button",onClick:()=>R(true),children:"Change"}),jsxRuntime.jsx("button",{className:"modal-v2-cover-action-button danger",onClick:He,children:"Remove"})]})]}),ee&&jsxRuntime.jsxs("div",{className:"modal-v2-cover-manager-wrapper",children:[jsxRuntime.jsxs("div",{className:"modal-v2-cover-manager-header",children:[jsxRuntime.jsx("h3",{children:"Cover Image"}),jsxRuntime.jsx("button",{className:"modal-v2-cover-manager-close",onClick:()=>R(false),children:jsxRuntime.jsxs("svg",{width:"16",height:"16",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.jsx(_o,{coverImage:le.coverImage,onUpload:x,onChange:ze,onRemove:He,unsplashAccessKey:b,showRecentUploads:true})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ue,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>G(!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:le.columnId||"No status"})]}),J&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(y.length>0?y:im.map(M=>({id:M,title:M}))).map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${le.columnId===M.id?"active":""}`,onClick:()=>H(M.id),children:M.title},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Gt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>te(!Z),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("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:Tt.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Tt.map(M=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:M.color},title:M.name,children:M.initials},M.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Z&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:n.map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.assignedUserIds?.includes(M.id)?"active":""}`,onClick:()=>Ke(M.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:M.color},children:M.initials}),M.name,le.assignedUserIds?.includes(M.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"})})]},M.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:tt,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>N(!se),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.priority||"None"})]}),se&&jsxRuntime.jsxs("div",{className:"modal-v2-popover",children:[sm.map(M=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${M.toLowerCase()} ${le.priority===M?"active":""}`,onClick:()=>Te(M),children:M},M)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>Te(""),children:"None"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:$t,children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>$e(!Be),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:le.labels&&le.labels.length>0?jsxRuntime.jsx("span",{children:le.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Be&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(M=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${le.labels?.includes(M)?"active":""}`,onClick:()=>oe(M),children:[M,le.labels?.includes(M)&&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"})})]},M))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{we(!Ft),setTimeout(()=>pa.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:le.endDate?new Date(le.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:pa,type:"date",value:typeof le.endDate=="string"?le.endDate.split("T")[0]:le.endDate?(()=>{let M=new Date(le.endDate),ae=M.getUTCFullYear(),Ue=String(M.getUTCMonth()+1).padStart(2,"0"),bt=String(M.getUTCDate()).padStart(2,"0");return `${ae}-${Ue}-${bt}`})():"",onChange:de,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>je(!mt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:le.estimatedTime?`${le.estimatedTime}h`:"Not set"})]}),mt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:le.estimatedTime||"",onChange:M=>sa(M.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>je(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"}),jsxRuntime.jsxs("button",{className:"modal-v2-ai-button",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 Assist"]})]}),v?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:le.description||"",onChange:M=>{if(h){let ae={...h,description:M.target.value};C(ae);}},onBlur:V,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>P(true),children:le.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:Ae(le.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:[Nt,"/",w.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>O(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(M=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${M.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ge(M.id),children:M.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:M.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>j(M.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"})]})})]},M.id)),T&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:z,onChange:M=>I(M.target.value),onKeyDown:M=>{M.key==="Enter"&&_t(),M.key==="Escape"&&(O(false),I(""));},onBlur:_t,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 ${U==="all"?"active":""}`,onClick:()=>Y("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="comments"?"active":""}`,onClick:()=>Y("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${U==="history"?"active":""}`,onClick:()=>Y("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:ya,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:$,onChange:M=>E(M.target.value),onKeyDown:ve,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:he,disabled:!$.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[it.map(M=>{let ae=n.find(bt=>bt.id===M.userId);if(M.type.includes("COMMENT")){let bt=l.find(ia=>ia.id===M.metadata?.commentId);return bt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ae&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:ae.color},children:ae.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:ae?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(M.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:bt.content})]})]},M.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-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("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.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:ae?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:M.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)}),it.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 bm({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 Qo({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((c,m)=>c+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data: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(bm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,c)=>l+c.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,c)=>l+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,c)=>l+(c.planned||0),0)})]})]})]})}function Nm({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 en({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,c=e[e.length-1]?.ideal||0,m=n>0?(n-l)/n*100:0,s=l<=c;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Nm,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color: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 Fm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bi=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Bm({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let l=r+(o-r)*.5,c=e+l*Math.cos(-a*(Math.PI/180)),m=t+l*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:c,y:m,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function hi({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 tn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((m,s)=>m+s.value,0),l=e.map(m=>({...m,totalValue:n,color:m.color||Fm[m.name]||bi[e.indexOf(m)%bi.length]})),c=l.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?Bm:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[s]},`cell-${s}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(hi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,s)=>{let p=s.payload,d=n>0?(p.value/n*100).toFixed(0):"0";return `${m} (${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(hi,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((m,s)=>jsxRuntime.jsx(recharts.Cell,{fill:c[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((m,s)=>s.value>m.value?s:m).name})]})]})]})}var Vr=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[l,c]=react.useState(false),[m,s]=react.useState(false),[p,d]=react.useState(false),[i,g]=react.useState(false);if(e.length===0)return null;let y=e.map(h=>h.id),k=h=>{r.onBulkUpdate?.(y,{priority:h}),c(false);},x=h=>{r.onBulkMove?.(y,h),s(false),a();},b=h=>{r.onBulkUpdate?.(y,{assignedUserIds:h}),d(false);},f=h=>{let C=new Set;e.forEach(P=>{P.labels?.forEach(w=>C.add(w));});let v=Array.from(new Set([...C,...h]));r.onBulkUpdate?.(y,{labels:v}),g(false);},u=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!l),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(h),children:[jsxRuntime.jsx("span",{className:F("asakaa-priority-dot",h==="LOW"&&"bg-asakaa-priority-low",h==="MEDIUM"&&"bg-asakaa-priority-medium",h==="HIGH"&&"bg-asakaa-priority-high",h==="URGENT"&&"bg-asakaa-priority-urgent")}),h]},h))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(h.id),children:h.title},h.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(h=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([h.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:h.color},children:h.initials}),h.name]},h.id))})]}),n.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:n.map(h=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([h]),children:h},h))})]}),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"})})]})]})})});Vr.displayName="BulkOperationsToolbar";function Gm(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,l,c,m,s;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(k=>k.id===g);l=`assignee-${g}`,c=y?.name||`User ${g}`,m=y?.color,s=y?.avatar,r.has(l)||r.set(l,{id:l,title:c,groupValue:g,cardIds:[],color:m,icon:s}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",c="Unassigned",m="#6b7280",s="\u{1F464}",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:m,icon:s}),r.get(l).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",l=`priority-${n}`;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"}}[n];c=i.title,m=i.color,r.has(l)||r.set(l,{id:l,title:c,groupValue:n,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{l=`label-${g}`,c=g,m="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:g,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);}):(l="label-none",c="No Labels",m="#6b7280",r.has(l)||r.set(l,{id:l,title:c,groupValue:null,cardIds:[],color:m}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function an({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,l]=react.useState(new Set),c=react.useMemo(()=>Gm(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(s=>{l(p=>{let d=new Set(p);return d.has(s)?d.delete(s):d.add(s),d});},[]);return t.groupBy==="none"||c.length===0?jsxRuntime.jsx(ka,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:F("asakaa-swimlane-view",o),children:[c.map(s=>{let p=n.has(s.id),d=e.cards.filter(g=>s.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&&m(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(ka,{board:i,callbacks:r,availableUsers:a})})]},s.id)}),c.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var rn=[{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 on({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=react.useRef(null),c=rn.find(s=>s.value===e)||rn[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 m=s=>{t(s),o(false);};return jsxRuntime.jsxs("div",{className:F("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:c.icon}),jsxRuntime.jsx("span",{children:c.label}),jsxRuntime.jsx("svg",{className:F("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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:rn.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s.value),className:F("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 vr=[{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 Hm(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,c=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return n&&l&&c&&m}function wi(e={}){let{shortcuts:t=vr,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(m=>{o.current=[...o.current,m];},[]),c=react.useCallback(m=>{o.current=o.current.filter(s=>s.action!==m);},[]);return react.useEffect(()=>{function m(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 d of o.current)if(Hm(s,d)){r&&s.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:l,unregisterShortcut:c,isEnabled:a}}function Vm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function jm(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 Km(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=jm(e),r=t?Vm(t):"";return a?`${a} + ${r}`:r}function Ym(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 nn({shortcuts:e=vr,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function c(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let l=Ym(e);return jsxRuntime.jsxs("div",{className:F("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([c,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.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:Km(s)})]},s.action))})]},c))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var sn=[{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,48 +42,48 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ln({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{function s(m){n.current&&!n.current.contains(m.target)&&i.current&&!i.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=s=>{t(s),o(false);},p=e.reduce((s,m)=>{let d=m.category||"Other";return s[d]||(s[d]=[]),s[d].push(m),s},{});return jsxRuntime.jsxs("div",{className:F("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,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:F("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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(p).map(([s,m])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:s})}),jsxRuntime.jsx("div",{children:m.map(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:l=>{l.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))})]},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 cn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[i,c]=react.useState("export"),[p,s]=react.useState("json"),[m,d]=react.useState(null),l=react.useRef(null);if(!t)return null;let u=async()=>{let y=o?.current||void 0,x=await Os(e,p,y);zs(x,p);},k=async y=>{let x=y.target.files?.[0];if(x){try{let f=await $s(x),h=x.name.endsWith(".json")?"json":"csv",g=Gs(f,h);d(g),g.success&&r&&r(g,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}l.current&&(l.current.value="");}};return jsxRuntime.jsxs("div",{className:F("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:()=>c("export"),className:F("flex-1 px-6 py-4 font-semibold transition-colors",i==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:F("flex-1 px-6 py-4 font-semibold transition-colors",i==="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:[i==="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:()=>s(y),className:F("p-4 rounded-lg border-2 transition-all text-center",p===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: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"})]}),i==="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:l,type:"file",accept:".json,.csv",onChange:k,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>l.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxRuntime.jsxs("div",{className:F("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:F("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:m.errors.map((y,x)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},x))})]})]})]})]})]})}var Qp=["URGENT","HIGH","MEDIUM","LOW"],em=[{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"}],tm=[{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:i,onFilterHighPriority:c,availableUsers:p=[],availableLabels:s=[],availableColumns:m=[],showQuickFilters:d=true,compact:l=false,groupBy:u="none",onGroupByChange:k}){let[y,x]=react.useState(true),f=react.useCallback(v=>{a({search:v.target.value});},[a]),h=react.useCallback(v=>{a({dateFilter:v.target.value});},[a]),g=react.useCallback(v=>{r({by:v.target.value});},[r]),b=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),w=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 ${l?"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:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.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"}),w&&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:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:v=>{let P=v.target.value;a({priorities:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Qp.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:v=>{let P=v.target.value;a({assignees:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(v=>jsxRuntime.jsx("option",{value:v.id,children:v.name},v.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:v=>{let P=v.target.value;a({labels:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),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:em.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:b,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),k&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:v=>k(v.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:tm.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))})}),w&&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:i,onExportGanttPNG:c,onExportGanttCSV:p}){let[s,m]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=k=>{d.current&&!d.current.contains(k.target)&&m(false);};return s&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[s]);let l=u=>{u(),m(false);};return jsxRuntime.jsxs("div",{className:F("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>m(!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:()=>l(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:()=>l(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:()=>l(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>l(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>l(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>l(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:()=>l(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 un={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"}},gn={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"}},Ra={dark:un,light:gn,neutral:fn},Kr="dark";var Yr=react.createContext(void 0),pm="asakaa-theme";function Ni({children:e,defaultTheme:t=Kr,storageKey:a=pm}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),n=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=Ra[r];Object.entries(p.colors).forEach(([m,d])=>{d&&c.style.setProperty(`--theme-${mm(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let l=p.colors[m];l&&c.style.setProperty(d,l);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let i={theme:r,setTheme:n,themes:Ra};return jsxRuntime.jsx(Yr.Provider,{value:i,children:e})}function Qa(){let e=react.useContext(Yr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function hn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Qa();return e?jsxRuntime.jsxs("div",{className:F("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ra).map(([n,i])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:F("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:i.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:i.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 De={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 Di(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return De[e]||De.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,i)=>a.getPropertyValue(n).trim()||i;return {bgPrimary:r("--theme-bg-primary",De[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",De[e].bgSecondary),bgGrid:r("--theme-bg-card",De[e].bgGrid),bgWeekend:r("--theme-bg-hover",De[e].bgWeekend),border:r("--theme-border-primary",De[e].border),borderLight:r("--theme-border-subtle",De[e].borderLight),textPrimary:r("--theme-text-primary",De[e].textPrimary),textSecondary:r("--theme-text-secondary",De[e].textSecondary),textTertiary:r("--theme-text-tertiary",De[e].textTertiary),accent:r("--theme-accent-primary",De[e].accent),accentHover:r("--theme-accent-hover",De[e].accentHover),accentLight:r("--theme-accent-primary",De[e].accentLight),taskBarPrimary:r("--theme-accent-primary",De[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",De[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",De[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",De[e].dependency),dependencyHover:r("--theme-border-secondary",De[e].dependencyHover),criticalPath:r("--theme-error",De[e].criticalPath),criticalPathLight:r("--theme-error",De[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",De[e].today):e==="neutral"?r("--theme-text-primary",De[e].today):r("--theme-error",De[e].today),todayLight:e==="light"?r("--theme-accent-primary",De[e].todayLight):e==="neutral"?r("--theme-text-primary",De[e].todayLight):r("--theme-error",De[e].todayLight),milestone:r("--theme-warning",De[e].milestone),milestoneLight:r("--theme-warning",De[e].milestoneLight),statusTodo:r("--theme-text-tertiary",De[e].statusTodo),statusInProgress:r("--theme-accent-primary",De[e].statusInProgress),statusCompleted:r("--theme-success",De[e].statusCompleted),hoverBg:r("--theme-bg-hover",De[e].hoverBg),focusRing:r("--theme-accent-primary",De[e].focusRing)}}var Xr={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},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"}},Si={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},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:Xr,es:Si};function Ei(e){return bn[e]||bn.en}function vn(e,t){let a=Ei(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 tr=react.createContext(Xr);function vr(){return react.useContext(tr)}function Pm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:i}){let[c,p]=react.useState(false),[s,m]=react.useState(null),d=react.useRef(null),l=vr();if(react.useEffect(()=>{let x=f=>{d.current&&!d.current.contains(f.target)&&p(false);};return c&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),!(t||a||r||o||n||i))return null;let k=[{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:i}].filter(x=>x.handler),y=async(x,f)=>{if(f){m(x);try{await f();}catch(h){console.error(`Export ${x} failed:`,h);}finally{m(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:k.map((x,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>y(x.id,x.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:f<k.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.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===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 Mm({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 i=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:i?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500,zIndex:i?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[i&&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:i?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function Im({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 Lm({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=vr();react.useEffect(()=>{let s=m=>{n.current&&!n.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[r]);let c=[{value:"compact",label:i.toolbar.compact||"Compact"},{value:"comfortable",label:i.toolbar.normal||"Normal"},{value:"spacious",label:i.toolbar.spacious||"Spacious"}],p=c.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:`${i.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((s,m)=>{let d=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:d?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:s.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function qr({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:i,rowDensity:c,onRowDensityChange:p,showThemeSelector:s=true,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:l,onExportPNG:u,onExportPDF:k,onExportExcel:y,onExportCSV:x,onExportJSON:f,onExportMSProject:h}){let g=vr(),b=u||k||y||x||f||h,w=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],v=[{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(Im,{options:w,value:t,onChange:P=>a(P),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Lm,{theme:e,value:c,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[m&&l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:l,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||g.toolbar.createTask})]}),(b||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pm,{theme:e,onExportPNG:u,onExportPDF:k,onExportExcel:y,onExportCSV:x,onExportJSON:f,onExportMSProject:h}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(Mm,{options:v,value:n,onChange:P=>i(P),theme:e})]})]})}function Jr({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,i]=react.useState({x:0,y:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let m=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let s=e.filter(m=>m.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();i({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${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(m=>jsxRuntime.jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:m.label}),m.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function ar({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let i=react.useRef(null);return react.useEffect(()=>{if(!e)return;let c=s=>{i.current&&!i.current.contains(s.target)&&o();},p=s=>{s.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p);}},[e,o]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg shadow-xl",style:{left:`${t}px`,top:`${a}px`,backgroundColor:n.bgSecondary,border:`1px solid ${n.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:p=>{c.disabled||(p.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},c.id))})})}):null}var ft={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 Gi({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:i,onTaskIndent:c,onTaskOutdent:p,onTaskRename:s,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:l=true}){let u=react.useRef(false),k=react.useCallback(g=>{u.current=g;},[]),y=react.useCallback(g=>{let b=[],w=v=>{for(let P of v)b.push(P),P.subtasks&&P.subtasks.length>0&&P.isExpanded&&w(P.subtasks);};return w(g),b},[]),x=react.useCallback(()=>{let g=y(e);for(let b of g)if(t.has(b.id))return b;return null},[e,t,y]),f=react.useCallback((g,b)=>{let w=y(e);if(w.length===0)return;let v=x();if(!v){a(w[0].id,false);return}let P=w.findIndex(T=>T.id===v.id);if(P===-1)return;let C=g==="up"?P-1:P+1;if(C<0||C>=w.length)return;let E=w[C];a(E.id,b);},[e,x,y,a]),h=react.useCallback(g=>{if(!l)return;let b=g.target;if(b.tagName==="INPUT"||b.tagName==="TEXTAREA"||b.isContentEditable||u.current){g.key==="Escape"&&(b.blur(),u.current=false);return}let P=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),E=x();if(g.key==="ArrowUp"){g.preventDefault(),f("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),f("down",g.shiftKey);return}if(E&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!E.isExpanded||g.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),i(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!P){E&&(g.preventDefault(),r(E.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!P){E&&(g.preventDefault(),r(E.id,"above"));return}if(g.key==="Enter"&&P){E&&(g.preventDefault(),d(E.id));return}if(g.key==="F2"){E&&(g.preventDefault(),s(E.id));return}if(g.key==="Delete"||g.key==="Backspace"&&P){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&P&&!g.shiftKey){C.length>0&&(g.preventDefault(),n(C));return}},[l,t,x,f,r,o,n,i,c,p,s,m,d]);return react.useEffect(()=>{if(l)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[l,h]),{setIsEditing:k}}function Wi(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),n=react.useCallback(d=>{t(l=>{let u=new Set(l);return u.has(d)?u.delete(d):u.add(d),u}),r(d);},[]),i=react.useCallback((d,l)=>{if(!a){o(d);return}let u=l.indexOf(a),k=l.indexOf(d);if(u===-1||k===-1){o(d);return}let y=Math.min(u,k),x=Math.max(u,k),f=l.slice(y,x+1);t(new Set(f)),r(d);},[a,o]),c=react.useCallback((d,l,u,k)=>{k?i(d,l):u?n(d):o(d);},[o,n,i]),p=react.useCallback((d,l)=>{l?t(u=>{let k=new Set(u);return k.add(d),k}):o(d);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),m=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:s,isTaskSelected:m}}function rr(e){let t=[],a=(r,o,n=0)=>{for(let i=0;i<r.length;i++){let c={...r[i],parentId:o,level:n,position:i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function kn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=kn(a.subtasks,t);if(r)return r}return null}function wn(e,t){if(t.length===0)return e;let a=rr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let n=a[o-1],i=(d,l)=>{let u=[];return {tasks:d.filter(y=>{if(l.has(y.id))return u.push(y),false;if(y.subtasks){let x=i(y.subtasks,l);y.subtasks=x.tasks,u.push(...x.removed);}return true}),removed:u}},c=(d,l,u)=>d.map(k=>k.id===l?{...k,subtasks:[...k.subtasks||[],...u],isExpanded:true}:k.subtasks?{...k,subtasks:c(k.subtasks,l,u)}:k),p=new Set(t),{tasks:s,removed:m}=i(e,p);return c(s,n.id,m)}function Cn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=kn(a,r);if(!o)continue;let n=kn(a,o.id),i=(s,m,d)=>{for(let l=0;l<s.length;l++){let u=s[l];if(u.id===m&&u.subtasks){let k=u.subtasks.findIndex(y=>y.id===d);if(k!==-1){let[y]=u.subtasks.splice(k,1);return y}}if(u.subtasks){let k=i(u.subtasks,m,d);if(k)return k}}return null},c=(s,m,d)=>{let l=s.findIndex(u=>u.id===m);if(l!==-1)return s.splice(l+1,0,d),s;for(let u of s)u.subtasks&&c(u.subtasks,m,d);return s},p=i(a,o.id,r);p&&(n&&n.subtasks?c(n.subtasks,o.id,p):c(a,o.id,p));}return a}function Tn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(i,c,p)=>{let s=i.findIndex(d=>d.id===c);if(s===-1){for(let d of i)if(d.subtasks&&n(d.subtasks,c,p))return true;return false}let m=p==="up"?s-1:s+1;return m<0||m>=i.length?false:([i[s],i[m]]=[i[m],i[s]],true)};return n(r,o,a),r}function Zr(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 Nn(e,t){let a=[...e];for(let r of t){let o=i=>{let c=i.findIndex(m=>m.id===r);if(c===-1){for(let m of i)if(m.subtasks&&o(m.subtasks))return true;return false}let p=i[c],s={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?n(p.subtasks):void 0};return i.splice(c+1,0,s),true},n=i=>i.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function Hi(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},c=p=>{let s=p.findIndex(d=>d.id===t);if(s===-1){for(let d of p)if(d.subtasks&&c(d.subtasks))return true;return false}let m=a==="above"?s:s+1;return p.splice(m,0,i),true};return c(r),{tasks:r,newTask:i}}function Dn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Dn(r.subtasks,t,a)}:r)}function Sn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Sn(a.subtasks,t)}:a)}function En(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let l=a(d.subtasks);if(l)return l}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i=r?.startDate||o,c=r?.endDate||n,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(i),endDate:new Date(c),color:r?.color||"#3B82F6"},s=m=>m.map(d=>{if(d.id===t){let l=d.subtasks||[];return {...d,subtasks:[...l,p],isExpanded:true}}return d.subtasks?{...d,subtasks:s(d.subtasks)}:d});return {tasks:s(e),newTask:p}}var ji={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"}},Ki=({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 Yi({status:e="todo",onChange:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState({top:0,left:0}),c=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(r&&p.current){let l=p.current.getBoundingClientRect();i({top:l.bottom+window.scrollY+8,left:l.left+window.scrollX});}},[r]),react.useEffect(()=>{let l=u=>{c.current&&!c.current.contains(u.target)&&!p.current?.contains(u.target)&&o(false);};if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]),react.useEffect(()=>{let l=u=>{u.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r]);let s=l=>{t(l),o(false);},m=ji[e],d=m.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,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:m.label,children:jsxRuntime.jsx(Ki,{icon:m.icon,color:d})}),r&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${n.top}px`,left:`${n.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(ji).map(([l,u])=>jsxRuntime.jsxs("button",{onClick:()=>s(l),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:u.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(Ki,{icon:u.icon,color:u.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:u.label}),e===l&&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"})})]},l))})]})})]})}function Qr({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:i,onTaskContextMenu:c,onTaskToggle:p,scrollTop:s,columns:m,onToggleColumn:d,onColumnResize:l,onTaskUpdate:u,onTaskIndent:k,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:g,onTaskRename:b,onCreateSubtask:w,onOpenTaskModal:v}){let P=react.useContext(tr),[C,E]=react.useState(null),[T,U]=react.useState(false),[O,I]=react.useState(null),[$,S]=react.useState(""),z=react.useRef(null),Y=react.useRef(null),[ee,R]=react.useState(null),[J,G]=react.useState(0),[se,N]=react.useState(0),[Z,te]=react.useState({isOpen:false,x:0,y:0,type:"header"});react.useEffect(()=>{function V(H){z.current&&!z.current.contains(H.target)&&U(false);}if(T)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[T]),react.useEffect(()=>{O&&Y.current&&(Y.current.focus(),Y.current.select());},[O]),react.useEffect(()=>{if(!ee)return;let V=Te=>{let Ke=Te.clientX-J,oe=se+Ke;l?.(ee,oe);},H=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,J,se,l]);let{selectedTaskIds:Be,handleTaskClick:$e,isTaskSelected:Ft}=Wi(),{setIsEditing:we}=Gi({tasks:e,selectedTaskIds:Be,onTaskSelect:(V,H)=>{let Ke=rr(e).map(oe=>oe.id);$e(V,Ke,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:k||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:V=>{let H=rr(e).find(Te=>Te.id===V);H&&ya(H);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:V=>{let H=rr(e).find(Te=>Te.id===V);H&&v&&v(H);},enableKeyboard:true}),pt=(V,H=0)=>{let Te=[];for(let Ke of V)Te.push({task:Ke,level:H}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&Te.push(...pt(Ke.subtasks,H+1));return Te},je=pt(e),Ut=48,Pa=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,ya=V=>{I(V.id),S(V.name),we(true);},ue=V=>{$.trim()&&$!==e.find(H=>H.id===V)?.name&&b?.(V,$.trim()),I(null),S(""),we(false);},tt=()=>{I(null),S(""),we(false);},Gt=(V,H)=>{H.stopPropagation(),w?.(V.id);},$t=(V,H,Te)=>{switch(V.id){case "name":let Ke=O===H.id,oe=C===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Te*20}px`},children:[H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),p?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),Ke?jsxRuntime.jsx("input",{ref:Y,type:"text",value:$,onChange:ge=>S(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"?ue(H.id):ge.key==="Escape"&&tt();},onBlur:()=>ue(H.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:ge=>ge.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Te===0?"14px":Te===1?"13px":"12px",fontWeight:H.isMilestone?600:H.subtasks&&H.subtasks.length>0?500:400,opacity:Te===0?1:Te===1?.95:.88},title:H.name,children:H.name}),oe&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ge=>ge.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ge=>Gt(H,ge),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:ge=>{ge.stopPropagation(),ya(H);},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 de=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:ge=>{u?.(H.id,{startDate:ge.target.value?new Date(ge.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 sa=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:sa||"",onChange:ge=>{u?.(H.id,{endDate:ge.target.value?new Date(ge.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:Pa(H)})});case "assignees":let _t=r.filter(ge=>H.assignees?.some(j=>j.name===ge.name||j.initials===ge.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(La,{assignedUsers:_t,availableUsers:r,onChange:ge=>{let j=ge.map(be=>({id:be.id,name:be.name,initials:be.initials,color:be.color}));u?.(H.id,{assignees:j.length>0?j:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Yi,{status:H.status||"todo",onChange:ge=>{u?.(H.id,{status:ge,progress:ge==="completed"?100:H.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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});default:return null}},ma=V=>[{id:"hide",label:"Hide Column",icon:ft.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ft.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ft.SortDesc,onClick:()=>{}}],ie=V=>[{id:"edit",label:P?.contextMenu?.editTask||"Edit Task",icon:ft.Pencil,onClick:()=>{i?.(V);}},{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:ft.Add,onClick:()=>{w?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:P?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ft.MarkIncomplete,onClick:()=>{u?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:P?.contextMenu?.setInProgress||"Set In Progress",icon:ft.SetInProgress,onClick:()=>{u?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:P?.contextMenu?.markComplete||"Mark Complete",icon:ft.MarkComplete,onClick:()=>{u?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:P?.contextMenu?.splitTask||"Split Task",icon:ft.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:ft.Delete,onClick:()=>{f?.([V.id]);}}],pe=m.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:`${Ut}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[pe.map((V,H)=>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:H<pe.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Te=>{Te.preventDefault(),te({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:V.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.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:ee===V.id?t.accent:"transparent"},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),R(V.id),G(Te.clientX),N(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",children:[jsxRuntime.jsx(Jr,{columns:m,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>U(!T),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"}),T&&jsxRuntime.jsxs("div",{ref:z,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:()=>U(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:je.map(({task:V,level:H},Te)=>{let Ke=Ft(V.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:Te%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>E(V.id),onMouseLeave:()=>E(null),onClick:oe=>{let sa=rr(e).map(j=>j.id),ge=navigator.platform.toUpperCase().indexOf("MAC")>=0?oe.metaKey:oe.ctrlKey;$e(V.id,sa,ge,oe.shiftKey),n?.(V);},onDoubleClick:oe=>{oe.stopPropagation(),i?.(V);},onContextMenu:oe=>{oe.preventDefault(),te({isOpen:true,x:oe.clientX,y:oe.clientY,type:"task",task:V}),c?.(V,oe);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:pe.map((oe,de)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${oe.id==="name"?"justify-start":"justify-center"} ${de<pe.length-1?"border-r":""}`,style:{width:`${oe.width}px`,minWidth:`${oe.width}px`,maxWidth:`${oe.width}px`,borderColor:C===V.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:$t(oe,V,oe.id==="name"?H:0)},`${V.id}-${oe.id}`))},V.id)})}),jsxRuntime.jsx(ar,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?ma(Z.columnId):Z.type==="task"&&Z.task?ie(Z.task):[],onClose:()=>te({...Z,isOpen:false}),theme:t})]})}function qi(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[i,c]=react.useState(e),[p,s]=react.useState(t),[m,d]=react.useState(null),[l,u]=react.useState(null),[k,y]=react.useState(null),[x,f]=react.useState(null),[h,g]=react.useState(0),[b,w]=react.useState(0),[v,P]=react.useState(null),[C,E]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:i,setGhostX:c,ghostWidth:p,setGhostWidth:s,connectionLine:m,setConnectionLine:d,hoveredTaskId:l,setHoveredTaskId:u,activeZone:k,setActiveZone:y,draggedSegmentIndex:x,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:g,segmentDragOffsetX:b,setSegmentDragOffsetX:w,hoveredSegmentIndex:v,setHoveredSegmentIndex:P,isHovered:C,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,S)=>{r("none"),d(null),u(null),c($),s(S),w(0),f(null),g(0);}}}function eo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:i,templates:c,onClick:p,onDoubleClick:s,onContextMenu:m,onDateChange:d,onDependencyCreate:l,allTaskPositions:u=[],onDragMove:k}){let y=qi(t,r),x=react.useRef(null),{dragMode:f,setDragMode:h,dragOffset:g,setDragOffset:b,ghostX:w,setGhostX:v,ghostWidth:P,setGhostWidth:C,connectionLine:E,setConnectionLine:T,hoveredTaskId:U,setHoveredTaskId:O,activeZone:I,setActiveZone:$,draggedSegmentIndex:S,setDraggedSegmentIndex:z,draggedSegmentStartX:Y,setDraggedSegmentStartX:ee,segmentDragOffsetX:R,setSegmentDragOffsetX:J,hoveredSegmentIndex:G,setHoveredSegmentIndex:se,isHovered:N,setIsHovered:Z,isDragging:te,isResizing:Be,isConnecting:$e,resetDragState:Ft}=y,we=32,pt=8,je=e.endDate&&e.endDate<new Date&&e.progress<100,Ut=e.isCriticalPath,Pa=o.name==="neutral"||o.today==="#1C1917",ue=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),tt=r<50,Gt=r<40,$t=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ma=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},ie=j=>Math.round(j/n)*n,pe=j=>{let be=Math.round(j/n),ve=new Date(i);return ve.setDate(ve.getDate()+be),ve},V=(j,be)=>{for(let ve of u){if(ve.id===e.id)continue;let ze=5;if(j>=ve.x-ze&&j<=ve.x+ve.width+ze&&be>=ve.y-ze&&be<=ve.y+ve.height+ze)return ve.id}return null},H=react.useCallback((j,be,ve)=>{j.preventDefault(),j.stopPropagation();let ze=x.current?.ownerSVGElement;if(!ze)return;let He=ze.createSVGPoint();He.x=j.clientX,He.y=j.clientY;let Ae=He.matrixTransform(ze.getScreenCTM()?.inverse()),it=ve!==void 0?ve:t,le=be;if(!le){let Tt=Ae.x-it;j.shiftKey?(le="connect",T({x:t+r,y:a+we/2})):j.ctrlKey||j.metaKey?le="move":j.altKey?le=Tt<r/2?"resize-start":"resize-end":Gt?Tt<r/2?le="move":le="resize-end":tt?Tt<=ue/2?le="resize-start":Tt>=r-ue/2?le="resize-end":le="move":Tt<=ue?le="resize-start":Tt>=r-ue?le="resize-end":le="move";}h(le),Z(false),$(null),le==="move"?b(Ae.x-it):le==="connect"?T({x:t+r,y:a+we/2}):b(0),v(it),C(r);},[t,r,a,we]),Te=react.useCallback(j=>{if(f==="none")return;let be=x.current?.ownerSVGElement;if(!be)return;let ve=be.createSVGPoint();ve.x=j.clientX,ve.y=j.clientY;let ze=ve.matrixTransform(be.getScreenCTM()?.inverse());if(f==="connect"){T({x:ze.x,y:ze.y});let He=V(ze.x,ze.y);O(He);}else if(f==="move"){let He=ze.x-g,Ae=ie(He);v(Ae),C(r);let it=Math.round((Ae-t)/n);if(k?.(e.id,it,true),e.segments&&e.segments.length>0&&S!==null){let le=Ae-Y;J(le);}}else if(f==="resize-start"){let He=ze.x,Ae=ie(He),it=t+r-Ae;it>=n&&(v(Ae),C(it));}else if(f==="resize-end"){let He=ze.x,it=ie(He)-t;it>=n&&C(it);}},[f,t,r,n,g,e,ie,S,Y,V,O,T,v,C,J,k]),Ke=react.useCallback(()=>{if(f!=="none"){if(f==="connect")U&&l&&l(e,U),T(null),O(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),be,ve,ze=true;if(f==="move"){if(be=pe(w),ve=new Date(be.getTime()+j),e.segments&&e.segments.length>0&&S!==null){let He=Math.round(R/n),Ae=e.segments.map((Nt,M)=>{if(M===S){let ae=new Date(Nt.startDate),Ue=new Date(Nt.endDate);return ae.setDate(ae.getDate()+He),Ue.setDate(Ue.getDate()+He),{startDate:ae,endDate:Ue}}return Nt}),it=Ae.flatMap(Nt=>[Nt.startDate,Nt.endDate]),le=new Date(Math.min(...it.map(Nt=>Nt.getTime()))),Tt=new Date(Math.max(...it.map(Nt=>Nt.getTime())));d?.({...e,segments:Ae},le,Tt),Ft(t,r);return}}else f==="resize-start"?(be=pe(w),ve=e.endDate,be>=ve&&(console.warn("Invalid date range: start date must be before end date"),ze=false)):f==="resize-end"?(be=e.startDate,ve=pe(w+P),ve<=be&&(console.warn("Invalid date range: end date must be after start date"),ze=false)):ze=false;ze&&be&&ve&&(ve.getTime()-be.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,be,ve));}k?.(e.id,0,false),Ft(t,r);}},[f,w,P,e,d,U,l,t,r,n,pe,R,S,Ft,k]);react.useEffect(()=>{if(f==="none")return;let j=ve=>{Te(ve);},be=()=>{Ke();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",be),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",be);}},[f,Te,Ke]);let oe=te&&!$e?w:t,de=te&&!$e?P:r,sa=c.taskTooltip(e),_t=typeof sa=="string"?sa:"",ge=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!te&&Z(true),onMouseLeave:()=>{te||(Z(false),$(null));},onClick:()=>!te&&p?.(e),onDoubleClick:j=>{te||(j.stopPropagation(),s?.(e));},onContextMenu:j=>{j.preventDefault(),m?.(e,j);},children:[_t&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:_t}}),N&&!te&&!tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ue,height:we,fill:I==="resize-start"?o.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:j=>H(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ue,y:a,width:r-ue*2,height:we,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:j=>H(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-ue,y:a,width:ue,height:we,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:j=>H(j,"resize-end")})]}),N&&!te&&Gt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:we,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:j=>H(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:j=>H(j,"resize-end")}),N&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),te&&!$e&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:a,width:P,height:we,rx:pt,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:oe,y:a,width:de,height:we,rx:pt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarPrimary,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:te&&!$e?.15:e.parentId?.6:N?.9:.8,scale:N&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>H(j),style:{cursor:te?$e?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de*(e.progress/100),height:we,rx:pt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,be)=>{let ve=(j.startDate.getTime()-i.getTime())/864e5*n,He=(j.endDate.getTime()-i.getTime())/(1e3*60*60*24)*n-ve+n,Ae=te&&f==="move"&&S===be,it=G===be,le=Ae?ve+R:ve;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!te&&se(be),onMouseLeave:()=>!te&&se(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:le,y:a,width:He,height:we,rx:pt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:it?.9:.8,scale:it&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Tt=>{Tt.stopPropagation(),z(be),ee(ve),H(Tt,void 0,ve);},style:{cursor:te?$e?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:le,y:a,width:He*(e.progress/100),height:we,rx:pt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${be}`)}),Pa&&(je||Ut)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ut&&!je&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de,height:we,rx:pt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),je&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de,height:we,rx:pt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),de>60&&!e.segments&&(()=>{let j=c.taskLabel(e),be=typeof j=="string"?j:e.name,ve=be.length>Math.floor(de/8)?`${be.substring(0,Math.floor(de/8))}...`:be;return jsxRuntime.jsx("text",{x:oe+12,y:a+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:ve})})(),de>100&&e.progress>0&&e.progress<100&&!te&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+de-12,y:a+we/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&&de>80&&!te&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+de-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+de-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(N||Be)&&!$e&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:tt?oe-15:oe-10,y:a-5,width:tt?25:20,height:we+10,fill:"transparent",onMouseDown:j=>H(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?oe-8:oe-3,y:a+6,width:tt?8:6,height:tt?we-12:we-16,rx:3,fill:f==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="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:oe+de-10,y:a-5,width:tt?25:20,height:we+10,fill:"transparent",onMouseDown:j=>H(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?oe+de:oe+de-3,y:a+6,width:tt?8:6,height:tt?we-12:we-16,rx:3,fill:f==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:f==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&!te&&!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+we/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(),H(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+we/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),$e&&E&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+we/2,x2:E.x,y2:E.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:E.x,cy:E.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:E.x+15,y:E.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:E.x+10},animate:{opacity:1,x:E.x+15},transition:{duration:.2},children:"Connect"})]}),(N||te)&&!$e&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:de+4,height:we+4,rx:pt+2,fill:"none",stroke:te?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:te?.6:.4,initial:{opacity:0},animate:{opacity:te?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+P,y1:0,x2:w+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&!te&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:oe+de/2-120,y:a-95,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("path",{d:`M ${oe+de/2-6} ${a-13} L ${oe+de/2} ${a-3} L ${oe+de/2+6} ${a-13}`,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:oe+de/2,y:a-73,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:oe+de/2-110,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+de/2-70,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsxRuntime.jsx("text",{x:oe+de/2-110,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+de/2-70,y:a-40,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsxRuntime.jsx("text",{x:oe+de/2+10,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+de/2+65,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ma()}),jsxRuntime.jsx("text",{x:oe+de/2+10,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+de/2+65,y:a-40,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:oe+de/2-110,y:a-25,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+de/2-50,y:a-25,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(j=>j.name).join(", ").substring(0,30),e.assignees.map(j=>j.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:oe+de/2,y:a-18,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Gt?"Left: move \u2022 Right: resize":tt?"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 ao({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[i,c]=react.useState(false),p=a-e,s=r-t,m=e+p/2,d=`M ${e} ${t} C ${m} ${t}, ${m} ${r}, ${a} ${r}`,l=6,u=Math.atan2(s,p),k=a-l*Math.cos(u-Math.PI/6),y=r-l*Math.sin(u-Math.PI/6),x=a-l*Math.cos(u+Math.PI/6),f=r-l*Math.sin(u+Math.PI/6),h=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(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:h,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:i?1:.6,strokeWidth:i?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 ${k} ${y} M ${a} ${r} L ${x} ${f}`,fill:"none",stroke:h,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:i?1:.6,scale:i?1.1:1,strokeWidth:i?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:h,initial:{scale:0},animate:{scale:i?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),i&&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:m,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:m-4,y1:(t+r)/2-4,x2:m+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:m+4,y1:(t+r)/2-4,x2:m-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function oo({task:e,x:t,y:a,theme:r,onClick:o}){let[n,i]=react.useState(false),c=16,p=s=>s.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children: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:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var _={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(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let i=new Set,c=new Set,p=s=>{if(!i.has(s)){i.add(s),c.add(s);let m=r.get(s)||[];for(let d of m){if(!i.has(d)&&p(d))return true;if(c.has(d))return true}}return c.delete(s),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=_.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=_.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=_.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=_.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=_.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=_.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)=>_.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=_.findTaskById(e,t);return !a||!a.dependencies?[]:_.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>_.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>_.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=_.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=>_.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=_.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
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ln({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 c=s=>{t(s),o(false);},m=e.reduce((s,p)=>{let d=p.category||"Other";return s[d]||(s[d]=[]),s[d].push(p),s},{});return jsxRuntime.jsxs("div",{className:F("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:F("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref: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(m).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(d=>jsxRuntime.jsxs("button",{onClick:()=>c(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},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 cn({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[l,c]=react.useState("export"),[m,s]=react.useState("json"),[p,d]=react.useState(null),i=react.useRef(null);if(!t)return null;let g=async()=>{let k=o?.current||void 0,x=await Os(e,m,k);zs(x,m);},y=async k=>{let x=k.target.files?.[0];if(x){try{let b=await $s(x),f=x.name.endsWith(".json")?"json":"csv",u=Gs(b,f);d(u),u.success&&r&&r(u,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:F("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:()=>c("export"),className:F("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:F("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(k=>jsxRuntime.jsxs("button",{onClick:()=>s(k),className:F("p-4 rounded-lg border-2 transition-all text-center",m===k?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick: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:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxRuntime.jsxs("div",{className:F("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:F("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((k,x)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},x))})]})]})]})]})]})}var Qm=["URGENT","HIGH","MEDIUM","LOW"],ep=[{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"}],tp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function mn({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:l,onFilterHighPriority:c,availableUsers:m=[],availableLabels:s=[],availableColumns:p=[],showQuickFilters:d=true,compact:i=false,groupBy:g="none",onGroupByChange:y}){let[k,x]=react.useState(true),b=react.useCallback(v=>{a({search:v.target.value});},[a]),f=react.useCallback(v=>{a({dateFilter:v.target.value});},[a]),u=react.useCallback(v=>{r({by:v.target.value});},[r]),h=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>x(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!k&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),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"}),c&&jsxRuntime.jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:f,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:v=>{let P=v.target.value;a({priorities:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Qm.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:v=>{let P=v.target.value;a({assignees:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(v=>jsxRuntime.jsx("option",{value:v.id,children:v.name},v.id))]})}),s.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:v=>{let P=v.target.value;a({labels:P==="all"?[]:[P]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),s.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]})}),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:ep.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:h,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:g,onChange:v=>y(v.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:tp.map(v=>jsxRuntime.jsx("option",{value:v.value,children:v.label},v.value))})}),C&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function pn({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:l,onExportGanttPNG:c,onExportGanttCSV:m}){let[s,p]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return s&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[s]);let i=g=>{g(),p(false);};return jsxRuntime.jsxs("div",{className:F("relative",r),ref:d,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: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":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:()=>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 n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"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 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("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>i(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 un={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"}},gn={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"}},Ra={dark:un,light:gn,neutral:fn},Kr="dark";var Yr=react.createContext(void 0),mp="asakaa-theme";function Ni({children:e,defaultTheme:t=Kr,storageKey:a=mp}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),n=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=Ra[r];Object.entries(m.colors).forEach(([p,d])=>{d&&c.style.setProperty(`--theme-${pp(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=m.colors[p];i&&c.style.setProperty(d,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:n,themes:Ra};return jsxRuntime.jsx(Yr.Provider,{value:l,children:e})}function er(){let e=react.useContext(Yr);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function pp(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function bn({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=er();return e?jsxRuntime.jsxs("div",{className:F("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ra).map(([n,l])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:F("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 De={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 Di(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return De[e]||De.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,l)=>a.getPropertyValue(n).trim()||l;return {bgPrimary:r("--theme-bg-primary",De[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",De[e].bgSecondary),bgGrid:r("--theme-bg-card",De[e].bgGrid),bgWeekend:r("--theme-bg-hover",De[e].bgWeekend),border:r("--theme-border-primary",De[e].border),borderLight:r("--theme-border-subtle",De[e].borderLight),textPrimary:r("--theme-text-primary",De[e].textPrimary),textSecondary:r("--theme-text-secondary",De[e].textSecondary),textTertiary:r("--theme-text-tertiary",De[e].textTertiary),accent:r("--theme-accent-primary",De[e].accent),accentHover:r("--theme-accent-hover",De[e].accentHover),accentLight:r("--theme-accent-primary",De[e].accentLight),taskBarPrimary:r("--theme-accent-primary",De[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",De[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",De[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",De[e].dependency),dependencyHover:r("--theme-border-secondary",De[e].dependencyHover),criticalPath:r("--theme-error",De[e].criticalPath),criticalPathLight:r("--theme-error",De[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",De[e].today):e==="neutral"?r("--theme-text-primary",De[e].today):r("--theme-error",De[e].today),todayLight:e==="light"?r("--theme-accent-primary",De[e].todayLight):e==="neutral"?r("--theme-text-primary",De[e].todayLight):r("--theme-error",De[e].todayLight),milestone:r("--theme-warning",De[e].milestone),milestoneLight:r("--theme-warning",De[e].milestoneLight),statusTodo:r("--theme-text-tertiary",De[e].statusTodo),statusInProgress:r("--theme-accent-primary",De[e].statusInProgress),statusCompleted:r("--theme-success",De[e].statusCompleted),hoverBg:r("--theme-bg-hover",De[e].hoverBg),focusRing:r("--theme-accent-primary",De[e].focusRing)}}var Xr={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete"},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"}},Si={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado"},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"}},hn={en:Xr,es:Si};function Ei(e){return hn[e]||hn.en}function vn(e,t){let a=Ei(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 ar=react.createContext(Xr);function yr(){return react.useContext(ar)}function Pp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:l}){let[c,m]=react.useState(false),[s,p]=react.useState(null),d=react.useRef(null),i=yr();if(react.useEffect(()=>{let x=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return c&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[c]),!(t||a||r||o||n||l))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(x=>x.handler),k=async(x,b)=>{if(b){p(x);try{await b();}catch(f){console.error(`Export ${x} failed:`,f);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:y.map((x,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>k(x.id,x.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:b<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:s===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 Mp({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 Ip({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 Lp({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),l=yr();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 c=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],m=c.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"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((s,p)=>{let d=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:d?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay: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:s.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},s.value)})})})})]})}function qr({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:l,rowDensity:c,onRowDensityChange:m,showThemeSelector:s=true,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:i,onExportPNG:g,onExportPDF:y,onExportExcel:k,onExportCSV:x,onExportJSON:b,onExportMSProject:f}){let u=yr(),h=g||y||k||x||b||f,C=[{value:"day",label:u.toolbar.day},{value:"week",label:u.toolbar.week},{value:"month",label:u.toolbar.month}],v=[{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(Ip,{options:C,value:t,onChange:P=>a(P),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Lp,{theme:e,value:c,onChange:m})]}),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, #10B981 0%, #059669 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(16, 185, 129, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(16, 185, 129, 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})]}),(h||s)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pp,{theme:e,onExportPNG:g,onExportPDF:y,onExportExcel:k,onExportCSV:x,onExportJSON:b,onExportMSProject:f}),s&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),s&&jsxRuntime.jsx(Mp,{options:v,value:n,onChange:P=>l(P),theme:e})]})]})}function Jr({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,l]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=d=>{c.current&&!c.current.contains(d.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:m,onClick:()=>{if(!r&&m.current){let p=m.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(Ge,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${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: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 rr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let l=react.useRef(null);return react.useEffect(()=>{if(!e)return;let c=s=>{l.current&&!l.current.contains(s.target)&&o();},m=s=>{s.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",m);}},[e,o]),e?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 shadow-xl",style:{left:`${t}px`,top:`${a}px`,backgroundColor:n.bgSecondary,border:`1px solid ${n.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:m=>{c.disabled||(m.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},c.id))})})}):null}var ft={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 Gi({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:l,onTaskIndent:c,onTaskOutdent:m,onTaskRename:s,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:i=true}){let g=react.useRef(false),y=react.useCallback(u=>{g.current=u;},[]),k=react.useCallback(u=>{let h=[],C=v=>{for(let P of v)h.push(P),P.subtasks&&P.subtasks.length>0&&P.isExpanded&&C(P.subtasks);};return C(u),h},[]),x=react.useCallback(()=>{let u=k(e);for(let h of u)if(t.has(h.id))return h;return null},[e,t,k]),b=react.useCallback((u,h)=>{let C=k(e);if(C.length===0)return;let v=x();if(!v){a(C[0].id,false);return}let P=C.findIndex(T=>T.id===v.id);if(P===-1)return;let w=u==="up"?P-1:P+1;if(w<0||w>=C.length)return;let S=C[w];a(S.id,h);},[e,x,k,a]),f=react.useCallback(u=>{if(!i)return;let h=u.target;if(h.tagName==="INPUT"||h.tagName==="TEXTAREA"||h.isContentEditable||g.current){u.key==="Escape"&&(h.blur(),g.current=false);return}let P=navigator.platform.toUpperCase().indexOf("MAC")>=0?u.metaKey:u.ctrlKey,w=Array.from(t),S=x();if(u.key==="ArrowUp"){u.preventDefault(),b("up",u.shiftKey);return}if(u.key==="ArrowDown"){u.preventDefault(),b("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")){w.length>0&&(u.preventDefault(),l(w,u.key==="ArrowUp"?"up":"down"));return}if(u.key==="Tab"&&!u.shiftKey){w.length>0&&(u.preventDefault(),c(w));return}if(u.key==="Tab"&&u.shiftKey){w.length>0&&(u.preventDefault(),m(w));return}if(u.key==="Enter"&&!u.shiftKey&&!P){S&&(u.preventDefault(),r(S.id,"below"));return}if(u.key==="Enter"&&u.shiftKey&&!P){S&&(u.preventDefault(),r(S.id,"above"));return}if(u.key==="Enter"&&P){S&&(u.preventDefault(),d(S.id));return}if(u.key==="F2"){S&&(u.preventDefault(),s(S.id));return}if(u.key==="Delete"||u.key==="Backspace"&&P){w.length>0&&(u.preventDefault(),o(w));return}if(u.key==="d"&&P&&!u.shiftKey){w.length>0&&(u.preventDefault(),n(w));return}},[i,t,x,b,r,o,n,l,c,m,s,p,d]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[i,f]),{setIsEditing:y}}function Wi(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),n=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),y=i.indexOf(d);if(g===-1||y===-1){o(d);return}let k=Math.min(g,y),x=Math.max(g,y),b=i.slice(k,x+1);t(new Set(b)),r(d);},[a,o]),c=react.useCallback((d,i,g,y)=>{y?l(d,i):g?n(d):o(d);},[o,n,l]),m=react.useCallback((d,i)=>{i?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),s=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:s,isTaskSelected:p}}function or(e){let t=[],a=(r,o,n=0)=>{for(let l=0;l<r.length;l++){let c={...r[l],parentId:o,level:n,position:l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,n+1);}};return a(e),t}function kn(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=kn(a.subtasks,t);if(r)return r}return null}function wn(e,t){if(t.length===0)return e;let a=or(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let n=a[o-1],l=(d,i)=>{let g=[];return {tasks:d.filter(k=>{if(i.has(k.id))return g.push(k),false;if(k.subtasks){let x=l(k.subtasks,i);k.subtasks=x.tasks,g.push(...x.removed);}return true}),removed:g}},c=(d,i,g)=>d.map(y=>y.id===i?{...y,subtasks:[...y.subtasks||[],...g],isExpanded:true}:y.subtasks?{...y,subtasks:c(y.subtasks,i,g)}:y),m=new Set(t),{tasks:s,removed:p}=l(e,m);return c(s,n.id,p)}function Cn(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=kn(a,r);if(!o)continue;let n=kn(a,o.id),l=(s,p,d)=>{for(let i=0;i<s.length;i++){let g=s[i];if(g.id===p&&g.subtasks){let y=g.subtasks.findIndex(k=>k.id===d);if(y!==-1){let[k]=g.subtasks.splice(y,1);return k}}if(g.subtasks){let y=l(g.subtasks,p,d);if(y)return y}}return null},c=(s,p,d)=>{let i=s.findIndex(g=>g.id===p);if(i!==-1)return s.splice(i+1,0,d),s;for(let g of s)g.subtasks&&c(g.subtasks,p,d);return s},m=l(a,o.id,r);m&&(n&&n.subtasks?c(n.subtasks,o.id,m):c(a,o.id,m));}return a}function Tn(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(l,c,m)=>{let s=l.findIndex(d=>d.id===c);if(s===-1){for(let d of l)if(d.subtasks&&n(d.subtasks,c,m))return true;return false}let p=m==="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 Zr(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 Nn(e,t){let a=[...e];for(let r of t){let o=l=>{let c=l.findIndex(p=>p.id===r);if(c===-1){for(let p of l)if(p.subtasks&&o(p.subtasks))return true;return false}let m=l[c],s={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?n(m.subtasks):void 0};return l.splice(c+1,0,s),true},n=l=>l.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?n(c.subtasks):void 0}));o(a);}return a}function Hi(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"},c=m=>{let s=m.findIndex(d=>d.id===t);if(s===-1){for(let d of m)if(d.subtasks&&c(d.subtasks))return true;return false}let p=a==="above"?s:s+1;return m.splice(p,0,l),true};return c(r),{tasks:r,newTask:l}}function Dn(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Dn(r.subtasks,t,a)}:r)}function Sn(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Sn(a.subtasks,t)}:a)}function En(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,n=new Date(o);n.setDate(n.getDate()+7);let l=r?.startDate||o,c=r?.endDate||n,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(c),color:r?.color||"#3B82F6"},s=p=>p.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,m],isExpanded:true}}return d.subtasks?{...d,subtasks:s(d.subtasks)}:d});return {tasks:s(e),newTask:m}}var ji={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"}},Ki=({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 Yi({status:e="todo",onChange:t,className:a}){let[r,o]=react.useState(false),[n,l]=react.useState({top:0,left:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(r&&m.current){let i=m.current.getBoundingClientRect();l({top:i.bottom+window.scrollY+8,left:i.left+window.scrollX});}},[r]),react.useEffect(()=>{let i=g=>{c.current&&!c.current.contains(g.target)&&!m.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 s=i=>{t(i),o(false);},p=ji[e],d=p.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,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(Ki,{icon:p.icon,color:d})}),r&&jsxRuntime.jsx(Ge,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"absolute",top:`${n.top}px`,left:`${n.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(ji).map(([i,g])=>jsxRuntime.jsxs("button",{onClick:()=>s(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ki,{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 Qr({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:l,onTaskContextMenu:c,onTaskToggle:m,scrollTop:s,columns:p,onToggleColumn:d,onColumnResize:i,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:k,onTaskMove:x,onMultiTaskDelete:b,onTaskDuplicate:f,onTaskCreate:u,onTaskRename:h,onCreateSubtask:C,onOpenTaskModal:v}){let P=react.useContext(ar),[w,S]=react.useState(null),[T,O]=react.useState(false),[z,I]=react.useState(null),[$,E]=react.useState(""),U=react.useRef(null),Y=react.useRef(null),[ee,R]=react.useState(null),[J,G]=react.useState(0),[se,N]=react.useState(0),[Z,te]=react.useState({isOpen:false,x:0,y:0,type:"header"});react.useEffect(()=>{function V(H){U.current&&!U.current.contains(H.target)&&O(false);}if(T)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[T]),react.useEffect(()=>{z&&Y.current&&(Y.current.focus(),Y.current.select());},[z]),react.useEffect(()=>{if(!ee)return;let V=Te=>{let Ke=Te.clientX-J,oe=se+Ke;i?.(ee,oe);},H=()=>{R(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,J,se,i]);let{selectedTaskIds:Be,handleTaskClick:$e,isTaskSelected:Ft}=Wi(),{setIsEditing:we}=Gi({tasks:e,selectedTaskIds:Be,onTaskSelect:(V,H)=>{let Ke=or(e).map(oe=>oe.id);$e(V,Ke,H||false,false);},onTaskCreate:u||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:f||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:V=>{let H=or(e).find(Te=>Te.id===V);H&&ya(H);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:V=>{let H=or(e).find(Te=>Te.id===V);H&&v&&v(H);},enableKeyboard:true}),mt=(V,H=0)=>{let Te=[];for(let Ke of V)Te.push({task:Ke,level:H}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&Te.push(...mt(Ke.subtasks,H+1));return Te},je=mt(e),Ut=48,Pa=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,ya=V=>{I(V.id),E(V.name),we(true);},ue=V=>{$.trim()&&$!==e.find(H=>H.id===V)?.name&&h?.(V,$.trim()),I(null),E(""),we(false);},tt=()=>{I(null),E(""),we(false);},Gt=(V,H)=>{H.stopPropagation(),C?.(V.id);},$t=(V,H,Te)=>{switch(V.id){case "name":let Ke=z===H.id,oe=w===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Te*20}px`},children:[H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),m?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),Ke?jsxRuntime.jsx("input",{ref:Y,type:"text",value:$,onChange:ge=>E(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"?ue(H.id):ge.key==="Escape"&&tt();},onBlur:()=>ue(H.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:ge=>ge.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Te===0?"14px":Te===1?"13px":"12px",fontWeight:H.isMilestone?600:H.subtasks&&H.subtasks.length>0?500:400,opacity:Te===0?1:Te===1?.95:.88},title:H.name,children:H.name}),oe&&!Ke&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ge=>ge.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ge=>Gt(H,ge),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:ge=>{ge.stopPropagation(),ya(H);},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 de=H.startDate?typeof H.startDate=="string"?H.startDate:H.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:ge=>{g?.(H.id,{startDate:ge.target.value?new Date(ge.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 sa=H.endDate?typeof H.endDate=="string"?H.endDate:H.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:sa||"",onChange:ge=>{g?.(H.id,{endDate:ge.target.value?new Date(ge.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:Pa(H)})});case "assignees":let _t=r.filter(ge=>H.assignees?.some(j=>j.name===ge.name||j.initials===ge.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(La,{assignedUsers:_t,availableUsers:r,onChange:ge=>{let j=ge.map(he=>({id:he.id,name:he.name,initials:he.initials,color:he.color}));g?.(H.id,{assignees:j.length>0?j:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Yi,{status:H.status||"todo",onChange:ge=>{g?.(H.id,{status:ge,progress:ge==="completed"?100:H.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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});default:return null}},pa=V=>[{id:"hide",label:"Hide Column",icon:ft.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ft.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ft.SortDesc,onClick:()=>{}}],ie=V=>[{id:"edit",label:P?.contextMenu?.editTask||"Edit Task",icon:ft.Pencil,onClick:()=>{l?.(V);}},{id:"addSubtask",label:P?.contextMenu?.addSubtask||"Add Subtask",icon:ft.Add,onClick:()=>{C?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:P?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ft.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:P?.contextMenu?.setInProgress||"Set In Progress",icon:ft.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:P?.contextMenu?.markComplete||"Mark Complete",icon:ft.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:P?.contextMenu?.splitTask||"Split Task",icon:ft.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:P?.contextMenu?.deleteTask||"Delete Task",icon:ft.Delete,onClick:()=>{b?.([V.id]);}}],me=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:`${Ut}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[me.map((V,H)=>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:H<me.length-1?`1px solid ${t.borderLight}`:"none",height:"100%",boxSizing:"border-box"},onContextMenu:Te=>{Te.preventDefault(),te({isOpen:true,x:Te.clientX,y:Te.clientY,type:"header",columnId:V.id});},onMouseEnter:Te=>{Te.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Te=>{Te.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:ee===V.id?t.accent:"transparent"},onMouseDown:Te=>{Te.preventDefault(),Te.stopPropagation(),R(V.id),G(Te.clientX),N(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",children:[jsxRuntime.jsx(Jr,{columns:p,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>O(!T),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"}),T&&jsxRuntime.jsxs("div",{ref:U,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:()=>O(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:je.map(({task:V,level:H},Te)=>{let Ke=Ft(V.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center cursor-pointer group",style:{height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:Te%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>S(V.id),onMouseLeave:()=>S(null),onClick:oe=>{let sa=or(e).map(j=>j.id),ge=navigator.platform.toUpperCase().indexOf("MAC")>=0?oe.metaKey:oe.ctrlKey;$e(V.id,sa,ge,oe.shiftKey),n?.(V);},onDoubleClick:oe=>{oe.stopPropagation(),l?.(V);},onContextMenu:oe=>{oe.preventDefault(),te({isOpen:true,x:oe.clientX,y:oe.clientY,type:"task",task:V}),c?.(V,oe);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:me.map((oe,de)=>jsxRuntime.jsx("div",{className:`px-4 flex items-center ${oe.id==="name"?"justify-start":"justify-center"} ${de<me.length-1?"border-r":""}`,style:{width:`${oe.width}px`,minWidth:`${oe.width}px`,maxWidth:`${oe.width}px`,borderColor:w===V.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:$t(oe,V,oe.id==="name"?H:0)},`${V.id}-${oe.id}`))},V.id)})}),jsxRuntime.jsx(rr,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?pa(Z.columnId):Z.type==="task"&&Z.task?ie(Z.task):[],onClose:()=>te({...Z,isOpen:false}),theme:t})]})}function qi(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[l,c]=react.useState(e),[m,s]=react.useState(t),[p,d]=react.useState(null),[i,g]=react.useState(null),[y,k]=react.useState(null),[x,b]=react.useState(null),[f,u]=react.useState(0),[h,C]=react.useState(0),[v,P]=react.useState(null),[w,S]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:l,setGhostX:c,ghostWidth:m,setGhostWidth:s,connectionLine:p,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:g,activeZone:y,setActiveZone:k,draggedSegmentIndex:x,setDraggedSegmentIndex:b,draggedSegmentStartX:f,setDraggedSegmentStartX:u,segmentDragOffsetX:h,setSegmentDragOffsetX:C,hoveredSegmentIndex:v,setHoveredSegmentIndex:P,isHovered:w,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,E)=>{r("none"),d(null),g(null),c($),s(E),C(0),b(null),u(0);}}}function eo({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:l,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:d,onDependencyCreate:i,allTaskPositions:g=[],onDragMove:y}){let k=qi(t,r),x=react.useRef(null),{dragMode:b,setDragMode:f,dragOffset:u,setDragOffset:h,ghostX:C,setGhostX:v,ghostWidth:P,setGhostWidth:w,connectionLine:S,setConnectionLine:T,hoveredTaskId:O,setHoveredTaskId:z,activeZone:I,setActiveZone:$,draggedSegmentIndex:E,setDraggedSegmentIndex:U,draggedSegmentStartX:Y,setDraggedSegmentStartX:ee,segmentDragOffsetX:R,setSegmentDragOffsetX:J,hoveredSegmentIndex:G,setHoveredSegmentIndex:se,isHovered:N,setIsHovered:Z,isDragging:te,isResizing:Be,isConnecting:$e,resetDragState:Ft}=k,we=32,mt=8,je=e.endDate&&e.endDate<new Date&&e.progress<100,Ut=e.isCriticalPath,Pa=o.name==="neutral"||o.today==="#1C1917",ue=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),tt=r<50,Gt=r<40,$t=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),pa=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},ie=j=>Math.round(j/n)*n,me=j=>{let he=Math.round(j/n),ve=new Date(l);return ve.setDate(ve.getDate()+he),ve},V=(j,he)=>{for(let ve of g){if(ve.id===e.id)continue;let ze=5;if(j>=ve.x-ze&&j<=ve.x+ve.width+ze&&he>=ve.y-ze&&he<=ve.y+ve.height+ze)return ve.id}return null},H=react.useCallback((j,he,ve)=>{j.preventDefault(),j.stopPropagation();let ze=x.current?.ownerSVGElement;if(!ze)return;let He=ze.createSVGPoint();He.x=j.clientX,He.y=j.clientY;let Ae=He.matrixTransform(ze.getScreenCTM()?.inverse()),it=ve!==void 0?ve:t,le=he;if(!le){let Tt=Ae.x-it;j.shiftKey?(le="connect",T({x:t+r,y:a+we/2})):j.ctrlKey||j.metaKey?le="move":j.altKey?le=Tt<r/2?"resize-start":"resize-end":Gt?Tt<r/2?le="move":le="resize-end":tt?Tt<=ue/2?le="resize-start":Tt>=r-ue/2?le="resize-end":le="move":Tt<=ue?le="resize-start":Tt>=r-ue?le="resize-end":le="move";}f(le),Z(false),$(null),le==="move"?h(Ae.x-it):le==="connect"?T({x:t+r,y:a+we/2}):h(0),v(it),w(r);},[t,r,a,we]),Te=react.useCallback(j=>{if(b==="none")return;let he=x.current?.ownerSVGElement;if(!he)return;let ve=he.createSVGPoint();ve.x=j.clientX,ve.y=j.clientY;let ze=ve.matrixTransform(he.getScreenCTM()?.inverse());if(b==="connect"){T({x:ze.x,y:ze.y});let He=V(ze.x,ze.y);z(He);}else if(b==="move"){let He=ze.x-u,Ae=ie(He);v(Ae),w(r);let it=Math.round((Ae-t)/n);if(y?.(e.id,it,true),e.segments&&e.segments.length>0&&E!==null){let le=Ae-Y;J(le);}}else if(b==="resize-start"){let He=ze.x,Ae=ie(He),it=t+r-Ae;it>=n&&(v(Ae),w(it));}else if(b==="resize-end"){let He=ze.x,it=ie(He)-t;it>=n&&w(it);}},[b,t,r,n,u,e,ie,E,Y,V,z,T,v,w,J,y]),Ke=react.useCallback(()=>{if(b!=="none"){if(b==="connect")O&&i&&i(e,O),T(null),z(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),he,ve,ze=true;if(b==="move"){if(he=me(C),ve=new Date(he.getTime()+j),e.segments&&e.segments.length>0&&E!==null){let He=Math.round(R/n),Ae=e.segments.map((Nt,M)=>{if(M===E){let ae=new Date(Nt.startDate),Ue=new Date(Nt.endDate);return ae.setDate(ae.getDate()+He),Ue.setDate(Ue.getDate()+He),{startDate:ae,endDate:Ue}}return Nt}),it=Ae.flatMap(Nt=>[Nt.startDate,Nt.endDate]),le=new Date(Math.min(...it.map(Nt=>Nt.getTime()))),Tt=new Date(Math.max(...it.map(Nt=>Nt.getTime())));d?.({...e,segments:Ae},le,Tt),Ft(t,r);return}}else b==="resize-start"?(he=me(C),ve=e.endDate,he>=ve&&(console.warn("Invalid date range: start date must be before end date"),ze=false)):b==="resize-end"?(he=e.startDate,ve=me(C+P),ve<=he&&(console.warn("Invalid date range: end date must be after start date"),ze=false)):ze=false;ze&&he&&ve&&(ve.getTime()-he.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,he,ve));}y?.(e.id,0,false),Ft(t,r);}},[b,C,P,e,d,O,i,t,r,n,me,R,E,Ft,y]);react.useEffect(()=>{if(b==="none")return;let j=ve=>{Te(ve);},he=()=>{Ke();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",he);}},[b,Te,Ke]);let oe=te&&!$e?C:t,de=te&&!$e?P:r,sa=c.taskTooltip(e),_t=typeof sa=="string"?sa:"",ge=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!te&&Z(true),onMouseLeave:()=>{te||(Z(false),$(null));},onClick:()=>!te&&m?.(e),onDoubleClick:j=>{te||(j.stopPropagation(),s?.(e));},onContextMenu:j=>{j.preventDefault(),p?.(e,j);},children:[_t&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:_t}}),N&&!te&&!tt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ue,height:we,fill:I==="resize-start"?o.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-start"),onMouseDown:j=>H(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ue,y:a,width:r-ue*2,height:we,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:j=>H(j,"move")}),jsxRuntime.jsx("rect",{x:t+r-ue,y:a,width:ue,height:we,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:j=>H(j,"resize-end")})]}),N&&!te&&Gt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:we,fill:I==="move"?o.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>$("move"),onMouseDown:j=>H(j,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:I==="resize-end"?o.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>$("resize-end"),onMouseDown:j=>H(j,"resize-end")}),N&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),te&&!$e&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:C,y:a,width:P,height:we,rx:mt,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:oe,y:a,width:de,height:we,rx:mt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarPrimary,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:te&&!$e?.15:e.parentId?.6:N?.9:.8,scale:N&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>H(j),style:{cursor:te?$e?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((j,he)=>{let ve=(j.startDate.getTime()-l.getTime())/864e5*n,He=(j.endDate.getTime()-l.getTime())/(1e3*60*60*24)*n-ve+n,Ae=te&&b==="move"&&E===he,it=G===he,le=Ae?ve+R:ve;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!te&&se(he),onMouseLeave:()=>!te&&se(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:le,y:a,width:He,height:we,rx:mt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:it?.9:.8,scale:it&&!te?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Tt=>{Tt.stopPropagation(),U(he),ee(ve),H(Tt,void 0,ve);},style:{cursor:te?$e?"crosshair":Be?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:le,y:a,width:He*(e.progress/100),height:we,rx:mt,fill:e.isCriticalPath||je?"#DC2626":e.color?e.color:o.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),Pa&&(je||Ut)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Ut&&!je&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de,height:we,rx:mt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),je&&jsxRuntime.jsx("rect",{x:oe,y:a,width:de,height:we,rx:mt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),de>60&&!e.segments&&(()=>{let j=c.taskLabel(e),he=typeof j=="string"?j:e.name,ve=he.length>Math.floor(de/8)?`${he.substring(0,Math.floor(de/8))}...`:he;return jsxRuntime.jsx("text",{x:oe+12,y:a+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:ve})})(),de>100&&e.progress>0&&e.progress<100&&!te&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+de-12,y:a+we/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&&de>80&&!te&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+de-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+de-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(N||Be)&&!$e&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:tt?oe-15:oe-10,y:a-5,width:tt?25:20,height:we+10,fill:"transparent",onMouseDown:j=>H(j,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?oe-8:oe-3,y:a+6,width:tt?8:6,height:tt?we-12:we-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:oe+de-10,y:a-5,width:tt?25:20,height:we+10,fill:"transparent",onMouseDown:j=>H(j,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt?oe+de:oe+de-3,y:a+6,width:tt?8:6,height:tt?we-12:we-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&!te&&!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+we/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(),H(j,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+we/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),$e&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+we/2,x2:S.x,y2:S.y,stroke:O?o.statusCompleted:o.accent,strokeWidth:O?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:O?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:S.x,cy:S.y,r:O?8:6,fill:O?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),O&&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"})]}),(N||te)&&!$e&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:de+4,height:we+4,rx:mt+2,fill:"none",stroke:te?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:te?.6:.4,initial:{opacity:0},animate:{opacity:te?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Be&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:C,y1:0,x2:C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:C+P,y1:0,x2:C+P,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&!te&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:oe+de/2-120,y:a-95,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("path",{d:`M ${oe+de/2-6} ${a-13} L ${oe+de/2} ${a-3} L ${oe+de/2+6} ${a-13}`,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:oe+de/2,y:a-73,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:oe+de/2-110,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+de/2-70,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsxRuntime.jsx("text",{x:oe+de/2-110,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+de/2-70,y:a-40,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsxRuntime.jsx("text",{x:oe+de/2+10,y:a-55,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+de/2+65,y:a-55,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pa()}),jsxRuntime.jsx("text",{x:oe+de/2+10,y:a-40,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+de/2+65,y:a-40,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:oe+de/2-110,y:a-25,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+de/2-50,y:a-25,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(j=>j.name).join(", ").substring(0,30),e.assignees.map(j=>j.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:oe+de/2,y:a-18,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Gt?"Left: move \u2022 Right: resize":tt?"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 ao({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n}){let[l,c]=react.useState(false),m=a-e,s=r-t,p=e+m/2,d=`M ${e} ${t} C ${p} ${t}, ${p} ${r}, ${a} ${r}`,i=6,g=Math.atan2(s,m),y=a-i*Math.cos(g-Math.PI/6),k=r-i*Math.sin(g-Math.PI/6),x=a-i*Math.cos(g+Math.PI/6),b=r-i*Math.sin(g+Math.PI/6),f=o.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>c(true),onMouseLeave:()=>c(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 ${y} ${k} M ${a} ${r} L ${x} ${b}`,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&&n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:u=>{u.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 oo({task:e,x:t,y:a,theme:r,onClick:o}){let[n,l]=react.useState(false),c=16,m=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:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children: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:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var _={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,c=new Set,m=s=>{if(!l.has(s)){l.add(s),c.add(s);let p=r.get(s)||[];for(let d of p){if(!l.has(d)&&m(d))return true;if(c.has(d))return true}}return c.delete(s),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=_.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=_.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=_.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=_.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=_.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=_.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)=>_.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=_.findTaskById(e,t);return !a||!a.dependencies?[]:_.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>_.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>_.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=_.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=>_.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=_.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"]],c=n.map(m=>{let s=m.startDate&&m.endDate?_.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?_.formatDate(m.startDate):"N/A",m.endDate?_.formatDate(m.endDate):"N/A",s>0?`${s} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:l,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=_.flattenTasks(e).map(m=>{let s=m.startDate&&m.endDate?_.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?_.formatDate(m.startDate):"","End Date":m.endDate?_.formatDate(m.endDate):"","Duration (days)":s>0?s:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(p=>p.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.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 c=a.utils.book_new();a.utils.book_append_sheet(c,n,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=_.flattenTasks(e),o=new Map;r.forEach((i,g)=>{o.set(i.id,g+1);});let n=i=>i.toISOString().replace("Z",""),l=_.getEarliestStartDate(e)||new Date,c=_.getLatestEndDate(e)||new Date,m=r.map((i,g)=>{let y=o.get(i.id),k=i.startDate&&i.endDate?_.calculateDuration(i.startDate,i.endDate):0,x=(i.dependencies||[]).filter(b=>o.has(b)).map(b=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
|
-
<PredecessorUID>${o.get(
|
|
48
|
+
<PredecessorUID>${o.get(b)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
50
50
|
<CrossProject>0</CrossProject>
|
|
51
51
|
<LinkLag>0</LinkLag>
|
|
52
52
|
<LagFormat>7</LagFormat>
|
|
53
53
|
</PredecessorLink>`).join("");return `
|
|
54
54
|
<Task>
|
|
55
|
-
<UID>${
|
|
56
|
-
<ID>${
|
|
57
|
-
<Name>${
|
|
55
|
+
<UID>${y}</UID>
|
|
56
|
+
<ID>${g+1}</ID>
|
|
57
|
+
<Name>${i.name.replace(/[<>&'"]/g,b=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[b]||b)}</Name>
|
|
58
58
|
<Type>0</Type>
|
|
59
59
|
<IsNull>0</IsNull>
|
|
60
60
|
<CreateDate>${n(new Date)}</CreateDate>
|
|
61
|
-
<WBS>${
|
|
62
|
-
<OutlineNumber>${
|
|
63
|
-
<OutlineLevel>${
|
|
61
|
+
<WBS>${g+1}</WBS>
|
|
62
|
+
<OutlineNumber>${g+1}</OutlineNumber>
|
|
63
|
+
<OutlineLevel>${i.level||0}</OutlineLevel>
|
|
64
64
|
<Priority>500</Priority>
|
|
65
|
-
<Start>${
|
|
66
|
-
<Finish>${
|
|
67
|
-
<Duration>PT${
|
|
65
|
+
<Start>${i.startDate?n(i.startDate):""}</Start>
|
|
66
|
+
<Finish>${i.endDate?n(i.endDate):""}</Finish>
|
|
67
|
+
<Duration>PT${k*8}H0M0S</Duration>
|
|
68
68
|
<DurationFormat>7</DurationFormat>
|
|
69
|
-
<Work>PT${
|
|
70
|
-
<Stop>${
|
|
71
|
-
<Resume>${
|
|
69
|
+
<Work>PT${k*8}H0M0S</Work>
|
|
70
|
+
<Stop>${i.endDate?n(i.endDate):""}</Stop>
|
|
71
|
+
<Resume>${i.startDate?n(i.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>${
|
|
78
|
-
<Summary>${
|
|
79
|
-
<Critical>${
|
|
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>
|
|
80
80
|
<IsSubproject>0</IsSubproject>
|
|
81
81
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
82
82
|
<ExternalTask>0</ExternalTask>
|
|
83
|
-
<EarlyStart>${
|
|
84
|
-
<EarlyFinish>${
|
|
85
|
-
<LateStart>${
|
|
86
|
-
<LateFinish>${
|
|
83
|
+
<EarlyStart>${i.startDate?n(i.startDate):""}</EarlyStart>
|
|
84
|
+
<EarlyFinish>${i.endDate?n(i.endDate):""}</EarlyFinish>
|
|
85
|
+
<LateStart>${i.startDate?n(i.startDate):""}</LateStart>
|
|
86
|
+
<LateFinish>${i.endDate?n(i.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>${
|
|
95
|
-
<PercentWorkComplete>${
|
|
94
|
+
<PercentComplete>${i.progress}</PercentComplete>
|
|
95
|
+
<PercentWorkComplete>${i.progress}</PercentWorkComplete>
|
|
96
96
|
<Cost>0</Cost>
|
|
97
97
|
<OvertimeCost>0</OvertimeCost>
|
|
98
98
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
99
|
-
<ActualStart>${
|
|
100
|
-
<ActualFinish>${
|
|
101
|
-
<ActualDuration>PT${Math.round(
|
|
99
|
+
<ActualStart>${i.progress>0&&i.startDate?n(i.startDate):""}</ActualStart>
|
|
100
|
+
<ActualFinish>${i.progress===100&&i.endDate?n(i.endDate):""}</ActualFinish>
|
|
101
|
+
<ActualDuration>PT${Math.round(k*i.progress/100)*8}H0M0S</ActualDuration>
|
|
102
102
|
<ActualCost>0</ActualCost>
|
|
103
103
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
104
|
-
<ActualWork>PT${Math.round(
|
|
104
|
+
<ActualWork>PT${Math.round(k*i.progress/100)*8}H0M0S</ActualWork>
|
|
105
105
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
106
|
-
<RegularWork>PT${
|
|
107
|
-
<RemainingDuration>PT${Math.round(
|
|
106
|
+
<RegularWork>PT${k*8}H0M0S</RegularWork>
|
|
107
|
+
<RemainingDuration>PT${Math.round(k*(100-i.progress)/100)*8}H0M0S</RemainingDuration>
|
|
108
108
|
<RemainingCost>0</RemainingCost>
|
|
109
|
-
<RemainingWork>PT${Math.round(
|
|
109
|
+
<RemainingWork>PT${Math.round(k*(100-i.progress)/100)*8}H0M0S</RemainingWork>
|
|
110
110
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
111
111
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
112
112
|
<ACWP>0</ACWP>
|
|
@@ -129,12 +129,12 @@
|
|
|
129
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,
|
|
133
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
132
|
+
<Name>${t.replace(/[<>&'"]/g,i=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[i]||i)}</Name>
|
|
133
|
+
<Title>${t.replace(/[<>&'"]/g,i=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[i]||i)}</Title>
|
|
134
134
|
<CreationDate>${n(new Date)}</CreationDate>
|
|
135
135
|
<LastSaved>${n(new Date)}</LastSaved>
|
|
136
136
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
137
|
-
<StartDate>${n(
|
|
137
|
+
<StartDate>${n(l)}</StartDate>
|
|
138
138
|
<FinishDate>${n(c)}</FinishDate>
|
|
139
139
|
<FYStartDate>1</FYStartDate>
|
|
140
140
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
@@ -271,11 +271,11 @@
|
|
|
271
271
|
</WeekDays>
|
|
272
272
|
</Calendar>
|
|
273
273
|
</Calendars>
|
|
274
|
-
<Tasks>${
|
|
274
|
+
<Tasks>${m}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,m=new Blob([s],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=_.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 m=s.startDate&&s.endDate?_.calculateDuration(s.startDate,s.endDate):0,d=0;if(s.dependencies&&s.dependencies.length>0)for(let u of s.dependencies){let k=t.find(y=>y.id===u);if(k){o(k);let y=r.get(u)?.ef||0;d=Math.max(d,y);}}let l=d+m;r.set(s.id,{es:d,ef:l});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),i=new Map,c=s=>{if(i.has(s.id))return;let m=s.startDate&&s.endDate?_.calculateDuration(s.startDate,s.endDate):0,d=t.filter(k=>k.dependencies&&k.dependencies.includes(s.id)),l=n;if(d.length>0)for(let k of d){c(k);let y=i.get(k.id)?.ls||0;l=Math.min(l,y);}let u=l-m;i.set(s.id,{ls:u,lf:l});};a.forEach(c);let p=[];for(let s of a){let m=r.get(s.id),d=i.get(s.id);if(m&&d){let l=d.ls-m.es;Math.abs(l)<.01&&p.push(s.id);}}return p},calculateSlack:(e,t)=>{let a=_.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(_.calculateCriticalPath(e).includes(t))return 0;let o=_.getDependentTasks(e,t);if(o.length===0){let c=_.getLatestEndDate(e);if(!c)return null;let p=_.calculateDuration(a.endDate,c);return Math.max(0,p)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!n)return null;let i=_.calculateDuration(a.endDate,new Date(n));return Math.max(0,i)},isOnCriticalPath:(e,t)=>_.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=_.findTaskById(e,t);if(!r||!r.endDate)return e;let o=_.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let i of o){if(!i.startDate||!i.endDate)continue;let c=_.calculateDuration(i.startDate,i.endDate),p;a!==void 0?(p=new Date(i.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let s=_.calculateEndDate(p,c),m=d=>d.map(l=>l.id===i.id?{...l,startDate:p,endDate:s}:l.subtasks?{...l,subtasks:m(l.subtasks)}:l);n=m(n),n=_.autoScheduleDependents(n,i.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,i,c)=>{if(a===0)return [];let p=[],s=o.getTime(),m=1e3*60*60*24,d=_.findTaskById(e,t);if(!d||!d.endDate)return [];let l=(u,k,y=new Set)=>{if(y.has(u))return;y.add(u);let x=_.getDependentTasks(e,u);for(let f of x){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(U=>U.id===f.id);if(h===-1)continue;let g=f.startDate.getTime(),w=(f.endDate.getTime()-g)/m,P=(g-s)/m*n,C=P+k*n,E=Math.max(w*n,n),T=c+h*i+12;p.push({taskId:f.id,taskName:f.name,originalX:P,previewX:C,width:E,y:T,rowIndex:h,daysDelta:k,color:f.color}),l(f.id,k,y);}};return l(t,a),p},splitTask:(e,t,a,r=3)=>{let o=_.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 i=new Date(a);i.setDate(i.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:n},{startDate:i,endDate:c}],s=m=>m.map(d=>d.id===o.id?{...d,endDate:c,segments:p}:d.subtasks?{...d,subtasks:s(d.subtasks)}:d);return s(e)}};function io({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:i,templates:c,onTaskClick:p,onTaskDblClick:s,onTaskContextMenu:m,onTaskDateChange:d,onDependencyCreate:l,onDependencyDelete:u}){let[y,x]=react.useState([]),f=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),h=r==="day"?60:r==="week"?20:8,g=f*h*i,b=S=>{let z=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),Y=z.getUTCDay()||7;z.setUTCDate(z.getUTCDate()+4-Y);let ee=new Date(Date.UTC(z.getUTCFullYear(),0,1));return Math.ceil(((z.getTime()-ee.getTime())/864e5+1)/7)},w=S=>{let z=S.getDay();return z===0||z===6},v=react.useCallback(S=>{let z=Math.round(S/(h*i)),Y=new Date(o);return Y.setDate(Y.getDate()+z),Y},[o,h,i]),P=react.useCallback((S,z)=>{if(z.startDate&&z.endDate)return;let Y=S.currentTarget.ownerSVGElement;if(!Y)return;let ee=Y.createSVGPoint();ee.x=S.clientX,ee.y=S.clientY;let R=ee.matrixTransform(Y.getScreenCTM()?.inverse()),J=v(R.x),G=new Date(J);G.setDate(G.getDate()+1),d?.(z,J,G);},[v,d]),C=react.useMemo(()=>{let S=R=>R.map(J=>{if(J.subtasks&&J.subtasks.length>0){let G=S(J.subtasks),se=G.filter(N=>N.startDate&&N.endDate);if(se.length>0){let N=se.map($e=>$e.startDate.getTime()),Z=se.map($e=>$e.endDate.getTime()),te=new Date(Math.min(...N)),Be=new Date(Math.max(...Z));return {...J,subtasks:G,startDate:J.startDate||te,endDate:J.endDate||Be}}return {...J,subtasks:G}}return J}),z=(R,J=[])=>{for(let G of R)J.push(G),G.subtasks&&G.subtasks.length>0&&(G.isExpanded===void 0||G.isExpanded)&&z(G.subtasks,J);return J},Y=S(e);return z(Y)},[e]),E=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let z=S.startDate.getTime(),Y=S.endDate.getTime(),ee=o.getTime(),R=(z-ee)/(1e3*60*60*24),J=(Y-z)/(1e3*60*60*24),G=R*h*i,se=Math.max(h*i,40),N=Math.max(J*h*i,se);return {x:G,width:N}},[o,h,i]),T=react.useMemo(()=>C.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:z,width:Y}=E(S),R=C.findIndex(J=>J.id===S.id)*a+12;return {id:S.id,x:z,y:R,width:Y,height:32}}),[C,E]),U=react.useCallback((S,z,Y)=>{if(!Y||z===0){x([]);return}let ee=_.calculateCascadePreview(e,S,z,C,o,h*i,a,48);x(ee);},[e,C,o,h,i,a,48]),O=react.useMemo(()=>{let S=[],z=new Date(o);for(;z<=n;){let R=(z.getTime()-o.getTime())/864e5*h*i;if(r==="day")S.push({date:new Date(z),label:z.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),z.setDate(z.getDate()+1);else if(r==="week"){let J=b(z);S.push({date:new Date(z),label:`Week ${J}`,x:R}),z.setDate(z.getDate()+7);}else S.push({date:new Date(z),label:z.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),z.setMonth(z.getMonth()+1);}return S},[o,n,r,h,i]),I=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*h*i,[o,h,i]),$=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},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}),O.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},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}),O.map((S,z)=>{let Y=O[z+1]?.x||g,ee=w(S.date);return jsxRuntime.jsxs("g",{children:[ee&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:Y-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 Y=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}`),!Y&&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:ee=>P(ee,S),onMouseEnter:ee=>{ee.currentTarget.setAttribute("fill",t.accentLight),ee.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:ee=>{ee.currentTarget.setAttribute("fill","transparent"),ee.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(Y=>{let ee=C.find(se=>se.id===Y);if(!ee||!ee.startDate||!ee.endDate)return null;let R=C.findIndex(se=>se.id===Y),J=E(ee),G=E(S);return jsxRuntime.jsx(ao,{x1:J.x+J.width,y1:R*a+a/2,x2:G.x,y2:z*a+a/2,theme:t,onDelete:()=>u?.(S.id,Y)},`dep-${Y}-${S.id}`)})),C.map((S,z)=>{if(!S.startDate||!S.endDate)return null;let{x:Y,width:ee}=E(S),R=z*a+12,J=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(oo,{task:S,x:Y+ee/2,y:R+16,theme:t,onClick:p},S.id):J?jsxRuntime.jsxs("g",{onClick:()=>p?.(S),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:Y,y:R,width:ee,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y+ee,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y+ee,y1:R,x2:Y+ee,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R+32,x2:Y+ee,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),ee>60&&jsxRuntime.jsx("text",{x:Y+12,y:R+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(eo,{task:S,x:Y,y:R,width:ee,theme:t,dayWidth:h*i,startDate:o,templates:c,onClick:p,onDoubleClick:s,onContextMenu:m,onDateChange:d,onDependencyCreate:l,allTaskPositions:T,onDragMove:U},S.id)}),y.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 el=[{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 tl({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:el.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:el.find(r=>r.value===e)?.name||"Personalizado"})]})}function lo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:i=false,mode:c=a?"edit":"create",theme:p="dark"}){let s=De[p]||De.dark,m={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},d={color:s.textSecondary},[l,u]=react.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[k,y]=react.useState({});react.useEffect(()=>{u(a?{name:a.name,startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[a,e]);let x=()=>{let g={};return l.name.trim()||(g.name="El nombre es requerido"),l.startDate&&l.endDate&&l.startDate>l.endDate&&(g.endDate="La fecha de fin debe ser posterior a la de inicio"),y(g),Object.keys(g).length===0},f=async g=>{if(g.preventDefault(),!!x())try{await n(l),t();}catch(b){console.error("Error submitting task:",b);}},h=(g,b)=>{u(w=>{let v={...w,[g]:b};if(g==="progress"){let P=typeof b=="number"?b:parseInt(b,10);P===100&&w.status!=="completed"?v.status="completed":P>0&&P<100&&w.status==="todo"?v.status="in-progress":P===0&&w.status==="in-progress"&&(v.status="todo");}return v}),k[g]&&y(w=>{let v={...w};return delete v[g],v});};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:s.bgPrimary,border:`1px solid ${s.border}`},onClick:g=>g.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:g=>g.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:g=>g.currentTarget.style.backgroundColor="transparent",disabled:i,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:f,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:l.name,onChange:g=>h("name",g.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:m,onFocus:g=>g.currentTarget.style.borderColor=s.accent,onBlur:g=>g.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:i}),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",{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:l.startDate?l.startDate.toISOString().split("T")[0]:"",onChange:g=>h("startDate",g.target.value?new Date(g.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:m,disabled:i||l.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:l.endDate?l.endDate.toISOString().split("T")[0]:"",onChange:g=>h("endDate",g.target.value?new Date(g.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:m,disabled:i||l.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",{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:l.status,onChange:g=>h("status",g.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:m,disabled:i,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-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(tl,{value:l.color,onChange:g=>h("color",g),disabled:i}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:s.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:l.progress<30?"#EF4444":l.progress<70?"#F59E0B":"#10B981",backgroundColor:l.progress<30?"rgba(239, 68, 68, 0.1)":l.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[l.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:l.progress,onChange:g=>h("progress",parseInt(g.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:s.bgSecondary,accentColor:l.progress<30?"#EF4444":l.progress<70?"#F59E0B":"#10B981"},disabled:i}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${l.progress}%`,backgroundColor:l.progress<30?"rgba(239, 68, 68, 0.3)":l.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:s.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(g=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>h("progress",g),disabled:i,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:l.progress===g?g<30?"#EF4444":g<70?"#F59E0B":"#10B981":s.bgSecondary,color:l.progress===g?"#FFFFFF":s.textSecondary,border:`1px solid ${l.progress===g?g<30?"#EF4444":g<70?"#F59E0B":"#10B981":s.borderLight}`},children:[g,"%"]},g))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:s.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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:l.isMilestone,onChange:g=>h("isMilestone",g.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(g=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:b=>b.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:b=>b.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.assignees?.some(b=>b.name===g.name),onChange:b=>{let w=b.target.checked?[...l.assignees||[],{name:g.name,avatar:g.avatar,initials:g.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(l.assignees||[]).filter(v=>v.name!==g.name);h("assignees",w);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),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:s.accent},children:g.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:g.name})]})]},g.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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:r.filter(g=>g.id!==a?.id).map(g=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:b=>b.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:b=>b.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:l.dependencies?.includes(g.id),onChange:b=>{let w=b.target.checked?[...l.dependencies||[],g.id]:(l.dependencies||[]).filter(v=>v!==g.id);h("dependencies",w);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:i}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.textPrimary},children:g.name})]},g.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:g=>{g.currentTarget.style.color=s.textPrimary,g.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:g=>{g.currentTarget.style.color=s.textSecondary,g.currentTarget.style.backgroundColor="transparent";},disabled:i,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:f,disabled:i,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:s.accent,color:"#FFFFFF"},onMouseEnter:g=>!i&&(g.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:g=>!i&&(g.currentTarget.style.backgroundColor=s.accent),children:i?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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Lu=['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"'],ll=()=>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"})]}),Au=()=>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"})}),Fu=()=>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"})}),Bu=()=>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"})}),Ru=()=>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 co({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:i,onDependencyCreate:c,onDependencyDelete:p}){let[s,m]=react.useState(false),[d,l]=react.useState(false),[u,k]=react.useState([]),[y,x]=react.useState(""),[f,h]=react.useState(false),[g,b]=react.useState(true),w=react.useRef(null),v=react.useRef(null),P=react.useRef(null),{enabled:C=true,placeholder:E='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:U,suggestions:O=Lu,maxHistory:I=50}=a;react.useEffect(()=>{v.current&&v.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{s&&!d&&w.current&&setTimeout(()=>w.current?.focus(),100);},[s,d]);let $=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&&n?.(R.newTask);break;case "delete_task":R.taskId&&i?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,n,i,c,p]),S=react.useCallback(async R=>{if(!R.trim()||f)return;let J={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};k(se=>[...se.slice(-(I-1)),J]),x(""),b(false),h(true);let G={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};k(se=>[...se,G]);try{if(U){let se=await U(R,e);k(N=>{let Z=N.filter(Be=>!Be.isLoading),te={id:`assistant-${Date.now()}`,role:"assistant",content:se.message,timestamp:new Date,command:se};return [...Z,te]}),$(se);}else k(se=>[...se.filter(Z=>!Z.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(se){k(N=>[...N.filter(te=>!te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${se instanceof Error?se.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,I,U,e,$]),z=R=>{R.preventDefault(),S(y);},Y=R=>{x(R),w.current?.focus();};if(react.useEffect(()=>{let R=J=>{(J.metaKey||J.ctrlKey)&&J.key==="k"&&(J.preventDefault(),m(G=>!G),s||l(false)),J.key==="Escape"&&s&&m(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[s]),!C)return null;let ee={"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(Ge,{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 ${ee[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsxRuntime.jsx(ll,{}),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:P,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ee[T]} 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(ll,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>l(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Bu,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Fu,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&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:O.slice(0,4).map((R,J)=>jsxRuntime.jsx("button",{onClick:()=>Y(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},J))})]}),u.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(Ru,{}):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:v})]}),jsxRuntime.jsxs("form",{onSubmit:z,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:w,type:"text",value:y,onChange:R=>x(R.target.value),placeholder:E,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!y.trim()||f,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(Au,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function dl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,m=true)=>{r(d=>{let l=typeof s=="function"?s(d.present):s;if(o.current)return {...d,present:l};if(!m)return {...d,present:l};let u=[...d.past,d.present];return u.length>t&&u.shift(),{past:u,present:l,future:[]}});},[t]),i=react.useCallback(()=>{r(s=>{if(s.past.length===0)return s;let m=s.past[s.past.length-1],d=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[s.present,...s.future]}});},[]),c=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let m=s.future[0],d=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:m,future:d}});},[]),p=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:i,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function cl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=i=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?i.metaKey:i.ctrlKey;if(p&&i.key==="z"&&!i.shiftKey&&a){i.preventDefault(),e();return}if(r){if(!c&&p&&i.key==="y"){i.preventDefault(),t();return}if(c&&p&&i.shiftKey&&i.key==="z"){i.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Gu={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${_.formatDate(e.startDate)} - ${_.formatDate(e.endDate)}`);let a=_.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=>_.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function pl(e){return {...Gu,...e}}var _u=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},gl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:i="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:s=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:l=true,aiAssistant:u,locale:k="en",customTranslations:y,showCreateTaskButton:x=false,createTaskLabel:f,onCreateTask:h,onThemeChange:g,onTaskClick:b,onTaskDblClick:w,onTaskContextMenu:v,onTaskUpdate:P,onProgressChange:C,onTaskEdit:E,onTaskAddSubtask:T,onTaskMarkIncomplete:U,onTaskSetInProgress:O,onDependencyCreate:I,onDependencyDelete:$,onBeforeTaskAdd:S,onAfterTaskAdd:z,onBeforeTaskUpdate:Y,onAfterTaskUpdate:ee}=a,J=react.useContext(Yr)?.theme,[G,se]=react.useState(J||n||"dark"),[N,Z]=react.useState(i),[te,Be]=react.useState(c),[$e,Ft]=react.useState(1),[we,pt]=react.useState(0),[je,Ut]=react.useState(false),[Pa,ya]=react.useState(null),[ue,tt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Gt,$t]=react.useState(null);react.useEffect(()=>{J&&J!==G&&se(J);},[J]),react.useEffect(()=>{n&&n!==G&&se(n);},[n]);let ma=react.useCallback(D=>{se(D),g?.(D);},[g]),{state:ie,setState:pe,undo:V,redo:H,canUndo:Te,canRedo:Ke,clearHistory:oe}=dl(t,50);react.useEffect(()=>{pe(t);},[t,pe]),react.useEffect(()=>{r&&r(ie);},[ie,r]);let de=react.useMemo(()=>vn(k,y),[k,y]),sa=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:D.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:D.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:D.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:D.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:D.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:D.columns.progress,width:120,visible:false,sortable:true}],[]),[_t,ge]=react.useState(()=>sa(de));react.useEffect(()=>{ge(D=>D.map(L=>({...L,label:de.columns[L.id==="name"?"taskName":L.id]||L.label})));},[de]);let j=react.useMemo(()=>_t.filter(D=>D.visible).reduce((D,L)=>D+L.width,0)+60,[_t]),be=Pa||j,ve=react.useRef(null),ze=react.useRef(null),He=react.useRef(null),Ae=react.useMemo(()=>Di(G),[G]),it=react.useMemo(()=>({theme:Ae,themeName:G}),[Ae,G]),le=react.useMemo(()=>pl(d),[d]),Tt=react.useMemo(()=>{if(!l)return ie;let D=_.calculateCriticalPath(ie),L=W=>W.map(Q=>({...Q,isCriticalPath:D.includes(Q.id),subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(ie)},[ie,l]),Nt=_u(te);cl({undo:V,redo:H,canUndo:Te,canRedo:Ke,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>_.findTaskById(ie,D),addTask:(D,L)=>{pe(W=>{if(!L)return [...W,{...D,level:0}];let Q=ne=>ne.map(ce=>ce.id===L?{...ce,subtasks:[...ce.subtasks||[],{...D,parentId:L,level:(ce.level||0)+1}],isExpanded:true}:ce.subtasks?{...ce,subtasks:Q(ce.subtasks)}:ce);return Q(W)});},updateTask:(D,L)=>{pe(W=>{let Q=ne=>ne.map(ce=>ce.id===D?{...ce,...L}:ce.subtasks?{...ce,subtasks:Q(ce.subtasks)}:ce);return Q(W)});},deleteTask:D=>{pe(L=>{let W=Q=>Q.filter(ne=>ne.id===D?false:(ne.subtasks&&(ne.subtasks=W(ne.subtasks)),true));return W(L)});},deleteTasks:D=>{pe(L=>Zr(L,D));},duplicateTask:D=>{pe(L=>Nn(L,[D]));},splitTask:(D,L,W=3)=>{pe(Q=>_.splitTask(Q,D,L,W));},calculateEndDate:_.calculateEndDate,calculateDuration:_.calculateDuration,validateDependency:(D,L)=>!_.validateDependencies(ie,D,L),getAllTasks:()=>_.flattenTasks(ie),getTasksByStatus:D=>_.flattenTasks(ie).filter(L=>L.status===D),getTasksByParent:D=>D?_.findTaskById(ie,D)?.subtasks||[]:ie.filter(W=>!W.parentId),getCriticalPath:()=>_.flattenTasks(ie).filter(D=>D.isCriticalPath),indentTask:D=>{pe(L=>wn(L,[D]));},outdentTask:D=>{pe(L=>Cn(L,[D]));},moveTask:(D,L)=>{pe(W=>Tn(W,[D],L));},createSubtask:async D=>{let{tasks:L,newTask:W}=En(ie,D);if(S){let Q=S({...W,parentId:D});if((Q instanceof Promise?await Q:Q)===false)return}pe(L),z&&z({...W,parentId:D});},scrollToTask:D=>{let W=_.flattenTasks(ie).findIndex(Q=>Q.id===D);if(W!==-1&&ve.current){let Q=W*Nt;ve.current.scrollTo({top:Q,behavior:"smooth"}),ze.current&&ze.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(D,L=2e3)=>{},expandTask:D=>{pe(L=>{let W=Q=>Q.map(ne=>ne.id===D?{...ne,isExpanded:true}:ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne);return W(L)});},collapseTask:D=>{pe(L=>{let W=Q=>Q.map(ne=>ne.id===D?{...ne,isExpanded:false}:ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne);return W(L)});},expandAll:()=>{pe(D=>{let L=W=>W.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(D)});},collapseAll:()=>{pe(D=>{let L=W=>W.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(D)});},undo:V,redo:H,canUndo:()=>Te,canRedo:()=>Ke,clearHistory:oe,exportToPNG:async()=>{if(!He.current)throw new Error("Gantt container not found");let D=await ml__default.default(He.current,{backgroundColor:Ae.bgPrimary,scale:2});return new Promise((L,W)=>{D.toBlob(Q=>{Q?L(Q):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await _.exportToPDF(ie,D);},exportToExcel:async D=>{await _.exportToExcel(ie,D);},exportToJSON:()=>_.exportToJSON(ie),exportToCSV:()=>_.exportToCSV(ie),importFromJSON:D=>{let L=_.importFromJSON(D);pe(L);},getTasks:()=>ie,refresh:()=>{pe(D=>[...D]);},clearAll:()=>{pe([]);}}),[ie,V,H,Te,Ke,oe,Ae,Nt]);let M=react.useCallback(D=>{ge(L=>L.map(W=>W.id===D?{...W,visible:!W.visible}:W));},[]),ae=react.useCallback((D,L)=>{ge(W=>W.map(Q=>{if(Q.id!==D)return Q;let ne=Q.minWidth??100,ce=Q.maxWidth??800,mt=Math.max(ne,Math.min(ce,L));return {...Q,width:mt}}));},[]),Ue=react.useCallback(D=>{pe(L=>Sn(L,D)),a.onTaskToggleExpand?.(D);},[a]),ht=react.useCallback((D,L)=>{if(Y&&Y(D,L)===false)return;let Q=_.findTaskById(ie,D)?.progress,ne=mt=>mt.map(Dt=>Dt.id===D?{...Dt,...L}:Dt.subtasks?{...Dt,subtasks:ne(Dt.subtasks)}:Dt);pe(ne(ie));let ce=_.findTaskById(ne(ie),D);ce&&(P?.(ce),ee?.(ce),L.progress!==void 0&&Q!==void 0&&L.progress!==Q&&C?.(D,Q,L.progress));},[ie,P,Y,ee,C]),ia=react.useCallback(D=>{D.length!==0&&(pe(L=>wn(L,D)),a.onTaskIndent?.(D[0]));},[a]),Dd=react.useCallback(D=>{D.length!==0&&(pe(L=>Cn(L,D)),a.onTaskOutdent?.(D[0]));},[a]),Sd=react.useCallback((D,L)=>{D.length!==0&&(pe(W=>Tn(W,D,L)),a.onTaskMove?.(D[0],L));},[a]),Ss=react.useCallback(D=>{a.onMultiTaskDelete?a.onMultiTaskDelete(D):(pe(L=>Zr(L,D)),D.forEach(L=>a.onTaskDelete?.(L)));},[a]),Ed=react.useCallback(D=>{pe(L=>Nn(L,D)),D.forEach(L=>a.onTaskDuplicate?.(L));},[a]),Pd=react.useCallback((D,L)=>{pe(W=>{let{tasks:Q,newTask:ne}=Hi(W,D,L);return S&&S(ne)===false?W:(a.onTaskCreate?.(ne.parentId,ne.position||0),z?.(ne),Q)});},[a,S,z]),Md=react.useCallback((D,L)=>{pe(W=>Dn(W,D,L)),a.onTaskRename?.(D,L);},[a]),Es=react.useCallback(D=>{pe(L=>{let{tasks:W}=En(L,D);return a.onTaskCreate?.(D,0),W});},[a]),Id=react.useCallback((D,L,W)=>{let Q=D.startDate?Math.round((L.getTime()-D.startDate.getTime())/864e5):0,ne=Dt=>Dt.map(Yt=>Yt.id===D.id?{...Yt,startDate:L,endDate:W,...D.segments&&{segments:D.segments}}:Yt.subtasks?{...Yt,subtasks:ne(Yt.subtasks)}:Yt),ce=ne(ie);ce=_.autoScheduleDependents(ce,D.id,Q),pe(ce);let mt={...D,startDate:L,endDate:W};P?.(mt);},[ie,P]),Ld=react.useCallback((D,L)=>{v?.(D,L),tt({isOpen:true,x:L.clientX,y:L.clientY,task:D});},[v]),Ad=react.useCallback((D,L)=>{let W=_.splitTask(ie,D.id,L);pe(W),tt({isOpen:false,x:0,y:0,task:null});},[ie]),Ps=react.useCallback(D=>{w?.(D),E||$t(D);},[w,E]),Ms=react.useCallback((D,L,W)=>{let Q=new Map,ne=Xt=>{Xt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&ne(ua.subtasks);});};ne(W);let ce=Q.get(L)||[];Q.set(L,[...ce,D]);let mt=new Set,Dt=new Set,Yt=Xt=>{if(!mt.has(Xt)){mt.add(Xt),Dt.add(Xt);let ua=Q.get(Xt)||[];for(let lr of ua){if(!mt.has(lr)&&Yt(lr))return true;if(Dt.has(lr))return true}}return Dt.delete(Xt),false};return Yt(L)},[]),Is=react.useCallback((D,L)=>{if(Ms(D.id,L,ie)){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;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=_.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?_.calculateDuration(s.startDate,s.endDate):0,d=0;if(s.dependencies&&s.dependencies.length>0)for(let g of s.dependencies){let y=t.find(k=>k.id===g);if(y){o(y);let k=r.get(g)?.ef||0;d=Math.max(d,k);}}let i=d+p;r.set(s.id,{es:d,ef:i});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(s=>s.ef)),l=new Map,c=s=>{if(l.has(s.id))return;let p=s.startDate&&s.endDate?_.calculateDuration(s.startDate,s.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(s.id)),i=n;if(d.length>0)for(let y of d){c(y);let k=l.get(y.id)?.ls||0;i=Math.min(i,k);}let g=i-p;l.set(s.id,{ls:g,lf:i});};a.forEach(c);let m=[];for(let s of a){let p=r.get(s.id),d=l.get(s.id);if(p&&d){let i=d.ls-p.es;Math.abs(i)<.01&&m.push(s.id);}}return m},calculateSlack:(e,t)=>{let a=_.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(_.calculateCriticalPath(e).includes(t))return 0;let o=_.getDependentTasks(e,t);if(o.length===0){let c=_.getLatestEndDate(e);if(!c)return null;let m=_.calculateDuration(a.endDate,c);return Math.max(0,m)}let n=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!n)return null;let l=_.calculateDuration(a.endDate,new Date(n));return Math.max(0,l)},isOnCriticalPath:(e,t)=>_.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=_.findTaskById(e,t);if(!r||!r.endDate)return e;let o=_.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let c=_.calculateDuration(l.startDate,l.endDate),m;a!==void 0?(m=new Date(l.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let s=_.calculateEndDate(m,c),p=d=>d.map(i=>i.id===l.id?{...i,startDate:m,endDate:s}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);n=p(n),n=_.autoScheduleDependents(n,l.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,l,c)=>{if(a===0)return [];let m=[],s=o.getTime(),p=1e3*60*60*24,d=_.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(g,y,k=new Set)=>{if(k.has(g))return;k.add(g);let x=_.getDependentTasks(e,g);for(let b of x){if(!b.startDate||!b.endDate)continue;let f=r.findIndex(O=>O.id===b.id);if(f===-1)continue;let u=b.startDate.getTime(),C=(b.endDate.getTime()-u)/p,P=(u-s)/p*n,w=P+y*n,S=Math.max(C*n,n),T=c+f*l+12;m.push({taskId:b.id,taskName:b.name,originalX:P,previewX:w,width:S,y:T,rowIndex:f,daysDelta:y,color:b.color}),i(b.id,y,k);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=_.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 c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:n},{startDate:l,endDate:c}],s=p=>p.map(d=>d.id===o.id?{...d,endDate:c,segments:m}:d.subtasks?{...d,subtasks:s(d.subtasks)}:d);return s(e)}};function io({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:l,templates:c,onTaskClick:m,onTaskDblClick:s,onTaskContextMenu:p,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:g}){let[k,x]=react.useState([]),b=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),f=r==="day"?60:r==="week"?20:8,u=b*f*l,h=E=>{let U=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),Y=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-Y);let ee=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-ee.getTime())/864e5+1)/7)},C=E=>{let U=E.getDay();return U===0||U===6},v=react.useCallback(E=>{let U=Math.round(E/(f*l)),Y=new Date(o);return Y.setDate(Y.getDate()+U),Y},[o,f,l]),P=react.useCallback((E,U)=>{if(U.startDate&&U.endDate)return;let Y=E.currentTarget.ownerSVGElement;if(!Y)return;let ee=Y.createSVGPoint();ee.x=E.clientX,ee.y=E.clientY;let R=ee.matrixTransform(Y.getScreenCTM()?.inverse()),J=v(R.x),G=new Date(J);G.setDate(G.getDate()+1),d?.(U,J,G);},[v,d]),w=react.useMemo(()=>{let E=R=>R.map(J=>{if(J.subtasks&&J.subtasks.length>0){let G=E(J.subtasks),se=G.filter(N=>N.startDate&&N.endDate);if(se.length>0){let N=se.map($e=>$e.startDate.getTime()),Z=se.map($e=>$e.endDate.getTime()),te=new Date(Math.min(...N)),Be=new Date(Math.max(...Z));return {...J,subtasks:G,startDate:J.startDate||te,endDate:J.endDate||Be}}return {...J,subtasks:G}}return J}),U=(R,J=[])=>{for(let G of R)J.push(G),G.subtasks&&G.subtasks.length>0&&(G.isExpanded===void 0||G.isExpanded)&&U(G.subtasks,J);return J},Y=E(e);return U(Y)},[e]),S=react.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let U=E.startDate.getTime(),Y=E.endDate.getTime(),ee=o.getTime(),R=(U-ee)/(1e3*60*60*24),J=(Y-U)/(1e3*60*60*24),G=R*f*l,se=Math.max(f*l,40),N=Math.max(J*f*l,se);return {x:G,width:N}},[o,f,l]),T=react.useMemo(()=>w.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:U,width:Y}=S(E),R=w.findIndex(J=>J.id===E.id)*a+12;return {id:E.id,x:U,y:R,width:Y,height:32}}),[w,S]),O=react.useCallback((E,U,Y)=>{if(!Y||U===0){x([]);return}let ee=_.calculateCascadePreview(e,E,U,w,o,f*l,a,48);x(ee);},[e,w,o,f,l,a,48]),z=react.useMemo(()=>{let E=[],U=new Date(o);for(;U<=n;){let R=(U.getTime()-o.getTime())/864e5*f*l;if(r==="day")E.push({date:new Date(U),label:U.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:R}),U.setDate(U.getDate()+1);else if(r==="week"){let J=h(U);E.push({date:new Date(U),label:`Week ${J}`,x:R}),U.setDate(U.getDate()+7);}else E.push({date:new Date(U),label:U.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:R}),U.setMonth(U.getMonth()+1);}return E},[o,n,r,f,l]),I=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*f*l,[o,f,l]),$=Math.max(w.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(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}),z.map((E,U)=>jsxRuntime.jsxs("g",{children:[U>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-${U}`)),I>=0&&I<=u&&jsxRuntime.jsx("circle",{cx:I,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(u,1e3),height:$,style:{display:"block",flexShrink:0},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}),z.map((E,U)=>{let Y=z[U+1]?.x||u,ee=C(E.date);return jsxRuntime.jsxs("g",{children:[ee&&jsxRuntime.jsx("rect",{x:E.x,y:0,width:Y-E.x,height:w.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsxRuntime.jsx("line",{x1:E.x,y1:0,x2:E.x,y2:w.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),I>=0&&I<=u&&jsxRuntime.jsx("line",{x1:I,y1:0,x2:I,y2:w.length*a,stroke:t.today,strokeWidth:2,opacity:1}),w.map((E,U)=>{let Y=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:u,height:a,fill:U%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!Y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:u,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ee=>P(ee,E),onMouseEnter:ee=>{ee.currentTarget.setAttribute("fill",t.accentLight),ee.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:ee=>{ee.currentTarget.setAttribute("fill","transparent"),ee.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:I>0?I:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),w.map((E,U)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(Y=>{let ee=w.find(se=>se.id===Y);if(!ee||!ee.startDate||!ee.endDate)return null;let R=w.findIndex(se=>se.id===Y),J=S(ee),G=S(E);return jsxRuntime.jsx(ao,{x1:J.x+J.width,y1:R*a+a/2,x2:G.x,y2:U*a+a/2,theme:t,onDelete:()=>g?.(E.id,Y)},`dep-${Y}-${E.id}`)})),w.map((E,U)=>{if(!E.startDate||!E.endDate)return null;let{x:Y,width:ee}=S(E),R=U*a+12,J=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(oo,{task:E,x:Y+ee/2,y:R+16,theme:t,onClick:m},E.id):J?jsxRuntime.jsxs("g",{onClick:()=>m?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:Y,y:R,width:ee,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y+ee,y2:R,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R,x2:Y,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y+ee,y1:R,x2:Y+ee,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:Y,y1:R+32,x2:Y+ee,y2:R+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),ee>60&&jsxRuntime.jsx("text",{x:Y+12,y:R+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(eo,{task:E,x:Y,y:R,width:ee,theme:t,dayWidth:f*l,startDate:o,templates:c,onClick:m,onDoubleClick:s,onContextMenu:p,onDateChange:d,onDependencyCreate:i,allTaskPositions:T,onDragMove:O},E.id)}),k.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 el=[{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 tl({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:el.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:el.find(r=>r.value===e)?.name||"Personalizado"})]})}function lo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:l=false,mode:c=a?"edit":"create",theme:m="dark"}){let s=De[m]||De.dark,p={backgroundColor:s.bgSecondary,border:`1px solid ${s.borderLight}`,color:s.textPrimary},d={color:s.textSecondary},[i,g]=react.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[y,k]=react.useState({});react.useEffect(()=>{g(a?{name:a.name,startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}:{name:"",progress:0,status:"todo",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"),k(u),Object.keys(u).length===0},b=async u=>{if(u.preventDefault(),!!x())try{await n(i),t();}catch(h){console.error("Error submitting task:",h);}},f=(u,h)=>{g(C=>{let v={...C,[u]:h};if(u==="progress"){let P=typeof h=="number"?h:parseInt(h,10);P===100&&C.status!=="completed"?v.status="completed":P>0&&P<100&&C.status==="todo"?v.status="in-progress":P===0&&C.status==="in-progress"&&(v.status="todo");}return v}),y[u]&&k(C=>{let v={...C};return delete v[u],v});};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:s.bgPrimary,border:`1px solid ${s.border}`},onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${s.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:s.textPrimary},children:c==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:u=>u.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:u=>u.currentTarget.style.backgroundColor="transparent",disabled:l,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:b,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=s.accent,onBlur:u=>u.currentTarget.style.borderColor=s.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:l}),y.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"}),y.name]})]}),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}),y.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"}),y.endDate]})]})]}),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-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(tl,{value:i.color,onChange:u=>f("color",u),disabled:l}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:s.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:s.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:s.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":s.bgSecondary,color:i.progress===u?"#FFFFFF":s.textSecondary,border:`1px solid ${i.progress===u?u<30?"#EF4444":u<70?"#F59E0B":"#10B981":s.borderLight}`},children:[u,"%"]},u))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:s.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:s.bgSecondary,border:`1px solid ${s.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:s.accent},disabled:l}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:s.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:s.bgSecondary,border:`1px solid ${s.borderLight}`},children:o.map(u=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:h=>h.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:h=>h.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:i.assignees?.some(h=>h.name===u.name),onChange:h=>{let C=h.target.checked?[...i.assignees||[],{name:u.name,avatar:u.avatar,initials:u.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2),color:s.accent}]:(i.assignees||[]).filter(v=>v.name!==u.name);f("assignees",C);},className:"w-4 h-4 rounded",style:{accentColor:s.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:s.accent},children:u.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.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:s.bgSecondary,border:`1px solid ${s.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:h=>h.currentTarget.style.backgroundColor=s.hoverBg,onMouseLeave:h=>h.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:i.dependencies?.includes(u.id),onChange:h=>{let C=h.target.checked?[...i.dependencies||[],u.id]:(i.dependencies||[]).filter(v=>v!==u.id);f("dependencies",C);},className:"w-4 h-4 rounded",style:{accentColor:s.accent},disabled:l}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:s.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 ${s.border}`,backgroundColor:s.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:s.textSecondary},onMouseEnter:u=>{u.currentTarget.style.color=s.textPrimary,u.currentTarget.style.backgroundColor=s.hoverBg;},onMouseLeave:u=>{u.currentTarget.style.color=s.textSecondary,u.currentTarget.style.backgroundColor="transparent";},disabled:l,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:b,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:s.accent,color:"#FFFFFF"},onMouseEnter:u=>!l&&(u.currentTarget.style.backgroundColor=s.accentHover),onMouseLeave:u=>!l&&(u.currentTarget.style.backgroundColor=s.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"}),c==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}var Lu=['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"'],ll=()=>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"})]}),Au=()=>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"})}),Fu=()=>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"})}),Bu=()=>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"})}),Ru=()=>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 co({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:l,onDependencyCreate:c,onDependencyDelete:m}){let[s,p]=react.useState(false),[d,i]=react.useState(false),[g,y]=react.useState([]),[k,x]=react.useState(""),[b,f]=react.useState(false),[u,h]=react.useState(true),C=react.useRef(null),v=react.useRef(null),P=react.useRef(null),{enabled:w=true,placeholder:S='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:O,suggestions:z=Lu,maxHistory:I=50}=a;react.useEffect(()=>{v.current&&v.current.scrollIntoView({behavior:"smooth"});},[g]),react.useEffect(()=>{s&&!d&&C.current&&setTimeout(()=>C.current?.focus(),100);},[s,d]);let $=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&&n?.(R.newTask);break;case "delete_task":R.taskId&&l?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,n,l,c,m]),E=react.useCallback(async R=>{if(!R.trim()||b)return;let J={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};y(se=>[...se.slice(-(I-1)),J]),x(""),h(false),f(true);let G={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(se=>[...se,G]);try{if(O){let se=await O(R,e);y(N=>{let Z=N.filter(Be=>!Be.isLoading),te={id:`assistant-${Date.now()}`,role:"assistant",content:se.message,timestamp:new Date,command:se};return [...Z,te]}),$(se);}else y(se=>[...se.filter(Z=>!Z.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(se){y(N=>[...N.filter(te=>!te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${se instanceof Error?se.message:"Unknown error"}`,timestamp:new Date}]);}finally{f(false);}},[b,I,O,e,$]),U=R=>{R.preventDefault(),E(k);},Y=R=>{x(R),C.current?.focus();};if(react.useEffect(()=>{let R=J=>{(J.metaKey||J.ctrlKey)&&J.key==="k"&&(J.preventDefault(),p(G=>!G),s||i(false)),J.key==="Escape"&&s&&p(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[s]),!w)return null;let ee={"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(Ge,{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 ${ee[T]} 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(ll,{}),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:P,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ee[T]} 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(ll,{}),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(Bu,{})}),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(Fu,{})})]})]}),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:z.slice(0,4).map((R,J)=>jsxRuntime.jsx("button",{onClick:()=>Y(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},J))})]}),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(Ru,{}):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:v})]}),jsxRuntime.jsxs("form",{onSubmit:U,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:C,type:"text",value:k,onChange:R=>x(R.target.value),placeholder:S,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!k.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(Au,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function dl(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((s,p=true)=>{r(d=>{let i=typeof s=="function"?s(d.present):s;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(s=>{if(s.past.length===0)return s;let p=s.past[s.past.length-1],d=s.past.slice(0,s.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[s.present,...s.future]}});},[]),c=react.useCallback(()=>{r(s=>{if(s.future.length===0)return s;let p=s.future[0],d=s.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...s.past,s.present],present:p,future:d}});},[]),m=react.useCallback(()=>{r(s=>({past:[],present:s.present,future:[]}));},[]);return {state:a.present,setState:n,undo:l,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function cl({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=l=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?l.metaKey:l.ctrlKey;if(m&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!c&&m&&l.key==="y"){l.preventDefault(),t();return}if(c&&m&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var Gu={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${_.formatDate(e.startDate)} - ${_.formatDate(e.endDate)}`);let a=_.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=>_.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function ml(e){return {...Gu,...e}}var _u=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},gl=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:l="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:s=true,availableUsers:p=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:g,locale:y="en",customTranslations:k,showCreateTaskButton:x=false,createTaskLabel:b,onCreateTask:f,onThemeChange:u,onTaskClick:h,onTaskDblClick:C,onTaskContextMenu:v,onTaskUpdate:P,onProgressChange:w,onTaskEdit:S,onTaskAddSubtask:T,onTaskMarkIncomplete:O,onTaskSetInProgress:z,onDependencyCreate:I,onDependencyDelete:$,onBeforeTaskAdd:E,onAfterTaskAdd:U,onBeforeTaskUpdate:Y,onAfterTaskUpdate:ee}=a,J=react.useContext(Yr)?.theme,[G,se]=react.useState(J||n||"dark"),[N,Z]=react.useState(l),[te,Be]=react.useState(c),[$e,Ft]=react.useState(1),[we,mt]=react.useState(0),[je,Ut]=react.useState(false),[Pa,ya]=react.useState(null),[ue,tt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Gt,$t]=react.useState(null);react.useEffect(()=>{J&&J!==G&&se(J);},[J]),react.useEffect(()=>{n&&n!==G&&se(n);},[n]);let pa=react.useCallback(D=>{se(D),u?.(D);},[u]),{state:ie,setState:me,undo:V,redo:H,canUndo:Te,canRedo:Ke,clearHistory:oe}=dl(t,50);react.useEffect(()=>{me(t);},[t,me]),react.useEffect(()=>{r&&r(ie);},[ie,r]);let de=react.useMemo(()=>vn(y,k),[y,k]),sa=react.useCallback(D=>[{id:"name",label:D.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:false},{id:"startDate",label:D.columns.startDate,width:110,visible:false,sortable:true},{id:"endDate",label:D.columns.endDate,width:110,visible:false,sortable:true},{id:"duration",label:D.columns.duration,width:80,visible:false,sortable:true},{id:"assignees",label:D.columns.assignees,width:120,visible:false,sortable:false},{id:"status",label:D.columns.status,width:80,visible:false,sortable:true},{id:"progress",label:D.columns.progress,width:120,visible:false,sortable:true}],[]),[_t,ge]=react.useState(()=>sa(de));react.useEffect(()=>{ge(D=>D.map(L=>({...L,label:de.columns[L.id==="name"?"taskName":L.id]||L.label})));},[de]);let j=react.useMemo(()=>_t.filter(D=>D.visible).reduce((D,L)=>D+L.width,0)+60,[_t]),he=Pa||j,ve=react.useRef(null),ze=react.useRef(null),He=react.useRef(null),Ae=react.useMemo(()=>Di(G),[G]),it=react.useMemo(()=>({theme:Ae,themeName:G}),[Ae,G]),le=react.useMemo(()=>ml(d),[d]),Tt=react.useMemo(()=>{if(!i)return ie;let D=_.calculateCriticalPath(ie),L=W=>W.map(Q=>({...Q,isCriticalPath:D.includes(Q.id),subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(ie)},[ie,i]),Nt=_u(te);cl({undo:V,redo:H,canUndo:Te,canRedo:Ke,enabled:true}),react.useImperativeHandle(o,()=>({getTask:D=>_.findTaskById(ie,D),addTask:(D,L)=>{me(W=>{if(!L)return [...W,{...D,level:0}];let Q=ne=>ne.map(ce=>ce.id===L?{...ce,subtasks:[...ce.subtasks||[],{...D,parentId:L,level:(ce.level||0)+1}],isExpanded:true}:ce.subtasks?{...ce,subtasks:Q(ce.subtasks)}:ce);return Q(W)});},updateTask:(D,L)=>{me(W=>{let Q=ne=>ne.map(ce=>ce.id===D?{...ce,...L}:ce.subtasks?{...ce,subtasks:Q(ce.subtasks)}:ce);return Q(W)});},deleteTask:D=>{me(L=>{let W=Q=>Q.filter(ne=>ne.id===D?false:(ne.subtasks&&(ne.subtasks=W(ne.subtasks)),true));return W(L)});},deleteTasks:D=>{me(L=>Zr(L,D));},duplicateTask:D=>{me(L=>Nn(L,[D]));},splitTask:(D,L,W=3)=>{me(Q=>_.splitTask(Q,D,L,W));},calculateEndDate:_.calculateEndDate,calculateDuration:_.calculateDuration,validateDependency:(D,L)=>!_.validateDependencies(ie,D,L),getAllTasks:()=>_.flattenTasks(ie),getTasksByStatus:D=>_.flattenTasks(ie).filter(L=>L.status===D),getTasksByParent:D=>D?_.findTaskById(ie,D)?.subtasks||[]:ie.filter(W=>!W.parentId),getCriticalPath:()=>_.flattenTasks(ie).filter(D=>D.isCriticalPath),indentTask:D=>{me(L=>wn(L,[D]));},outdentTask:D=>{me(L=>Cn(L,[D]));},moveTask:(D,L)=>{me(W=>Tn(W,[D],L));},createSubtask:async D=>{let{tasks:L,newTask:W}=En(ie,D);if(E){let Q=E({...W,parentId:D});if((Q instanceof Promise?await Q:Q)===false)return}me(L),U&&U({...W,parentId:D});},scrollToTask:D=>{let W=_.flattenTasks(ie).findIndex(Q=>Q.id===D);if(W!==-1&&ve.current){let Q=W*Nt;ve.current.scrollTo({top:Q,behavior:"smooth"}),ze.current&&ze.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(D,L=2e3)=>{},expandTask:D=>{me(L=>{let W=Q=>Q.map(ne=>ne.id===D?{...ne,isExpanded:true}:ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne);return W(L)});},collapseTask:D=>{me(L=>{let W=Q=>Q.map(ne=>ne.id===D?{...ne,isExpanded:false}:ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne);return W(L)});},expandAll:()=>{me(D=>{let L=W=>W.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(D)});},collapseAll:()=>{me(D=>{let L=W=>W.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(D)});},undo:V,redo:H,canUndo:()=>Te,canRedo:()=>Ke,clearHistory:oe,exportToPNG:async()=>{if(!He.current)throw new Error("Gantt container not found");let D=await pl__default.default(He.current,{backgroundColor:Ae.bgPrimary,scale:2});return new Promise((L,W)=>{D.toBlob(Q=>{Q?L(Q):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async D=>{await _.exportToPDF(ie,D);},exportToExcel:async D=>{await _.exportToExcel(ie,D);},exportToJSON:()=>_.exportToJSON(ie),exportToCSV:()=>_.exportToCSV(ie),importFromJSON:D=>{let L=_.importFromJSON(D);me(L);},getTasks:()=>ie,refresh:()=>{me(D=>[...D]);},clearAll:()=>{me([]);}}),[ie,V,H,Te,Ke,oe,Ae,Nt]);let M=react.useCallback(D=>{ge(L=>L.map(W=>W.id===D?{...W,visible:!W.visible}:W));},[]),ae=react.useCallback((D,L)=>{ge(W=>W.map(Q=>{if(Q.id!==D)return Q;let ne=Q.minWidth??100,ce=Q.maxWidth??800,pt=Math.max(ne,Math.min(ce,L));return {...Q,width:pt}}));},[]),Ue=react.useCallback(D=>{me(L=>Sn(L,D)),a.onTaskToggleExpand?.(D);},[a]),bt=react.useCallback((D,L)=>{if(Y&&Y(D,L)===false)return;let Q=_.findTaskById(ie,D)?.progress,ne=pt=>pt.map(Dt=>Dt.id===D?{...Dt,...L}:Dt.subtasks?{...Dt,subtasks:ne(Dt.subtasks)}:Dt);me(ne(ie));let ce=_.findTaskById(ne(ie),D);ce&&(P?.(ce),ee?.(ce),L.progress!==void 0&&Q!==void 0&&L.progress!==Q&&w?.(D,Q,L.progress));},[ie,P,Y,ee,w]),ia=react.useCallback(D=>{D.length!==0&&(me(L=>wn(L,D)),a.onTaskIndent?.(D[0]));},[a]),Dd=react.useCallback(D=>{D.length!==0&&(me(L=>Cn(L,D)),a.onTaskOutdent?.(D[0]));},[a]),Sd=react.useCallback((D,L)=>{D.length!==0&&(me(W=>Tn(W,D,L)),a.onTaskMove?.(D[0],L));},[a]),Ss=react.useCallback(D=>{a.onMultiTaskDelete?a.onMultiTaskDelete(D):(me(L=>Zr(L,D)),D.forEach(L=>a.onTaskDelete?.(L)));},[a]),Ed=react.useCallback(D=>{me(L=>Nn(L,D)),D.forEach(L=>a.onTaskDuplicate?.(L));},[a]),Pd=react.useCallback((D,L)=>{me(W=>{let{tasks:Q,newTask:ne}=Hi(W,D,L);return E&&E(ne)===false?W:(a.onTaskCreate?.(ne.parentId,ne.position||0),U?.(ne),Q)});},[a,E,U]),Md=react.useCallback((D,L)=>{me(W=>Dn(W,D,L)),a.onTaskRename?.(D,L);},[a]),Es=react.useCallback(D=>{me(L=>{let{tasks:W}=En(L,D);return a.onTaskCreate?.(D,0),W});},[a]),Id=react.useCallback((D,L,W)=>{let Q=D.startDate?Math.round((L.getTime()-D.startDate.getTime())/864e5):0,ne=Dt=>Dt.map(Yt=>Yt.id===D.id?{...Yt,startDate:L,endDate:W,...D.segments&&{segments:D.segments}}:Yt.subtasks?{...Yt,subtasks:ne(Yt.subtasks)}:Yt),ce=ne(ie);ce=_.autoScheduleDependents(ce,D.id,Q),me(ce);let pt={...D,startDate:L,endDate:W};P?.(pt);},[ie,P]),Ld=react.useCallback((D,L)=>{v?.(D,L),tt({isOpen:true,x:L.clientX,y:L.clientY,task:D});},[v]),Ad=react.useCallback((D,L)=>{let W=_.splitTask(ie,D.id,L);me(W),tt({isOpen:false,x:0,y:0,task:null});},[ie]),Ps=react.useCallback(D=>{C?.(D),S||$t(D);},[C,S]),Ms=react.useCallback((D,L,W)=>{let Q=new Map,ne=Xt=>{Xt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&ne(ua.subtasks);});};ne(W);let ce=Q.get(L)||[];Q.set(L,[...ce,D]);let pt=new Set,Dt=new Set,Yt=Xt=>{if(!pt.has(Xt)){pt.add(Xt),Dt.add(Xt);let ua=Q.get(Xt)||[];for(let dr of ua){if(!pt.has(dr)&&Yt(dr))return true;if(Dt.has(dr))return true}}return Dt.delete(Xt),false};return Yt(L)},[]),Is=react.useCallback((D,L)=>{if(Ms(D.id,L,ie)){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 W=Q=>Q.map(ne=>{if(ne.id===L){let ce=ne.dependencies||[];if(!ce.includes(D.id))return {...ne,dependencies:[...ce,D.id]}}return ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne});
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let W=Q=>Q.map(ne=>{if(ne.id===L){let ce=ne.dependencies||[];if(!ce.includes(D.id))return {...ne,dependencies:[...ce,D.id]}}return ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne});me(W(ie)),I?.(D.id,L);},[ie,I,Ms]),Ls=react.useCallback((D,L)=>{let W=Q=>Q.map(ne=>{if(ne.id===D&&ne.dependencies){let ce=ne.dependencies.filter(pt=>pt!==L);return {...ne,dependencies:ce}}return ne.subtasks?{...ne,subtasks:W(ne.subtasks)}:ne});me(W(ie)),$?.(D,L);},[ie,$]),{startDate:Fd,endDate:Bd}=react.useMemo(()=>{let D=ie.filter(ce=>ce.startDate&&ce.endDate);if(D.length===0){let ce=new Date,pt=new Date(ce);pt.setDate(pt.getDate()-30);let Dt=new Date(ce);return Dt.setDate(Dt.getDate()+60),{startDate:pt,endDate:Dt}}let L=D.flatMap(ce=>[ce.startDate,ce.endDate]).filter(ce=>ce!==void 0),W=new Date(Math.min(...L.map(ce=>ce.getTime()))),Q=new Date(Math.max(...L.map(ce=>ce.getTime()))),ne=N==="day"?7:N==="week"?14:30;return W.setDate(W.getDate()-ne),Q.setDate(Q.getDate()+ne),{startDate:W,endDate:Q}},[ie,N]),Rd=react.useCallback(async()=>{if(!He.current)return;let D=await pl__default.default(He.current,{backgroundColor:Ae.bgPrimary,scale:2}),L=document.createElement("a");L.download="gantt-chart.png",L.href=D.toDataURL("image/png"),L.click();},[Ae]),Od=react.useCallback(async()=>{await _.exportToPDF(ie);},[ie]),zd=react.useCallback(async()=>{await _.exportToExcel(ie);},[ie]),Ud=react.useCallback(()=>{let D=_.exportToCSV(ie),L=new Blob([D],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(L),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href);},[ie]),Gd=react.useCallback(()=>{let D=_.exportToJSON(ie),L=new Blob([D],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(L),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href);},[ie]),$d=react.useCallback(()=>{_.exportToMSProject(ie,"Gantt Project","project.xml");},[ie]),Wd=D=>{D.preventDefault(),Ut(true);};return react.useEffect(()=>{let D=ze.current,L=ve.current;if(!D||!L)return;let W=L.querySelector(".gantt-taskgrid-content"),Q=()=>{let pt=D.scrollTop;mt(pt),W&&(W.style.transform=`translateY(-${pt}px)`);},ne=pt=>{if(je&&L){let Yt=L.parentElement?.getBoundingClientRect()?.left||0,Xt=pt.clientX-Yt,ua=200,dr=Math.min(window.innerWidth-300,800);Xt>=ua&&Xt<=dr&&ya(Xt);}},ce=()=>{Ut(false);};return D.addEventListener("scroll",Q),document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ce),()=>{D.removeEventListener("scroll",Q),document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ce);}},[je]),jsxRuntime.jsx(ar.Provider,{value:de,children:jsxRuntime.jsx(Lo.Provider,{value:it,children:jsxRuntime.jsxs("div",{ref:He,className:"flex flex-col h-full w-full",style:{backgroundColor:Ae.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(qr,{theme:Ae,timeScale:N,onTimeScaleChange:Z,zoom:$e,onZoomChange:Ft,currentTheme:G,onThemeChange:pa,rowDensity:te,onRowDensityChange:Be,showThemeSelector:m,showCreateTaskButton:x,createTaskLabel:b,onCreateTask:f,onExportPNG:s?Rd:void 0,onExportPDF:s?Od:void 0,onExportExcel:s?zd:void 0,onExportCSV:s?Ud:void 0,onExportJSON:s?Gd:void 0,onExportMSProject:s?$d:void 0}),jsxRuntime.jsxs("div",{ref:ve,className:"flex-1 flex min-h-0",style:{overflow:"hidden"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:he,overflow:"hidden"},children:jsxRuntime.jsx(Qr,{tasks:Tt,theme:Ae,rowHeight:Nt,availableUsers:p,templates:le,onTaskClick:h,onTaskDblClick:Ps,onTaskContextMenu:v,onTaskToggle:Ue,scrollTop:we,columns:_t,onToggleColumn:M,onColumnResize:ae,onTaskUpdate:bt,onTaskIndent:ia,onTaskOutdent:Dd,onTaskMove:Sd,onMultiTaskDelete:Ss,onTaskDuplicate:Ed,onTaskCreate:Pd,onTaskRename:Md,onCreateSubtask:Es,onOpenTaskModal:h?D=>h(D):void 0})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Wd}),jsxRuntime.jsx("div",{ref:ze,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(io,{tasks:Tt,theme:Ae,rowHeight:Nt,timeScale:N,startDate:Fd,endDate:Bd,zoom:$e,templates:le,onTaskClick:h,onTaskDblClick:Ps,onTaskContextMenu:Ld,onTaskDateChange:Id,onDependencyCreate:Is,onDependencyDelete:Ls})})]}),ue.task&&jsxRuntime.jsx(rr,{isOpen:ue.isOpen,x:ue.x,y:ue.y,theme:Ae,onClose:()=>tt({isOpen:false,x:0,y:0,task:null}),items:[{id:"edit",label:de.contextMenu?.editTask||"Edit Task",icon:ft.Pencil,onClick:()=>{ue.task&&(S?S(ue.task):$t(ue.task));}},{id:"addSubtask",label:de.contextMenu?.addSubtask||"Add Subtask",icon:ft.Add,onClick:()=>{ue.task&&(T?T(ue.task):Es(ue.task.id));}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:de.contextMenu?.markIncomplete||"Mark Incomplete",icon:ft.MarkIncomplete,onClick:()=>{ue.task&&(O?O(ue.task):bt(ue.task.id,{status:"todo",progress:0}));},disabled:ue.task?.status==="todo"},{id:"setInProgress",label:de.contextMenu?.setInProgress||"Set In Progress",icon:ft.SetInProgress,onClick:()=>{ue.task&&(z?z(ue.task):bt(ue.task.id,{status:"in-progress"}));},disabled:ue.task?.status==="in-progress"},{id:"markComplete",label:de.contextMenu?.markComplete||"Mark Complete",icon:ft.MarkComplete,onClick:()=>{ue.task&&bt(ue.task.id,{status:"completed",progress:100});},disabled:ue.task?.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:de.contextMenu?.splitTask||"Split Task",icon:ft.Split,onClick:()=>{if(!ue.task?.startDate||!ue.task?.endDate){console.warn("Cannot split task without dates");return}let D=ue.task.startDate.getTime(),L=ue.task.endDate.getTime(),W=D+(L-D)/2,Q=new Date(W);Ad(ue.task,Q);},disabled:!ue.task?.startDate||!ue.task?.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:de.contextMenu?.deleteTask||"Delete Task",icon:ft.Delete,onClick:()=>{ue.task&&Ss([ue.task.id]);}}]}),Gt&&jsxRuntime.jsx(lo,{isOpen:true,onClose:()=>$t(null),task:Gt,onSubmit:D=>{bt(Gt.id,D),$t(null);},mode:"edit",theme:G}),g?.enabled&&jsxRuntime.jsx(co,{tasks:ie,theme:Ae,config:g,onTasksUpdate:me,onTaskUpdate:bt,onTaskCreate:D=>{me(L=>[...L,D]);},onTaskDelete:D=>{me(L=>Zr(L,[D]));},onDependencyCreate:(D,L)=>{let W=_.findTaskById(ie,D);W&&Is(W,L);},onDependencyDelete:Ls})]})})})});var fl=`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,17 +316,17 @@ 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
|
|
320
|
-
${
|
|
319
|
+
If ambiguous, ask for clarification in the message field.`;function bl(e){return `CURRENT TASKS:
|
|
320
|
+
${hl(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 bl(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function va(e,t){let a=bl(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let i=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return i.every(s=>p.includes(s))})}function zn(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 l=new Date(r);return l.setDate(l.getDate()+1),l}if(a==="yesterday"||a==="ayer"){let l=new Date(r);return l.setDate(l.getDate()-1),l}if(a==="next week"||a==="la pr\xF3xima semana"){let l=new Date(r);return l.setDate(l.getDate()+7),l}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 k=new Date(r),y=k.getDay(),x=u-y;return x<=0&&(x+=7),k.setDate(k.getDate()+x),k}}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 l=parseInt(n[1],10),u=n[2].toLowerCase(),k=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?k.setDate(k.getDate()+l):u==="week"||u==="semana"||u==="semanas"?k.setDate(k.getDate()+l*7):(u==="month"||u==="mes"||u==="meses")&&k.setMonth(k.getMonth()+l),k}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let l=parseInt(c[1],10),u=parseInt(c[2],10)-1,k=parseInt(c[3],10);return new Date(k,u,l)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},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 l=parseInt(s[1],10),u=p[s[2].toLowerCase()],k=s[3]?parseInt(s[3],10):r.getFullYear();if(u!==void 0)return new Date(k,u,l)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let l=m[d[1].toLowerCase()],u=parseInt(d[2],10),k=d[3]?parseInt(d[3],10):r.getFullYear();if(l!==void 0)return new Date(k,l,u)}return null}function Un(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 Gn(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 vl(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 yl(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(),m=r[2].trim(),d=va(t,s),l=zn(m);if(!d)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(!l)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,k=new Date(l);return k.setDate(k.getDate()+u),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:l,endDate:k},message:`Moved "${d.name}" to ${l.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(),m=o[2].trim(),d=va(t,s),l=Un(m);if(!d)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"};if(!l||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(d.endDate);return u.setDate(u.getDate()+l),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:u},message:`Extended "${d.name}" by ${l} 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(),m=n[2].trim(),d=va(t,s),l=Gn(m);return d?l===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:l},message:`Set "${d.name}" progress to ${l}%.`,success:true}:{type:"set_progress",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let i=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let s=i[1].trim(),m=i[2].trim(),d=va(t,s);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let s=c[1].trim(),m=c[2].trim(),d=va(t,s),l=va(t,m);return d?l?{type:"link_tasks",taskId:l.id,taskName:l.name,dependencyFrom:d.id,dependencyTo:l.id,message:`Linked "${d.name}" \u2192 "${l.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let s=p[1].trim(),m=va(t,s);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.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 xl(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 Vu(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 ju(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function mo(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(l=>l.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>mo(m,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let i=m=>{if(m)return typeof m=="string"?new Date(m):m},c=i(e.startDate),p=i(e.endDate),s=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:Vu(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 kl(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:ju(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function wl(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>mo(r,e,t))}var $n={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"}},Wn={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"}},uo={en:$n,es:Wn};function Hn(e){return uo[e]||uo.en}function go(e,t){let a=Hn(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 Dl(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(...Dl(r.subtasks,t+1));return a}function rg({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 Sl({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:i}){let{theme:c="dark",locale:p="en",customTranslations:s,showSearch:m=true,showHierarchy:d=true}=t,l=go(p,s),u=c==="dark",[k,y]=react.useState(new Set),[x,f]=react.useState("startDate"),[h,g]=react.useState("asc"),[b,w]=react.useState("");react.useMemo(()=>{let T=new Set;function U(O){for(let I of O)I.subtasks?.length&&(T.add(I.id),U(I.subtasks));}U(e),y(T);},[e]);let v=react.useCallback(T=>{y(U=>{let O=new Set(U);return O.has(T)?O.delete(T):O.add(T),O}),a.onTaskToggleExpand?.(T);},[a]),P=react.useCallback(T=>{x===T?g(U=>U==="asc"?"desc":"asc"):(f(T),g("asc")),a.onSortChange?.({column:T,direction:h==="asc"?"desc":"asc"});},[x,h,a]),C=react.useMemo(()=>{let T=Dl(e);if(b.trim()){let O=b.toLowerCase();T=T.filter(I=>I.name.toLowerCase().includes(O));}let U=[];for(let O of T){let I=O.level===0;O.level>0&&(I=true),(I||b.trim())&&U.push(O);}return b.trim()&&U.sort((O,I)=>{let $,S;switch(x){case "name":$=O.name.toLowerCase(),S=I.name.toLowerCase();break;case "startDate":$=O.startDate?.getTime()||0,S=I.startDate?.getTime()||0;break;case "endDate":$=O.endDate?.getTime()||0,S=I.endDate?.getTime()||0;break;case "progress":$=O.progress||0,S=I.progress||0;break;case "status":$=O.status||"todo",S=I.status||"todo";break;default:return 0}return $<S?h==="asc"?-1:1:$>S?h==="asc"?1:-1:0}),U},[e,b,x,h]),E=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:F("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[l.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:F("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:l.empty.noTasks}),jsxRuntime.jsx("p",{className:F("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:F("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",n),style:i,children:[jsxRuntime.jsx("div",{className:F("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:F("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:b,onChange:T=>w(T.target.value),placeholder:l.toolbar.searchPlaceholder,className:F("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:F("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",l.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:F("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>P("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[l.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C.map((T,U)=>{let O=k.has(T.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:F("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),v(T.id);},className:F("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:O?jsxRuntime.jsx(lucideReact.ChevronDown,{className:F("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:F("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),d&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(rg,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:F("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:F("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?l.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?l.status.inProgress:l.status.todo})}),jsxRuntime.jsxs("div",{className:F("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"}),E(T.startDate)]}),jsxRuntime.jsxs("div",{className:F("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"}),E(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:F("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:F("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:F("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&b&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:F("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:F(u?"text-[#9CA3AF]":"text-gray-600"),children:l.empty.noResults})]})})]})]})}var _n={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"},Vn={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"},jn={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"},ho={dark:_n,light:Vn,neutral:jn};function El(e){return ho[e]||ho.dark}var Kn={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"}},Yn={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"}},bo={en:Kn,es:Yn};function Tr(e){return bo[e]||bo.en}function vo(e,t){let a=Tr(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 Pl(e){let t=Tr(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 Ml(e,t=0,a=true){let r=Tr(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 mg(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 qn(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 ug({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 Al({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:i,style:c}){let{theme:p="dark",locale:s="en",customTranslations:m}=t,d=vo(s,m),l=p==="dark",[u,k]=react.useState(r||new Date),[y,x]=react.useState(null),f=react.useCallback(()=>{k(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),h=react.useCallback(()=>{k(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),g=react.useCallback(()=>{k(new Date);},[]),b=react.useMemo(()=>{let C=u.getFullYear(),E=u.getMonth(),T=new Date(C,E,1),U=new Date(C,E+1,0),O=T.getDay(),I=U.getDate(),$=mg(e),S=new Date;S.setHours(0,0,0,0);let z=[],Y=O,ee=new Date(C,E,0).getDate();for(let J=Y-1;J>=0;J--){let G=new Date(C,E-1,ee-J);z.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(se=>qn(G,se)).map(se=>({id:se.id,title:se.name,start:se.startDate,end:se.endDate,task:se}))});}for(let J=1;J<=I;J++){let G=new Date(C,E,J),se=G.getTime()===S.getTime();z.push({date:G,isCurrentMonth:true,isToday:se,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(N=>qn(G,N)).map(N=>({id:N.id,title:N.name,start:N.startDate,end:N.endDate,task:N}))});}let R=42-z.length;for(let J=1;J<=R;J++){let G=new Date(C,E+1,J);z.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(se=>qn(G,se)).map(se=>({id:se.id,title:se.name,start:se.startDate,end:se.endDate,task:se}))});}return z},[u,e]),w=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],v=u.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),P=react.useCallback(C=>{let E=C.progress===100?0:100,T=E===100?"completed":"todo";a.onTaskUpdate?.({...C,status:T,progress:E});},[a]);return o?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:F("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:F("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",l?"bg-[#0F1117]":"bg-white",i),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",l?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:F("text-sm",l?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:F("flex-1 flex flex-col w-full h-full overflow-hidden",l?"bg-[#0F1117]":"bg-white",i),style:c,children:[jsxRuntime.jsx("div",{className:F("flex-shrink-0 px-6 py-4 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:F("text-xl font-semibold capitalize",l?"text-white":"text-gray-900"),children:v}),jsxRuntime.jsx("button",{onClick:g,className:F("px-3 py-1.5 text-sm rounded-lg transition-colors",l?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:f,className:F("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:F("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:h,className:F("p-2 rounded-lg transition-colors",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:F("w-5 h-5",l?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 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:w.map(C=>jsxRuntime.jsx("div",{className:F("py-2 text-center text-xs font-medium uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:C},C))}),jsxRuntime.jsx("div",{className:F("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",l?"bg-white/5":"bg-gray-200"),children:b.map((C,E)=>jsxRuntime.jsxs("div",{className:F("min-h-[100px] p-2 transition-colors",l?"bg-[#0F1117]":"bg-white",!C.isCurrentMonth&&(l?"bg-[#0F1117]/50":"bg-gray-50"),C.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:F("text-sm font-medium mb-1",C.isToday?"text-[#3B82F6]":C.isCurrentMonth?l?"text-white":"text-gray-900":l?"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(T=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(T.task),a.onEventClick?.(T);},whileHover:{scale:1.02},className:F("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",T.task.progress===100?l?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":l?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(ug,{task:T.task}),jsxRuntime.jsx("span",{className:"truncate",children:T.title})]},T.id)),C.events.length>3&&jsxRuntime.jsxs("div",{className:F("text-xs px-1.5",l?"text-[#6B7280]":"text-gray-400"),children:["+",C.events.length-3," ",s==="es"?"m\xE1s":"more"]})]})]},E))})]})}),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:F("fixed right-0 top-0 h-full w-80 border-l shadow-xl z-50",l?"bg-[#1A1D25] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:F("p-4 border-b flex items-center justify-between",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:F("font-semibold",l?"text-white":"text-gray-900"),children:s==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>x(null),className:F("p-1 rounded",l?"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:F("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:F("font-medium",l?"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:F("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:F("text-sm",l?"text-white":"text-gray-900"),children:y.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:F("text-xs uppercase",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:F("text-sm",l?"text-white":"text-gray-900"),children:y.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:F("text-xs uppercase mb-2 block",l?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:F("flex-1 h-2 rounded-full overflow-hidden",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:F("h-full rounded-full transition-all",y.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${y.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:F("text-sm font-medium w-10",l?"text-white":"text-gray-900"),children:[y.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{P(y),x(null);},className:F("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?s==="es"?"Marcar como pendiente":"Mark as pending":s==="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 Jn={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"},Zn={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"},Qn={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"},xo={dark:Jn,light:Zn,neutral:Qn};function Fl(e){return xo[e]||xo.dark}function fg({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:i,className:c}){let[p,s]=react.useState(false),m=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),d=react.useMemo(()=>{let u=m.length,k=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,y=m.map(f=>f.priority).filter(Boolean),x=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:u,uniqueAssignees:k,priorities:y,labels:x}},[m]),l=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:F("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:l,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:F("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),i?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:m.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:m.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:k=>{k.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 Rl={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Nr(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 Dr(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 Ol(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 zl({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:i,className:c}){let p=react.useMemo(()=>({...Rl,...i}),[i]),[s,m]=react.useState(new Set),d=react.useRef(null),l=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(g=>{let b=g.timestamp.toISOString().split("T")[0],w=h.get(b);w?w.push(g):h.set(b,[g]);}),Array.from(h.entries()).sort((g,b)=>b[0].localeCompare(g[0])).map(([g,b])=>({date:new Date(g),events:b.sort((w,v)=>v.timestamp.getTime()-w.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:k}=react.useMemo(()=>{let h=new Set,g=new Set;return e.forEach(b=>{h.add(b.userId),g.add(b.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(g)}},[e]),y=h=>{m(g=>{let b=new Set(g);return b.has(h)?b.delete(h):b.add(h),b});},x=h=>{let b=new Date().getTime()-h.getTime(),w=Math.floor(b/6e4),v=Math.floor(b/36e5),P=Math.floor(b/864e5);return w<1?"just now":w<60?`${w}m ago`:v<24?`${v}h ago`:P<7?`${P}d ago`:h.toLocaleDateString()},f=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(n&&d.current){let h=d.current.querySelector(`[data-event-id="${n}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:F("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:F("history-timeline",p.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let g=h.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),k.map(h=>jsxRuntime.jsxs("option",{value:h,children:[Dr(h)," ",h.replace("_"," ")]},h))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let g=h.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:l.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((g,b)=>{let w=s.has(g.id),v=n===g.id,P=Ol(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:F("history-timeline-event",w&&"expanded",v&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:P},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Dr(g.type)})}),b<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:P}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&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:Nr(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?x(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),y(g.id);},children:[w?"\u25BC":"\u25B6"," Show changes"]}),w&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([C,E])=>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(E.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.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,E])=>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(E)})]},C))]})]})]})]},g.id)})})]},h.date?.toISOString()||"all"))})]})}function Gl({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:i,onGoToEvent:c,onSpeedChange:p,className:s}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),l=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:F("history-replay-empty",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:F("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Dr(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Nr(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${l}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,k)=>jsxRuntime.jsx("div",{className:F("history-replay-progress-marker",k===e.currentIndex&&"active"),style:{left:`${k/(e.totalEvents-1)*100}%`},onClick:()=>c(k),title:Nr(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:i,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxRuntime.jsxs("button",{className:F("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:F("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 es(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 ts(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 $l(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 Wl(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function kg(e,t,a,r,o,n=100){let i=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(i.map(p=>[p.id,p]));for(let p=0;p<n;p++){let s=1-p/n;i.forEach(m=>{let d=a/2,l=r/2;m.vx+=(d-m.x)*o.centerForce*s,m.vy+=(l-m.y)*o.centerForce*s,i.forEach(u=>{if(m.id===u.id)return;let k=m.x-u.x,y=m.y-u.y,x=Math.sqrt(k*k+y*y)||1,f=o.chargeStrength*s/(x*x);m.vx+=k/x*f,m.vy+=y/x*f;});}),t.forEach(m=>{let d=c.get(typeof m.source=="string"?m.source:m.source.id),l=c.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!l)return;let u=l.x-d.x,k=l.y-d.y,y=Math.sqrt(u*u+k*k)||1,x=(y-o.linkDistance)/y*o.forceStrength*s;d.vx+=u*x,d.vy+=k*x,l.vx-=u*x,l.vy-=k*x;}),i.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return i}function Hl({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:i,onInteraction:c,className:p}){let s=react.useRef(null),[m,d]=react.useState([]),[l,u]=react.useState(null),[k,y]=react.useState(null),[x,f]=react.useState(null),[h,g]=react.useState(1),[b,w]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=kg(e,t,a.width,a.height,a,150);d(I);},[e,t,a]);let v=react.useCallback((I,$)=>{a.enableDragging&&($.stopPropagation(),u(I));},[a.enableDragging]),P=react.useCallback(I=>{if(!l||!s.current)return;let S=s.current.getBoundingClientRect(),z=(I.clientX-S.left-b.x)/h,Y=(I.clientY-S.top-b.y)/h;d(ee=>ee.map(R=>R.id===l?{...R,x:z,y:Y,fx:z,fy:Y}:R));},[l,h,b]),C=react.useCallback(()=>{u(null);},[]),E=react.useCallback((I,$)=>{$.stopPropagation(),c?.({type:"node-click",node:I,position:{x:$.clientX,y:$.clientY}});},[c]),T=react.useCallback((I,$)=>{$.stopPropagation(),c?.({type:"edge-click",edge:I,position:{x:$.clientX,y:$.clientY}});},[c]),U=react.useCallback(I=>{let $=m.find(S=>S.id===I);return $?{x:$.x,y:$.y}:{x:0,y:0}},[m]),O=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:F("relationships-graph-empty",p),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:F("relationships-graph",p),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:i.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:i.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(h*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),w({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:es(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[$l(I)," ",ts(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:P,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${b.x}, ${b.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let $=U(typeof I.source=="string"?I.source:I.source.id),S=U(typeof I.target=="string"?I.target:I.target.id),z=Wl(I.type),Y=x===I.id,ee=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:F("relationships-graph-edge",Y&&"hovered",ee&&"critical"),onMouseEnter:()=>f(I.id),onMouseLeave:()=>f(null),onClick:R=>T(I,R),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:S.x,y2:S.y,stroke:es(I.type),strokeWidth:ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Y?1:.6,markerEnd:z?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Y&&jsxRuntime.jsx("text",{x:($.x+S.x)/2,y:($.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ts(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(I=>{let $=k===I.id,S=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:F("relationships-graph-node",$&&"hovered",S&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:z=>v(I.id,z),onMouseEnter:()=>y(I.id),onMouseLeave:()=>y(null),onClick:z=>E(I,z),children:[jsxRuntime.jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:O(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 jl({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,i]=react.useState(""),[c,p]=react.useState(false),[s,m]=react.useState(null),[d,l]=react.useState(null),u=react.useRef(null),k=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let h=g=>{g.key==="Escape"&&!k&&y();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,k]);let y=()=>{k||(i(""),m(null),l(null),t());},x=async()=>{if(!(!n.trim()||k)){p(true),m(null),l(null);try{let h=await r(n.trim());l(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{p(false);}}},f=()=>{d&&(a(d),y());};return e?jsxRuntime.jsxs(Ge,{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:h=>h.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:y,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,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:h.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},g)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:n,onChange:h=>i(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),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((h,g)=>jsxRuntime.jsx("button",{onClick:()=>i(h),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&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:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:x,disabled:!n.trim()||k,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:k?"Generating...":"Generate Plan"})]})]})]})})]}):null}var as={"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 Cg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Tg={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 Ng(e,t,a){let r=as[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Sr(e){return `$${e.toFixed(4)}`}var rs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Ng(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,l)=>d+l.cost,0),n=a.reduce((d,l)=>d+l.inputTokens,0),i=a.reduce((d,l)=>d+l.outputTokens,0),c=a.filter(d=>d.success),p=a.reduce((d,l)=>d+l.duration,0),s={},m={};return a.forEach(d=>{s[d.feature]=(s[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:i,operationsByFeature:s,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],n=new Date,i=new Date;a==="month"?i.setMonth(n.getMonth()-1):i.setDate(n.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=i).length,p=Math.max(0,o-c),s=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:s,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$a=new rs;function Xl({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState($a.getStats()),[n,i]=react.useState($a.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o($a.getStats()),i($a.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=$a.getRecentOperations(5);return jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[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:Sr(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,s])=>{let m=r.costsByFeature[p]||0,d=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:p.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Sr(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(p=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Sr(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Zl({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[i,c]=react.useState(""),[p,s]=react.useState(""),[m,d]=react.useState(""),[l,u]=react.useState(false),[k,y]=react.useState(null),[x,f]=react.useState(null),[h,g]=react.useState(null),b=react.useRef(null),w=l||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let T=U=>{U.key==="Escape"&&!w&&v();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,w]);let v=()=>{w||(c(""),s(""),d(""),y(null),f(null),g(null),t());},P=async()=>{if(!(!i.trim()||w)){u(true),y(null),f(null),g(null);try{let T=await r({prompt:i.trim(),projectName:n||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});f(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){y(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{x&&(a(x),v());};if(!e)return null;let E=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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:T=>T.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:v,disabled:w,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:[h?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[x.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:x.map((T,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:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.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:b,value:i,onChange:T=>c(T.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:w}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>s(T.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:w})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>d(T.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:w})]})]}),k&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:k}),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((T,U)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:w,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:T},U))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&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:v,disabled:w,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: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:P,disabled:!i.trim()||w,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:w?"Generating...":"Generate Tasks"})]})]})]})})]})}function Co({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(x=>{t&&Br(()=>Promise.resolve(t(x)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,g)=>{console.warn(`Retry attempt ${h} after ${g}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),n=react.useCallback(async(x,f,h)=>{r(g=>{let b=g.cards.find(T=>T.id===x);if(!b)return g;let w=b.columnId,v={...b,columnId:f,position:h},P=g.cards.map(T=>T.id===x?v:T),C=g.columns.map(T=>{if(T.id===w)return {...T,cardIds:T.cardIds.filter(U=>U!==x)};if(T.id===f){let U=P.filter(O=>O.columnId===f).sort((O,I)=>O.position-I.position);return {...T,cardIds:U.map(O=>O.id)}}return T}),E={...g,cards:P,columns:C};return o(E),E});},[o]),i=react.useCallback(async(x,f)=>{r(h=>{let g=h.cards.map(w=>w.id===x?{...w,...f}:w),b={...h,cards:g};return o(b),b});},[o]),c=react.useCallback(async x=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let g={...x,id:f},b=h.columns.map(v=>v.id===x.columnId?{...v,cardIds:[...v.cardIds,f]}:v),w={...h,cards:[...h.cards,g],columns:b};return o(w),w});},[o]),p=react.useCallback(async x=>{r(f=>{let h=f.cards.find(v=>v.id===x);if(!h)return f;let g=f.cards.filter(v=>v.id!==x),b=f.columns.map(v=>v.id===h.columnId?{...v,cardIds:v.cardIds.filter(P=>P!==x)}:v),w={...f,cards:g,columns:b};return o(w),w});},[o]),s=react.useCallback(async x=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let g={...x,id:f,cardIds:[]},b={...h,columns:[...h.columns,g]};return o(b),b});},[o]),m=react.useCallback(async(x,f)=>{r(h=>{let g=h.columns.map(w=>w.id===x?{...w,...f}:w),b={...h,columns:g};return o(b),b});},[o]),d=react.useCallback(async x=>{r(f=>{let h=f.cards.filter(w=>w.columnId!==x),g=f.columns.filter(w=>w.id!==x),b={...f,cards:h,columns:g};return o(b),b});},[o]),l=react.useCallback(x=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(x),f},[c]),u=react.useCallback(x=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(x),f},[s]),k=react.useCallback(()=>{r(x=>{let f={...x,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:i,onCardCreate:c,onCardDelete:p,onColumnCreate:s,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:l,addColumn:u,deleteCard:p,deleteColumn:d,clearBoard:k}}}function ed({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Co({initialBoard:e,onPersist:a}),i=react.useMemo(()=>({addCard:(p,s,m={})=>{n.addCard({title:s,columnId:p,position:r.cards.filter(d=>d.columnId===p).length,...m});},addColumn:(p,s)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;n.addColumn({title:p,position:s??m+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:i}}var Er={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ad={by:"none",order:"asc"};function rd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Er,...e}),[n,i]=react.useState({...ad,...t}),c=react.useCallback(y=>{o(x=>({...x,...y}));},[]),p=react.useCallback(y=>{i(x=>({...x,...y}));},[]),s=react.useCallback(()=>{o(Er),i(ad);},[]),m=react.useCallback(()=>{a&&o({...Er,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Er,dateFilter:"overdue"});},[]),l=react.useCallback(()=>{o({...Er,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]),k=react.useCallback(y=>{let x=[...y];if(r.search){let f=r.search.toLowerCase();x=x.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),g=String(f.getMonth()+1).padStart(2,"0"),b=String(f.getDate()).padStart(2,"0"),w=`${h}-${g}-${b}`;x=x.filter(v=>{if(!v.endDate&&!v.dueDate)return false;let P=v.endDate||v.dueDate;if(!P)return false;let C;if(typeof P=="string")C=P.split("T")[0]||P;else {let E=P.getUTCFullYear(),T=String(P.getUTCMonth()+1).padStart(2,"0"),U=String(P.getUTCDate()).padStart(2,"0");C=`${E}-${T}-${U}`;}switch(r.dateFilter){case "overdue":return C<w;case "today":return C===w;case "this-week":let E=new Date(w+"T00:00:00"),T=new Date(C+"T00:00:00"),U=new Date(E);return U.setDate(U.getDate()+7),T>=E&&T<=U;case "custom":if(r.dateRange){let O=typeof P=="string"?new Date(P):P;return O>=r.dateRange.start&&O<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(x=x.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(x=x.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(x=x.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(x=x.filter(f=>r.columns.includes(f.columnId))),n.by!=="none"&&x.sort((f,h)=>{let g=0;switch(n.by){case "created":let b=f.createdAt?new Date(f.createdAt).getTime():0,w=h.createdAt?new Date(h.createdAt).getTime():0;g=b-w;break;case "priority":let v={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},P=v[f.priority||"LOW"],C=v[h.priority||"LOW"];g=P-C;break;case "dueDate":let E=f.endDate||f.dueDate,T=h.endDate||h.dueDate;if(!E)return 1;if(!T)return -1;let U=typeof E=="string"?new Date(E).getTime():E.getTime(),O=typeof T=="string"?new Date(T).getTime():T.getTime();g=U-O;break;case "title":g=f.title.localeCompare(h.title);break;case "estimate":let I=f.estimatedTime||0,$=h.estimatedTime||0;g=I-$;break;default:g=0;}return n.order==="asc"?g:-g}),x},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:p,resetFilters:s,filterMyTasks:m,filterOverdue:d,filterHighPriority:l,applyFilters:k,hasActiveFilters:u}}var nd,sd;if(typeof window<"u")try{let e=Lr("ai");nd=e.generateObject,sd=e.generateText;}catch{}function id(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(nd&&sd&&e.apiKey),i=react.useCallback(async d=>{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:",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(l){let u=l instanceof Error?l:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[n]),c=react.useCallback(async d=>{if(!n)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(l){let u=l instanceof Error?l:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[n]),p=react.useCallback(async d=>{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(l){let u=l instanceof Error?l:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[n]),s=react.useCallback(async d=>{if(!n)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(l){let u=l instanceof Error?l:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[n]),m=react.useCallback(async d=>{if(!n)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(l){let u=l instanceof Error?l:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[n]);return {onGeneratePlan:i,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:s,onEstimateEffort:m,isAvailable:n,isLoading:t,error:r}}function ns(){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 ld(e){let{cards:t}=e,[a,r]=ns(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),n=react.useCallback((d,l)=>{if(!l){r({selectedCardIds:[d],lastSelectedCardId:d});return}let u=l.ctrlKey||l.metaKey,k=l.shiftKey;if(u)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(y=>y!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(k&&a.lastSelectedCardId){let y=t.find(f=>f.id===d),x=t.find(f=>f.id===a.lastSelectedCardId);if(y&&x&&y.columnId===x.columnId){let f=t.filter(C=>C.columnId===y.columnId).sort((C,E)=>C.position-E.position),h=f.findIndex(C=>C.id===a.lastSelectedCardId),g=f.findIndex(C=>C.id===d),[b,w]=h<g?[h,g]:[g,h],v=f.slice(b,w+1).map(C=>C.id),P=Array.from(new Set([...a.selectedCardIds,...v]));r({selectedCardIds:P,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),i=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(l=>l!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=react.useCallback(d=>{a.selectedCardIds.includes(d)?i(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,i,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:i,clearSelection:c,selectAll:p,toggleCard:s,getSelectedCards:m}}var dd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...dd,...a}),[a]),[n,i]=react.useState([]),c=react.useCallback((y,x,f,h,g)=>{if(x.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let b={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:x,columnId:f,strategy:h,color:g,isExpanded:true,position:n.filter(w=>w.columnId===f).length,createdAt:new Date};i(w=>[...w,b]);},[o.minCardsPerStack,n]),p=react.useCallback(y=>{i(x=>x.filter(f=>f.id!==y));},[]),s=react.useCallback(y=>{i(x=>x.map(f=>f.id===y?{...f,isExpanded:!f.isExpanded}:f));},[]),m=react.useCallback((y,x)=>{i(f=>f.map(h=>h.id===y&&!h.cardIds.includes(x)?{...h,cardIds:[...h.cardIds,x]}:h));},[]),d=react.useCallback((y,x)=>{i(f=>f.map(h=>{if(h.id===y){let g=h.cardIds.filter(b=>b!==x);return g.length<o.minCardsPerStack?null:{...h,cardIds:g}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),l=react.useCallback(y=>n.filter(x=>x.columnId===y).sort((x,f)=>x.position-f.position),[n]),u=react.useCallback(async y=>{let x=t.filter(w=>w.columnId===y);if(x.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;x.forEach(w=>{w.labels&&w.labels.length>0&&w.labels.forEach(v=>{h.has(v)||h.set(v,[]),h.get(v).push(w);});}),h.forEach((w,v)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${v}`,cardIds:w.map(P=>P.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${w.length} cards with label "${v}"`,confidence:.85});});let g=new Map;x.forEach(w=>{w.assignedUserIds&&w.assignedUserIds.length>0&&w.assignedUserIds.forEach(v=>{g.has(v)||g.set(v,[]),g.get(v).push(w);});}),g.forEach((w,v)=>{w.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${v.slice(-4)}`,cardIds:w.map(P=>P.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${w.length} cards assigned to the same user`,confidence:.8});});let b=new Map;if(x.forEach(w=>{w.priority&&(b.has(w.priority)||b.set(w.priority,[]),b.get(w.priority).push(w));}),b.forEach((w,v)=>{if(w.length>=o.minCardsPerStack){let P={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[v.toLowerCase()]||"\u26AA";f.push({stack:{title:`${P} ${v} Priority`,cardIds:w.map(C=>C.id),columnId:y,strategy:"priority",color:v==="high"||v==="urgent"?"#ef4444":"#10b981"},reason:`${w.length} cards with ${v} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let w of x){let P=(await r.findSimilar(w,x)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(P.length>=o.minCardsPerStack-1){let C=[w.id,...P.map(T=>T.card.id)],E=P.reduce((T,U)=>T+U.similarity,0)/P.length;f.push({stack:{title:`\u2728 Similar to "${w.title.substring(0,30)}${w.title.length>30?"...":""}"`,cardIds:C,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${P.length+1} similar tasks`,confidence:E});}}return f.filter(w=>w.confidence>=o.autoStackConfidenceThreshold).sort((w,v)=>v.confidence-w.confidence).slice(0,5)},[t,o,r]),k=react.useCallback(y=>{c(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(x=>x.columnId)).forEach(async x=>{let f=await u(x),h=f[0];f.length>0&&h&&h.confidence>=.9&&k(h);});},[]),{stacks:n,createStack:c,deleteStack:p,toggleStack:s,addToStack:m,removeFromStack:d,getStacksForColumn:l,getSuggestions:u,applySuggestion:k,config:o}}var pd=react.createContext(null);function md({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,i=new Map;t?.columns?.forEach(p=>{let{Column:s}=Lr("@libxai/core");n.set(p.id,new s(p));}),t?.cards?.forEach(p=>{let{Card:s}=Lr("@libxai/core");i.set(p.id,new s(p));});let c=null;if(t?.board){let{Board:p}=Lr("@libxai/core");c=new p(t.board);}r.current=new core.BoardStore({board:c,columns:n,cards:i});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(pd.Provider,{value:{store:o},children:e})}function To(){let e=react.useContext(pd);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Mr(){let e=To(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,i]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),i(e.getAllCards());}),[e]);let c=react.useCallback(h=>{e.updateBoard(h);},[e]),p=react.useCallback(h=>{e.addColumn(h);},[e]),s=react.useCallback((h,g)=>{e.updateColumn(h,g);},[e]),m=react.useCallback(h=>{e.deleteColumn(h);},[e]),d=react.useCallback(h=>e.getColumn(h),[e]),l=react.useCallback(h=>{e.addCard(h);},[e]),u=react.useCallback((h,g)=>{e.updateCard(h,g);},[e]),k=react.useCallback(h=>{e.deleteCard(h);},[e]),y=react.useCallback((h,g,b)=>{e.moveCard(h,g,b);},[e]),x=react.useCallback(h=>e.getCard(h),[e]),f=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:p,updateColumn:s,deleteColumn:m,getColumn:d,addCard:l,updateCard:u,deleteCard:k,moveCard:y,getCard:x,getCardsByColumn:f}}function gd(e){let{cards:t}=Mr();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 fd(e="position",t="asc"){let{cards:a}=Mr();return react.useMemo(()=>[...a].sort((o,n)=>{let i=0;switch(e){case "title":i=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,s=n.priority?c[n.priority]:0;i=p-s;break}case "createdAt":i=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":i=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":i=o.position-n.position;break}return t==="asc"?i:-i}),[a,e,t])}var No=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Bs.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 i=n[t];if(typeof i=="function")try{let c=await Promise.resolve(i.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{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(i=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,i,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Wg=new No;function bd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:i=false,gap:c=0,getItemKey:p}){let s=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:i,gap:c}),d=m.getVirtualItems(),l={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=i?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:s,style:l,className:o,children:jsxRuntime.jsx("div",{style:u,children:d.map(k=>{let y=e[k.index];if(!y)return null;let x=p?p(y,k.index):k.index,f={position:"absolute",top:i?0:k.start,left:i?k.start:0,width:i?k.size:"100%",height:i?"100%":k.size};return jsxRuntime.jsx("div",{style:f,"data-index":k.index,children:r(y,k.index)},x)})})})}function vd(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 xd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:i=3,gap:c=16,getItemKey:p,horizontal:s=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:i,gap:c}),l=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},k={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:u,className:n,children:jsxRuntime.jsx("div",{style:k,children:l.map(y=>{let x=e[y.index];if(!x)return null;let f=p?p(x,y.index):y.index,h={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":y.index,children:o(x,y.index)},f)})})})}function kd(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 wd(e,t=10){return e>t}var ds={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},cs={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ps={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ms={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},us={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},gs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},fs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},hs={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)"},bs={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)"},vs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ys={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}},xs={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}},Do={spacing:ds,borderRadius:cs,fontSize:ps,fontWeight:ms,lineHeight:us,zIndex:gs,duration:fs,easing:hs,shadows:bs,opacity:vs,kanban:ys,gantt:xs};function Cd(e,t,a){return e[t]??a}function ks(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)?ks(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Vg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ws(e="asakaa"){let t=ks(Do),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,i=Vg(o);a.push(` ${n}: ${i};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function hl(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function va(e,t){let a=hl(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let n=a.find(c=>c.name.toLowerCase().includes(r));if(n)return n;let l=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return l.every(s=>m.includes(s))})}function zn(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 y=new Date(r),k=y.getDay(),x=g-k;return x<=0&&(x+=7),y.setDate(y.getDate()+x),y}}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 i=parseInt(n[1],10),g=n[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+i):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+i*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+i),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),g=parseInt(c[2],10)-1,y=parseInt(c[3],10);return new Date(y,g,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},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 i=parseInt(s[1],10),g=m[s[2].toLowerCase()],y=s[3]?parseInt(s[3],10):r.getFullYear();if(g!==void 0)return new Date(y,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),y=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(y,i,g)}return null}function Un(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 Gn(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 vl(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 yl(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(),d=va(t,s),i=zn(p);if(!d)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(!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,y=new Date(i);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:y},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let s=o[1].trim(),p=o[2].trim(),d=va(t,s),i=Un(p);if(!d)return {type:"resize_task",taskName:s,message:`Could not find a task named "${s}".`,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 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(),d=va(t,s),i=Gn(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: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(),d=va(t,s);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:s,message:`Could not find a task named "${s}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let s=c[1].trim(),p=c[2].trim(),d=va(t,s),i=va(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:s,message:`Could not find a task named "${s}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let s=m[1].trim(),p=va(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 xl(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 Vu(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 ju(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function po(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=>po(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},c=l(e.startDate),m=l(e.endDate),s=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:Vu(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 kl(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:ju(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function wl(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>po(r,e,t))}var $n={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"}},Wn={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"}},uo={en:$n,es:Wn};function Hn(e){return uo[e]||uo.en}function go(e,t){let a=Hn(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 Dl(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(...Dl(r.subtasks,t+1));return a}function rg({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 Sl({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:l}){let{theme:c="dark",locale:m="en",customTranslations:s,showSearch:p=true,showHierarchy:d=true}=t,i=go(m,s),g=c==="dark",[y,k]=react.useState(new Set),[x,b]=react.useState("startDate"),[f,u]=react.useState("asc"),[h,C]=react.useState("");react.useMemo(()=>{let T=new Set;function O(z){for(let I of z)I.subtasks?.length&&(T.add(I.id),O(I.subtasks));}O(e),k(T);},[e]);let v=react.useCallback(T=>{k(O=>{let z=new Set(O);return z.has(T)?z.delete(T):z.add(T),z}),a.onTaskToggleExpand?.(T);},[a]),P=react.useCallback(T=>{x===T?u(O=>O==="asc"?"desc":"asc"):(b(T),u("asc")),a.onSortChange?.({column:T,direction:f==="asc"?"desc":"asc"});},[x,f,a]),w=react.useMemo(()=>{let T=Dl(e);if(h.trim()){let z=h.toLowerCase();T=T.filter(I=>I.name.toLowerCase().includes(z));}let O=[];for(let z of T){let I=z.level===0;z.level>0&&(I=true),(I||h.trim())&&O.push(z);}return h.trim()&&O.sort((z,I)=>{let $,E;switch(x){case "name":$=z.name.toLowerCase(),E=I.name.toLowerCase();break;case "startDate":$=z.startDate?.getTime()||0,E=I.startDate?.getTime()||0;break;case "endDate":$=z.endDate?.getTime()||0,E=I.endDate?.getTime()||0;break;case "progress":$=z.progress||0,E=I.progress||0;break;case "status":$=z.status||"todo",E=I.status||"todo";break;default:return 0}return $<E?f==="asc"?-1:1:$>E?f==="asc"?1:-1:0}),O},[e,h,x,f]),S=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",g?"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:F("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",g?"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:F("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:F("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",g?"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:F("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:F("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:F("flex-1 flex flex-col w-full h-full overflow-hidden",g?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsxRuntime.jsx("div",{className:F("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:F("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:h,onChange:T=>C(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:F("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:F("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:F("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",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:()=>P("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>P("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((T,O)=>{let z=y.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:O*.02},className:F("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+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),v(T.id);},className:F("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-200"),children:z?jsxRuntime.jsx(lucideReact.ChevronDown,{className:F("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:F("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-400")})}),d&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(rg,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:F("truncate",g?"text-white":"text-gray-900",T.progress===100&&(g?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:F("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:F("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(T.startDate)]}),jsxRuntime.jsxs("div",{className:F("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(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:F("flex-1 h-1.5 rounded-full overflow-hidden",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:F("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:F("text-xs w-8",g?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),w.length===0&&h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:F("w-12 h-12 mx-auto mb-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:F(g?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var _n={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"},Vn={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"},jn={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"},bo={dark:_n,light:Vn,neutral:jn};function El(e){return bo[e]||bo.dark}var Kn={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"}},Yn={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"}},ho={en:Kn,es:Yn};function Nr(e){return ho[e]||ho.en}function vo(e,t){let a=Nr(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 Pl(e){let t=Nr(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 Ml(e,t=0,a=true){let r=Nr(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 pg(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 qn(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 ug({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 Al({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:l,style:c}){let{theme:m="dark",locale:s="en",customTranslations:p}=t,d=vo(s,p),i=m==="dark",[g,y]=react.useState(r||new Date),[k,x]=react.useState(null),b=react.useCallback(()=>{y(new Date(g.getFullYear(),g.getMonth()-1,1));},[g]),f=react.useCallback(()=>{y(new Date(g.getFullYear(),g.getMonth()+1,1));},[g]),u=react.useCallback(()=>{y(new Date);},[]),h=react.useMemo(()=>{let w=g.getFullYear(),S=g.getMonth(),T=new Date(w,S,1),O=new Date(w,S+1,0),z=T.getDay(),I=O.getDate(),$=pg(e),E=new Date;E.setHours(0,0,0,0);let U=[],Y=z,ee=new Date(w,S,0).getDate();for(let J=Y-1;J>=0;J--){let G=new Date(w,S-1,ee-J);U.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(se=>qn(G,se)).map(se=>({id:se.id,title:se.name,start:se.startDate,end:se.endDate,task:se}))});}for(let J=1;J<=I;J++){let G=new Date(w,S,J),se=G.getTime()===E.getTime();U.push({date:G,isCurrentMonth:true,isToday:se,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(N=>qn(G,N)).map(N=>({id:N.id,title:N.name,start:N.startDate,end:N.endDate,task:N}))});}let R=42-U.length;for(let J=1;J<=R;J++){let G=new Date(w,S+1,J);U.push({date:G,isCurrentMonth:false,isToday:false,isWeekend:G.getDay()===0||G.getDay()===6,events:$.filter(se=>qn(G,se)).map(se=>({id:se.id,title:se.name,start:se.startDate,end:se.endDate,task:se}))});}return U},[g,e]),C=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],v=g.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),P=react.useCallback(w=>{let S=w.progress===100?0:100,T=S===100?"completed":"todo";a.onTaskUpdate?.({...w,status:T,progress:S});},[a]);return o?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:F("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:F("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:F("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:F("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsxRuntime.jsx("p",{className:F("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:F("flex-1 flex flex-col w-full h-full overflow-hidden",i?"bg-[#0F1117]":"bg-white",l),style:c,children:[jsxRuntime.jsx("div",{className:F("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:F("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:v}),jsxRuntime.jsx("button",{onClick:u,className:F("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:b,className:F("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:F("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:f,className:F("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:F("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:C.map(w=>jsxRuntime.jsx("div",{className:F("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:w},w))}),jsxRuntime.jsx("div",{className:F("flex-1 grid grid-cols-7 grid-rows-6 gap-px rounded-lg overflow-hidden",i?"bg-white/5":"bg-gray-200"),children:h.map((w,S)=>jsxRuntime.jsxs("div",{className:F("min-h-[100px] p-2 transition-colors",i?"bg-[#0F1117]":"bg-white",!w.isCurrentMonth&&(i?"bg-[#0F1117]/50":"bg-gray-50"),w.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[jsxRuntime.jsx("div",{className:F("text-sm font-medium mb-1",w.isToday?"text-[#3B82F6]":w.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:w.date.getDate()}),jsxRuntime.jsxs("div",{className:"space-y-1 overflow-y-auto max-h-[80px]",children:[w.events.slice(0,3).map(T=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(T.task),a.onEventClick?.(T);},whileHover:{scale:1.02},className:F("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",T.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(ug,{task:T.task}),jsxRuntime.jsx("span",{className:"truncate",children:T.title})]},T.id)),w.events.length>3&&jsxRuntime.jsxs("div",{className:F("text-xs px-1.5",i?"text-[#6B7280]":"text-gray-400"),children:["+",w.events.length-3," ",s==="es"?"m\xE1s":"more"]})]})]},S))})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,x:300},animate:{opacity:1,x:0},exit:{opacity:0,x:300},className:F("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:F("p-4 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:F("font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Detalle de tarea":"Task Detail"}),jsxRuntime.jsx("button",{onClick:()=>x(null),className:F("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:F("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Nombre":"Name"}),jsxRuntime.jsx("p",{className:F("font-medium",i?"text-white":"text-gray-900"),children:k.name})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:F("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Inicio":"Start"}),jsxRuntime.jsx("p",{className:F("text-sm",i?"text-white":"text-gray-900"),children:k.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:F("text-xs uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fin":"End"}),jsxRuntime.jsx("p",{className:F("text-sm",i?"text-white":"text-gray-900"),children:k.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US")||"-"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:F("text-xs uppercase mb-2 block",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:F("flex-1 h-2 rounded-full overflow-hidden",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:F("h-full rounded-full transition-all",k.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${k.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:F("text-sm font-medium w-10",i?"text-white":"text-gray-900"),children:[k.progress||0,"%"]})]})]}),jsxRuntime.jsx("button",{onClick:()=>{P(k),x(null);},className:F("w-full py-2 rounded-lg font-medium transition-colors",k.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:k.progress===100?s==="es"?"Marcar como pendiente":"Mark as pending":s==="es"?"Marcar como completada":"Mark as complete"})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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 Jn={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"},Zn={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"},Qn={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"},xo={dark:Jn,light:Zn,neutral:Qn};function Fl(e){return xo[e]||xo.dark}function fg({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:l,className:c}){let[m,s]=react.useState(false),p=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=p.length,y=new Set(p.flatMap(b=>b.assignedUserIds||[])).size,k=p.map(b=>b.priority).filter(Boolean),x=new Set(p.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:k,labels:x}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:F("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>s(true),onMouseLeave:()=>s(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:F("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick: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:y=>{y.stopPropagation(),n?.(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 Rl={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Dr(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 Sr(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 Ol(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 zl({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:l,className:c}){let m=react.useMemo(()=>({...Rl,...l}),[l]),[s,p]=react.useState(new Set),d=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let f=new Map;return e.forEach(u=>{let h=u.timestamp.toISOString().split("T")[0],C=f.get(h);C?C.push(u):f.set(h,[u]);}),Array.from(f.entries()).sort((u,h)=>h[0].localeCompare(u[0])).map(([u,h])=>({date:new Date(u),events:h.sort((C,v)=>v.timestamp.getTime()-C.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let f=new Set,u=new Set;return e.forEach(h=>{f.add(h.userId),u.add(h.type);}),{uniqueUsers:Array.from(f),uniqueTypes:Array.from(u)}},[e]),k=f=>{p(u=>{let h=new Set(u);return h.has(f)?h.delete(f):h.add(f),h});},x=f=>{let h=new Date().getTime()-f.getTime(),C=Math.floor(h/6e4),v=Math.floor(h/36e5),P=Math.floor(h/864e5);return C<1?"just now":C<60?`${C}m ago`:v<24?`${v}h ago`:P<7?`${P}d ago`:f.toLocaleDateString()},b=react.useMemo(()=>{let f=0;return t.types&&t.types.length>0&&f++,t.users&&t.users.length>0&&f++,t.dateRange&&f++,t.searchTerm&&f++,f},[t]);return react.useEffect(()=>{if(n&&d.current){let f=d.current.querySelector(`[data-event-id="${n}"]`);f&&f.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:F("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:F("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:f=>{let u=f.target.value;a({...t,types:u?[u]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(f=>jsxRuntime.jsxs("option",{value:f,children:[Sr(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})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:i.map(f=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.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,h)=>{let C=s.has(u.id),v=n===u.id,P=Ol(u.type);return jsxRuntime.jsxs("div",{"data-event-id":u.id,className:F("history-timeline-event",C&&"expanded",v&&"selected"),onClick:()=>o?.(u),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:P},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Sr(u.type)})}),h<f.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:P}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.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:Dr(u)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?x(u.timestamp):u.timestamp.toLocaleString()})]}),Object.keys(u.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(u.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(u.changes).map(([w,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),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)})]})]},w)),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(([w,S])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},w))]})]})]})]},u.id)})})]},f.date?.toISOString()||"all"))})]})}function Gl({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:l,onGoToEvent:c,onSpeedChange:m,className:s}){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:F("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:F("history-replay",s),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Sr(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Dr(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=>c(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,y)=>jsxRuntime.jsx("div",{className:F("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>c(y),title:Dr(g)},g.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(g=>jsxRuntime.jsxs("button",{className:F("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>m(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:F("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 es(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 ts(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 $l(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 Wl(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function kg(e,t,a,r,o,n=100){let l=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(l.map(m=>[m.id,m]));for(let m=0;m<n;m++){let s=1-m/n;l.forEach(p=>{let d=a/2,i=r/2;p.vx+=(d-p.x)*o.centerForce*s,p.vy+=(i-p.y)*o.centerForce*s,l.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,k=p.y-g.y,x=Math.sqrt(y*y+k*k)||1,b=o.chargeStrength*s/(x*x);p.vx+=y/x*b,p.vy+=k/x*b;});}),t.forEach(p=>{let d=c.get(typeof p.source=="string"?p.source:p.source.id),i=c.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!i)return;let g=i.x-d.x,y=i.y-d.y,k=Math.sqrt(g*g+y*y)||1,x=(k-o.linkDistance)/k*o.forceStrength*s;d.vx+=g*x,d.vy+=y*x,i.vx-=g*x,i.vy-=y*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 Hl({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:l,onInteraction:c,className:m}){let s=react.useRef(null),[p,d]=react.useState([]),[i,g]=react.useState(null),[y,k]=react.useState(null),[x,b]=react.useState(null),[f,u]=react.useState(1),[h,C]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let I=kg(e,t,a.width,a.height,a,150);d(I);},[e,t,a]);let v=react.useCallback((I,$)=>{a.enableDragging&&($.stopPropagation(),g(I));},[a.enableDragging]),P=react.useCallback(I=>{if(!i||!s.current)return;let E=s.current.getBoundingClientRect(),U=(I.clientX-E.left-h.x)/f,Y=(I.clientY-E.top-h.y)/f;d(ee=>ee.map(R=>R.id===i?{...R,x:U,y:Y,fx:U,fy:Y}:R));},[i,f,h]),w=react.useCallback(()=>{g(null);},[]),S=react.useCallback((I,$)=>{$.stopPropagation(),c?.({type:"node-click",node:I,position:{x:$.clientX,y:$.clientY}});},[c]),T=react.useCallback((I,$)=>{$.stopPropagation(),c?.({type:"edge-click",edge:I,position:{x:$.clientX,y:$.clientY}});},[c]),O=react.useCallback(I=>{let $=p.find(E=>E.id===I);return $?{x:$.x,y:$.y}:{x:0,y:0}},[p]),z=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:F("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:F("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children: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:()=>u(I=>Math.min(I+.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(I=>Math.max(I-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{u(1),C({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:es(I)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[$l(I)," ",ts(I)]})]},I))}),jsxRuntime.jsxs("svg",{ref:s,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:P,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${h.x}, ${h.y}) scale(${f})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(I=>{let $=O(typeof I.source=="string"?I.source:I.source.id),E=O(typeof I.target=="string"?I.target:I.target.id),U=Wl(I.type),Y=x===I.id,ee=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:F("relationships-graph-edge",Y&&"hovered",ee&&"critical"),onMouseEnter:()=>b(I.id),onMouseLeave:()=>b(null),onClick:R=>T(I,R),children:[jsxRuntime.jsx("line",{x1:$.x,y1:$.y,x2:E.x,y2:E.y,stroke:es(I.type),strokeWidth:ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Y?1:.6,markerEnd:U?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Y&&jsxRuntime.jsx("text",{x:($.x+E.x)/2,y:($.y+E.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ts(I.type)})]},I.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(I=>{let $=y===I.id,E=I.onCriticalPath;return jsxRuntime.jsxs("g",{className:F("relationships-graph-node",$&&"hovered",E&&"critical"),transform:`translate(${I.x}, ${I.y})`,onMouseDown:U=>v(I.id,U),onMouseEnter:()=>k(I.id),onMouseLeave:()=>k(null),onClick:U=>S(I,U),children:[jsxRuntime.jsx("circle",{r:E?a.nodeSize*1.2:a.nodeSize,fill:z(I),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: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 jl({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,l]=react.useState(""),[c,m]=react.useState(false),[s,p]=react.useState(null),[d,i]=react.useState(null),g=react.useRef(null),y=c||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let f=u=>{u.key==="Escape"&&!y&&k();};if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,y]);let k=()=>{y||(l(""),p(null),i(null),t());},x=async()=>{if(!(!n.trim()||y)){m(true),p(null),i(null);try{let f=await r(n.trim());i(f);}catch(f){p(f instanceof Error?f.message:"Failed to generate plan");}finally{m(false);}}},b=()=>{d&&(a(d),k());};return e?jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:k,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((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:n,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:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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((f,u)=>jsxRuntime.jsx("button",{onClick:()=>l(f),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:f},u))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:k,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:x,disabled:!n.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var as={"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 Cg={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Tg={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 Ng(e,t,a){let r=as[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Er(e){return `$${e.toFixed(4)}`}var rs=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Ng(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),n=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),c=a.filter(d=>d.success),m=a.reduce((d,i)=>d+i.duration,0),s={},p={};return a.forEach(d=>{s[d.feature]=(s[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:l,operationsByFeature:s,costsByFeature:p,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],n=new Date,l=new Date;a==="month"?l.setMonth(n.getMonth()-1):l.setDate(n.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=l).length,m=Math.max(0,o-c),s=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:s,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$a=new rs;function Xl({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState($a.getStats()),[n,l]=react.useState($a.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o($a.getStats()),l($a.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=s=>{s.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=$a.getRecentOperations(5);return jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[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:Er(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,s])=>{let p=r.costsByFeature[m]||0,d=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:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[s," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Er(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}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Er(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Zl({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[l,c]=react.useState(""),[m,s]=react.useState(""),[p,d]=react.useState(""),[i,g]=react.useState(false),[y,k]=react.useState(null),[x,b]=react.useState(null),[f,u]=react.useState(null),h=react.useRef(null),C=i||o;react.useEffect(()=>{e&&h.current&&h.current.focus();},[e]),react.useEffect(()=>{let T=O=>{O.key==="Escape"&&!C&&v();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,C]);let v=()=>{C||(c(""),s(""),d(""),k(null),b(null),u(null),t());},P=async()=>{if(!(!l.trim()||C)){g(true),k(null),b(null),u(null);try{let T=await r({prompt:l.trim(),projectName:n||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});b(T.tasks.tasks),u({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){k(T instanceof Error?T.message:"Failed to generate tasks");}finally{g(false);}}},w=()=>{x&&(a(x),v());};if(!e)return null;let S=f?.similarity?((f.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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:T=>T.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:v,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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((T,O)=>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:["#",O+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.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"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.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:h,value:l,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>s(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>d(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,O)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},O))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:C&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),x?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:P,disabled:!l.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Co({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(x=>{t&&Rr(()=>Promise.resolve(t(x)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,f,u)=>{console.warn(`Retry attempt ${f} after ${u}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),n=react.useCallback(async(x,b,f)=>{r(u=>{let h=u.cards.find(T=>T.id===x);if(!h)return u;let C=h.columnId,v={...h,columnId:b,position:f},P=u.cards.map(T=>T.id===x?v:T),w=u.columns.map(T=>{if(T.id===C)return {...T,cardIds:T.cardIds.filter(O=>O!==x)};if(T.id===b){let O=P.filter(z=>z.columnId===b).sort((z,I)=>z.position-I.position);return {...T,cardIds:O.map(z=>z.id)}}return T}),S={...u,cards:P,columns:w};return o(S),S});},[o]),l=react.useCallback(async(x,b)=>{r(f=>{let u=f.cards.map(C=>C.id===x?{...C,...b}:C),h={...f,cards:u};return o(h),h});},[o]),c=react.useCallback(async x=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let u={...x,id:b},h=f.columns.map(v=>v.id===x.columnId?{...v,cardIds:[...v.cardIds,b]}:v),C={...f,cards:[...f.cards,u],columns:h};return o(C),C});},[o]),m=react.useCallback(async x=>{r(b=>{let f=b.cards.find(v=>v.id===x);if(!f)return b;let u=b.cards.filter(v=>v.id!==x),h=b.columns.map(v=>v.id===f.columnId?{...v,cardIds:v.cardIds.filter(P=>P!==x)}:v),C={...b,cards:u,columns:h};return o(C),C});},[o]),s=react.useCallback(async x=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(f=>{let u={...x,id:b,cardIds:[]},h={...f,columns:[...f.columns,u]};return o(h),h});},[o]),p=react.useCallback(async(x,b)=>{r(f=>{let u=f.columns.map(C=>C.id===x?{...C,...b}:C),h={...f,columns:u};return o(h),h});},[o]),d=react.useCallback(async x=>{r(b=>{let f=b.cards.filter(C=>C.columnId!==x),u=b.columns.filter(C=>C.id!==x),h={...b,cards:f,columns:u};return o(h),h});},[o]),i=react.useCallback(x=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(x),b},[c]),g=react.useCallback(x=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return s(x),b},[s]),y=react.useCallback(()=>{r(x=>{let b={...x,cards:[],columns:[]};return o(b),b});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:l,onCardCreate:c,onCardDelete:m,onColumnCreate:s,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:g,deleteCard:m,deleteColumn:d,clearBoard:y}}}function ed({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Co({initialBoard:e,onPersist:a}),l=react.useMemo(()=>({addCard:(m,s,p={})=>{n.addCard({title:s,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...p});},addColumn:(m,s)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;n.addColumn({title:m,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 Pr={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ad={by:"none",order:"asc"};function rd({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...Pr,...e}),[n,l]=react.useState({...ad,...t}),c=react.useCallback(k=>{o(x=>({...x,...k}));},[]),m=react.useCallback(k=>{l(x=>({...x,...k}));},[]),s=react.useCallback(()=>{o(Pr),l(ad);},[]),p=react.useCallback(()=>{a&&o({...Pr,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...Pr,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...Pr,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!==""||n.by!=="none",[r,n]),y=react.useCallback(k=>{let x=[...k];if(r.search){let b=r.search.toLowerCase();x=x.filter(f=>f.title.toLowerCase().includes(b)||f.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,f=b.getFullYear(),u=String(b.getMonth()+1).padStart(2,"0"),h=String(b.getDate()).padStart(2,"0"),C=`${f}-${u}-${h}`;x=x.filter(v=>{if(!v.endDate&&!v.dueDate)return false;let P=v.endDate||v.dueDate;if(!P)return false;let w;if(typeof P=="string")w=P.split("T")[0]||P;else {let S=P.getUTCFullYear(),T=String(P.getUTCMonth()+1).padStart(2,"0"),O=String(P.getUTCDate()).padStart(2,"0");w=`${S}-${T}-${O}`;}switch(r.dateFilter){case "overdue":return w<C;case "today":return w===C;case "this-week":let S=new Date(C+"T00:00:00"),T=new Date(w+"T00:00:00"),O=new Date(S);return O.setDate(O.getDate()+7),T>=S&&T<=O;case "custom":if(r.dateRange){let z=typeof P=="string"?new Date(P):P;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(x=x.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(x=x.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(u=>r.assignees.includes(u)))),r.labels.length>0&&(x=x.filter(b=>b.labels&&b.labels.some(f=>r.labels.includes(f)))),r.columns.length>0&&(x=x.filter(b=>r.columns.includes(b.columnId))),n.by!=="none"&&x.sort((b,f)=>{let u=0;switch(n.by){case "created":let h=b.createdAt?new Date(b.createdAt).getTime():0,C=f.createdAt?new Date(f.createdAt).getTime():0;u=h-C;break;case "priority":let v={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},P=v[b.priority||"LOW"],w=v[f.priority||"LOW"];u=P-w;break;case "dueDate":let S=b.endDate||b.dueDate,T=f.endDate||f.dueDate;if(!S)return 1;if(!T)return -1;let O=typeof S=="string"?new Date(S).getTime():S.getTime(),z=typeof T=="string"?new Date(T).getTime():T.getTime();u=O-z;break;case "title":u=b.title.localeCompare(f.title);break;case "estimate":let I=b.estimatedTime||0,$=f.estimatedTime||0;u=I-$;break;default:u=0;}return n.order==="asc"?u:-u}),x},[r,n]);return {filters:r,sort:n,setFilters:c,setSort:m,resetFilters:s,filterMyTasks:p,filterOverdue:d,filterHighPriority:i,applyFilters:y,hasActiveFilters:g}}var nd,sd;if(typeof window<"u")try{let e=Ar("ai");nd=e.generateObject,sd=e.generateText;}catch{}function id(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(nd&&sd&&e.apiKey),l=react.useCallback(async d=>{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:",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);}},[n]),c=react.useCallback(async d=>{if(!n)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);}},[n]),m=react.useCallback(async d=>{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(i){let g=i instanceof Error?i:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[n]),s=react.useCallback(async d=>{if(!n)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);}},[n]),p=react.useCallback(async d=>{if(!n)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);}},[n]);return {onGeneratePlan:l,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:s,onEstimateEffort:p,isAvailable:n,isLoading:t,error:r}}function ns(){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 ld(e){let{cards:t}=e,[a,r]=ns(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),n=react.useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=i.ctrlKey||i.metaKey,y=i.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let k=t.find(b=>b.id===d),x=t.find(b=>b.id===a.lastSelectedCardId);if(k&&x&&k.columnId===x.columnId){let b=t.filter(w=>w.columnId===k.columnId).sort((w,S)=>w.position-S.position),f=b.findIndex(w=>w.id===a.lastSelectedCardId),u=b.findIndex(w=>w.id===d),[h,C]=f<u?[f,u]:[u,f],v=b.slice(h,C+1).map(w=>w.id),P=Array.from(new Set([...a.selectedCardIds,...v]));r({selectedCardIds:P,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),s=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:n,deselectCard:l,clearSelection:c,selectAll:m,toggleCard:s,getSelectedCards:p}}var dd={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cd(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...dd,...a}),[a]),[n,l]=react.useState([]),c=react.useCallback((k,x,b,f,u)=>{if(x.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let h={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:x,columnId:b,strategy:f,color:u,isExpanded:true,position:n.filter(C=>C.columnId===b).length,createdAt:new Date};l(C=>[...C,h]);},[o.minCardsPerStack,n]),m=react.useCallback(k=>{l(x=>x.filter(b=>b.id!==k));},[]),s=react.useCallback(k=>{l(x=>x.map(b=>b.id===k?{...b,isExpanded:!b.isExpanded}:b));},[]),p=react.useCallback((k,x)=>{l(b=>b.map(f=>f.id===k&&!f.cardIds.includes(x)?{...f,cardIds:[...f.cardIds,x]}:f));},[]),d=react.useCallback((k,x)=>{l(b=>b.map(f=>{if(f.id===k){let u=f.cardIds.filter(h=>h!==x);return u.length<o.minCardsPerStack?null:{...f,cardIds:u}}return f}).filter(f=>f!==null));},[o.minCardsPerStack]),i=react.useCallback(k=>n.filter(x=>x.columnId===k).sort((x,b)=>x.position-b.position),[n]),g=react.useCallback(async k=>{let x=t.filter(C=>C.columnId===k);if(x.length<o.minCardsPerStack*2)return [];let b=[],f=new Map;x.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(v=>{f.has(v)||f.set(v,[]),f.get(v).push(C);});}),f.forEach((C,v)=>{C.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${v}`,cardIds:C.map(P=>P.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${v}"`,confidence:.85});});let u=new Map;x.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(v=>{u.has(v)||u.set(v,[]),u.get(v).push(C);});}),u.forEach((C,v)=>{C.length>=o.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${v.slice(-4)}`,cardIds:C.map(P=>P.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let h=new Map;if(x.forEach(C=>{C.priority&&(h.has(C.priority)||h.set(C.priority,[]),h.get(C.priority).push(C));}),h.forEach((C,v)=>{if(C.length>=o.minCardsPerStack){let P={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[v.toLowerCase()]||"\u26AA";b.push({stack:{title:`${P} ${v} Priority`,cardIds:C.map(w=>w.id),columnId:k,strategy:"priority",color:v==="high"||v==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${v} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of x){let P=(await r.findSimilar(C,x)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(P.length>=o.minCardsPerStack-1){let w=[C.id,...P.map(T=>T.card.id)],S=P.reduce((T,O)=>T+O.similarity,0)/P.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${P.length+1} similar tasks`,confidence:S});}}return b.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,v)=>v.confidence-C.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(k=>{c(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(x=>x.columnId)).forEach(async x=>{let b=await g(x),f=b[0];b.length>0&&f&&f.confidence>=.9&&y(f);});},[]),{stacks:n,createStack:c,deleteStack:m,toggleStack:s,addToStack:p,removeFromStack:d,getStacksForColumn:i,getSuggestions:g,applySuggestion:y,config:o}}var md=react.createContext(null);function pd({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,l=new Map;t?.columns?.forEach(m=>{let{Column:s}=Ar("@libxai/core");n.set(m.id,new s(m));}),t?.cards?.forEach(m=>{let{Card:s}=Ar("@libxai/core");l.set(m.id,new s(m));});let c=null;if(t?.board){let{Board:m}=Ar("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:n,cards:l});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(md.Provider,{value:{store:o},children:e})}function To(){let e=react.useContext(md);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ir(){let e=To(),[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 c=react.useCallback(f=>{e.updateBoard(f);},[e]),m=react.useCallback(f=>{e.addColumn(f);},[e]),s=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]),y=react.useCallback(f=>{e.deleteCard(f);},[e]),k=react.useCallback((f,u,h)=>{e.moveCard(f,u,h);},[e]),x=react.useCallback(f=>e.getCard(f),[e]),b=react.useCallback(f=>e.getCardsByColumn(f),[e]);return {board:t,columns:r,cards:n,updateBoard:c,addColumn:m,updateColumn:s,deleteColumn:p,getColumn:d,addCard:i,updateCard:g,deleteCard:y,moveCard:k,getCard:x,getCardsByColumn:b}}function gd(e){let{cards:t}=Ir();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 fd(e="position",t="asc"){let{cards:a}=Ir();return react.useMemo(()=>[...a].sort((o,n)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(n.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,s=n.priority?c[n.priority]:0;l=m-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 No=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Bs.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 c=await Promise.resolve(l.apply(n,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,c,{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);}},Wg=new No;function hd({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:l=false,gap:c=0,getItemKey:m}){let s=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>s.current,estimateSize:()=>a,overscan:n,horizontal:l,gap:c}),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:s,style:i,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let k=e[y.index];if(!k)return null;let x=m?m(k,y.index):y.index,b={position:"absolute",top:l?0:y.start,left:l?y.start:0,width:l?y.size:"100%",height:l?"100%":y.size};return jsxRuntime.jsx("div",{style:b,"data-index":y.index,children:r(k,y.index)},x)})})})}function vd(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 xd({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:l=3,gap:c=16,getItemKey:m,horizontal:s=true}){let p=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:s,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:l,gap:c}),i=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:g,className:n,children:jsxRuntime.jsx("div",{style:y,children:i.map(k=>{let x=e[k.index];if(!x)return null;let b=m?m(x,k.index):k.index,f={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsxRuntime.jsx("div",{style:f,"data-index":k.index,children:o(x,k.index)},b)})})})}function kd(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 wd(e,t=10){return e>t}var ds={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},cs={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ms={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ps={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},us={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},gs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},fs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},bs={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)"},hs={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)"},vs={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ys={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}},xs={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}},Do={spacing:ds,borderRadius:cs,fontSize:ms,fontWeight:ps,lineHeight:us,zIndex:gs,duration:fs,easing:bs,shadows:hs,opacity:vs,kanban:ys,gantt:xs};function Cd(e,t,a){return e[t]??a}function ks(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)?ks(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Vg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function ws(e="asakaa"){let t=ks(Do),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,l=Vg(o);a.push(` ${n}: ${l};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
326
|
+
}`}function Lr(e,t="asakaa"){let a=[],r=ks(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 So={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"}},Cs={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"}},Ts={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 Ns(e=So,t="asakaa"){let a=ws(t),r=
|
|
329
|
+
}`}var So={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"}},Cs={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"}},Ts={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 Ns(e=So,t="asakaa"){let a=ws(t),r=Lr(e,t);return `${a}
|
|
330
330
|
|
|
331
331
|
${r}`}function Td(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
@@ -338,17 +338,17 @@ ${Ns(So)}
|
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${Lr(Cs,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${
|
|
348
|
+
${Lr(Ts,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
|
-
`}var jg=({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 Nd({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=
|
|
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=Xl;exports.AI_FEATURES=Tg;exports.AI_MODELS=as;exports.AttachmentUploader=hr;exports.BoardProvider=
|
|
352
|
+
`}var jg=({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 Nd({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=er();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([l,c])=>{let m=l,s=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${s?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":s,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(jg,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
|
|
353
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Xl;exports.AI_FEATURES=Tg;exports.AI_MODELS=as;exports.AttachmentUploader=hr;exports.BoardProvider=pd;exports.BulkOperationsToolbar=Vr;exports.BurnDownChart=en;exports.CalendarBoard=Al;exports.Card=ga;exports.CardDetailModal=Xo;exports.CardDetailModalV2=Jo;exports.CardHistoryReplay=Gl;exports.CardHistoryTimeline=zl;exports.CardRelationshipsGraph=Hl;exports.CardStack=fg;exports.CardTemplateSelector=ln;exports.CircuitBreaker=Po;exports.Column=Ya;exports.ColumnManager=Jr;exports.CommandPalette=Ko;exports.ConfigMenu=pn;exports.ContextMenu=rr;exports.DEFAULT_SHORTCUTS=vr;exports.DEFAULT_TEMPLATES=sn;exports.DateRangePicker=mr;exports.DependenciesSelector=pr;exports.DependencyLine=ao;exports.DistributionCharts=tn;exports.EditableColumnTitle=Go;exports.ErrorBoundary=qa;exports.ExportImportModal=cn;exports.FilterBar=mn;exports.GANTT_AI_SYSTEM_PROMPT=fl;exports.GanttAIAssistant=co;exports.GanttBoard=gl;exports.GanttI18nContext=ar;exports.GanttMilestone=oo;exports.GanttToolbar=qr;exports.GenerateGanttTasksDialog=Zl;exports.GeneratePlanModal=jl;exports.GroupBySelector=on;exports.KanbanBoard=ka;exports.KanbanViewAdapter=gr;exports.KeyboardShortcutsHelp=nn;exports.ListView=Sl;exports.MenuIcons=ft;exports.PluginManager=No;exports.PrioritySelector=cr;exports.RATE_LIMITS=Cg;exports.SwimlaneBoardView=an;exports.TaskBar=eo;exports.TaskFormModal=lo;exports.TaskGrid=Qr;exports.ThemeModal=bn;exports.ThemeProvider=Ni;exports.ThemeSwitcher=Nd;exports.Timeline=io;exports.UserAssignmentSelector=La;exports.VelocityChart=Qo;exports.VirtualGrid=xd;exports.VirtualList=hd;exports.aiUsageTracker=$a;exports.borderRadius=cs;exports.calculatePosition=Br;exports.calendarDarkTheme=Jn;exports.calendarEnTranslations=Kn;exports.calendarEsTranslations=Yn;exports.calendarLightTheme=Zn;exports.calendarNeutralTheme=Qn;exports.calendarThemes=xo;exports.calendarTranslations=ho;exports.cardToGanttTask=po;exports.cardsToGanttTasks=wl;exports.cn=F;exports.createKanbanView=oi;exports.createRetryWrapper=Xd;exports.darkTheme=un;exports.darkTokenTheme=So;exports.defaultTheme=Kr;exports.designTokens=Do;exports.duration=fs;exports.easing=bs;exports.exportTokensToCSS=Td;exports.findTaskByName=va;exports.fontSize=ms;exports.fontWeight=ps;exports.formatCost=Er;exports.ganttEnTranslations=Xr;exports.ganttEsTranslations=Si;exports.ganttTaskToCardUpdate=kl;exports.ganttThemes=De;exports.ganttTokens=xs;exports.ganttTranslations=hn;exports.ganttUtils=_;exports.generateCSSVariables=ws;exports.generateCompleteCSS=Ns;exports.generateInitialPositions=Vd;exports.generateTasksContext=bl;exports.generateThemeVariables=Lr;exports.getCalendarTheme=Fl;exports.getCalendarTranslations=Nr;exports.getListViewTheme=El;exports.getListViewTranslations=Hn;exports.getMonthNames=Pl;exports.getToken=Cd;exports.getTranslations=Ei;exports.getWeekdayNames=Ml;exports.kanbanTokens=ys;exports.lightTheme=gn;exports.lightTokenTheme=Cs;exports.lineHeight=us;exports.listViewDarkTheme=_n;exports.listViewEnTranslations=$n;exports.listViewEsTranslations=Wn;exports.listViewLightTheme=Vn;exports.listViewNeutralTheme=jn;exports.listViewThemes=bo;exports.listViewTranslations=uo;exports.mergeCalendarTranslations=vo;exports.mergeListViewTranslations=go;exports.mergeTranslations=vn;exports.neutralTheme=fn;exports.neutralTokenTheme=Ts;exports.opacity=vs;exports.parseLocalCommand=yl;exports.parseNaturalDate=zn;exports.parseNaturalDuration=Un;exports.parseProgress=Gn;exports.parseStatus=vl;exports.pluginManager=Wg;exports.retrySyncOperation=Yd;exports.retryWithBackoff=Rr;exports.shadows=hs;exports.shouldVirtualizeGrid=wd;exports.spacing=ds;exports.themes=Ra;exports.useAI=id;exports.useBoard=ed;exports.useBoardCore=Ir;exports.useBoardStore=To;exports.useCardStacking=cd;exports.useDragState=Wo;exports.useFilteredCards=gd;exports.useFilters=rd;exports.useGanttI18n=yr;exports.useKanbanState=Co;exports.useKeyboardShortcuts=wi;exports.useMultiSelect=ld;exports.useSelectionState=ns;exports.useSortedCards=fd;exports.useTheme=er;exports.useVirtualGrid=kd;exports.useVirtualList=vd;exports.validateAIResponse=xl;exports.withErrorBoundary=Vo;exports.zIndex=gs;//# sourceMappingURL=index.cjs.map
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|