@libxai/board 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,79 @@
1
+ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import*as xe from'react';import {memo,useLayoutEffect,useRef,useState,createContext,forwardRef,useContext,useEffect,useCallback,useMemo,useImperativeHandle,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import sd from'html2canvas';import*as Hi from'react-dom';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Command}from'cmdk';import mp from'react-markdown';import fp from'remark-gfm';import gp from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart,Bar}from'recharts';import {Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Edit3,Calendar,Moon,Sun,Palette,AlignJustify,ZoomOut,ZoomIn,Keyboard,ChevronRight,Check,ChevronDown,X as X$1,AlertCircle,CheckCircle2,Clock,Milestone,Users}from'lucide-react';import {motion,AnimatePresence}from'framer-motion';var $a=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Wa=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [Wa.Translate.toString(e),Wa.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function te(...e){return twMerge(clsx(e))}function Va(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 td(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function Vn(e,t){return e.length===0?1e3:t===0?Va(null,e[0].position):t>=e.length?Va(e[e.length-1].position,null):Va(e[t-1].position,e[t].position)}function $s(e,t=100){return e>t}var rd=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 ad(e,t,r,a){let n=t*Math.pow(r,e-1),o=n*.2*Math.random();return Math.min(n+o,a)}async function Ka(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:o=1e4,shouldRetry:s=rd,onRetry:l}=t,c,i=0;for(let u=1;u<=r;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,u===r||!s(c,u))return {error:c,attempts:i,success:false};let p=ad(u,a,n,o);if(l)try{l(c,u,p);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,p));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function nd(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function od(e,t={}){return async(...r)=>Ka(()=>e(...r),t)}var Kn=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;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 r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}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 Ws=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(Ws||{}),Rr=class Rr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:o,...s}=t,l=`[${r}] [${a}] [${o}]`,c=Object.keys(s).length>0;switch(a){case "DEBUG":console.debug(l,n,c?s:"");break;case "INFO":console.info(l,n,c?s:"");break;case "WARN":console.warn(l,n,c?s:"");break;case "ERROR":console.error(l,n,c?s:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Rr.globalOptions};}static configure(t){Rr.globalOptions={...Rr.globalOptions,...t};}child(t){return new Rr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new ja((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new ja(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Ws[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};Rr.globalOptions={};var jn=Rr,ja=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Vs=new jn;function id(e,t){let r={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(r,null,2)}function ld(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(o=>{let s=e.columns.find(l=>l.id===o.columnId);return [o.id,Yn(o.title),Yn(o.description||""),Yn(s?.title||""),o.priority||"",(o.labels||[]).join(";"),(o.assignedUserIds||[]).join(";"),o.startDate||"",o.endDate||"",o.createdAt||"",o.updatedAt||""]});return [r.join(","),...a.map(o=>o.join(","))].join(`
2
+ `)}async function cd(e,t,r){let a=t;if(!a){let s=document.querySelector(".asakaa-board");s&&(a=s.parentElement||s);}if(a)try{let s=await sd(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),l=s.toDataURL("image/png"),c=297,i=210,u=s.width/s.height,d=c-20,f=d/u;f>i-20&&(f=i-20,d=f*u);let p=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});p.setFontSize(16),p.setTextColor(255,255,255),p.setFillColor(10,10,10),p.rect(0,0,c,15,"F"),p.text(e.title||"Kanban Board",10,10);let x=(c-d)/2;return p.addImage(l,"PNG",x,20,d,f),p}catch(s){console.error("Error capturing board:",s);}let n=new jsPDF,o=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,o),o+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,o),o+=15,n.setTextColor(0,0,0),e.columns.forEach(s=>{let l=e.cards.filter(c=>c.columnId===s.id);o>250&&(n.addPage(),o=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(s.title,20,o),o+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,o),n.setTextColor(0,0,0),o+=10):l.forEach(c=>{if(o>260&&(n.addPage(),o=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,o),o+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(c.description,160);n.text(u,25,o),o+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,o),n.setTextColor(0,0,0),o+=5),o+=5;}),o+=5;}),n}function Yn(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function js(e,t,r,a){switch(t){case "json":return id(e,a);case "csv":return ld(e);case "pdf":return await cd(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Ys(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${a}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let o=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:s[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function dd(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 r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ud(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 r=qs(t[0]),a=[],n=new Map,o=[];for(let s=1;s<t.length;s++)try{let l=qs(t[s]||"");if(l.length>r.length){o.push(`Line ${s+1}: Too many columns`);continue}if(r.length-l.length>3){o.push(`Line ${s+1}: Column count mismatch (expected ${r.length}, got ${l.length})`);continue}for(;l.length<r.length;)l.push("");let i={};r.forEach((p,x)=>{i[p]=l[x]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let d=n.get(u),f={id:i["Card ID"]||`card-${s}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(f),d.cardIds.push(f.id);}catch(l){o.push(`Line ${s+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...o]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:o.length>0?o:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function qs(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let o=e[n],s=e[n+1];o==='"'&&a&&s==='"'?(r+='"',n++):o==='"'?a=!a:o===","&&!a?(t.push(r),r=""):r+=o;}return t.push(r),t}function Xs(e,t){switch(t){case "json":return dd(e);case "csv":return ud(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Zs(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}function Ae({children:e,container:t}){let[r,a]=useState(false);if(useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let n=t||(typeof document<"u"?document.body:null);return n?createPortal(e,n):null}var ei={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},gd="#BDC3C7",hd=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function ti({priority:e,onChange:t,className:r}){let[a,n]=useState(false),[o,s]=useState({top:0,left:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(a&&c.current){let f=c.current.getBoundingClientRect();s({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[a]),useEffect(()=>{let f=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),useEffect(()=>{let f=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let i=f=>{t(f),n(false);},u=e?ei[e]:null,d=u?.color||gd;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:c,onClick:()=>n(!a),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:u?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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"})})}),a&&jsx(Ae,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsxs("div",{className:"py-1",children:[Object.entries(ei).map(([f,p])=>jsxs("button",{onClick:()=>i(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:p.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(hd,{color:p.color}),jsx("span",{className:"font-semibold text-sm",children:p.label}),e===f&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>i(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var vd=[{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 Ya({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=useState(false),[s,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null);useEffect(()=>{if(n&&i.current){let b=i.current.getBoundingClientRect();l({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[n]),useEffect(()=>{let b=g=>{c.current&&!c.current.contains(g.target)&&!i.current?.contains(g.target)&&o(false);};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{let b=g=>{g.key==="Escape"&&o(false);};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let u=b=>{let g=new Date,h=w=>{let y=w.getFullYear(),C=String(w.getMonth()+1).padStart(2,"0"),T=String(w.getDate()).padStart(2,"0");return `${y}-${C}-${T}`},v=h(g),m=new Date(g);m.setDate(m.getDate()+b);let k=h(m);r(v,k),o(false);},d=()=>{if(!e||!t)return "Set date";let b=m=>{if(m instanceof Date)return m;if(typeof m!="string"||!m.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=m.split("-").map(Number);if(k.length!==3||k.some(T=>isNaN(T)))return null;let w=k[0],y=k[1],C=k[2];return w===void 0||y===void 0||C===void 0?null:new Date(w,y-1,C)},g=b(e),h=b(t);if(!g||!h||isNaN(g.getTime())||isNaN(h.getTime()))return "Set date";let v=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${v[g.getMonth()]} ${g.getDate()} \u2013 ${v[h.getMonth()]} ${h.getDate()}`},f=e&&t,x=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,g=new Date;return g.setHours(0,0,0,0),b<g})();return jsxs("div",{className:`relative ${a||""}`,children:[jsxs("button",{ref:i,onClick:()=>o(!n),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:f?`${d()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:d()})]}),n&&jsx(Ae,{children:jsxs("div",{ref:c,className:"date-picker-menu absolute rounded-xl shadow-2xl border min-w-[320px]",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:[jsxs("div",{className:"p-4 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:vd.map(b=>jsx("button",{onClick:()=>u(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95 border",style:{color:"var(--modal-v2-text-primary, #60a5fa)",borderColor:"var(--modal-v2-border, rgba(96, 165, 250, 0.3))",background:"var(--modal-v2-bg-secondary, rgba(96, 165, 250, 0.08))"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(96, 165, 250, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(96, 165, 250, 0.08))";},children:b.label},b.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:b=>r(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus: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)"}}),jsx("input",{type:"date",value:t||"",onChange:b=>r(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus: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)"}})]}),(e||t)&&jsx("button",{onClick:()=>{r(void 0,void 0),o(false);},className:"mt-4 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 Dates"})]})]})})]})}function qa({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=useState(false),[l,c]=useState(""),[i,u]=useState({top:0,left:0}),d=useRef(null),f=useRef(null);useEffect(()=>{if(o&&f.current){let h=f.current.getBoundingClientRect();u({top:h.bottom+window.scrollY+8,left:h.left+window.scrollX});}},[o]),useEffect(()=>{let h=v=>{d.current&&!d.current.contains(v.target)&&!f.current?.contains(v.target)&&(s(false),c(""));};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(s(false),c(""));};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let p=h=>{let v=e.some(m=>m.id===h.id);r(v?e.filter(m=>m.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),b=e.slice(0,n),g=e.length-n;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:f,onClick:()=>s(!o),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?jsxs("div",{className:"asakaa-avatar-group",children:[b.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),g>0&&jsxs("div",{className:"asakaa-avatar",children:["+",g]})]}):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:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),o&&jsx(Ae,{children:jsxs("div",{ref:d,className:"user-selector-menu absolute rounded-xl shadow-2xl border min-w-[300px]",style:{top:`${i.top}px`,left:`${i.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:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?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"}):x.map(h=>{let v=e.some(m=>m.id===h.id);return jsxs("button",{onClick:()=>p(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsx("span",{className:"font-semibold flex-1 text-left",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),v&&jsx("span",{className:"text-lg",style:{color:"#3b82f6"},children:"\u2713"})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{r([]),s(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 si({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,s]=useState(false),[l,c]=useState(""),[i,u]=useState(t.length>0),[d,f]=useState({top:0,left:0}),p=useRef(null),x=useRef(null);useEffect(()=>{if(o&&x.current){let m=x.current.getBoundingClientRect();f({top:m.bottom+window.scrollY+8,left:m.left+window.scrollX});}},[o]),useEffect(()=>{let m=k=>{p.current&&!p.current.contains(k.target)&&!x.current?.contains(k.target)&&(s(false),c(""));};if(o)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]),useEffect(()=>{let m=k=>{k.key==="Escape"&&(s(false),c(""));};if(o)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[o]);let b=m=>{if(t.includes(m)){let w=t.filter(y=>y!==m);a(w),w.length===0&&u(false);}else a([...t,m]),u(true);},g=()=>{let m=!i;u(m),m||a([]);},h=r.filter(m=>m.id!==e).filter(m=>m.title.toLowerCase().includes(l.toLowerCase())||m.id.toLowerCase().includes(l.toLowerCase())),v=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:x,onClick:()=>s(!o),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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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:v,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:v},children:t.length})]}),o&&jsx(Ae,{children:jsxs("div",{ref:p,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:[jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children: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"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:g,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),i&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:m=>c(m.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})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):h.map(m=>{let k=t.includes(m.id);return jsxs("button",{onClick:()=>b(m.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:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:k?"#3b82f6":"transparent",borderColor:k?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:k&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:m.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:m.id})]})]},m.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{a([]),u(false),s(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 sr=memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:o,onUpdate:s,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:x}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),b={transform:Wa.Transform.toString(f),transition:p};if(t)return jsx("div",{ref:d,style:b,...i,...u,onClick:()=>r?.(e),children:t(e)});let g=l.filter(h=>e.assignedUserIds?.includes(h.id));return jsxs("div",{ref:d,style:b,className:te("asakaa-card",x&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",o),...i,...u,onClick:h=>{h.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:h=>{h.currentTarget.style.display="none";}})}),jsx("h3",{className:"asakaa-card-title mb-2",children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:h=>h.stopPropagation(),className:"priority-selector",children:jsx(ti,{priority:e.priority,onChange:h=>s?.(e.id,{priority:h})})}),jsx("div",{onClick:h=>h.stopPropagation(),className:"date-picker",children:jsx(Ya,{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:(h,v)=>s?.(e.id,{startDate:h,endDate:v})})}),l.length>0&&jsx("div",{onClick:h=>h.stopPropagation(),className:"user-selector",children:jsx(qa,{assignedUsers:g,availableUsers:l,onChange:h=>s?.(e.id,{assignedUserIds:h.map(v=>v.id)})})}),jsx("div",{onClick:h=>h.stopPropagation(),className:"dependencies-selector",children:jsx(si,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(h=>typeof h=="string"?h:h.taskId):[],availableTasks:c,onChange:h=>s?.(e.id,{dependencies:h})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(h=>jsx("span",{className:"asakaa-label",children:h},h))})]})},(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));sr.displayName="Card";function Za(){return typeof window<"u"}function gr(e){return to(e)?(e.nodeName||"").toLowerCase():"#document"}function xt(e){var t;return (e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function _t(e){var t;return (t=(to(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function to(e){return Za()?e instanceof Node||e instanceof xt(e).Node:false}function dt(e){return Za()?e instanceof Element||e instanceof xt(e).Element:false}function Ot(e){return Za()?e instanceof HTMLElement||e instanceof xt(e).HTMLElement:false}function eo(e){return !Za()||typeof ShadowRoot>"u"?false:e instanceof ShadowRoot||e instanceof xt(e).ShadowRoot}var kd=new Set(["inline","contents"]);function ea(e){let{overflow:t,overflowX:r,overflowY:a,display:n}=St(e);return /auto|scroll|overlay|hidden|clip/.test(t+a+r)&&!kd.has(n)}var wd=new Set(["table","td","th"]);function li(e){return wd.has(gr(e))}var Cd=[":popover-open",":modal"];function ha(e){return Cd.some(t=>{try{return e.matches(t)}catch{return false}})}var Td=["transform","translate","scale","rotate","perspective"],Sd=["transform","translate","scale","rotate","perspective","filter"],Nd=["paint","layout","strict","content"];function Ja(e){let t=va(),r=dt(e)?St(e):e;return Td.some(a=>r[a]?r[a]!=="none":false)||(r.containerType?r.containerType!=="normal":false)||!t&&(r.backdropFilter?r.backdropFilter!=="none":false)||!t&&(r.filter?r.filter!=="none":false)||Sd.some(a=>(r.willChange||"").includes(a))||Nd.some(a=>(r.contain||"").includes(a))}function ci(e){let t=er(e);for(;Ot(t)&&!hr(t);){if(Ja(t))return t;if(ha(t))return null;t=er(t);}return null}function va(){return typeof CSS>"u"||!CSS.supports?false:CSS.supports("-webkit-backdrop-filter","none")}var Dd=new Set(["html","body","#document"]);function hr(e){return Dd.has(gr(e))}function St(e){return xt(e).getComputedStyle(e)}function ba(e){return dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function er(e){if(gr(e)==="html")return e;let t=e.assignedSlot||e.parentNode||eo(e)&&e.host||_t(e);return eo(t)?t.host:t}function di(e){let t=er(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ot(t)&&ea(t)?t:di(t)}function ir(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=true);let n=di(e),o=n===((a=e.ownerDocument)==null?void 0:a.body),s=xt(n);if(o){let l=Qa(s);return t.concat(s,s.visualViewport||[],ea(n)?n:[],l&&r?ir(l):[])}return t.concat(n,ir(n,[],r))}function Qa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var tr=Math.min,kt=Math.max,xa=Math.round,ka=Math.floor,$t=e=>({x:e,y:e}),Ed={left:"right",right:"left",bottom:"top",top:"bottom"},Rd={start:"end",end:"start"};function tn(e,t,r){return kt(e,tr(t,r))}function Mr(e,t){return typeof e=="function"?e(t):e}function lr(e){return e.split("-")[0]}function Lr(e){return e.split("-")[1]}function ro(e){return e==="x"?"y":"x"}function rn(e){return e==="y"?"height":"width"}var Pd=new Set(["top","bottom"]);function rr(e){return Pd.has(lr(e))?"y":"x"}function an(e){return ro(rr(e))}function mi(e,t,r){r===void 0&&(r=false);let a=Lr(e),n=an(e),o=rn(n),s=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=ya(s)),[s,ya(s)]}function fi(e){let t=ya(e);return [en(e),t,en(t)]}function en(e){return e.replace(/start|end/g,t=>Rd[t])}var ui=["left","right"],pi=["right","left"],Id=["top","bottom"],Md=["bottom","top"];function Ld(e,t,r){switch(e){case "top":case "bottom":return r?t?pi:ui:t?ui:pi;case "left":case "right":return t?Id:Md;default:return []}}function gi(e,t,r,a){let n=Lr(e),o=Ld(lr(e),r==="start",a);return n&&(o=o.map(s=>s+"-"+n),t&&(o=o.concat(o.map(en)))),o}function ya(e){return e.replace(/left|right|bottom|top/g,t=>Ed[t])}function Ad(e){return {top:0,right:0,bottom:0,left:0,...e}}function ao(e){return typeof e!="number"?Ad(e):{top:e,right:e,bottom:e,left:e}}function Ar(e){let{x:t,y:r,width:a,height:n}=e;return {width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}var Fd=typeof document<"u",Od=function(){},Ca=Fd?useLayoutEffect:Od,zd={...xe};var Hd=zd.useInsertionEffect,Ud=Hd||(e=>e());function hi(e){let t=xe.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ud(()=>{t.current=e;}),xe.useCallback(function(){for(var r=arguments.length,a=new Array(r),n=0;n<r;n++)a[n]=arguments[n];return t.current==null?void 0:t.current(...a)},[])}function vi(e,t,r){let{reference:a,floating:n}=e,o=rr(t),s=an(t),l=rn(s),c=lr(t),i=o==="y",u=a.x+a.width/2-n.width/2,d=a.y+a.height/2-n.height/2,f=a[l]/2-n[l]/2,p;switch(c){case "top":p={x:u,y:a.y-n.height};break;case "bottom":p={x:u,y:a.y+a.height};break;case "right":p={x:a.x+a.width,y:d};break;case "left":p={x:a.x-n.width,y:d};break;default:p={x:a.x,y:a.y};}switch(Lr(t)){case "start":p[s]-=f*(r&&i?-1:1);break;case "end":p[s]+=f*(r&&i?-1:1);break}return p}var bi=async(e,t,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:o=[],platform:s}=r,l=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t)),i=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=vi(i,a,c),f=a,p={},x=0;for(let b=0;b<l.length;b++){let{name:g,fn:h}=l[b],{x:v,y:m,data:k,reset:w}=await h({x:u,y:d,initialPlacement:a,placement:f,strategy:n,middlewareData:p,rects:i,platform:s,elements:{reference:e,floating:t}});u=v??u,d=m??d,p={...p,[g]:{...p[g],...k}},w&&x<=50&&(x++,typeof w=="object"&&(w.placement&&(f=w.placement),w.rects&&(i=w.rects===true?await s.getElementRects({reference:e,floating:t,strategy:n}):w.rects),{x:u,y:d}=vi(i,f,c)),b=-1);}return {x:u,y:d,placement:f,strategy:n,middlewareData:p}};async function nn(e,t){var r;t===void 0&&(t={});let{x:a,y:n,platform:o,rects:s,elements:l,strategy:c}=e,{boundary:i="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=false,padding:p=0}=Mr(t,e),x=ao(p),g=l[f?d==="floating"?"reference":"floating":d],h=Ar(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(g)))==null||r?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:i,rootBoundary:u,strategy:c})),v=d==="floating"?{x:a,y:n,width:s.floating.width,height:s.floating.height}:s.reference,m=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),k=await(o.isElement==null?void 0:o.isElement(m))?await(o.getScale==null?void 0:o.getScale(m))||{x:1,y:1}:{x:1,y:1},w=Ar(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:m,strategy:c}):v);return {top:(h.top-w.top+x.top)/k.y,bottom:(w.bottom-h.bottom+x.bottom)/k.y,left:(h.left-w.left+x.left)/k.x,right:(w.right-h.right+x.right)/k.x}}var yi=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:a,placement:n,rects:o,platform:s,elements:l,middlewareData:c}=t,{element:i,padding:u=0}=Mr(e,t)||{};if(i==null)return {};let d=ao(u),f={x:r,y:a},p=an(n),x=rn(p),b=await s.getDimensions(i),g=p==="y",h=g?"top":"left",v=g?"bottom":"right",m=g?"clientHeight":"clientWidth",k=o.reference[x]+o.reference[p]-f[p]-o.floating[x],w=f[p]-o.reference[p],y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i)),C=y?y[m]:0;(!C||!await(s.isElement==null?void 0:s.isElement(y)))&&(C=l.floating[m]||o.floating[x]);let T=k/2-w/2,R=C/2-b[x]/2-1,E=tr(d[h],R),O=tr(d[v],R),D=E,S=C-b[x]-O,I=C/2-b[x]/2+T,z=tn(D,I,S),$=!c.arrow&&Lr(n)!=null&&I!==z&&o.reference[x]/2-(I<D?E:O)-b[x]/2<0,Z=$?I<D?I-D:I-S:0;return {[p]:f[p]+Z,data:{[p]:z,centerOffset:I-z-Z,...$&&{alignmentOffset:Z}},reset:$}}});var xi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;let{placement:n,middlewareData:o,rects:s,initialPlacement:l,platform:c,elements:i}=t,{mainAxis:u=true,crossAxis:d=true,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=true,...g}=Mr(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return {};let h=lr(n),v=rr(l),m=lr(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(i.floating)),w=f||(m||!b?[ya(l)]:fi(l)),y=x!=="none";!f&&y&&w.push(...gi(l,b,x,k));let C=[l,...w],T=await nn(t,g),R=[],E=((a=o.flip)==null?void 0:a.overflows)||[];if(u&&R.push(T[h]),d){let I=mi(n,s,k);R.push(T[I[0]],T[I[1]]);}if(E=[...E,{placement:n,overflows:R}],!R.every(I=>I<=0)){var O,D;let I=(((O=o.flip)==null?void 0:O.index)||0)+1,z=C[I];if(z&&(!(d==="alignment"?v!==rr(z):false)||E.every(J=>rr(J.placement)===v?J.overflows[0]>0:true)))return {data:{index:I,overflows:E},reset:{placement:z}};let $=(D=E.filter(Z=>Z.overflows[0]<=0).sort((Z,J)=>Z.overflows[1]-J.overflows[1])[0])==null?void 0:D.placement;if(!$)switch(p){case "bestFit":{var S;let Z=(S=E.filter(J=>{if(y){let oe=rr(J.placement);return oe===v||oe==="y"}return true}).map(J=>[J.placement,J.overflows.filter(oe=>oe>0).reduce((oe,Ne)=>oe+Ne,0)]).sort((J,oe)=>J[1]-oe[1])[0])==null?void 0:S[0];Z&&($=Z);break}case "initialPlacement":$=l;break}if(n!==$)return {reset:{placement:$}}}return {}}}};var Gd=new Set(["left","top"]);async function _d(e,t){let{placement:r,platform:a,elements:n}=e,o=await(a.isRTL==null?void 0:a.isRTL(n.floating)),s=lr(r),l=Lr(r),c=rr(r)==="y",i=Gd.has(s)?-1:1,u=o&&c?-1:1,d=Mr(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:x}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof x=="number"&&(p=l==="end"?x*-1:x),c?{x:p*u,y:f*i}:{x:f*i,y:p*u}}var ki=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;let{x:n,y:o,placement:s,middlewareData:l}=t,c=await _d(t,e);return s===((r=l.offset)==null?void 0:r.placement)&&(a=l.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:o+c.y,data:{...c,placement:s}}}}},wi=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:r,y:a,placement:n}=t,{mainAxis:o=true,crossAxis:s=false,limiter:l={fn:g=>{let{x:h,y:v}=g;return {x:h,y:v}}},...c}=Mr(e,t),i={x:r,y:a},u=await nn(t,c),d=rr(lr(n)),f=ro(d),p=i[f],x=i[d];if(o){let g=f==="y"?"top":"left",h=f==="y"?"bottom":"right",v=p+u[g],m=p-u[h];p=tn(v,p,m);}if(s){let g=d==="y"?"top":"left",h=d==="y"?"bottom":"right",v=x+u[g],m=x-u[h];x=tn(v,x,m);}let b=l.fn({...t,[f]:p,[d]:x});return {...b,data:{x:b.x-r,y:b.y-a,enabled:{[f]:o,[d]:s}}}}}};var Ci=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;let{placement:n,rects:o,platform:s,elements:l}=t,{apply:c=()=>{},...i}=Mr(e,t),u=await nn(t,i),d=lr(n),f=Lr(n),p=rr(n)==="y",{width:x,height:b}=o.floating,g,h;d==="top"||d==="bottom"?(g=d,h=f===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(h=d,g=f==="end"?"top":"bottom");let v=b-u.top-u.bottom,m=x-u.left-u.right,k=tr(b-u[g],v),w=tr(x-u[h],m),y=!t.middlewareData.shift,C=k,T=w;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(T=m),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(C=v),y&&!f){let E=kt(u.left,0),O=kt(u.right,0),D=kt(u.top,0),S=kt(u.bottom,0);p?T=x-2*(E!==0||O!==0?E+O:kt(u.left,u.right)):C=b-2*(D!==0||S!==0?D+S:kt(u.top,u.bottom));}await c({...t,availableWidth:T,availableHeight:C});let R=await s.getDimensions(l.floating);return x!==R.width||b!==R.height?{reset:{rects:true}}:{}}}};function Di(e){let t=St(e),r=parseFloat(t.width)||0,a=parseFloat(t.height)||0,n=Ot(e),o=n?e.offsetWidth:r,s=n?e.offsetHeight:a,l=xa(r)!==o||xa(a)!==s;return l&&(r=o,a=s),{width:r,height:a,$:l}}function oo(e){return dt(e)?e:e.contextElement}function ta(e){let t=oo(e);if(!Ot(t))return $t(1);let r=t.getBoundingClientRect(),{width:a,height:n,$:o}=Di(t),s=(o?xa(r.width):r.width)/a,l=(o?xa(r.height):r.height)/n;return (!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var $d=$t(0);function Ei(e){let t=xt(e);return !va()||!t.visualViewport?$d:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wd(e,t,r){return t===void 0&&(t=false),!r||t&&r!==xt(e)?false:t}function Br(e,t,r,a){t===void 0&&(t=false),r===void 0&&(r=false);let n=e.getBoundingClientRect(),o=oo(e),s=$t(1);t&&(a?dt(a)&&(s=ta(a)):s=ta(e));let l=Wd(o,r,a)?Ei(o):$t(0),c=(n.left+l.x)/s.x,i=(n.top+l.y)/s.y,u=n.width/s.x,d=n.height/s.y;if(o){let f=xt(o),p=a&&dt(a)?xt(a):a,x=f,b=Qa(x);for(;b&&a&&p!==x;){let g=ta(b),h=b.getBoundingClientRect(),v=St(b),m=h.left+(b.clientLeft+parseFloat(v.paddingLeft))*g.x,k=h.top+(b.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,i*=g.y,u*=g.x,d*=g.y,c+=m,i+=k,x=xt(b),b=Qa(x);}}return Ar({width:u,height:d,x:c,y:i})}function on(e,t){let r=ba(e).scrollLeft;return t?t.left+r:Br(_t(e)).left+r}function Ri(e,t){let r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-on(e,r),n=r.top+t.scrollTop;return {x:a,y:n}}function Vd(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e,o=n==="fixed",s=_t(a),l=t?ha(t.floating):false;if(a===s||l&&o)return r;let c={scrollLeft:0,scrollTop:0},i=$t(1),u=$t(0),d=Ot(a);if((d||!d&&!o)&&((gr(a)!=="body"||ea(s))&&(c=ba(a)),Ot(a))){let p=Br(a);i=ta(a),u.x=p.x+a.clientLeft,u.y=p.y+a.clientTop;}let f=s&&!d&&!o?Ri(s,c):$t(0);return {width:r.width*i.x,height:r.height*i.y,x:r.x*i.x-c.scrollLeft*i.x+u.x+f.x,y:r.y*i.y-c.scrollTop*i.y+u.y+f.y}}function Kd(e){return Array.from(e.getClientRects())}function jd(e){let t=_t(e),r=ba(e),a=e.ownerDocument.body,n=kt(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),o=kt(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight),s=-r.scrollLeft+on(e),l=-r.scrollTop;return St(a).direction==="rtl"&&(s+=kt(t.clientWidth,a.clientWidth)-n),{width:n,height:o,x:s,y:l}}var Ti=25;function Yd(e,t){let r=xt(e),a=_t(e),n=r.visualViewport,o=a.clientWidth,s=a.clientHeight,l=0,c=0;if(n){o=n.width,s=n.height;let u=va();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop);}let i=on(a);if(i<=0){let u=a.ownerDocument,d=u.body,f=getComputedStyle(d),p=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,x=Math.abs(a.clientWidth-d.clientWidth-p);x<=Ti&&(o-=x);}else i<=Ti&&(o+=i);return {width:o,height:s,x:l,y:c}}var qd=new Set(["absolute","fixed"]);function Xd(e,t){let r=Br(e,true,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,o=Ot(e)?ta(e):$t(1),s=e.clientWidth*o.x,l=e.clientHeight*o.y,c=n*o.x,i=a*o.y;return {width:s,height:l,x:c,y:i}}function Si(e,t,r){let a;if(t==="viewport")a=Yd(e,r);else if(t==="document")a=jd(_t(e));else if(dt(t))a=Xd(t,r);else {let n=Ei(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height};}return Ar(a)}function Pi(e,t){let r=er(e);return r===t||!dt(r)||hr(r)?false:St(r).position==="fixed"||Pi(r,t)}function Zd(e,t){let r=t.get(e);if(r)return r;let a=ir(e,[],false).filter(l=>dt(l)&&gr(l)!=="body"),n=null,o=St(e).position==="fixed",s=o?er(e):e;for(;dt(s)&&!hr(s);){let l=St(s),c=Ja(s);!c&&l.position==="fixed"&&(n=null),(o?!c&&!n:!c&&l.position==="static"&&!!n&&qd.has(n.position)||ea(s)&&!c&&Pi(e,s))?a=a.filter(u=>u!==s):n=l,s=er(s);}return t.set(e,a),a}function Jd(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e,s=[...r==="clippingAncestors"?ha(t)?[]:Zd(t,this._c):[].concat(r),a],l=s[0],c=s.reduce((i,u)=>{let d=Si(t,u,n);return i.top=kt(d.top,i.top),i.right=tr(d.right,i.right),i.bottom=tr(d.bottom,i.bottom),i.left=kt(d.left,i.left),i},Si(t,l,n));return {width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Qd(e){let{width:t,height:r}=Di(e);return {width:t,height:r}}function eu(e,t,r){let a=Ot(t),n=_t(t),o=r==="fixed",s=Br(e,true,o,t),l={scrollLeft:0,scrollTop:0},c=$t(0);function i(){c.x=on(n);}if(a||!a&&!o)if((gr(t)!=="body"||ea(n))&&(l=ba(t)),a){let p=Br(t,true,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop;}else n&&i();o&&!a&&n&&i();let u=n&&!a&&!o?Ri(n,l):$t(0),d=s.left+l.scrollLeft-c.x-u.x,f=s.top+l.scrollTop-c.y-u.y;return {x:d,y:f,width:s.width,height:s.height}}function no(e){return St(e).position==="static"}function Ni(e,t){if(!Ot(e)||St(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return _t(e)===r&&(r=r.ownerDocument.body),r}function Ii(e,t){let r=xt(e);if(ha(e))return r;if(!Ot(e)){let n=er(e);for(;n&&!hr(n);){if(dt(n)&&!no(n))return n;n=er(n);}return r}let a=Ni(e,t);for(;a&&li(a)&&no(a);)a=Ni(a,t);return a&&hr(a)&&no(a)&&!Ja(a)?r:a||ci(e)||r}var tu=async function(e){let t=this.getOffsetParent||Ii,r=this.getDimensions,a=await r(e.floating);return {reference:eu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function ru(e){return St(e).direction==="rtl"}var so={convertOffsetParentRelativeRectToViewportRelativeRect:Vd,getDocumentElement:_t,getClippingRect:Jd,getOffsetParent:Ii,getElementRects:tu,getClientRects:Kd,getDimensions:Qd,getScale:ta,isElement:dt,isRTL:ru};function Mi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function au(e,t){let r=null,a,n=_t(e);function o(){var l;clearTimeout(a),(l=r)==null||l.disconnect(),r=null;}function s(l,c){l===void 0&&(l=false),c===void 0&&(c=1),o();let i=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=i;if(l||t(),!f||!p)return;let x=ka(d),b=ka(n.clientWidth-(u+f)),g=ka(n.clientHeight-(d+p)),h=ka(u),m={rootMargin:-x+"px "+-b+"px "+-g+"px "+-h+"px",threshold:kt(0,tr(1,c))||1},k=true;function w(y){let C=y[0].intersectionRatio;if(C!==c){if(!k)return s();C?s(false,C):a=setTimeout(()=>{s(false,1e-7);},1e3);}C===1&&!Mi(i,e.getBoundingClientRect())&&s(),k=false;}try{r=new IntersectionObserver(w,{...m,root:n.ownerDocument});}catch{r=new IntersectionObserver(w,m);}r.observe(e);}return s(true),o}function sn(e,t,r,a){a===void 0&&(a={});let{ancestorScroll:n=true,ancestorResize:o=true,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=false}=a,i=oo(e),u=n||o?[...i?ir(i):[],...ir(t)]:[];u.forEach(h=>{n&&h.addEventListener("scroll",r,{passive:true}),o&&h.addEventListener("resize",r);});let d=i&&l?au(i,r):null,f=-1,p=null;s&&(p=new ResizeObserver(h=>{let[v]=h;v&&v.target===i&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var m;(m=p)==null||m.observe(t);})),r();}),i&&!c&&p.observe(i),p.observe(t));let x,b=c?Br(e):null;c&&g();function g(){let h=Br(e);b&&!Mi(b,h)&&r(),b=h,x=requestAnimationFrame(g);}return r(),()=>{var h;u.forEach(v=>{n&&v.removeEventListener("scroll",r),o&&v.removeEventListener("resize",r);}),d?.(),(h=p)==null||h.disconnect(),p=null,c&&cancelAnimationFrame(x);}}var Li=ki;var Ai=wi,Bi=xi,Fi=Ci;var io=yi;var ln=(e,t,r)=>{let a=new Map,n={platform:so,...r},o={...n.platform,_c:a};return bi(e,t,{...n,platform:o})};var ou=typeof document<"u",su=function(){},cn=ou?useLayoutEffect:su;function dn(e,t){if(e===t)return true;if(typeof e!=typeof t)return false;if(typeof e=="function"&&e.toString()===t.toString())return true;let r,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return false;for(a=r;a--!==0;)if(!dn(e[a],t[a]))return false;return true}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return false;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return false;for(a=r;a--!==0;){let o=n[a];if(!(o==="_owner"&&e.$$typeof)&&!dn(e[o],t[o]))return false}return true}return e!==e&&t!==t}function Ui(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Oi(e,t){let r=Ui(e);return Math.round(t*r)/r}function lo(e){let t=xe.useRef(e);return cn(()=>{t.current=e;}),t}function Gi(e){e===void 0&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:o,floating:s}={},transform:l=true,whileElementsMounted:c,open:i}=e,[u,d]=xe.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:false}),[f,p]=xe.useState(a);dn(f,a)||p(a);let[x,b]=xe.useState(null),[g,h]=xe.useState(null),v=xe.useCallback(J=>{J!==y.current&&(y.current=J,b(J));},[]),m=xe.useCallback(J=>{J!==C.current&&(C.current=J,h(J));},[]),k=o||x,w=s||g,y=xe.useRef(null),C=xe.useRef(null),T=xe.useRef(u),R=c!=null,E=lo(c),O=lo(n),D=lo(i),S=xe.useCallback(()=>{if(!y.current||!C.current)return;let J={placement:t,strategy:r,middleware:f};O.current&&(J.platform=O.current),ln(y.current,C.current,J).then(oe=>{let Ne={...oe,isPositioned:D.current!==false};I.current&&!dn(T.current,Ne)&&(T.current=Ne,Hi.flushSync(()=>{d(Ne);}));});},[f,t,r,O,D]);cn(()=>{i===false&&T.current.isPositioned&&(T.current.isPositioned=false,d(J=>({...J,isPositioned:false})));},[i]);let I=xe.useRef(false);cn(()=>(I.current=true,()=>{I.current=false;}),[]),cn(()=>{if(k&&(y.current=k),w&&(C.current=w),k&&w){if(E.current)return E.current(k,w,S);S();}},[k,w,S,E,R]);let z=xe.useMemo(()=>({reference:y,floating:C,setReference:v,setFloating:m}),[v,m]),$=xe.useMemo(()=>({reference:k,floating:w}),[k,w]),Z=xe.useMemo(()=>{let J={position:r,left:0,top:0};if(!$.floating)return J;let oe=Oi($.floating,u.x),Ne=Oi($.floating,u.y);return l?{...J,transform:"translate("+oe+"px, "+Ne+"px)",...Ui($.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:oe,top:Ne}},[r,l,$.floating,u.x,u.y]);return xe.useMemo(()=>({...u,update:S,refs:z,elements:$,floatingStyles:Z}),[u,S,z,$,Z])}var iu=e=>{function t(r){return {}.hasOwnProperty.call(r,"current")}return {name:"arrow",options:e,fn(r){let{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?io({element:a.current,padding:n}).fn(r):{}:a?io({element:a,padding:n}).fn(r):{}}}},un=(e,t)=>({...Li(e),options:[e,t]}),co=(e,t)=>({...Ai(e),options:[e,t]});var uo=(e,t)=>({...Bi(e),options:[e,t]}),po=(e,t)=>({...Fi(e),options:[e,t]});var mo=(e,t)=>({...iu(e),options:[e,t]});var gu={...xe},_i=false,hu=0,$i=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+hu++;function vu(){let[e,t]=xe.useState(()=>_i?$i():void 0);return Ca(()=>{e==null&&t($i());},[]),xe.useEffect(()=>{_i=true;},[]),e}var bu=gu.useId,Vi=bu||vu,Ta;process.env.NODE_ENV!=="production"&&(Ta=new Set);function yu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Ta)!=null&&e.has(n))){var o;(o=Ta)==null||o.add(n),console.warn(n);}}function xu(){for(var e,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];let n="Floating UI: "+r.join(" ");if(!((e=Ta)!=null&&e.has(n))){var o;(o=Ta)==null||o.add(n),console.error(n);}}var Ki=xe.forwardRef(function(t,r){let{context:{placement:a,elements:{floating:n},middlewareData:{arrow:o,shift:s}},width:l=14,height:c=7,tipRadius:i=0,strokeWidth:u=0,staticOffset:d,stroke:f,d:p,style:{transform:x,...b}={},...g}=t;process.env.NODE_ENV!=="production"&&(r||yu("The `ref` prop is required for `FloatingArrow`."));let h=Vi(),[v,m]=xe.useState(false);if(Ca(()=>{if(!n)return;St(n).direction==="rtl"&&m(true);},[n]),!n)return null;let[k,w]=a.split("-"),y=k==="top"||k==="bottom",C=d;(y&&s!=null&&s.x||!y&&s!=null&&s.y)&&(C=null);let T=u*2,R=T/2,E=l/2*(i/-8+1),O=c/2*i/4,D=!!p,S=C&&w==="end"?"bottom":"top",I=C&&w==="end"?"right":"left";C&&v&&(I=w==="end"?"left":"right");let z=o?.x!=null?C||o.x:"",$=o?.y!=null?C||o.y:"",Z=p||"M0,0"+(" H"+l)+(" L"+(l-E)+","+(c-O))+(" Q"+l/2+","+c+" "+E+","+(c-O))+" Z",J={top:D?"rotate(180deg)":"",left:D?"rotate(90deg)":"rotate(-90deg)",bottom:D?"":"rotate(180deg)",right:D?"rotate(-90deg)":"rotate(90deg)"}[k];return jsxs("svg",{...g,"aria-hidden":true,ref:r,width:D?l:l+T,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[I]:z,[S]:$,[k]:y||D?"100%":"calc(100% - "+T/2+"px)",transform:[J,x].filter(oe=>!!oe).join(" "),...b},children:[T>0&&jsx("path",{clipPath:"url(#"+h+")",fill:"none",stroke:f,strokeWidth:T+(p?0:1),d:Z}),jsx("path",{stroke:T&&!p?g.fill:"none",d:Z}),jsx("clipPath",{id:h,children:jsx("rect",{x:-R,y:R*(D?-1:1),width:l+T,height:l})})]})});function ku(){let e=new Map;return {emit(t,r){var a;(a=e.get(t))==null||a.forEach(n=>n(r));},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r);},off(t,r){var a;(a=e.get(t))==null||a.delete(r);}}}var wu=xe.createContext(null),Cu=xe.createContext(null),Tu=()=>{var e;return ((e=xe.useContext(wu))==null?void 0:e.id)||null},Su=()=>xe.useContext(Cu);function Nu(e){let{open:t=false,onOpenChange:r,elements:a}=e,n=Vi(),o=xe.useRef({}),[s]=xe.useState(()=>ku()),l=Tu()!=null;if(process.env.NODE_ENV!=="production"){let p=a.reference;p&&!dt(p)&&xu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.");}let[c,i]=xe.useState(a.reference),u=hi((p,x,b)=>{o.current.openEvent=p?x:void 0,s.emit("openchange",{open:p,event:x,reason:b,nested:l}),r?.(p,x,b);}),d=xe.useMemo(()=>({setPositionReference:i}),[]),f=xe.useMemo(()=>({reference:c||a.reference||null,floating:a.floating||null,domReference:a.reference}),[c,a.reference,a.floating]);return xe.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:f,events:s,floatingId:n,refs:d}),[t,u,f,s,n,d])}function ji(e){e===void 0&&(e={});let{nodeId:t}=e,r=Nu({...e,elements:{reference:null,floating:null,...e.elements}}),a=e.rootContext||r,n=a.elements,[o,s]=xe.useState(null),[l,c]=xe.useState(null),u=n?.domReference||o,d=xe.useRef(null),f=Su();Ca(()=>{u&&(d.current=u);},[u]);let p=Gi({...e,elements:{...n,...l&&{reference:l}}}),x=xe.useCallback(m=>{let k=dt(m)?{getBoundingClientRect:()=>m.getBoundingClientRect(),getClientRects:()=>m.getClientRects(),contextElement:m}:m;c(k),p.refs.setReference(k);},[p.refs]),b=xe.useCallback(m=>{(dt(m)||m===null)&&(d.current=m,s(m)),(dt(p.refs.reference.current)||p.refs.reference.current===null||m!==null&&!dt(m))&&p.refs.setReference(m);},[p.refs]),g=xe.useMemo(()=>({...p.refs,setReference:b,setPositionReference:x,domReference:d}),[p.refs,b,x]),h=xe.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=xe.useMemo(()=>({...p,...a,refs:g,elements:h,nodeId:t}),[p,g,h,t,a]);return Ca(()=>{a.dataRef.current.floatingContext=v;let m=f?.nodesRef.current.find(k=>k.id===t);m&&(m.context=v);}),xe.useMemo(()=>({...p,context:v,refs:g,elements:h}),[p,g,h,v])}function Yi(e,t,r=true){useEffect(()=>{if(!r)return;let a=o=>{(Array.isArray(e)?e:[e]).some(c=>{let i=c.current;if(!i)return false;let u=o.target;return i===u||i.contains(u)})||t(o);},n=setTimeout(()=>{document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);},0);return ()=>{clearTimeout(n),document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a);}},[e,t,r]);}function Xi({itemCount:e,onSelect:t,onEscape:r,enabled:a=true,loop:n=true,containerRef:o}){let[s,l]=useState(-1);useEffect(()=>{if(!a||s===-1||!o?.current)return;let d=o.current.querySelector(`[data-index="${s}"]`);d&&d.scrollIntoView({block:"nearest",behavior:"smooth"});},[s,a,o]);let c=useCallback(u=>{if(a)switch(u.key){case "ArrowDown":u.preventDefault(),l(d=>d===-1?0:d===e-1?n?0:d:d+1);break;case "ArrowUp":u.preventDefault(),l(d=>d===-1?e-1:d===0?n?e-1:d:d-1);break;case "Enter":case " ":u.preventDefault(),s!==-1&&t&&t(s);break;case "Escape":u.preventDefault(),r&&r();break;case "Home":u.preventDefault(),l(0);break;case "End":u.preventDefault(),l(e-1);break;}},[a,s,e,n,t,r]),i=useCallback(u=>({"data-active":u===s,"data-index":u,role:"option",tabIndex:-1}),[s]);return {activeIndex:s,setActiveIndex:l,handleKeyDown:c,getItemProps:i}}function cr({trigger:e,children:t,isOpen:r,onOpenChange:a,placement:n="bottom-start",offsetDistance:o=8,maxHeight:s=320,minWidth:l="trigger",maxWidth:c,showArrow:i=false,className:u="",triggerClassName:d="",disableClickOutside:f=false,disableKeyboardNav:p=false,itemCount:x=0,onSelectItem:b,onOpen:g,onClose:h,animationDuration:v=200,zIndex:m=1e3}){let[k,w]=useState(false),y=r!==void 0?r:k,C=useCallback(Pe=>{let B=y;r===void 0&&w(Pe),a?.(Pe),Pe&&!B?g?.():!Pe&&B&&h?.();},[r,a,g,h,y]),T=useCallback(()=>{C(!y);},[y,C]),R=useCallback(()=>{C(false);},[C]),E=useRef(null),O=useRef(null),D=useRef(null),{refs:S,floatingStyles:I,context:z}=ji({open:y,onOpenChange:C,placement:n,middleware:[un(o),uo({padding:8}),co({padding:8}),po({apply({rects:Pe,elements:B}){Object.assign(B.floating.style,{minWidth:l==="trigger"?`${Pe.reference.width}px`:l?`${l}px`:void 0,maxWidth:c?`${c}px`:void 0,maxHeight:`${s}px`});},padding:8}),i?mo({element:D}):null].filter(Boolean),whileElementsMounted:sn});Yi([E,O],R,y&&!f);let{activeIndex:$,setActiveIndex:Z,handleKeyDown:J}=Xi({itemCount:x,onSelect:b,onEscape:R,enabled:y&&!p,loop:true,containerRef:O}),oe=()=>typeof e=="function"?e({isOpen:y,toggle:T}):e,Ne=()=>typeof t=="function"?t({activeIndex:$,setActiveIndex:Z,close:R}):t,re={transition:`opacity ${v}ms ease-in-out, transform ${v}ms ease-in-out`,opacity:y?1:0,transform:y?"scale(1)":"scale(0.95)",pointerEvents:y?"auto":"none"};return jsxs(Fragment,{children:[jsx("div",{ref:E,className:`dropdown-trigger ${d}`,onClick:T,children:oe()}),jsx(Ae,{children:jsxs("div",{ref:S.setFloating,style:{...I,zIndex:m,...re},className:`dropdown-content ${u}`,role:"menu","aria-orientation":"vertical",onKeyDown:J,children:[jsx("div",{ref:O,className:"dropdown-inner",children:Ne()}),i&&jsx(Ki,{ref:D,context:z,className:"dropdown-arrow"})]})})]})}var Ji={URGENT:{label:"Urgent",color:"#E74C3C",darkColor:"#ff6b6b"},HIGH:{label:"High",color:"#E67E22",darkColor:"#ffa94d"},MEDIUM:{label:"Normal",color:"#F1C40F",darkColor:"#ffd43b"},LOW:{label:"Low",color:"#2ECC71",darkColor:"#51cf66"}},Mu="#BDC3C7",Lu="#868e96",Au=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]}),Qi=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"var(--asakaa-color-interactive-primary, #1976d2)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function ho({priority:e,onChange:t,className:r}){let a=e?Ji[e]:null,n=document.documentElement.getAttribute("data-theme")==="dark",o=a?n?a.darkColor:a.color:n?Lu:Mu,s=c=>{t(c);},l=Object.entries(Ji);return jsx(cr,{trigger:({isOpen:c})=>jsx("button",{className:`flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95 ${r||""}`,style:{background:e?`${o}10`:"transparent",boxShadow:e?`0 0 0 2px ${o}30 inset`:"none",transform:c?"scale(1.1)":"scale(1)"},title:a?.label||"Set priority","aria-label":"Select priority","aria-expanded":c,"aria-haspopup":"menu",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:o,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:o,fillOpacity:e?"0.6":"0.4"})})}),placement:"bottom-start",minWidth:180,maxHeight:280,itemCount:l.length+1,onSelectItem:c=>{let i=l[c];s(i?i[0]:void 0);},children:({activeIndex:c,close:i})=>jsxs("div",{className:"priority-dropdown",children:[jsx("div",{className:"dropdown-section-header",children:"Priority"}),jsxs("div",{className:"dropdown-section",children:[l.map(([u,d],f)=>{let p=n?d.darkColor:d.color,x=c===f,b=e===u;return jsxs("button",{onClick:()=>{s(u),i();},className:"dropdown-item","data-active":x,"data-index":f,role:"option","aria-selected":b,style:{color:x?p:"inherit",fontWeight:b?600:400},children:[jsx(Au,{color:p}),jsx("span",{children:d.label}),b&&jsx(Qi,{})]},u)}),jsx("div",{style:{borderTop:"1px solid var(--asakaa-color-border-default, #e0e0e0)",marginTop:"4px",paddingTop:"4px"},children:jsxs("button",{onClick:()=>{s(void 0),i();},className:"dropdown-item","data-active":c===l.length,"data-index":l.length,role:"option","aria-selected":!e,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"var(--asakaa-color-text-tertiary, #9e9e9e)",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{children:"Clear"}),!e&&jsx(Qi,{})]})})]})]})})}var tl=[{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 vo({startDate:e,endDate:t,onChange:r,className:a}){let[n,o]=useState(e||""),[s,l]=useState(t||""),c=(x,b)=>{let g=new Date,h=new Date(g);h.setDate(h.getDate()+x);let v=g.toISOString().split("T")[0]||"",m=h.toISOString().split("T")[0]||"";o(v),l(m),r(v,m),b();},i=x=>{r(n||void 0,s||void 0),x();},u=()=>{if(!e||!t)return "Set date";let x=v=>{if(v instanceof Date)return v;if(typeof v!="string"||!v.match(/^\d{4}-\d{2}-\d{2}$/))return null;let m=v.split("-").map(Number);if(m.length!==3||m.some(C=>isNaN(C)))return null;let k=m[0],w=m[1],y=m[2];return k===void 0||w===void 0||y===void 0?null:new Date(k,w-1,y)},b=x(e),g=x(t);if(!b||!g||isNaN(b.getTime())||isNaN(g.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[b.getMonth()]} ${b.getDate()} \u2013 ${h[g.getMonth()]} ${g.getDate()}`},d=e&&t,p=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,b=new Date;return b.setHours(0,0,0,0),x<b})();return jsx(cr,{trigger:({isOpen:x})=>jsxs("button",{className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${p?"asakaa-date-overdue":"asakaa-date"} ${a||""}`,style:{transform:x?"scale(1.05)":"scale(1)"},title:d?`${u()}`:"Set date range","aria-label":"Select date range","aria-expanded":x,"aria-haspopup":"menu",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:u()})]}),placement:"bottom-start",minWidth:320,maxHeight:480,itemCount:tl.length,onOpen:()=>{o(e||""),l(t||"");},children:({activeIndex:x,close:b})=>jsxs("div",{className:"date-range-picker-dropdown",children:[jsxs("div",{className:"dropdown-button-wrapper",children:[jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Quick Select"}),jsx("div",{className:"dropdown-quick-grid",children:tl.map((g,h)=>jsx("button",{onClick:()=>c(g.days,b),className:"dropdown-quick-button","data-active":x===h,"data-index":h,role:"option",children:g.label},g.label))})]}),jsxs("div",{className:"dropdown-button-wrapper",children:[jsx("div",{className:"dropdown-section-header",style:{marginBottom:"12px"},children:"Custom Range"}),jsxs("div",{className:"dropdown-form-actions",children:[jsxs("div",{className:"dropdown-form-group",children:[jsx("label",{className:"dropdown-label",children:"Start Date"}),jsx("input",{type:"date",value:n,onChange:g=>o(g.target.value),className:"dropdown-input"})]}),jsxs("div",{className:"dropdown-form-group",children:[jsx("label",{className:"dropdown-label",children:"End Date"}),jsx("input",{type:"date",value:s,onChange:g=>l(g.target.value),className:"dropdown-input"})]}),jsx("button",{onClick:()=>i(b),className:"dropdown-primary-button",children:"Apply"}),(e||t)&&jsx("button",{onClick:()=>{o(""),l(""),r(void 0,void 0),b();},className:"dropdown-danger-button",children:"Clear Dates"})]})]})]})})}function bo({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[o,s]=useState(""),l=d=>{let f=e.some(p=>p.id===d.id);r(f?e.filter(p=>p.id!==d.id):[...e,d]);},c=t.filter(d=>d.name.toLowerCase().includes(o.toLowerCase())),i=e.slice(0,n),u=e.length-n;return jsx(cr,{trigger:({isOpen:d})=>jsx("button",{className:`dropdown-avatar-trigger ${a||""}`,style:{transform:d?"scale(1.05)":"scale(1)"},title:e.length>0?`${e.length} assigned`:"Assign users","aria-label":"Assign users","aria-expanded":d,"aria-haspopup":"menu",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[i.map(f=>jsx("div",{className:"asakaa-avatar",title:f.name,style:{backgroundColor:f.color,color:"#fff"},children:f.avatar?jsx("img",{src:f.avatar,alt:f.name,className:"asakaa-avatar-img"}):f.initials},f.id)),u>0&&jsxs("div",{className:"asakaa-avatar dropdown-avatar-overflow",children:["+",u]})]}):jsx("div",{className:"dropdown-avatar-empty-trigger",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[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"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:c.length,onSelectItem:d=>{let f=c[d];f&&l(f);},onClose:()=>s(""),children:({activeIndex:d,close:f})=>jsxs("div",{children:[jsx("div",{className:"dropdown-section-header",children:"Assign Users"}),jsx("div",{className:"dropdown-search-wrapper",children:jsx("input",{type:"text",value:o,onChange:p=>s(p.target.value),placeholder:"Search users...",className:"dropdown-search-input",autoFocus:true})}),jsx("div",{className:"dropdown-list",children:c.length===0?jsx("div",{className:"dropdown-empty",children:"No users found"}):c.map((p,x)=>{let b=e.some(g=>g.id===p.id);return jsxs("button",{onClick:()=>{l(p);},className:"dropdown-item","data-active":d===x,"data-index":x,role:"option","aria-selected":b,children:[jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,flexShrink:0,backgroundColor:p.color,color:"#fff",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},children:p.avatar?jsx("img",{src:p.avatar,alt:p.name,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):p.initials}),jsx("span",{style:{flex:1,fontWeight:600},children:p.name}),b&&jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 9L7.5 12.5L14 6",stroke:"var(--asakaa-color-interactive-primary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p.id)})}),e.length>0&&jsx("div",{className:"dropdown-button-wrapper",children:jsx("button",{onClick:()=>{r([]),f();},className:"dropdown-danger-button",children:"Clear All"})})]})})}function yo({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n}){let[o,s]=useState(""),[l,c]=useState(t.length>0),i=p=>{if(t.includes(p)){let b=t.filter(g=>g!==p);a(b),b.length===0&&c(false);}else a([...t,p]),c(true);},u=()=>{let p=!l;c(p),p||a([]);},d=r.filter(p=>p.id!==e).filter(p=>p.title.toLowerCase().includes(o.toLowerCase())||p.id.toLowerCase().includes(o.toLowerCase())),f=t.length>0?"#3B82F6":"#BDC3C7";return jsx(cr,{trigger:({isOpen:p})=>jsxs("button",{className:`flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5 ${n||""}`,style:{transform:p?"scale(1.05)":"scale(1)"},title:t.length>0?`${t.length} dependencies`:"Add dependencies","aria-label":"Select dependencies","aria-expanded":p,"aria-haspopup":"menu",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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&&jsx("span",{className:"text-xs font-medium",style:{color:f},children:t.length})]}),placement:"bottom-start",minWidth:300,maxHeight:350,itemCount:l?d.length:0,onSelectItem:p=>{let x=d[p];x&&i(x.id);},onClose:()=>s(""),onOpen:()=>c(t.length>0),children:({activeIndex:p,close:x})=>jsxs("div",{className:"dependencies-dropdown",children:[jsx("div",{className:"dropdown-section-header",children:"Task Dependencies"}),jsx("div",{className:"dropdown-button-wrapper",style:{borderBottom:"1px solid var(--asakaa-color-border-subtle)"},children:jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:u,children:[jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",border:l?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:l?"var(--asakaa-color-interactive-primary)":"transparent"},children:l&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:"Has dependencies"})]})}),l&&jsxs(Fragment,{children:[jsx("div",{className:"dropdown-search-wrapper",children:jsx("input",{type:"text",value:o,onChange:b=>s(b.target.value),placeholder:"Search by name or ID...",className:"dropdown-search-input",autoFocus:true})}),jsx("div",{className:"dropdown-list",children:d.length===0?jsx("div",{className:"dropdown-empty",children:"No tasks found"}):d.map((b,g)=>{let h=t.includes(b.id);return jsxs("button",{onClick:()=>i(b.id),className:"dropdown-item","data-active":p===g,"data-index":g,role:"option","aria-selected":h,children:[jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"2px",transition:"all 0.15s",border:h?"2px solid var(--asakaa-color-interactive-primary)":"2px solid var(--asakaa-color-border-default)",background:h?"var(--asakaa-color-interactive-primary)":"transparent"},children:h&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsx("div",{style:{fontWeight:600,color:"var(--asakaa-color-text-primary)"},children:b.title}),jsx("div",{style:{fontSize:"11px",marginTop:"2px",color:"var(--asakaa-color-text-secondary)"},children:b.id})]})]},b.id)})})]}),t.length>0&&jsx("div",{className:"dropdown-button-wrapper",children:jsx("button",{onClick:()=>{a([]),c(false),x();},className:"dropdown-danger-button",children:"Clear All Dependencies"})})]})})}function al({columnTitle:e,onRename:t,className:r}){let[a,n]=useState(false),[o,s]=useState(false),[l,c]=useState(e),[i,u]=useState({top:0,left:0}),d=useRef(null),f=useRef(null),p=useRef(null);useEffect(()=>{if(a&&f.current){let h=f.current.getBoundingClientRect();u({top:h.bottom+window.scrollY+8,left:h.left+window.scrollX});}},[a]),useEffect(()=>{let h=v=>{d.current&&!d.current.contains(v.target)&&!f.current?.contains(v.target)&&(n(false),s(false));};if(a)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[a]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(n(false),s(false),c(e));};if(a)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[a,e]),useEffect(()=>{o&&p.current&&(p.current.focus(),p.current.select());},[o]);let x=()=>{s(true),c(e);},b=()=>{let h=l.trim();h&&h!==e&&t(h),s(false),n(false),c(e);},g=h=>{h.key==="Enter"?b():h.key==="Escape"&&(s(false),c(e));};return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:f,onClick:()=>n(!a),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),a&&jsx(Ae,{children:jsx("div",{ref:d,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${i.top}px`,left:`${i.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:o?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:p,type:"text",value:l,onChange:h=>c(h.target.value),onKeyDown:g,onBlur:b,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsx("div",{className:"py-1",children:jsxs("button",{onClick:x,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:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]})})})})]})}var aa=memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:o,onCardClick:s,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:d=120,isCollapsed:f,onToggleCollapse:p,onColumnRename:x,className:b})=>{let{setNodeRef:g,isOver:h}=useDroppable({id:e.id,data:{type:"column",column:e}}),v=useRef(null),m=u??$s(t.length),k=useVirtualizer({count:t.length,getScrollElement:()=>v.current,estimateSize:()=>d,enabled:m});if(r)return jsx("div",{ref:g,className:b,children:r(e,t)});let y=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let R=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:R}:R>=80?{state:"warning",percentage:R}:R>=60?{state:"approaching",percentage:R}:{state:"ok",percentage:R}})(),C=y.state==="exceeded",T=()=>"asakaa-column-count";return jsxs("div",{ref:g,className:te("asakaa-column",h&&"ring-2 ring-asakaa-accent-blue",C&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:te(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&y.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${y.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[y.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),y.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),y.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),y.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),x&&jsx(al,{columnTitle:e.title,onRename:R=>x(e.id,R)}),p&&jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":f?"Expand column":"Collapse column",children:f?"\u25B6":"\u25BC"})]})]}),!f&&jsx("div",{ref:v,className:"asakaa-column-cards",style:{maxHeight:m?"600px":void 0},children:jsx(SortableContext,{items:t.map(R=>R.id),strategy:verticalListSortingStrategy,children:t.length===0?o?o(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):m?jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(R=>{let E=t[R.index];return E?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${R.start}px)`},children:jsx(sr,{card:E,render:a,onClick:s,onUpdate:l,availableUsers:c,allCards:i})},E.id):null})}):t.map(R=>jsx(sr,{card:R,render:a,onClick:s,onUpdate:l,availableUsers:c,allCards:i},R.id))})})]})});aa.displayName="Column";function ko({title:e,onSave:t,className:r}){let[a,n]=useState(false),[o,s]=useState(e),l=useRef(null);useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.select());},[a]);let c=()=>{let u=o.trim();u&&u!==e?t(u):s(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(s(e),n(false));};return a?jsx("input",{ref:l,type:"text",value:o,onChange:u=>s(u.target.value),onBlur:c,onKeyDown:i,className:te("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",r),maxLength:50}):jsx("h2",{className:te("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function Co(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{dragStore.setState(a);},[]);return [e,r]}function yr({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:o=[],className:s,style:l,isLoading:c,error:i,children:u}){let[d,f]=Co(),p=useCallback((w,y)=>{t.onCardUpdate?.(w,y);},[t]),x=useCallback((w,y)=>{t.onColumnUpdate?.(w,{title:y});},[t]),b=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),g=useMemo(()=>{let w=new Map;return e.columns.forEach(y=>{let C=y.cardIds.map(T=>e.cards.find(R=>R.id===T)).filter(T=>T!==void 0).sort((T,R)=>T.position-R.position);w.set(y.id,C);}),w},[e.cards,e.columns]),h=useCallback(w=>{let{active:y}=w,C=e.cards.find(T=>T.id===y.id);C&&f({isDragging:true,draggedCardId:C.id,sourceColumnId:C.columnId,targetColumnId:C.columnId});},[e.cards,f]),v=useCallback(w=>{let{active:y,over:C}=w;if(!C||!e.cards.find(E=>E.id===y.id))return;let R=null;C.data.current?.type==="column"?R=C.id:C.data.current?.type==="card"&&(R=e.cards.find(O=>O.id===C.id)?.columnId||null),R&&R!==d.targetColumnId&&f({...d,targetColumnId:R});},[e.cards,d,f]),m=useCallback(async w=>{let{active:y,over:C}=w;if(f({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!C)return;let T=e.cards.find(D=>D.id===y.id);if(!T)return;let R,E;if(C.data.current?.type==="column"){R=C.id;let D=g.get(R)||[];E=Vn(D,0);}else {let D=e.cards.find(z=>z.id===C.id);if(!D)return;R=D.columnId;let S=g.get(R)||[],I=S.findIndex(z=>z.id===C.id);E=Vn(S,I);}let O=e.columns.find(D=>D.id===R);if(O&&O.wipLimit&&O.wipLimitType==="hard"){let D=g.get(R)||[];if(T.columnId!==R&&D.length>=O.wipLimit){t.onWipLimitExceeded?.(O,T);return}}(T.columnId!==R||T.position!==E)&&await t.onCardMove?.(T.id,R,E);},[e.cards,e.columns,g,t,f]),k=useCallback(w=>{r?.(w);},[r]);return c?jsx("div",{className:te("asakaa-board",s),style:l,children:jsx(rp,{columnCount:3})}):i?jsx("div",{className:te("asakaa-board",s),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(DndContext,{sensors:b,collisionDetection:closestCorners,onDragStart:h,onDragOver:v,onDragEnd:m,children:[jsxs("div",{className:te("asakaa-board",s),style:l,children:[e.columns.sort((w,y)=>w.position-y.position).map(w=>{let y=g.get(w.id)||[];return jsx(aa,{column:w,cards:y,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,onCardClick:k,onCardUpdate:p,onColumnRename:x,availableUsers:o,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight},w.id)}),u]}),jsx(DragOverlay,{children:d.draggedCardId?jsx(sr,{card:e.cards.find(w=>w.id===d.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})}function rp({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,r)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var Ea=class extends BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(jsx(yr,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(o=>o.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).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 a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,o)=>{a.toBlob(s=>{s?n(s):o(new Error("Failed to create PNG blob"));},"image/png");})}};function il(e={}){return new Ea(e)}var oa=class extends Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:o}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${o||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:o,componentName:s}=this.props;return r&&a?o?o(a,this.resetError):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:jsxs("div",{className:"flex items-start gap-3",children:[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:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:s?`Error in ${s}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),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"})]})]})}):n}};function To(e,t){let r=a=>jsx(oa,{...t,children:jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function No({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:o,onGeneratePlan:s,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[d,f]=useState(false),[p,x]=useState(""),[b,g]=useState("home"),[h,v]=useState(""),[m,k]=useState("");useEffect(()=>{let T=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),f(E=>!E)),R.key==="Escape"&&(f(false),g("home"),x(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),useEffect(()=>{d||(g("home"),x(""),v(""),k(""));},[d]);let w=useCallback(()=>{f(false);},[]),y=useCallback(T=>{let[R,E]=T.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":v(E||"");break;case "navigate":E?(r?.(E),w()):g("navigate");break;case "search":a?.(p),w();break;case "priority":g("priority");break;case "set-priority":m&&E&&(n?.(m,E),w());break;case "assign":g("assign");break;case "assign-user":m&&E&&(o?.(m,E),w());break;case "ai":g("ai");break;case "ai-generate-plan":s?.(),w();break;case "ai-predict-risks":l?.(),w();break;case "ai-usage":c?.(),w();break;case "back":g("home");break;}},[p,m,t,r,a,n,o,s,l,c,w]),C=useCallback(()=>{h&&p.trim()&&(t?.(h,p.trim()),w());},[h,p,t,w]);return d?jsx(Ae,{children:jsx("div",{className:"command-palette-overlay",onClick:w,children:jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:p,onValueChange:x,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:b==="create-card"&&h?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&h&&C();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),b==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:y,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:y,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:y,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:y,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},T.id))})]}),b==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:y,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),b==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let R=e.columns.find(E=>E.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:y,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},T.id)})})]}),b==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:y,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:y,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function cp(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function dp(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 up(e){return e.startsWith("image/")}function Pa({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:o=10}){let[s,l]=useState(false),[c,i]=useState(false),[u,d]=useState(null),f=useRef(null),p=useCallback(y=>{let C=[],T=[];return e.length+y.length>o?(T.push(`Maximum ${o} files allowed`),{valid:C,errors:T}):(y.forEach(R=>{if(R.size/1048576>a){T.push(`${R.name} is too large (max ${a}MB)`);return}if(n&&!n.some(O=>R.type.match(O))){T.push(`${R.name} has invalid file type`);return}C.push(R);}),{valid:C,errors:T})},[e.length,o,a,n]),x=useCallback(async y=>{let{valid:C,errors:T}=p(y);if(T.length>0){d(T.join(", ")),setTimeout(()=>d(null),5e3);return}if(C.length!==0){i(true),d(null);try{await t?.(C);}catch(R){d(R instanceof Error?R.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[p,t]),b=useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(true);},[]),g=useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(false);},[]),h=useCallback(y=>{y.preventDefault(),y.stopPropagation();},[]),v=useCallback(y=>{y.preventDefault(),y.stopPropagation(),l(false);let C=Array.from(y.dataTransfer.files);x(C);},[x]),m=useCallback(y=>{let C=y.target.files?Array.from(y.target.files):[];x(C),f.current&&(f.current.value="");},[x]),k=useCallback(()=>{f.current?.click();},[]),w=useCallback(y=>{confirm("Are you sure you want to delete this attachment?")&&r?.(y);},[r]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:g,onDragOver:h,onDrop:v,onClick:k,children:[jsx("input",{ref:f,type:"file",multiple:true,onChange:m,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[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:[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"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:s?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",o," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(y=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:up(y.type)&&y.url?jsx("img",{src:y.thumbnailUrl||y.url,alt:y.name,className:"attachment-thumbnail"}):jsx("div",{className:"attachment-icon",children:dp(y.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:y.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:y.name,children:y.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:cp(y.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(y.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>w(y.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},y.id))})]})}function Eo({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:f,onDeleteAttachment:p,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:g,currentUserId:h="user-1"}){let[v,m]=useState("details"),[k,w]=useState(false),[y,C]=useState({}),[T,R]=useState(""),[E,O]=useState(false),[D,S]=useState({});if(!t||!e)return null;let I=useCallback(()=>{w(false),C({}),m("details"),R(""),S({}),r();},[r]),z=useCallback(()=>{a&&Object.keys(y).length>0&&(a(e.id,y),C({}),w(false));},[e.id,y,a]),$=useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),I());},[e.id,n,I]),Z=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),R(""));},[e.id,T,u]),J=useCallback(async()=>{if(x){O(true);try{let B=await x(e);S(ee=>({...ee,assignees:B}));}catch(B){console.error("Failed to suggest assignee:",B);}finally{O(false);}}},[e,x]),oe=useCallback(async()=>{if(b){O(true);try{let B=await b(e);S(ee=>({...ee,subtasks:B}));}catch(B){console.error("Failed to generate subtasks:",B);}finally{O(false);}}},[e,b]),Ne=useCallback(async()=>{if(g){O(true);try{let B=await g(e);S(ee=>({...ee,effort:B}));}catch(B){console.error("Failed to estimate effort:",B);}finally{O(false);}}},[e,g]),re={...e,...y},Pe=o.filter(B=>re.assignedUserIds?.includes(B.id));return jsx(Ae,{children:jsx("div",{className:"card-detail-overlay",onClick:I,children:jsxs("div",{className:"card-detail-modal",onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsx("input",{type:"text",value:y.title??re.title,onChange:B=>C({...y,title:B.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:re.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[k?jsxs(Fragment,{children:[jsx("button",{onClick:z,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{w(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>w(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:$,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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"]}),jsx("button",{onClick:I,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>m("details"),className:`card-detail-tab ${v==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>m("comments"),className:`card-detail-tab ${v==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",s.length>0&&jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxs("button",{onClick:()=>m("activity"),className:`card-detail-tab ${v==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>m("attachments"),className:`card-detail-tab ${v==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>m("ai"),className:`card-detail-tab ${v==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[v==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),k?jsx("textarea",{value:y.description??re.description??"",onChange:B=>C({...y,description:B.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:re.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsx("select",{multiple:true,value:y.assignedUserIds??re.assignedUserIds??[],onChange:B=>{let ee=Array.from(B.target.selectedOptions,ye=>ye.value);C({...y,assignedUserIds:ee});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:o.map(B=>jsx("option",{value:B.id,children:B.name},B.id))}):jsx("div",{className:"card-detail-users",children:Pe.length>0?Pe.map(B=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsx("span",{children:B.name})]},B.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxs("select",{value:y.priority??re.priority??"",onChange:B=>C({...y,priority:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:re.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:re.labels&&re.labels.length>0?re.labels.map(B=>jsx("span",{className:"card-detail-label-tag",children:B},B)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsx("input",{type:"date",value:y.startDate?new Date(y.startDate).toISOString().split("T")[0]:re.startDate?new Date(re.startDate).toISOString().split("T")[0]:"",onChange:B=>C({...y,startDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.startDate?new Date(re.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsx("input",{type:"date",value:y.endDate?new Date(y.endDate).toISOString().split("T")[0]:re.endDate?new Date(re.endDate).toISOString().split("T")[0]:"",onChange:B=>C({...y,endDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsx("input",{type:"number",min:"0",step:"0.5",value:y.estimatedTime??re.estimatedTime??"",onChange:B=>C({...y,estimatedTime:B.target.value?parseFloat(B.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:re.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:re.dependencies&&re.dependencies.length>0?re.dependencies.map(B=>{let ee=typeof B=="string"?B:B.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",ee.slice(-4)]},ee)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:re.createdAt?new Date(re.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:B=>R(B.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Z,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(B=>{let ee=o.find(ye=>ye.id===B.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[ee&&jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:ee?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(B.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(B.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:B.content})]},B.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),v==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(B=>{let ee=o.find(ye=>ye.id===B.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[B.type.includes("CREATED")&&"\u2795",B.type.includes("UPDATED")&&"\u270F\uFE0F",B.type.includes("MOVED")&&"\u27A1\uFE0F",B.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",B.type.includes("COMMENT")&&"\u{1F4AC}",B.type.includes("ASSIGNED")&&"\u{1F464}",B.type.includes("PRIORITY")&&"\u{1F3AF}",B.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",B.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:ee?.name||"Unknown"})," ",B.type.replace(/_/g," ").toLowerCase(),B.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:B.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(B.timestamp).toLocaleString()})]})]},B.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),v==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Pa,{cardId:e.id,attachments:i,onUpload:f?B=>f(e.id,B):void 0,onDelete:p,currentUserId:h,maxSizeMB:10,maxFiles:20})}),v==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:J,disabled:E||!x,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:oe,disabled:E||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:Ne,disabled:E||!g,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),D.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),D.assignees.map((B,ee)=>{let ye=o.find(ot=>ot.id===B.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ye&&jsx("div",{className:"card-detail-user-avatar",style:{background:ye.color},children:ye.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ye?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:B.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(B.confidence*100).toFixed(0),"%"]})]})]},ee)})]}),D.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),D.subtasks.map((B,ee)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:B.title}),B.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:B.description}),B.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",B.estimatedTime,"h"]})]},ee))]}),D.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[D.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(D.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(B=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${B.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:B.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:B.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:B.description}),B.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",B.suggestedAction]})]},B.id))]}),!D.assignees&&!D.subtasks&&!D.effort&&c.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}var hp=["LOW","MEDIUM","HIGH","URGENT"],vp=["todo","in-progress","review","done"];function Po({card:e,isOpen:t,onClose:r,onUpdate:a,onDelete:n,availableUsers:o=[],comments:s=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:f,onAIFindSimilar:p,availableColumns:x=[],availableLabels:b=[]}){let[g,h]=useState(e),[v,m]=useState(false),[k,w]=useState([]),[y,C]=useState(false),[T,R]=useState(""),[E,O]=useState(""),[D,S]=useState("all"),[I,z]=useState(false),[$,Z]=useState(false),[J,oe]=useState(false),[Ne,re]=useState(false),[Pe,B]=useState(false),[ee,ye]=useState(false),ot=useRef(null),Jt=useRef(null),V=useRef(null),ae=useRef(null),Pt=useRef(null),Bt=useRef(null),Gt=useRef(null),Qt=useRef(null);useEffect(()=>{e&&!g?h({...e}):e&&g&&e.id!==g.id&&h({...e});},[e,g]),useEffect(()=>{let N=U=>{let de=U.target;ae.current&&!ae.current.contains(de)&&z(false),Pt.current&&!Pt.current.contains(de)&&Z(false),Bt.current&&!Bt.current.contains(de)&&oe(false),Gt.current&&!Gt.current.contains(de)&&re(false);};if(I||$||J||Ne)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[I,$,J,Ne]),useEffect(()=>{if(!t)return;let N=U=>{let de=U.target,we=de.tagName==="INPUT"||de.tagName==="TEXTAREA"||de.isContentEditable;if(U.key==="Escape"){U.preventDefault(),I||$||J||Ne||Pe||ee?(z(false),Z(false),oe(false),re(false),B(false),ye(false)):we||r();return}if(we&&U.key!=="Escape")return;let Ee=U.metaKey||U.ctrlKey;switch(U.key.toLowerCase()){case "s":U.preventDefault(),z(true);break;case "a":U.preventDefault(),oe(true);break;case "p":U.preventDefault(),Z(true);break;case "l":U.preventDefault(),re(true);break;case "d":Ee||(U.preventDefault(),B(true),setTimeout(()=>Qt.current?.focus(),0));break;case "e":Ee||(U.preventDefault(),ye(true));break;case "i":U.preventDefault(),m(true),setTimeout(()=>Jt.current?.focus(),0);break;case "t":U.preventDefault(),C(true);break;case "c":U.preventDefault(),V.current?.focus();break}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[t,r,I,$,J,Ne,Pe,ee]);let mt=useCallback(N=>{let U=N.currentTarget.textContent?.trim()||"";if(g&&U!==g.title){let de={...g,title:U};h(de),a?.(g.id,{title:U});}},[g,a]),H=useCallback(N=>{N.key==="Enter"&&(N.preventDefault(),N.currentTarget.blur()),N.key==="Escape"&&(N.preventDefault(),N.currentTarget.textContent=g?.title||"",N.currentTarget.blur());},[g]),K=useCallback(()=>{g&&e&&g.description!==e.description&&a?.(g.id,{description:g.description}),m(false);},[g,e,a]),Le=useCallback(N=>{if(g){let U={...g,columnId:N};h(U),a?.(g.id,{columnId:N}),z(false);}},[g,a]),He=useCallback(N=>{if(g){let U={...g,priority:N};h(U),a?.(g.id,{priority:N}),Z(false);}},[g,a]),De=useCallback(N=>{if(g){let U=g.assignedUserIds||[],de=U.includes(N)?U.filter(Ee=>Ee!==N):[...U,N],we={...g,assignedUserIds:de};h(we),a?.(g.id,{assignedUserIds:de});}},[g,a]),Ct=useCallback(N=>{if(g){let U=g.labels||[],de=U.includes(N)?U.filter(Ee=>Ee!==N):[...U,N],we={...g,labels:de};h(we),a?.(g.id,{labels:de});}},[g,a]),le=useCallback(N=>{if(g){let U=N.target.value,de={...g,endDate:U};h(de),a?.(g.id,{endDate:U}),B(false);}},[g,a]),ke=useCallback(N=>{if(g){let U={...g,estimatedTime:parseFloat(N)||0};h(U),a?.(g.id,{estimatedTime:parseFloat(N)||0});}},[g,a]),Tt=useCallback(()=>{if(T.trim()){let N={id:`subtask-${Date.now()}`,title:T.trim(),completed:false};w([...k,N]),R(""),C(false);}},[T,k]),or=useCallback(N=>{w(k.map(U=>U.id===N?{...U,completed:!U.completed}:U));},[k]),pe=useCallback(N=>{w(k.filter(U=>U.id!==N));},[k]),ge=useCallback(()=>{E.trim()&&g&&c&&(c(g.id,E.trim()),O(""));},[E,g,c]),jr=useCallback(N=>{(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),ge());},[ge]),Yr=N=>jsx(mp,{remarkPlugins:[fp],rehypePlugins:[gp],components:{a:({node:U,...de})=>jsx("a",{...de,target:"_blank",rel:"noopener noreferrer"})},children:N}),qr=l.filter(N=>D==="comments"?N.type.includes("COMMENT"):D==="history"?!N.type.includes("COMMENT"):true);if(!t||!e)return null;let F=g||e,he=o.filter(N=>F.assignedUserIds?.includes(N.id)),ce=k.filter(N=>N.completed).length;return jsx(Ae,{children:jsx("div",{className:"modal-v2-backdrop",onClick:r,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:N=>N.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:ot,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:mt,onKeyDown:H,children:F.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:r,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),F.coverImage&&jsx("div",{className:"modal-v2-cover",children:jsx("img",{src:F.coverImage,alt:`Cover for ${F.title}`,className:"w-full max-h-96 object-cover",onError:N=>{N.currentTarget.style.display="none";}})}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:ae,children:[jsxs("button",{className:"modal-v2-field",onClick:()=>z(!I),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:F.columnId||"No status"})]}),I&&jsx("div",{className:"modal-v2-popover",children:(x.length>0?x:vp.map(N=>({id:N,title:N}))).map(N=>jsx("button",{className:`modal-v2-popover-item ${F.columnId===N.id?"active":""}`,onClick:()=>Le(N.id),children:N.title},N.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Bt,children:[jsxs("button",{className:"modal-v2-field",onClick:()=>oe(!J),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:he.length>0?jsx("div",{className:"modal-v2-avatars",children:he.map(N=>jsx("div",{className:"modal-v2-avatar",style:{background:N.color},title:N.name,children:N.initials},N.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),J&&jsx("div",{className:"modal-v2-popover",children:o.map(N=>jsxs("button",{className:`modal-v2-popover-item ${F.assignedUserIds?.includes(N.id)?"active":""}`,onClick:()=>De(N.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:N.color},children:N.initials}),N.name,F.assignedUserIds?.includes(N.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},N.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Pt,children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Z(!$),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:F.priority||"None"})]}),$&&jsxs("div",{className:"modal-v2-popover",children:[hp.map(N=>jsx("button",{className:`modal-v2-popover-item priority-${N.toLowerCase()} ${F.priority===N?"active":""}`,onClick:()=>He(N),children:N},N)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Gt,children:[jsxs("button",{className:"modal-v2-field",onClick:()=>re(!Ne),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:F.labels&&F.labels.length>0?jsx("span",{children:F.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),Ne&&jsx("div",{className:"modal-v2-popover",children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(N=>jsxs("button",{className:`modal-v2-popover-item ${F.labels?.includes(N)?"active":""}`,onClick:()=>Ct(N),children:[N,F.labels?.includes(N)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},N))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{B(!Pe),setTimeout(()=>Qt.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Qt,type:"date",value:typeof F.endDate=="string"?F.endDate.split("T")[0]:F.endDate?(()=>{let N=new Date(F.endDate),U=N.getUTCFullYear(),de=String(N.getUTCMonth()+1).padStart(2,"0"),we=String(N.getUTCDate()).padStart(2,"0");return `${U}-${de}-${we}`})():"",onChange:le,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>ye(!ee),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:F.estimatedTime?`${F.estimatedTime}h`:"Not set"})]}),ee&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:F.estimatedTime||"",onChange:N=>ke(N.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>ye(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"}),jsxs("button",{className:"modal-v2-ai-button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Assist"]})]}),v?jsx("textarea",{className:"modal-v2-textarea",value:F.description||"",onChange:N=>{if(g){let U={...g,description:N.target.value};h(U);}},onBlur:K,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>m(true),children:F.description?jsx("div",{className:"modal-v2-markdown",children:Yr(F.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),k.length>0&&jsxs("span",{className:"modal-v2-count",children:[ce,"/",k.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>C(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[k.map(N=>jsxs("div",{className:`modal-v2-subtask ${N.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>or(N.id),children:N.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:N.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>pe(N.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},N.id)),y&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:T,onChange:N=>R(N.target.value),onKeyDown:N=>{N.key==="Enter"&&Tt(),N.key==="Escape"&&(C(false),R(""));},onBlur:Tt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${D==="all"?"active":""}`,onClick:()=>S("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${D==="comments"?"active":""}`,onClick:()=>S("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${D==="history"?"active":""}`,onClick:()=>S("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:V,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:E,onChange:N=>O(N.target.value),onKeyDown:jr,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children: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"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:ge,disabled:!E.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[qr.map(N=>{let U=o.find(we=>we.id===N.userId);if(N.type.includes("COMMENT")){let we=s.find(Ee=>Ee.id===N.metadata?.commentId);return we?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[U&&jsx("div",{className:"modal-v2-avatar",style:{background:U.color},children:U.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:U?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(N.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:we.content})]})]},N.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-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("ASSIGNED")&&"\u{1F464}",N.type.includes("PRIORITY")&&"\u{1F3AF}",N.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:U?.name||"Unknown"})," ",N.type.replace(/_/g," ").toLowerCase(),N.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:N.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(N.timestamp).toLocaleString()})]})]},N.id)}),qr.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Np({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," cards"]},a))]})}function Mo({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let o=e.map(s=>({...s,average:s.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(LineChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Np,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),a&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((s,l)=>s+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((s,l)=>s+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(s=>s.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((s,l)=>s+(l.planned||0),0)})]})]})]})}function Bp({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," tasks"]},a))]})}function Lo({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let o=a??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=o>0?(o-s)/o*100:0,i=s<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Bp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Wp={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},hl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Vp({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:o}){let s=a+(n-a)*.5,l=e+s*Math.cos(-r*(Math.PI/180)),c=t+s*Math.sin(-r*(Math.PI/180));return o<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(o*100).toFixed(0)}%`})}function vl({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsx("strong",{children:r.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Ao({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let o=e.reduce((c,i)=>c+i.value,0),s=e.map(c=>({...c,totalValue:o,color:c.color||Wp[c.name]||hl[e.indexOf(c)%hl.length]})),l=s.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:s,cx:"50%",cy:"50%",labelLine:false,label:n?Vp:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:s.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(vl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,d=o>0?(u.value/o*100).toFixed(0):"0";return `${c} (${u.value} - ${d}%)`}})]}):jsxs(BarChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:s.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var xn=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:o=[]})=>{let[s,l]=useState(false),[c,i]=useState(false),[u,d]=useState(false),[f,p]=useState(false);if(e.length===0)return null;let x=e.map(k=>k.id),b=k=>{a.onBulkUpdate?.(x,{priority:k}),l(false);},g=k=>{a.onBulkMove?.(x,k),i(false),r();},h=k=>{a.onBulkUpdate?.(x,{assignedUserIds:k}),d(false);},v=k=>{let w=new Set;e.forEach(C=>{C.labels?.forEach(T=>w.add(T));});let y=Array.from(new Set([...w,...k]));a.onBulkUpdate?.(x,{labels:y}),p(false);},m=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(x),r());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!s),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(k),children:[jsx("span",{className:te("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(k=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(k.id),children:k.title},k.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([k.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!f),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),f&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([k]),children:k},k))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:m,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});xn.displayName="BulkOperationsToolbar";function Xp(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let o,s,l,c,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(p=>{let x=r?.find(b=>b.id===p);s=`assignee-${p}`,l=x?.name||`User ${p}`,c=x?.color,i=x?.avatar,a.has(s)||a.set(s,{id:s,title:l,groupValue:p,cardIds:[],color:c,icon:i}),a.get(s).cardIds.push(n.id);}):(s="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",a.has(s)||a.set(s,{id:s,title:l,groupValue:null,cardIds:[],color:c,icon:i}),a.get(s).cardIds.push(n.id));break;case "priority":o=n.priority||"NONE",s=`priority-${o}`;let f={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[o];l=f.title,c=f.color,a.has(s)||a.set(s,{id:s,title:l,groupValue:o,cardIds:[],color:c}),a.get(s).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{s=`label-${p}`,l=p,c="#6b7280",a.has(s)||a.set(s,{id:s,title:l,groupValue:p,cardIds:[],color:c}),a.get(s).cardIds.push(n.id);}):(s="label-none",l="No Labels",c="#6b7280",a.has(s)||a.set(s,{id:s,title:l,groupValue:null,cardIds:[],color:c}),a.get(s).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,o)=>n.title.localeCompare(o.title))}function Bo({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n}){let[o,s]=useState(new Set),l=useMemo(()=>Xp(e.cards,t.groupBy,r),[e.cards,t.groupBy,r]),c=useCallback(i=>{s(u=>{let d=new Set(u);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(yr,{board:e,callbacks:a,availableUsers:r,className:n}):jsxs("div",{className:te("asakaa-swimlane-view",n),children:[l.map(i=>{let u=o.has(i.id),d=e.cards.filter(p=>i.cardIds.includes(p.id)),f={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(yr,{board:f,callbacks:a,availableUsers:r})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Fo=[{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 Oo({value:e,onChange:t,className:r}){let[a,n]=useState(false),o=useRef(null),s=useRef(null),l=Fo.find(i=>i.value===e)||Fo[0];useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return jsxs("div",{className:te("relative inline-block",r),children:[jsxs("button",{ref:s,onClick:()=>n(!a),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:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:te("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:o,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:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Fo.map(i=>jsxs("button",{onClick:()=>c(i.value),className:te("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ia=[{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 Qp(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},o=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return o&&s&&l&&c}function wl(e={}){let{shortcuts:t=Ia,enabled:r=true,preventDefault:a=true}=e,n=useRef(t),o=useRef(r);useEffect(()=>{n.current=t,o.current=r;},[t,r]);let s=useCallback(c=>{n.current=[...n.current,c];},[]),l=useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!o.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of n.current)if(Qp(i,d)){a&&i.preventDefault();let f=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(f);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:s,unregisterShortcut:l,isEnabled:r}}function tm(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function rm(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function am(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=rm(e),a=t?tm(t):"";return r?`${r} + ${a}`:a}function nm(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function zo({shortcuts:e=Ia,isOpen:t,onClose:r,className:a}){let[n,o]=useState(false);if(useEffect(()=>{o(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,r]),!n||!t)return null;let s=nm(e);return jsxs("div",{className:te("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:r,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"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(s).map(([l,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsx("span",{className:"text-sm text-white/80",children:i.description}),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:am(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Ho=[{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
+ 1.
7
+
8
+ **Expected behavior:**
9
+
10
+ **Actual behavior:**
11
+
12
+ **Screenshots:**`,priority:"HIGH",labels:["bug"]}},{id:"feature-request",name:"Feature Request",description:"Propose a new feature",icon:"\u2728",category:"Development",template:{title:"[FEATURE] ",description:`**Problem:**
13
+
14
+ **Proposed solution:**
15
+
16
+ **Alternatives considered:**
17
+
18
+ **Additional context:**`,priority:"MEDIUM",labels:["feature","enhancement"]}},{id:"task",name:"Task",description:"General task or to-do",icon:"\u{1F4DD}",category:"General",template:{title:"",description:`**Objective:**
19
+
20
+ **Acceptance criteria:**
21
+ - [ ]
22
+
23
+ **Notes:**`,priority:"MEDIUM"}},{id:"research",name:"Research",description:"Investigation or research task",icon:"\u{1F52C}",category:"General",template:{title:"[RESEARCH] ",description:`**Goal:**
24
+
25
+ **Questions to answer:**
26
+ -
27
+
28
+ **Resources:**
29
+ -
30
+
31
+ **Findings:**`,priority:"LOW",labels:["research"]}},{id:"documentation",name:"Documentation",description:"Documentation task",icon:"\u{1F4DA}",category:"Documentation",template:{title:"[DOCS] ",description:`**What needs to be documented:**
32
+
33
+ **Target audience:**
34
+
35
+ **Key points:**
36
+ - `,priority:"LOW",labels:["documentation"]}},{id:"meeting",name:"Meeting",description:"Meeting or discussion",icon:"\u{1F4AC}",category:"Communication",template:{title:"Meeting: ",description:`**Date & Time:**
37
+
38
+ **Participants:**
39
+ -
40
+
41
+ **Agenda:**
42
+ 1.
43
+
44
+ **Action items:**
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Uo({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),o=useRef(null),s=useRef(null);useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxs("div",{className:te("relative inline-block",r),children:[jsxs("button",{ref:s,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:te("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:o,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:[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:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function _o({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=useState("export"),[c,i]=useState("json"),[u,d]=useState(null),f=useRef(null);if(!t)return null;let p=async()=>{let b=n?.current||void 0,g=await js(e,c,b);Ys(g,c);},x=async b=>{let g=b.target.files?.[0];if(g){try{let h=await Zs(g),v=g.name.endsWith(".json")?"json":"csv",m=Xs(h,v);d(m),m.success&&a&&a(m,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxs("div",{className:te("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:r,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"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:te("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:te("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[s==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxs("button",{onClick:()=>i(b),className:te("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:p,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"})]}),s==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:f,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxs("button",{onClick:()=>f.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:te("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:te("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},g))})]})]})]})]})]})}var cm=["URGENT","HIGH","MEDIUM","LOW"],dm=[{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"}],um=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function $o({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:f=false,groupBy:p="none",onGroupByChange:x}){let[b,g]=useState(true),h=useCallback(y=>{r({search:y.target.value});},[r]),v=useCallback(y=>{r({dateFilter:y.target.value});},[r]),m=useCallback(y=>{a({by:y.target.value});},[a]),k=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),w=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${f?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),w&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:y=>{let C=y.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),cm.map(y=>jsx("option",{value:y,children:y},y))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let C=y.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(y=>jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let C=y.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsx("option",{value:y,children:y},y))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:m,className:"filter-bar__select filter-bar__select--sm",children:dm.map(y=>jsx("option",{value:y.value,children:y.label},y.value))}),t.by!=="none"&&jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:p,onChange:y=>x(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:um.map(y=>jsx("option",{value:y.value,children:y.label},y.value))})}),w&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Wo({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=useState(false),d=useRef(null);useEffect(()=>{let p=x=>{d.current&&!d.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let f=p=>{p(),u(false);};return jsxs("div",{className:te("relative",a),ref:d,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),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"})]}),jsx("span",{children:"Config"})]}),i&&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:[n==="kanban"?jsxs("button",{onClick:()=>f(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>f(async()=>await o?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>f(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>f(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>f(()=>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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>f(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),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"]}),jsxs("button",{onClick:()=>f(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Vo={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"}},Ko={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"}},jo={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"}},zr={dark:Vo,light:Ko,neutral:jo},wn="dark";var Cn=createContext(void 0),km="asakaa-theme";function Sl({children:e,defaultTheme:t=wn,storageKey:r=km}){let[a,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=zr[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${wm(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let f=c.colors[u];f&&l.style.setProperty(d,f);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:zr};return jsx(Cn.Provider,{value:s,children:e})}function ca(){let e=useContext(Cn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function wm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Yo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ca();return e?jsxs("div",{className:te("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),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:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),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"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(zr).map(([o,s])=>jsxs("button",{onClick:()=>{n(o),t();},className:te("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:s.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},o))})]})]}):null}var me={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(139, 92, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#8B5CF6",accentHover:"#9D72F8",accentLight:"rgba(139, 92, 246, 0.12)",taskBarPrimary:"#8B5CF6",taskBarProgress:"#7C3AED",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:"#8B5CF6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#8B5CF6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",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:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",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 Nl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return me[e]||me.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",me[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",me[e].bgSecondary),bgGrid:a("--theme-bg-card",me[e].bgGrid),bgWeekend:a("--theme-bg-hover",me[e].bgWeekend),border:a("--theme-border-primary",me[e].border),borderLight:a("--theme-border-subtle",me[e].borderLight),textPrimary:a("--theme-text-primary",me[e].textPrimary),textSecondary:a("--theme-text-secondary",me[e].textSecondary),textTertiary:a("--theme-text-tertiary",me[e].textTertiary),accent:a("--theme-accent-primary",me[e].accent),accentHover:a("--theme-accent-hover",me[e].accentHover),accentLight:a("--theme-accent-primary",me[e].accentLight),taskBarPrimary:a("--theme-accent-primary",me[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",me[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",me[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",me[e].dependency),dependencyHover:a("--theme-border-secondary",me[e].dependencyHover),criticalPath:a("--theme-error",me[e].criticalPath),criticalPathLight:a("--theme-error",me[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",me[e].today):e==="neutral"?a("--theme-text-primary",me[e].today):a("--theme-error",me[e].today),todayLight:e==="light"?a("--theme-accent-primary",me[e].todayLight):e==="neutral"?a("--theme-text-primary",me[e].todayLight):a("--theme-error",me[e].todayLight),milestone:a("--theme-warning",me[e].milestone),milestoneLight:a("--theme-warning",me[e].milestoneLight),statusTodo:a("--theme-text-tertiary",me[e].statusTodo),statusInProgress:a("--theme-accent-primary",me[e].statusInProgress),statusCompleted:a("--theme-success",me[e].statusCompleted),hoverBg:a("--theme-bg-hover",me[e].hoverBg),focusRing:a("--theme-accent-primary",me[e].focusRing)}}function Zo({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxs(motion.button,{onClick:()=>r(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:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function Sn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true}){let u=[{value:"day",label:"Day",icon:jsx(Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsx(Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsx(Calendar,{className:"w-3.5 h-3.5"})}],d=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],f=[{value:"compact",label:"Compact",icon:jsx(AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsx(AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsx(AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"View"}),jsx(Zo,{options:u,value:t,onChange:p=>r(p),theme:e})]}),jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Zoom"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]})]}),jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Density"}),jsx(Zo,{options:f,value:l,onChange:p=>c(p),theme:e})]})]}),i&&jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Theme"}),jsx(Zo,{options:d,value:o,onChange:p=>s(p),theme:e})]})]})}function Nn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[o,s]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(Ae,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function ua({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=useRef(null);return useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsx(AnimatePresence,{children:jsx(motion.div,{ref:s,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:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsx("div",{className:"py-1",children:a.map(l=>jsxs("div",{children:[l.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var Rt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"})};function Il({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:f=true}){let p=useRef(false),x=useCallback(m=>{p.current=m;},[]),b=useCallback(m=>{let k=[],w=y=>{for(let C of y)k.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&w(C.subtasks);};return w(m),k},[]),g=useCallback(()=>{let m=b(e);for(let k of m)if(t.has(k.id))return k;return null},[e,t,b]),h=useCallback((m,k)=>{let w=b(e);if(w.length===0)return;let y=g();if(!y){r(w[0].id,false);return}let C=w.findIndex(E=>E.id===y.id);if(C===-1)return;let T=m==="up"?C-1:C+1;if(T<0||T>=w.length)return;let R=w[T];r(R.id,k);},[e,g,b,r]),v=useCallback(m=>{if(!f)return;let k=m.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||p.current){m.key==="Escape"&&(k.blur(),p.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?m.metaKey:m.ctrlKey,T=Array.from(t),R=g();if(m.key==="ArrowUp"){m.preventDefault(),h("up",m.shiftKey);return}if(m.key==="ArrowDown"){m.preventDefault(),h("down",m.shiftKey);return}if(R&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(m.preventDefault(),(m.key==="ArrowRight"&&!R.isExpanded||m.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(m.altKey&&(m.key==="ArrowUp"||m.key==="ArrowDown")){T.length>0&&(m.preventDefault(),s(T,m.key==="ArrowUp"?"up":"down"));return}if(m.key==="Tab"&&!m.shiftKey){T.length>0&&(m.preventDefault(),l(T));return}if(m.key==="Tab"&&m.shiftKey){T.length>0&&(m.preventDefault(),c(T));return}if(m.key==="Enter"&&!m.shiftKey&&!C){R&&(m.preventDefault(),a(R.id,"below"));return}if(m.key==="Enter"&&m.shiftKey&&!C){R&&(m.preventDefault(),a(R.id,"above"));return}if(m.key==="Enter"&&C){R&&(m.preventDefault(),d(R.id));return}if(m.key==="F2"){R&&(m.preventDefault(),i(R.id));return}if(m.key==="Delete"||m.key==="Backspace"&&C){T.length>0&&(m.preventDefault(),n(T));return}if(m.key==="d"&&C&&!m.shiftKey){T.length>0&&(m.preventDefault(),o(T));return}},[f,t,g,h,a,n,o,s,l,c,i,u,d]);return useEffect(()=>{if(f)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[f,v]),{setIsEditing:x}}function Ll(){let[e,t]=useState(new Set),[r,a]=useState(null),n=useCallback(d=>{t(new Set([d])),a(d);},[]),o=useCallback(d=>{t(f=>{let p=new Set(f);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=useCallback((d,f)=>{if(!r){n(d);return}let p=f.indexOf(r),x=f.indexOf(d);if(p===-1||x===-1){n(d);return}let b=Math.min(p,x),g=Math.max(p,x),h=f.slice(b,g+1);t(new Set(h)),a(d);},[r,n]),l=useCallback((d,f,p,x)=>{x?s(d,f):p?o(d):n(d);},[n,o,s]),c=useCallback((d,f)=>{f?t(p=>{let x=new Set(p);return x.add(d),x}):n(d);},[n]),i=useCallback(()=>{t(new Set),a(null);},[]),u=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function pa(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function Qo(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Qo(r.subtasks,t);if(a)return a}return null}function es(e,t){if(t.length===0)return e;let r=pa(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,f)=>{let p=[];return {tasks:d.filter(b=>{if(f.has(b.id))return p.push(b),false;if(b.subtasks){let g=s(b.subtasks,f);b.subtasks=g.tasks,p.push(...g.removed);}return true}),removed:p}},l=(d,f,p)=>d.map(x=>x.id===f?{...x,subtasks:[...x.subtasks||[],...p],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,f,p)}:x),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function ts(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Qo(r,a);if(!n)continue;let o=Qo(r,n.id),s=(i,u,d)=>{for(let f=0;f<i.length;f++){let p=i[f];if(p.id===u&&p.subtasks){let x=p.subtasks.findIndex(b=>b.id===d);if(x!==-1){let[b]=p.subtasks.splice(x,1);return b}}if(p.subtasks){let x=s(p.subtasks,u,d);if(x)return x}}return null},l=(i,u,d)=>{let f=i.findIndex(p=>p.id===u);if(f!==-1)return i.splice(f+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function rs(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function as(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function ns(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function Al(e,t,r){let a=[...e],n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo"},o=s=>{let l=s.findIndex(i=>i.id===t);if(l===-1){for(let i of s)if(i.subtasks&&o(i.subtasks))return true;return false}let c=r==="above"?l:l+1;return s.splice(c,0,n),true};return o(a),{tasks:a,newTask:n}}function os(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:os(a.subtasks,t,r)}:a)}function ss(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ss(r.subtasks,t)}:r)}function is(e,t){let r={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo"},a=n=>n.map(o=>{if(o.id===t){let s=o.subtasks||[];return {...o,subtasks:[...s,r],isExpanded:true}}return o.subtasks?{...o,subtasks:a(o.subtasks)}:o});return {tasks:a(e),newTask:r}}var Ol={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"}},zl=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Hl({status:e="todo",onChange:t,className:r}){let[a,n]=useState(false),[o,s]=useState({top:0,left:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(a&&c.current){let f=c.current.getBoundingClientRect();s({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[a]),useEffect(()=>{let f=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),useEffect(()=>{let f=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let i=f=>{t(f),n(false);},u=Ol[e],d=u.color;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:c,onClick:()=>n(!a),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:u.label,children:jsx(zl,{icon:u.icon,color:d})}),a&&jsx(Ae,{children:jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"py-1",children:Object.entries(Ol).map(([f,p])=>jsxs("button",{onClick:()=>i(f),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:p.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(zl,{icon:p.icon,color:p.color}),jsx("span",{className:"font-semibold",children:p.label}),e===f&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f))})]})})]})}function Dn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onTaskUpdate:f,onTaskDelete:p,onTaskIndent:x,onTaskOutdent:b,onTaskMove:g,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:m,onTaskRename:k,onCreateSubtask:w,onOpenTaskModal:y}){let[C,T]=useState(null),[R,E]=useState(false),[O,D]=useState(null),[S,I]=useState(""),z=useRef(null),$=useRef(null),[Z,J]=useState({isOpen:false,x:0,y:0,type:"header"});useEffect(()=>{function H(K){z.current&&!z.current.contains(K.target)&&E(false);}if(R)return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[R]),useEffect(()=>{O&&$.current&&($.current.focus(),$.current.select());},[O]);let{selectedTaskIds:oe,handleTaskClick:Ne,isTaskSelected:re}=Ll(),{setIsEditing:Pe}=Il({tasks:e,selectedTaskIds:oe,onTaskSelect:(H,K)=>{let He=pa(e).map(De=>De.id);Ne(H,He,K||false,false);},onTaskCreate:m||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:H=>{let K=pa(e).find(Le=>Le.id===H);K&&Jt(K);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:H=>{let K=pa(e).find(Le=>Le.id===H);K&&y&&y(K);},enableKeyboard:true}),B=(H,K=0)=>{let Le=[];for(let He of H)Le.push({task:He,level:K}),He.subtasks&&He.subtasks.length>0&&He.isExpanded&&Le.push(...B(He.subtasks,K+1));return Le},ee=B(e),ye=48,ot=H=>!H.startDate||!H.endDate?"-":`${Math.ceil((H.endDate.getTime()-H.startDate.getTime())/(1e3*60*60*24))}d`,Jt=H=>{D(H.id),I(H.name),Pe(true);},V=H=>{S.trim()&&S!==e.find(K=>K.id===H)?.name&&k?.(H,S.trim()),D(null),I(""),Pe(false);},ae=()=>{D(null),I(""),Pe(false);},Pt=(H,K)=>{K.stopPropagation(),w?.(H.id);},Bt=(H,K,Le)=>{switch(H.id){case "name":let He=O===K.id,De=C===K.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Le*24}px`},children:[K.subtasks&&K.subtasks.length>0&&jsx("button",{onClick:le=>{le.stopPropagation(),c?.(K.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:K.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}),jsx("div",{className:"flex-shrink-0",style:{opacity:Le===0?.7:Le===1?.6:.5},children:K.isMilestone?jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:jsx("path",{d:"M7 1L12 7L7 13L2 7L7 1Z",stroke:t.accent,strokeWidth:"1.5",fill:"none"})}):Le>=2?jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:jsx("circle",{cx:"7",cy:"7",r:"2.5",fill:t.textTertiary,opacity:"0.5"})}):Le===1?jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:jsx("circle",{cx:"7",cy:"7",r:"5",stroke:t.textTertiary,strokeWidth:"1.5",fill:"none"})}):jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:jsx("circle",{cx:"7",cy:"7",r:"5",stroke:t.textSecondary,strokeWidth:"2",fill:"none"})})}),He?jsx("input",{ref:$,type:"text",value:S,onChange:le=>I(le.target.value),onKeyDown:le=>{le.key==="Enter"?V(K.id):le.key==="Escape"&&ae();},onBlur:()=>V(K.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:le=>le.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Le===0?"14px":Le===1?"13px":"12px",fontWeight:K.isMilestone?600:K.subtasks&&K.subtasks.length>0?500:400,opacity:Le===0?1:Le===1?.95:.88},children:K.name}),De&&!He&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:le=>le.stopPropagation(),children:[jsx("button",{onClick:le=>Pt(K,le),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:le=>{le.stopPropagation(),Jt(K);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":return jsx("div",{onClick:le=>le.stopPropagation(),children:jsx(Ya,{startDate:K.startDate?typeof K.startDate=="string"?K.startDate:K.startDate.toISOString().split("T")[0]:void 0,endDate:K.endDate?typeof K.endDate=="string"?K.endDate:K.endDate.toISOString().split("T")[0]:void 0,onChange:(le,ke)=>{f?.(K.id,{startDate:le?new Date(le):void 0,endDate:ke?new Date(ke):void 0});}})});case "duration":return jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ot(K)});case "assignees":let Ct=a.filter(le=>K.assignees?.some(ke=>ke.name===le.name||ke.initials===le.initials));return jsx("div",{onClick:le=>le.stopPropagation(),children:jsx(qa,{assignedUsers:Ct,availableUsers:a,onChange:le=>{let ke=le.map(Tt=>({name:Tt.name,initials:Tt.initials,color:Tt.color}));f?.(K.id,{assignees:ke.length>0?ke:void 0});}})});case "status":return jsx("div",{onClick:le=>le.stopPropagation(),children:jsx(Hl,{status:K.status||"todo",onChange:le=>{f?.(K.id,{status:le,progress:le==="completed"?100:K.progress});}})});case "progress":return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${K.progress}%`,backgroundColor:K.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[K.progress,"%"]})]});default:return null}},Gt=H=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(H),disabled:H==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Qt=H=>[{id:"edit",label:"Edit Task",icon:Rt.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:Rt.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:Rt.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:H.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Rt.Progress,onClick:()=>{let K=H.status==="completed"?"in-progress":"completed",Le=H.status==="completed"?H.progress:100;f?.(H.id,{status:K,progress:Le});}},{id:"setInProgress",label:"Set In Progress",icon:Rt.Progress,onClick:()=>{f?.(H.id,{status:"in-progress"});},disabled:H.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Rt.Delete,onClick:()=>{window.confirm(`Delete task "${H.name}"?`)&&p?.(H.id);}}],mt=u.filter(H=>H.visible);return jsxs("div",{className:"h-full overflow-auto",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${ye}px`},children:[mt.map(H=>jsx("div",{className:"flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative",style:{width:`${H.width}px`,borderColor:t.borderLight,height:"100%"},onContextMenu:K=>{K.preventDefault(),J({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:H.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.currentTarget.style.backgroundColor="transparent";},children:jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:H.label})},H.id)),jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsx(Nn,{columns:u,onToggleColumn:d,theme:t}),jsxs("button",{onClick:()=>E(!R),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsx(Keyboard,{className:"w-4 h-4"}),R&&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:H=>H.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>E(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),ee.map(({task:H,level:K},Le)=>{let He=re(H.id);return jsx(motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${He?t.accent:t.borderLight}`,borderRight:`1px solid ${He?t.accent:t.borderLight}`,borderBottom:`1px solid ${He?t.accent:t.borderLight}`,borderLeft:He?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:He?t.accentLight:Le%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>T(H.id),onMouseLeave:()=>T(null),onClick:De=>{let le=pa(e).map(or=>or.id),Tt=navigator.platform.toUpperCase().indexOf("MAC")>=0?De.metaKey:De.ctrlKey;Ne(H.id,le,Tt,De.shiftKey),o?.(H);},onDoubleClick:De=>{De.stopPropagation(),s?.(H);},onContextMenu:De=>{De.preventDefault(),J({isOpen:true,x:De.clientX,y:De.clientY,type:"task",task:H}),l?.(H,De);},whileHover:{backgroundColor:He?t.accentLight:t.hoverBg},children:mt.map(De=>jsx("div",{className:"px-4 border-r flex items-center",style:{width:`${De.width}px`,borderColor:C===H.id?t.border:t.borderLight,height:"100%"},children:Bt(De,H,De.id==="name"?K:0)},`${H.id}-${De.id}`))},H.id)}),jsx(ua,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Gt(Z.columnId):Z.type==="task"&&Z.task?Qt(Z.task):[],onClose:()=>J({...Z,isOpen:false}),theme:t})]})}function _l(e,t){let[r,a]=useState("none"),[n,o]=useState(0),[s,l]=useState(e),[c,i]=useState(t),[u,d]=useState(null),[f,p]=useState(null),[x,b]=useState(null),[g,h]=useState(null),[v,m]=useState(0),[k,w]=useState(0),[y,C]=useState(null),[T,R]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:f,setHoveredTaskId:p,activeZone:x,setActiveZone:b,draggedSegmentIndex:g,setDraggedSegmentIndex:h,draggedSegmentStartX:v,setDraggedSegmentStartX:m,segmentDragOffsetX:k,setSegmentDragOffsetX:w,hoveredSegmentIndex:y,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:R,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(I,z)=>{a("none"),d(null),p(null),l(I),i(z),w(0),h(null),m(0);}}}function En({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:p=[]}){let x=_l(t,a),b=useRef(null),{dragMode:g,setDragMode:h,dragOffset:v,setDragOffset:m,ghostX:k,setGhostX:w,ghostWidth:y,setGhostWidth:C,connectionLine:T,setConnectionLine:R,hoveredTaskId:E,setHoveredTaskId:O,activeZone:D,setActiveZone:S,draggedSegmentIndex:I,setDraggedSegmentIndex:z,draggedSegmentStartX:$,setDraggedSegmentStartX:Z,segmentDragOffsetX:J,setSegmentDragOffsetX:oe,hoveredSegmentIndex:Ne,setHoveredSegmentIndex:re,isHovered:Pe,setIsHovered:B,isDragging:ee,isResizing:ye,isConnecting:ot,resetDragState:Jt}=x,V=32,ae=8,Pt=e.endDate&&e.endDate<new Date&&e.progress<100,Bt=e.isCriticalPath,Gt=n.name==="neutral"||n.today==="#1C1917",mt=(F=>F>=80?20:F>=60?15:F>=50?12:10)(a),H=a<50,K=a<40,Le=F=>F.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),He=()=>{let F=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${F} day${F!==1?"s":""}`},De=F=>Math.round(F/o)*o,Ct=F=>{let he=Math.round(F/o),ce=new Date(s);return ce.setDate(ce.getDate()+he),ce},le=(F,he)=>{for(let ce of p){if(ce.id===e.id)continue;let N=5;if(F>=ce.x-N&&F<=ce.x+ce.width+N&&he>=ce.y-N&&he<=ce.y+ce.height+N)return ce.id}return null},ke=useCallback((F,he,ce)=>{F.preventDefault(),F.stopPropagation();let N=b.current?.ownerSVGElement;if(!N)return;let U=N.createSVGPoint();U.x=F.clientX,U.y=F.clientY;let de=U.matrixTransform(N.getScreenCTM()?.inverse()),we=ce!==void 0?ce:t,Ee=he;if(!Ee){let It=de.x-we;F.shiftKey?(Ee="connect",R({x:t+a,y:r+V/2})):F.ctrlKey||F.metaKey?Ee="move":F.altKey?Ee=It<a/2?"resize-start":"resize-end":K?It<a/2?Ee="move":Ee="resize-end":H?It<=mt/2?Ee="resize-start":It>=a-mt/2?Ee="resize-end":Ee="move":It<=mt?Ee="resize-start":It>=a-mt?Ee="resize-end":Ee="move";}h(Ee),B(false),S(null),Ee==="move"?m(de.x-we):Ee==="connect"?R({x:t+a,y:r+V/2}):m(0),w(we),C(a);},[t,a,r,V]),Tt=useCallback(F=>{if(g==="none")return;let he=b.current?.ownerSVGElement;if(!he)return;let ce=he.createSVGPoint();ce.x=F.clientX,ce.y=F.clientY;let N=ce.matrixTransform(he.getScreenCTM()?.inverse());if(g==="connect"){R({x:N.x,y:N.y});let U=le(N.x,N.y);O(U);}else if(g==="move"){let U=N.x-v,de=De(U);if(w(de),C(a),e.segments&&e.segments.length>0&&I!==null){let we=de-$;oe(we);}}else if(g==="resize-start"){let U=N.x,de=De(U),we=t+a-de;we>=o&&(w(de),C(we));}else if(g==="resize-end"){let U=N.x,we=De(U)-t;we>=o&&C(we);}},[g,t,a,o,v,e,De,I,$,le,O,R,w,C,oe]),or=useCallback(()=>{if(g!=="none"){if(g==="connect")E&&f&&f(e,E),R(null),O(null);else {let F=e.endDate.getTime()-e.startDate.getTime(),he,ce,N=true;if(g==="move"){if(he=Ct(k),ce=new Date(he.getTime()+F),e.segments&&e.segments.length>0&&I!==null){let U=Math.round(J/o),de=e.segments.map((Ft,$n)=>{if($n===I){let Xr=new Date(Ft.startDate),ga=new Date(Ft.endDate);return Xr.setDate(Xr.getDate()+U),ga.setDate(ga.getDate()+U),{startDate:Xr,endDate:ga}}return Ft}),we=de.flatMap(Ft=>[Ft.startDate,Ft.endDate]),Ee=new Date(Math.min(...we.map(Ft=>Ft.getTime()))),It=new Date(Math.max(...we.map(Ft=>Ft.getTime())));d?.({...e,segments:de},Ee,It),Jt(t,a);return}}else g==="resize-start"?(he=Ct(k),ce=e.endDate,he>=ce&&(console.warn("Invalid date range: start date must be before end date"),N=false)):g==="resize-end"?(he=e.startDate,ce=Ct(k+y),ce<=he&&(console.warn("Invalid date range: end date must be after start date"),N=false)):N=false;N&&he&&ce&&(ce.getTime()-he.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,he,ce));}Jt(t,a);}},[g,k,y,e,d,E,f,t,a,o,Ct,J,I,Jt]);useEffect(()=>{if(g==="none")return;let F=ce=>{Tt(ce);},he=()=>{or();};return window.addEventListener("mousemove",F),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",he);}},[g,Tt,or]);let pe=ee&&!ot?k:t,ge=ee&&!ot?y:a,jr=l.taskTooltip(e),Yr=typeof jr=="string"?jr:"",qr=l.taskClass(e);return jsxs("g",{ref:b,onMouseEnter:()=>!ee&&B(true),onMouseLeave:()=>{ee||(B(false),S(null));},onClick:()=>!ee&&c?.(e),onDoubleClick:F=>{ee||(F.stopPropagation(),i?.(e));},onContextMenu:F=>{F.preventDefault(),u?.(e,F);},children:[Yr&&jsx("title",{dangerouslySetInnerHTML:{__html:Yr}}),Pe&&!ee&&!H&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:mt,height:V,fill:D==="resize-start"?n.accent:"transparent",opacity:D==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>S("resize-start"),onMouseDown:F=>ke(F,"resize-start")}),jsx("rect",{x:t+mt,y:r,width:a-mt*2,height:V,fill:D==="move"?n.accent:"transparent",opacity:D==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>S("move"),onMouseDown:F=>ke(F,"move")}),jsx("rect",{x:t+a-mt,y:r,width:mt,height:V,fill:D==="resize-end"?n.accent:"transparent",opacity:D==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>S("resize-end"),onMouseDown:F=>ke(F,"resize-end")})]}),Pe&&!ee&&K&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:V,fill:D==="move"?n.accent:"transparent",opacity:D==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>S("move"),onMouseDown:F=>ke(F,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:V,fill:D==="resize-end"?n.accent:"transparent",opacity:D==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>S("resize-end"),onMouseDown:F=>ke(F,"resize-end")}),Pe&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+V-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ee&&!ot&&!e.segments&&jsx(motion.rect,{x:k,y:r,width:y,height:V,rx:ae,fill:e.isCriticalPath?"#DC2626":n.taskBarPrimary,opacity:.3,stroke:e.isCriticalPath?"#EF4444":n.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.5},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:pe,y:r,width:ge,height:V,rx:ae,fill:e.isCriticalPath?"#DC2626":n.taskBarPrimary,"data-task-class":qr,initial:{opacity:0,scale:.95},animate:{opacity:ee&&!ot?.15:Pe?.25:.2,scale:Pe&&!ee?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:F=>ke(F),style:{cursor:ee?ot?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:pe,y:r,width:ge*(e.progress/100),height:V,rx:ae,fill:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((F,he)=>{let ce=(F.startDate.getTime()-s.getTime())/864e5*o,U=(F.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-ce+o,de=ee&&g==="move"&&I===he,we=Ne===he,Ee=de?ce+J:ce;return jsxs("g",{onMouseEnter:()=>!ee&&re(he),onMouseLeave:()=>!ee&&re(null),children:[jsx(motion.rect,{x:Ee,y:r,width:U,height:V,rx:ae,fill:e.isCriticalPath?"#DC2626":n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:de?.6:we?.9:.8,scale:we&&!ee?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:It=>{It.stopPropagation(),z(he),Z(ce),ke(It,void 0,ce);},style:{cursor:ee?ot?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Ee,y:r,width:U*(e.progress/100),height:V,rx:ae,fill:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),Gt&&(Pt||Bt)&&!e.segments&&jsxs(Fragment,{children:[Bt&&!Pt&&jsx("rect",{x:pe,y:r,width:ge,height:V,rx:ae,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Pt&&jsx("rect",{x:pe,y:r,width:ge,height:V,rx:ae,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ge>60&&!e.segments&&(()=>{let F=l.taskLabel(e),he=typeof F=="string"?F:e.name,ce=he.length>Math.floor(ge/8)?`${he.substring(0,Math.floor(ge/8))}...`:he;return jsx("text",{x:pe+12,y:r+V/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:ce})})(),ge>100&&e.progress>0&&e.progress<100&&!ee&&!e.segments&&jsxs("text",{x:pe+ge-12,y:r+V/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&&ge>80&&!ee&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:pe+ge-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:pe+ge-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Pe||ye)&&!ot&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:H?pe-15:pe-10,y:r-5,width:H?25:20,height:V+10,fill:"transparent",onMouseDown:F=>ke(F,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:H?pe-8:pe-3,y:r+6,width:H?8:6,height:H?V-12:V-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:pe+ge-10,y:r-5,width:H?25:20,height:V+10,fill:"transparent",onMouseDown:F=>ke(F,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:H?pe+ge:pe+ge-3,y:r+6,width:H?8:6,height:H?V-12:V-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:Pe&&!ee&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+a+8,cy:r+V/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:F=>{F.stopPropagation(),ke(F,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+a+20,y:r+V/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ot&&T&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+V/2,x2:T.x,y2:T.y,stroke:E?n.statusCompleted:n.accent,strokeWidth:E?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:E?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:T.x,cy:T.y,r:E?8:6,fill:E?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),E&&jsx(motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Pe||ee)&&!ot&&!e.segments&&jsx(motion.rect,{x:pe-2,y:r-2,width:ge+4,height:V+4,rx:ae+2,fill:"none",stroke:ee?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:ee?.6:.4,initial:{opacity:0},animate:{opacity:ee?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ye&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+y,y1:0,x2:k+y,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Pe&&!ee&&!e.segments&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("rect",{x:pe+ge/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${pe+ge/2-6} ${r-13} L ${pe+ge/2} ${r-3} L ${pe+ge/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("text",{x:pe+ge/2,y:r-73,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:pe+ge/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:pe+ge/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Le(e.startDate)}),jsx("text",{x:pe+ge/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:pe+ge/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Le(e.endDate)}),jsx("text",{x:pe+ge/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:pe+ge/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:He()}),jsx("text",{x:pe+ge/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:pe+ge/2+65,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:pe+ge/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:pe+ge/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(F=>F.name).join(", ").substring(0,30),e.assignees.map(F=>F.name).join(", ").length>30?"...":""]})]}),jsx("text",{x:pe+ge/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:K?"Left: move \u2022 Right: resize":H?"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 Pn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,f=6,p=Math.atan2(i,c),x=r-f*Math.cos(p-Math.PI/6),b=a-f*Math.sin(p-Math.PI/6),g=r-f*Math.cos(p+Math.PI/6),h=a-f*Math.sin(p+Math.PI/6),v=n.dependency;return jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsx(motion.path,{d:`M ${r} ${a} L ${x} ${b} M ${r} ${a} L ${g} ${h}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsx(motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:m=>{m.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Mn({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsx(motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:o&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}function Ln({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:l,onTaskClick:c,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:f,onDependencyDelete:p}){let b=Math.ceil((o.getTime()-n.getTime())/864e5),g=a==="day"?60:a==="week"?20:8,h=b*g*s,v=D=>{let S=new Date(Date.UTC(D.getFullYear(),D.getMonth(),D.getDate())),I=S.getUTCDay()||7;S.setUTCDate(S.getUTCDate()+4-I);let z=new Date(Date.UTC(S.getUTCFullYear(),0,1));return Math.ceil(((S.getTime()-z.getTime())/864e5+1)/7)},m=D=>{let S=D.getDay();return S===0||S===6},k=useCallback(D=>{let S=Math.round(D/(g*s)),I=new Date(n);return I.setDate(I.getDate()+S),I},[n,g,s]),w=useCallback((D,S)=>{if(S.startDate&&S.endDate)return;let I=D.currentTarget.ownerSVGElement;if(!I)return;let z=I.createSVGPoint();z.x=D.clientX,z.y=D.clientY;let $=z.matrixTransform(I.getScreenCTM()?.inverse()),Z=k($.x),J=new Date(Z);J.setDate(J.getDate()+1),d?.(S,Z,J);},[k,d]),y=(D,S=[])=>{for(let I of D)S.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&y(I.subtasks,S);return S},C=y(e),T=useCallback(D=>{if(!D.startDate||!D.endDate)return {x:0,width:0};let S=D.startDate.getTime(),I=D.endDate.getTime(),z=n.getTime(),$=(S-z)/(1e3*60*60*24),Z=(I-S)/(1e3*60*60*24),J=$*g*s,oe=Math.max(g*s,40),Ne=Math.max(Z*g*s,oe);return {x:J,width:Ne}},[n,g,s]),R=useMemo(()=>C.filter(D=>D.startDate&&D.endDate).map(D=>{let{x:S,width:I}=T(D),$=48+C.findIndex(Z=>Z.id===D.id)*r+12;return {id:D.id,x:S,y:$,width:I,height:32}}),[C,T]),E=useMemo(()=>{let D=[],S=new Date(n);for(;S<=o;){let $=(S.getTime()-n.getTime())/864e5*g*s;if(a==="day")D.push({date:new Date(S),label:S.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:$}),S.setDate(S.getDate()+1);else if(a==="week"){let Z=v(S);D.push({date:new Date(S),label:`Week ${Z}`,x:$}),S.setDate(S.getDate()+7);}else D.push({date:new Date(S),label:S.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:$}),S.setMonth(S.getMonth()+1);}return D},[n,o,a,g,s]),O=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*g*s,[n,g,s]);return jsx("div",{className:"flex-1 overflow-auto","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:jsxs("svg",{width:Math.max(h,1e3),height:Math.max(C.length*r+48,600),children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(h,1e3),height:Math.max(C.length*r+48,600),fill:t.bgPrimary}),jsx("rect",{x:0,y:0,width:h,height:48,fill:t.bgGrid}),E.map((D,S)=>{let I=E[S+1]?.x||h,z=m(D.date);return jsxs("g",{children:[z&&jsx("rect",{x:D.x,y:48,width:I-D.x,height:C.length*r,fill:t.bgWeekend,opacity:.6}),jsx("line",{x1:D.x,y1:48,x2:D.x,y2:C.length*r+48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:D.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",dominantBaseline:"middle",children:D.label})]},S)}),O>=0&&O<=h&&jsxs("g",{children:[jsx("line",{x1:O,y1:48,x2:O,y2:C.length*r+48,stroke:t.today,strokeWidth:2,opacity:1}),jsx("circle",{cx:O,cy:38,r:6,fill:t.today,opacity:1})]}),C.map((D,S)=>{let I=D.startDate&&D.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:48+S*r,width:h,height:r,fill:S%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${D.id}`),!I&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:48+S*r,width:h,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:z=>w(z,D),onMouseEnter:z=>{z.currentTarget.setAttribute("fill",t.accentLight),z.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:z=>{z.currentTarget.setAttribute("fill","transparent"),z.currentTarget.setAttribute("opacity","1");}},`clickable-${D.id}`),jsx("text",{x:O>0?O:100,y:48+S*r+r/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-${D.id}`)]})]},`row-group-${D.id}`)}),C.map((D,S)=>!D.dependencies||D.dependencies.length===0||!D.startDate||!D.endDate?null:D.dependencies.map(I=>{let z=C.find(oe=>oe.id===I);if(!z||!z.startDate||!z.endDate)return null;let $=C.findIndex(oe=>oe.id===I),Z=T(z),J=T(D);return jsx(Pn,{x1:Z.x+Z.width,y1:48+$*r+r/2,x2:J.x,y2:48+S*r+r/2,theme:t,onDelete:()=>p?.(D.id,I)},`dep-${I}-${D.id}`)})),C.map((D,S)=>{if(!D.startDate||!D.endDate)return null;let{x:I,width:z}=T(D),$=48+S*r+12,Z=D.subtasks&&D.subtasks.length>0&&!D.isMilestone;return D.isMilestone?jsx(Mn,{task:D,x:I+z/2,y:$+16,theme:t,onClick:c},D.id):Z?jsxs("g",{onClick:()=>c?.(D),style:{cursor:"pointer"},children:[jsx("line",{x1:I,y1:$,x2:I+z,y2:$,stroke:t.borderLight,strokeWidth:2,opacity:.6}),jsx("line",{x1:I,y1:$,x2:I,y2:$+32,stroke:t.borderLight,strokeWidth:2,opacity:.6}),jsx("line",{x1:I+z,y1:$,x2:I+z,y2:$+32,stroke:t.borderLight,strokeWidth:2,opacity:.6}),jsx("line",{x1:I,y1:$+32,x2:I+z,y2:$+32,stroke:t.borderLight,strokeWidth:2,opacity:.6})]},D.id):jsx(En,{task:D,x:I,y:$,width:z,theme:t,dayWidth:g*s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:R},D.id)})]})})}function Vl(e,t=50){let[r,a]=useState({past:[],present:e,future:[]}),n=useRef(false),o=useCallback((i,u=true)=>{a(d=>{let f=typeof i=="function"?i(d.present):i;if(n.current)return {...d,present:f};if(!u)return {...d,present:f};let p=[...d.past,d.present];return p.length>t&&p.shift(),{past:p,present:f,future:[]}});},[t]),s=useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Kl({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){useEffect(()=>{if(!n)return;let o=s=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?s.metaKey:s.ctrlKey;if(c&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!l&&c&&s.key==="y"){s.preventDefault(),t();return}if(l&&c&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var X={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=X.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=X.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=X.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=X.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
46
+ `)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=X.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=X.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>X.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=X.findTaskById(e,t);return !r||!r.dependencies?[]:X.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>X.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>X.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=X.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>X.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(console.log("[PDF Export] Starting export..."),console.log("[PDF Export] Tasks count:",e?.length||0),!e||e.length===0){console.warn("[PDF Export] No tasks provided"),alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable');console.log("[PDF Export] Modules loaded");let n=new r,o=X.flattenTasks(e);if(console.log("[PDF Export] Flattened tasks count:",o.length),o.length===0){console.warn("[PDF Export] No tasks after flattening"),alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=o.map(c=>{let i=c.startDate&&c.endDate?X.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?X.formatDate(c.startDate):"N/A",c.endDate?X.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});console.log("[PDF Export] Generating table with autoTable function..."),a(n,{head:s,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),console.log("[PDF Export] Table generated successfully"),console.log("[PDF Export] Saving PDF:",t),n.save(t),console.log("[PDF Export] PDF saved successfully");}catch(r){throw console.error("Error exporting to PDF:",r),r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=X.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?X.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?X.formatDate(c.startDate):"","End Date":c.endDate?X.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(u=>u.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let l=r.utils.book_new();r.utils.book_append_sheet(l,o,"Gantt Tasks"),r.writeFile(l,t);},calculateCriticalPath:e=>{let t=X.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?X.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let x=t.find(b=>b.id===p);if(x){n(x);let b=a.get(p)?.ef||0;d=Math.max(d,b);}}let f=d+u;a.set(i.id,{es:d,ef:f});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,l=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?X.calculateDuration(i.startDate,i.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),f=o;if(d.length>0)for(let x of d){l(x);let b=s.get(x.id)?.ls||0;f=Math.min(f,b);}let p=f-u;s.set(i.id,{ls:p,lf:f});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),d=s.get(i.id);if(u&&d){let f=d.ls-u.es;Math.abs(f)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let r=X.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(X.calculateCriticalPath(e).includes(t))return 0;let n=X.getDependentTasks(e,t);if(n.length===0){let l=X.getLatestEndDate(e);if(!l)return null;let c=X.calculateDuration(r.endDate,l);return Math.max(0,c)}let o=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!o)return null;let s=X.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>X.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t)=>{let r=X.findTaskById(e,t);if(!r||!r.endDate)return e;let a=X.getDependentTasks(e,t);if(a.length===0)return e;let n=[...e];for(let o of a){if(!o.startDate||!o.endDate)continue;let s=X.calculateDuration(o.startDate,o.endDate),l=new Date(r.endDate);l.setDate(l.getDate()+1);let c=X.calculateEndDate(l,s),i=u=>u.map(d=>d.id===o.id?{...d,startDate:l,endDate:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);n=i(n),n=X.autoScheduleDependents(n,o.id);}return n},splitTask:(e,t,r,a=3)=>{let n=X.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:l}],i=u=>u.map(d=>d.id===n.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};var vf={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${X.formatDate(e.startDate)} - ${X.formatDate(e.endDate)}`);let r=X.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>X.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function jl(e){return {...vf,...e}}var Cf=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},ql=forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:l="comfortable",showThemeSelector:c=true,availableUsers:i=[],templates:u,onThemeChange:d,onTaskClick:f,onTaskDblClick:p,onTaskContextMenu:x,onTaskUpdate:b,onProgressChange:g,onDependencyCreate:h,onDependencyDelete:v,onBeforeTaskAdd:m,onAfterTaskAdd:k,onBeforeTaskUpdate:w,onAfterTaskUpdate:y,onBeforeTaskDelete:C,onAfterTaskDelete:T}=r,E=useContext(Cn)?.theme,[O,D]=useState(E||o||"dark"),[S,I]=useState(s),[z,$]=useState(l),[Z,J]=useState(1),[oe,Ne]=useState(0),[re,Pe]=useState(false),[B,ee]=useState(null),[ye,ot]=useState({isOpen:false,x:0,y:0,task:null});useEffect(()=>{E&&E!==O&&D(E);},[E]);let Jt=useCallback(P=>{D(P),d?.(P);},[d]),{state:V,setState:ae,undo:Pt,redo:Bt,canUndo:Gt,canRedo:Qt,clearHistory:mt}=Vl(t,50);useEffect(()=>{a&&a(V);},[V,a]);let[H,K]=useState([{id:"name",label:"Task Name",width:240,visible:true,sortable:true},{id:"startDate",label:"Start Date",width:110,visible:false,sortable:true},{id:"endDate",label:"End Date",width:110,visible:false,sortable:true},{id:"duration",label:"Duration",width:80,visible:false,sortable:true},{id:"assignees",label:"Assignees",width:120,visible:false,sortable:false},{id:"status",label:"Status",width:80,visible:false,sortable:true},{id:"progress",label:"% Complete",width:120,visible:false,sortable:true}]),Le=useMemo(()=>H.filter(P=>P.visible).reduce((P,A)=>P+A.width,0)+60,[H]),He=B||Le,De=useRef(null),Ct=useRef(null),le=useRef(null),ke=useMemo(()=>Nl(O),[O]),Tt=useMemo(()=>jl(u),[u]),or=useMemo(()=>{let P=X.calculateCriticalPath(V),A=W=>W.map(Y=>({...Y,isCriticalPath:P.includes(Y.id),subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(V)},[V]),pe=Cf(z);Kl({undo:Pt,redo:Bt,canUndo:Gt,canRedo:Qt,enabled:true}),useImperativeHandle(n,()=>({getTask:P=>X.findTaskById(V,P),addTask:(P,A)=>{ae(W=>{if(!A)return [...W,{...P,level:0}];let Y=Q=>Q.map(ne=>ne.id===A?{...ne,subtasks:[...ne.subtasks||[],{...P,parentId:A,level:(ne.level||0)+1}],isExpanded:true}:ne.subtasks?{...ne,subtasks:Y(ne.subtasks)}:ne);return Y(W)});},updateTask:(P,A)=>{ae(W=>{let Y=Q=>Q.map(ne=>ne.id===P?{...ne,...A}:ne.subtasks?{...ne,subtasks:Y(ne.subtasks)}:ne);return Y(W)});},deleteTask:P=>{ae(A=>{let W=Y=>Y.filter(Q=>Q.id===P?false:(Q.subtasks&&(Q.subtasks=W(Q.subtasks)),true));return W(A)});},deleteTasks:P=>{ae(A=>as(A,P));},duplicateTask:P=>{ae(A=>ns(A,[P]));},splitTask:(P,A,W=3)=>{ae(Y=>X.splitTask(Y,P,A,W));},calculateEndDate:X.calculateEndDate,calculateDuration:X.calculateDuration,validateDependency:(P,A)=>!X.validateDependencies(V,P,A),getAllTasks:()=>X.flattenTasks(V),getTasksByStatus:P=>X.flattenTasks(V).filter(A=>A.status===P),getTasksByParent:P=>P?X.findTaskById(V,P)?.subtasks||[]:V.filter(W=>!W.parentId),getCriticalPath:()=>X.flattenTasks(V).filter(P=>P.isCriticalPath),indentTask:P=>{ae(A=>es(A,[P]));},outdentTask:P=>{ae(A=>ts(A,[P]));},moveTask:(P,A)=>{ae(W=>rs(W,[P],A));},createSubtask:P=>{ae(A=>{let{tasks:W}=is(A,P);return W});},scrollToTask:P=>{let W=X.flattenTasks(V).findIndex(Y=>Y.id===P);if(W!==-1&&De.current){let Y=W*pe;De.current.scrollTo({top:Y,behavior:"smooth"}),Ct.current&&Ct.current.scrollTo({top:Y,behavior:"smooth"});}},highlightTask:(P,A=2e3)=>{console.log(`Highlighting task ${P} for ${A}ms`);},expandTask:P=>{ae(A=>{let W=Y=>Y.map(Q=>Q.id===P?{...Q,isExpanded:true}:Q.subtasks?{...Q,subtasks:W(Q.subtasks)}:Q);return W(A)});},collapseTask:P=>{ae(A=>{let W=Y=>Y.map(Q=>Q.id===P?{...Q,isExpanded:false}:Q.subtasks?{...Q,subtasks:W(Q.subtasks)}:Q);return W(A)});},expandAll:()=>{ae(P=>{let A=W=>W.map(Y=>({...Y,isExpanded:true,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(P)});},collapseAll:()=>{ae(P=>{let A=W=>W.map(Y=>({...Y,isExpanded:false,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(P)});},undo:Pt,redo:Bt,canUndo:()=>Gt,canRedo:()=>Qt,clearHistory:mt,exportToPNG:async()=>{if(!le.current)throw new Error("Gantt container not found");let P=await sd(le.current,{backgroundColor:ke.bgPrimary,scale:2});return new Promise((A,W)=>{P.toBlob(Y=>{Y?A(Y):W(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await X.exportToPDF(V,P);},exportToExcel:async P=>{await X.exportToExcel(V,P);},exportToJSON:()=>X.exportToJSON(V),exportToCSV:()=>X.exportToCSV(V),importFromJSON:P=>{let A=X.importFromJSON(P);ae(A);},getTasks:()=>V,refresh:()=>{ae(P=>[...P]);},clearAll:()=>{ae([]);}}),[V,Pt,Bt,Gt,Qt,mt,ke,pe]);let ge=useCallback(P=>{K(A=>A.map(W=>W.id===P?{...W,visible:!W.visible}:W));},[]),jr=useCallback(P=>{ae(A=>ss(A,P)),r.onTaskToggleExpand?.(P);},[r]),Yr=useCallback((P,A)=>{if(w&&w(P,A)===false)return;let Y=X.findTaskById(V,P)?.progress,Q=ft=>ft.map(_e=>_e.id===P?{..._e,...A}:_e.subtasks?{..._e,subtasks:Q(_e.subtasks)}:_e);ae(Q(V));let ne=X.findTaskById(Q(V),P);ne&&(b?.(ne),y?.(ne),A.progress!==void 0&&Y!==void 0&&A.progress!==Y&&g?.(P,Y,A.progress));},[V,b,w,y,g]),qr=useCallback(P=>{if(C&&C(P)===false)return;let A=W=>W.filter(Y=>Y.id===P?false:(Y.subtasks&&(Y.subtasks=A(Y.subtasks)),true));ae(A(V)),T?.(P);},[V,C,T]),F=useCallback(P=>{P.length!==0&&(ae(A=>es(A,P)),r.onTaskIndent?.(P[0]));},[r]),he=useCallback(P=>{P.length!==0&&(ae(A=>ts(A,P)),r.onTaskOutdent?.(P[0]));},[r]),ce=useCallback((P,A)=>{P.length!==0&&(ae(W=>rs(W,P,A)),r.onTaskMove?.(P[0],A));},[r]),N=useCallback(P=>{ae(A=>as(A,P)),P.forEach(A=>r.onTaskDelete?.(A));},[r]),U=useCallback(P=>{ae(A=>ns(A,P)),P.forEach(A=>r.onTaskDuplicate?.(A));},[r]),de=useCallback((P,A)=>{ae(W=>{let{tasks:Y,newTask:Q}=Al(W,P,A);return m&&m(Q)===false?W:(r.onTaskCreate?.(Q.parentId,Q.position||0),k?.(Q),Y)});},[r,m,k]),we=useCallback((P,A)=>{ae(W=>os(W,P,A)),r.onTaskRename?.(P,A);},[r]),Ee=useCallback(P=>{ae(A=>{let{tasks:W}=is(A,P);return r.onTaskCreate?.(P,0),W});},[r]),It=useCallback((P,A,W)=>{let Y=ft=>ft.map(_e=>_e.id===P.id?{..._e,startDate:A,endDate:W,...P.segments&&{segments:P.segments}}:_e.subtasks?{..._e,subtasks:Y(_e.subtasks)}:_e),Q=Y(V);Q=X.autoScheduleDependents(Q,P.id),ae(Q);let ne={...P,startDate:A,endDate:W};b?.(ne);},[V,b]),Ft=useCallback((P,A)=>{x?.(P,A),ot({isOpen:true,x:A.clientX,y:A.clientY,task:P});},[x]),$n=useCallback((P,A)=>{let W=X.splitTask(V,P.id,A);ae(W),ot({isOpen:false,x:0,y:0,task:null});},[V]),Xr=useCallback((P,A,W)=>{let Y=new Map,Q=Dr=>{Dr.forEach(Er=>{Er.dependencies&&Y.set(Er.id,Er.dependencies),Er.subtasks&&Q(Er.subtasks);});};Q(W);let ne=Y.get(A)||[];Y.set(A,[...ne,P]);let ft=new Set,_e=new Set,Zr=Dr=>{if(!ft.has(Dr)){ft.add(Dr),_e.add(Dr);let Er=Y.get(Dr)||[];for(let Wn of Er){if(!ft.has(Wn)&&Zr(Wn))return true;if(_e.has(Wn))return true}}return _e.delete(Dr),false};return Zr(A)},[]),ga=useCallback((P,A)=>{if(Xr(P.id,A,V)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
47
+
48
+ Task dependencies must flow in one direction only.`);return}let W=Y=>Y.map(Q=>{if(Q.id===A){let ne=Q.dependencies||[];if(!ne.includes(P.id))return {...Q,dependencies:[...ne,P.id]}}return Q.subtasks?{...Q,subtasks:W(Q.subtasks)}:Q});ae(W(V)),h?.(P.id,A);},[V,h,Xr]),qc=useCallback((P,A)=>{let W=Y=>Y.map(Q=>{if(Q.id===P&&Q.dependencies){let ne=Q.dependencies.filter(ft=>ft!==A);return {...Q,dependencies:ne}}return Q.subtasks?{...Q,subtasks:W(Q.subtasks)}:Q});ae(W(V)),v?.(P,A);},[V,v]),{startDate:Xc,endDate:Zc}=useMemo(()=>{let P=V.filter(ne=>ne.startDate&&ne.endDate);if(P.length===0){let ne=new Date,ft=new Date(ne);ft.setDate(ft.getDate()-30);let _e=new Date(ne);return _e.setDate(_e.getDate()+60),{startDate:ft,endDate:_e}}let A=P.flatMap(ne=>[ne.startDate,ne.endDate]).filter(ne=>ne!==void 0),W=new Date(Math.min(...A.map(ne=>ne.getTime()))),Y=new Date(Math.max(...A.map(ne=>ne.getTime()))),Q=S==="day"?7:S==="week"?14:30;return W.setDate(W.getDate()-Q),Y.setDate(Y.getDate()+Q),{startDate:W,endDate:Y}},[V,S]),Jc=P=>{P.preventDefault(),Pe(true);};return useEffect(()=>{let P=De.current,A=Ct.current;if(!P||!A)return;let W=r.disableScrollSync||false,Y=()=>{if(W){Ne(P.scrollTop);return}A.scrollTop!==P.scrollTop&&(A.scrollTop=P.scrollTop),Ne(P.scrollTop);},Q=()=>{if(W){Ne(A.scrollTop);return}P.scrollTop!==A.scrollTop&&(P.scrollTop=A.scrollTop),Ne(A.scrollTop);},ne=_e=>{if(re){let Zr=_e.clientX;Zr>300&&Zr<window.innerWidth-400&&ee(Zr);}},ft=()=>{Pe(false);};return P.addEventListener("scroll",Y),A.addEventListener("scroll",Q),document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ft),()=>{P.removeEventListener("scroll",Y),A.removeEventListener("scroll",Q),document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ft);}},[re,r.disableScrollSync]),jsxs("div",{ref:le,className:"flex flex-col h-screen overflow-hidden",style:{backgroundColor:ke.bgPrimary,fontFamily:"Inter, sans-serif",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(Sn,{theme:ke,timeScale:S,onTimeScaleChange:I,zoom:Z,onZoomChange:J,currentTheme:O,onThemeChange:Jt,rowDensity:z,onRowDensityChange:$,showThemeSelector:c}),jsxs("div",{className:"flex-1 flex overflow-hidden",children:[jsx("div",{ref:De,style:{width:He,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Dn,{tasks:or,theme:ke,rowHeight:pe,availableUsers:i,templates:Tt,onTaskClick:f,onTaskDblClick:p,onTaskContextMenu:x,onTaskToggle:jr,scrollTop:oe,columns:H,onToggleColumn:ge,onTaskUpdate:Yr,onTaskDelete:qr,onTaskIndent:F,onTaskOutdent:he,onTaskMove:ce,onMultiTaskDelete:N,onTaskDuplicate:U,onTaskCreate:de,onTaskRename:we,onCreateSubtask:Ee,onOpenTaskModal:f?P=>f(P):void 0})}),jsx("div",{className:"relative flex-shrink-0 cursor-col-resize group",style:{width:8,backgroundColor:re?ke.accent:ke.border,transition:"background-color 0.2s"},onMouseDown:Jc,children:jsx(motion.div,{className:"absolute inset-y-0 left-1/2 -translate-x-1/2",style:{width:2,backgroundColor:ke.accent},initial:{opacity:0},animate:{opacity:re?1:0},whileHover:{opacity:1}})}),jsx("div",{ref:Ct,className:"flex-1 overflow-hidden",style:{...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ln,{tasks:or,theme:ke,rowHeight:pe,timeScale:S,startDate:Xc,endDate:Zc,zoom:Z,templates:Tt,onTaskClick:f,onTaskDblClick:p,onTaskContextMenu:Ft,onTaskDateChange:It,onDependencyCreate:ga,onDependencyDelete:qc})})]}),ye.task&&jsx(ua,{isOpen:ye.isOpen,x:ye.x,y:ye.y,theme:ke,onClose:()=>ot({isOpen:false,x:0,y:0,task:null}),items:[{id:"split",label:"Split Task",icon:Rt.Split,onClick:()=>{if(!ye.task?.startDate||!ye.task?.endDate){console.warn("Cannot split task without dates");return}let P=ye.task.startDate.getTime(),A=ye.task.endDate.getTime(),W=P+(A-P)/2,Y=new Date(W);$n(ye.task,Y);},disabled:!ye.task?.startDate||!ye.task?.endDate}]})]})});function tc({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:l=r?"edit":"create",theme:c="dark"}){let i=me[c]||me.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},d={color:i.textSecondary},[f,p]=useState({name:"",progress:0,status:"todo",isMilestone:false,assignees:[],dependencies:[]}),[x,b]=useState({});useEffect(()=>{p(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,assignees:[],dependencies:[]});},[r,e]);let g=()=>{let m={};return f.name.trim()||(m.name="El nombre es requerido"),f.startDate&&f.endDate&&f.startDate>f.endDate&&(m.endDate="La fecha de fin debe ser posterior a la de inicio"),b(m),Object.keys(m).length===0},h=async m=>{if(m.preventDefault(),!!g())try{await o(f),t();}catch(k){console.error("Error submitting task:",k);}},v=(m,k)=>{p(w=>({...w,[m]:k})),x[m]&&b(w=>{let y={...w};return delete y[m],y});};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsx(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:jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:m=>m.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:l==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>m.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsx(X$1,{className:"w-5 h-5"})})]}),jsxs("form",{onSubmit:h,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsx("input",{type:"text",value:f.name,onChange:m=>v("name",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:m=>m.currentTarget.style.borderColor=i.accent,onBlur:m=>m.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),x.name&&jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-4 h-4"}),x.name]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsx(Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsx("input",{type:"date",value:f.startDate?f.startDate.toISOString().split("T")[0]:"",onChange:m=>v("startDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone})]}),jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsx(Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsx("input",{type:"date",value:f.endDate?f.endDate.toISOString().split("T")[0]:"",onChange:m=>v("endDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone}),x.endDate&&jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-4 h-4"}),x.endDate]})]})]}),jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsx(CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxs("select",{value:f.status,onChange:m=>v("status",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsx("option",{value:"todo",children:"Por Hacer"}),jsx("option",{value:"in-progress",children:"En Progreso"}),jsx("option",{value:"completed",children:"Completada"})]})]}),jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxs("span",{className:"flex items-center gap-2",children:[jsx(Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxs("span",{className:"font-semibold",style:{color:i.accent},children:[f.progress,"%"]})]}),jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress,onChange:m=>v("progress",parseInt(m.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:i.accent},disabled:s}),jsxs("div",{className:"flex justify-between text-xs mt-1",style:{color:i.textTertiary},children:[jsx("span",{children:"0%"}),jsx("span",{children:"25%"}),jsx("span",{children:"50%"}),jsx("span",{children:"75%"}),jsx("span",{children:"100%"})]})]}),jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsx("input",{type:"checkbox",id:"isMilestone",checked:f.isMilestone,onChange:m=>v("isMilestone",m.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsx(Users,{className:"w-4 h-4"}),"Asignar a"]}),jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(m=>jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:f.assignees?.some(k=>k.name===m.name),onChange:k=>{let w=k.target.checked?[...f.assignees||[],{name:m.name,avatar:m.avatar,initials:m.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(f.assignees||[]).filter(y=>y.name!==m.name);v("assignees",w);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:m.name.charAt(0).toUpperCase()}),jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]})]},m.id))})]}),a.length>0&&jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsx(Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(m=>m.id!==r?.id).map(m=>jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:k=>k.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:k=>k.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:f.dependencies?.includes(m.id),onChange:k=>{let w=k.target.checked?[...f.dependencies||[],m.id]:(f.dependencies||[]).filter(y=>y!==m.id);v("dependencies",w);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]},m.id))})]})]}),jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>{m.currentTarget.style.color=i.textPrimary,m.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.color=i.textSecondary,m.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsx("button",{onClick:h,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:m=>!s&&(m.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:m=>!s&&(m.currentTarget.style.backgroundColor=i.accent),children:s?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxs(Fragment,{children:[jsx(CheckCircle2,{className:"w-4 h-4"}),l==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}function If(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 Mf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Bn(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let d=r.find(f=>f.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Bn(u,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},l=s(e.startDate),c=s(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:If(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:o?.length?o:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function rc(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(o=>o.name===a.name||o.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:Mf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ac(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Bn(a,e,t))}function Af({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:s,className:l}){let[c,i]=useState(false),u=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),d=useMemo(()=>{let p=u.length,x=new Set(u.flatMap(h=>h.assignedUserIds||[])).size,b=u.map(h=>h.priority).filter(Boolean),g=new Set(u.flatMap(h=>h.labels||[])).size;return {totalCards:p,uniqueAssignees:x,priorities:b,labels:g}},[u]),f=()=>{n?.(e.id);};return jsxs("div",{className:te("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:f,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:te("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),s?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:x=>{x.stopPropagation(),o?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var oc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Fa(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 Oa(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 sc(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 ic({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:s,className:l}){let c=useMemo(()=>({...oc,...s}),[s]),[i,u]=useState(new Set),d=useRef(null),f=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(m=>{let k=m.timestamp.toISOString().split("T")[0],w=v.get(k);w?w.push(m):v.set(k,[m]);}),Array.from(v.entries()).sort((m,k)=>k[0].localeCompare(m[0])).map(([m,k])=>({date:new Date(m),events:k.sort((w,y)=>y.timestamp.getTime()-w.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:x}=useMemo(()=>{let v=new Set,m=new Set;return e.forEach(k=>{v.add(k.userId),m.add(k.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(m)}},[e]),b=v=>{u(m=>{let k=new Set(m);return k.has(v)?k.delete(v):k.add(v),k});},g=v=>{let k=new Date().getTime()-v.getTime(),w=Math.floor(k/6e4),y=Math.floor(k/36e5),C=Math.floor(k/864e5);return w<1?"just now":w<60?`${w}m ago`:y<24?`${y}h ago`:C<7?`${C}d ago`:v.toLocaleDateString()},h=useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return useEffect(()=>{if(o&&d.current){let v=d.current.querySelector(`[data-event-id="${o}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxs("div",{className:te("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:te("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:v=>{let m=v.target.value;r({...t,types:m?[m]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),x.map(v=>jsxs("option",{value:v,children:[Oa(v)," ",v.replace("_"," ")]},v))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let m=v.target.value;r({...t,users:m?[m]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(v=>jsx("option",{value:v,children:v},v))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>r({...t,searchTerm:v.target.value})})]}),h>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",h,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:f.map(v=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&v.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:v.events.map((m,k)=>{let w=i.has(m.id),y=o===m.id,C=sc(m.type);return jsxs("div",{"data-event-id":m.id,className:te("history-timeline-event",w&&"expanded",y&&"selected"),onClick:()=>n?.(m),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Oa(m.type)})}),k<v.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&m.userAvatar&&jsx("img",{src:m.userAvatar,alt:m.userName||m.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:m.userName||m.userId}),jsx("span",{className:"history-timeline-event-action",children:Fa(m)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?g(m.timestamp):m.timestamp.toLocaleString()})]}),Object.keys(m.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(m.id);},children:[w?"\u25BC":"\u25B6"," Show changes"]}),w&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(m.changes).map(([T,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},T)),m.metadata&&Object.keys(m.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(m.metadata).map(([T,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},T))]})]})]})]},m.id)})})]},v.date?.toISOString()||"all"))})]})}function cc({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:s,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),f=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:te("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:te("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Oa(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Fa(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>l(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${f}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,x)=>jsx("div",{className:te("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>l(x),title:Fa(p)},p.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(p=>jsxs("button",{className:te("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:te("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function hs(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 vs(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 dc(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 uc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Uf(e,t,r,a,n,o=100){let s=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(s.map(c=>[c.id,c]));for(let c=0;c<o;c++){let i=1-c/o;s.forEach(u=>{let d=r/2,f=a/2;u.vx+=(d-u.x)*n.centerForce*i,u.vy+=(f-u.y)*n.centerForce*i,s.forEach(p=>{if(u.id===p.id)return;let x=u.x-p.x,b=u.y-p.y,g=Math.sqrt(x*x+b*b)||1,h=n.chargeStrength*i/(g*g);u.vx+=x/g*h,u.vy+=b/g*h;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),f=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!f)return;let p=f.x-d.x,x=f.y-d.y,b=Math.sqrt(p*p+x*x)||1,g=(b-n.linkDistance)/b*n.forceStrength*i;d.vx+=p*g,d.vy+=x*g,f.vx-=p*g,f.vy-=x*g;}),s.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return s}function pc({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:s,onInteraction:l,className:c}){let i=useRef(null),[u,d]=useState([]),[f,p]=useState(null),[x,b]=useState(null),[g,h]=useState(null),[v,m]=useState(1),[k,w]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let S=Uf(e,t,r.width,r.height,r,150);d(S);},[e,t,r]);let y=useCallback((S,I)=>{r.enableDragging&&(I.stopPropagation(),p(S));},[r.enableDragging]),C=useCallback(S=>{if(!f||!i.current)return;let z=i.current.getBoundingClientRect(),$=(S.clientX-z.left-k.x)/v,Z=(S.clientY-z.top-k.y)/v;d(J=>J.map(oe=>oe.id===f?{...oe,x:$,y:Z,fx:$,fy:Z}:oe));},[f,v,k]),T=useCallback(()=>{p(null);},[]),R=useCallback((S,I)=>{I.stopPropagation(),l?.({type:"node-click",node:S,position:{x:I.clientX,y:I.clientY}});},[l]),E=useCallback((S,I)=>{I.stopPropagation(),l?.({type:"edge-click",edge:S,position:{x:I.clientX,y:I.clientY}});},[l]),O=useCallback(S=>{let I=u.find(z=>z.id===S);return I?{x:I.x,y:I.y}:{x:0,y:0}},[u]),D=useCallback(S=>{if(S.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return S.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let I=S.card.priority;return I==="URGENT"?"#ef4444":I==="HIGH"?"#f59e0b":I==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return S.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:te("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:te("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),o&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>m(S=>Math.min(S+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>m(S=>Math.max(S-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{m(1),w({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(S=>S.type))).map(S=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:hs(S)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[dc(S)," ",vs(S)]})]},S))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:C,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${v})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(S=>{let I=O(typeof S.source=="string"?S.source:S.source.id),z=O(typeof S.target=="string"?S.target:S.target.id),$=uc(S.type),Z=g===S.id,J=S.onCriticalPath;return jsxs("g",{className:te("relationships-graph-edge",Z&&"hovered",J&&"critical"),onMouseEnter:()=>h(S.id),onMouseLeave:()=>h(null),onClick:oe=>E(S,oe),children:[jsx("line",{x1:I.x,y1:I.y,x2:z.x,y2:z.y,stroke:hs(S.type),strokeWidth:J?r.edgeWidth*2:r.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:$?"url(#arrowhead)":void 0}),r.showEdgeLabels&&Z&&jsx("text",{x:(I.x+z.x)/2,y:(I.y+z.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:vs(S.type)})]},S.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(S=>{let I=x===S.id,z=S.onCriticalPath;return jsxs("g",{className:te("relationships-graph-node",I&&"hovered",z&&"critical"),transform:`translate(${S.x}, ${S.y})`,onMouseDown:$=>y(S.id,$),onMouseEnter:()=>b(S.id),onMouseLeave:()=>b(null),onClick:$=>R(S,$),children:[jsx("circle",{r:z?r.nodeSize*1.2:r.nodeSize,fill:D(S),stroke:z?"#fbbf24":"#ffffff",strokeWidth:z?3:2,opacity:I?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:S.card.title.length>20?S.card.title.substring(0,20)+"...":S.card.title})]},S.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function gc({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,s]=useState(""),[l,c]=useState(false),[i,u]=useState(null),[d,f]=useState(null),p=useRef(null),x=l||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let v=m=>{m.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,x]);let b=()=>{x||(s(""),u(null),f(null),t());},g=async()=>{if(!(!o.trim()||x)){c(true),u(null),f(null);try{let v=await a(o.trim());f(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{d&&(r(d),b());};return e?jsxs(Ae,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:x,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((v,m)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},m))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((v,m)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:v.title}),v.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},m)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:p,value:o,onChange:v=>s(v.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((v,m)=>jsx("button",{onClick:()=>s(v),disabled:x,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:v},m))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:x&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,disabled:x,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:g,disabled:!o.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var bs={"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 _f={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},$f={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 Wf(e,t,r){let a=bs[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function za(e){return `$${e.toFixed(4)}`}var ys=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=Wf(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let a=r.length,n=r.reduce((d,f)=>d+f.cost,0),o=r.reduce((d,f)=>d+f.inputTokens,0),s=r.reduce((d,f)=>d+f.outputTokens,0),l=r.filter(d=>d.success),c=r.reduce((d,f)=>d+f.duration,0),i={},u={};return r.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],o=new Date,s=new Date;r==="month"?s.setMonth(o.getMonth()-1):s.setDate(o.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=s).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$r=new ys;function bc({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState($r.getStats()),[o,s]=useState($r.checkLimit(r));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n($r.getStats()),s($r.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=$r.getRecentOperations(5);return jsxs(Ae,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[o.used," / ",o.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,o.percentUsed)}%`,background:o.percentUsed>90?"#EF4444":o.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[o.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:za(a.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:a.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let u=a.costsByFeature[c]||0,d=a.totalOperations>0?i/a.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:za(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:za(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 kc({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[s,l]=useState(""),[c,i]=useState(""),[u,d]=useState(""),[f,p]=useState(false),[x,b]=useState(null),[g,h]=useState(null),[v,m]=useState(null),k=useRef(null),w=f||n;useEffect(()=>{e&&k.current&&k.current.focus();},[e]),useEffect(()=>{let E=O=>{O.key==="Escape"&&!w&&y();};if(e)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[e,w]);let y=()=>{w||(l(""),i(""),d(""),b(null),h(null),m(null),t());},C=async()=>{if(!(!s.trim()||w)){p(true),b(null),h(null),m(null);try{let E=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});h(E.tasks.tasks),m({from_cache:E.from_cache,tokens_used:E.tokens_used,mock_mode:E.mock_mode,similarity:E.similarity,tokens_saved:E.tokens_saved});}catch(E){b(E instanceof Error?E.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{g&&(r(g),y());};if(!e)return null;let R=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxs(Ae,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:E=>E.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:y,disabled:w,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[v?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),v?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):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"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[v?.tokens_used||0," tokens"]}),v?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[v.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((E,O)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",O+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:E.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),E.start," \u2192 ",E.end]}),jsxs("span",{children:[E.duration," days"]}),E.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",E.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${E.priority==="high"?"bg-red-500/20 text-red-400":E.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:E.priority})]})},E.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:k,value:s,onChange:E=>l(E.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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:E=>i(E.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})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:E=>d(E.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})]})]}),x&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((E,O)=>jsx("button",{onClick:()=>l(E),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:E},O))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:w&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:y,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"}),g?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:C,disabled:!s.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 zn({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(g=>{t&&Ka(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,v,m)=>{console.warn(`Retry attempt ${v} after ${m}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),o=useCallback(async(g,h,v)=>{a(m=>{let k=m.cards.find(E=>E.id===g);if(!k)return m;let w=k.columnId,y={...k,columnId:h,position:v},C=m.cards.map(E=>E.id===g?y:E),T=m.columns.map(E=>{if(E.id===w)return {...E,cardIds:E.cardIds.filter(O=>O!==g)};if(E.id===h){let O=C.filter(D=>D.columnId===h).sort((D,S)=>D.position-S.position);return {...E,cardIds:O.map(D=>D.id)}}return E}),R={...m,cards:C,columns:T};return n(R),R});},[n]),s=useCallback(async(g,h)=>{a(v=>{let m=v.cards.map(w=>w.id===g?{...w,...h}:w),k={...v,cards:m};return n(k),k});},[n]),l=useCallback(async g=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let m={...g,id:h},k=v.columns.map(y=>y.id===g.columnId?{...y,cardIds:[...y.cardIds,h]}:y),w={...v,cards:[...v.cards,m],columns:k};return n(w),w});},[n]),c=useCallback(async g=>{a(h=>{let v=h.cards.find(y=>y.id===g);if(!v)return h;let m=h.cards.filter(y=>y.id!==g),k=h.columns.map(y=>y.id===v.columnId?{...y,cardIds:y.cardIds.filter(C=>C!==g)}:y),w={...h,cards:m,columns:k};return n(w),w});},[n]),i=useCallback(async g=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let m={...g,id:h,cardIds:[]},k={...v,columns:[...v.columns,m]};return n(k),k});},[n]),u=useCallback(async(g,h)=>{a(v=>{let m=v.columns.map(w=>w.id===g?{...w,...h}:w),k={...v,columns:m};return n(k),k});},[n]),d=useCallback(async g=>{a(h=>{let v=h.cards.filter(w=>w.columnId!==g),m=h.columns.filter(w=>w.id!==g),k={...h,cards:v,columns:m};return n(k),k});},[n]),f=useCallback(g=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),h},[l]),p=useCallback(g=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),h},[i]),x=useCallback(()=>{a(g=>{let h={...g,cards:[],columns:[]};return n(h),h});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:s,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:a,helpers:{addCard:f,addColumn:p,deleteCard:c,deleteColumn:d,clearBoard:x}}}function Cc({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=zn({initialBoard:e,onPersist:r}),s=useMemo(()=>({addCard:(c,i,u={})=>{o.addCard({title:i,columnId:c,position:a.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(d=>d.position)):0;o.addColumn({title:c,position:i??u+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:s}}var Ha={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Sc={by:"none",order:"asc"};function Nc({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...Ha,...e}),[o,s]=useState({...Sc,...t}),l=useCallback(b=>{n(g=>({...g,...b}));},[]),c=useCallback(b=>{s(g=>({...g,...b}));},[]),i=useCallback(()=>{n(Ha),s(Sc);},[]),u=useCallback(()=>{r&&n({...Ha,assignees:[r]});},[r]),d=useCallback(()=>{n({...Ha,dateFilter:"overdue"});},[]),f=useCallback(()=>{n({...Ha,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),x=useCallback(b=>{let g=[...b];if(a.search){let h=a.search.toLowerCase();g=g.filter(v=>v.title.toLowerCase().includes(h)||v.description?.toLowerCase().includes(h));}if(a.dateFilter!=="all"){let h=new Date,v=h.getFullYear(),m=String(h.getMonth()+1).padStart(2,"0"),k=String(h.getDate()).padStart(2,"0"),w=`${v}-${m}-${k}`;g=g.filter(y=>{if(!y.endDate&&!y.dueDate)return false;let C=y.endDate||y.dueDate;if(!C)return false;let T;if(typeof C=="string")T=C.split("T")[0]||C;else {let R=C.getUTCFullYear(),E=String(C.getUTCMonth()+1).padStart(2,"0"),O=String(C.getUTCDate()).padStart(2,"0");T=`${R}-${E}-${O}`;}switch(a.dateFilter){case "overdue":return T<w;case "today":return T===w;case "this-week":let R=new Date(w+"T00:00:00"),E=new Date(T+"T00:00:00"),O=new Date(R);return O.setDate(O.getDate()+7),E>=R&&E<=O;case "custom":if(a.dateRange){let D=typeof C=="string"?new Date(C):C;return D>=a.dateRange.start&&D<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(g=g.filter(h=>h.priority&&a.priorities.includes(h.priority))),a.assignees.length>0&&(g=g.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(m=>a.assignees.includes(m)))),a.labels.length>0&&(g=g.filter(h=>h.labels&&h.labels.some(v=>a.labels.includes(v)))),a.columns.length>0&&(g=g.filter(h=>a.columns.includes(h.columnId))),o.by!=="none"&&g.sort((h,v)=>{let m=0;switch(o.by){case "created":let k=h.createdAt?new Date(h.createdAt).getTime():0,w=v.createdAt?new Date(v.createdAt).getTime():0;m=k-w;break;case "priority":let y={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=y[h.priority||"LOW"],T=y[v.priority||"LOW"];m=C-T;break;case "dueDate":let R=h.endDate||h.dueDate,E=v.endDate||v.dueDate;if(!R)return 1;if(!E)return -1;let O=typeof R=="string"?new Date(R).getTime():R.getTime(),D=typeof E=="string"?new Date(E).getTime():E.getTime();m=O-D;break;case "title":m=h.title.localeCompare(v.title);break;case "estimate":let S=h.estimatedTime||0,I=v.estimatedTime||0;m=S-I;break;default:m=0;}return o.order==="asc"?m:-m}),g},[a,o]);return {filters:a,sort:o,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:f,applyFilters:x,hasActiveFilters:p}}var Ec,Rc;if(typeof window<"u")try{let e=$a("ai");Ec=e.generateObject,Rc=e.generateText;}catch{}function Pc(e={}){let[t,r]=useState(false),[a,n]=useState(null),o=!!(Ec&&Rc&&e.apiKey),s=useCallback(async d=>{if(!o)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(f){let p=f instanceof Error?f:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[o]),l=useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(f){let p=f instanceof Error?f:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[o]),c=useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(f){let p=f instanceof Error?f:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[o]),i=useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(f){let p=f instanceof Error?f:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[o]),u=useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(f){let p=f instanceof Error?f:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:o,isLoading:t,error:a}}function ks(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function Ic(e){let{cards:t}=e,[r,a]=ks(),n=useCallback(d=>r.selectedCardIds.includes(d),[r.selectedCardIds]),o=useCallback((d,f)=>{if(!f){a({selectedCardIds:[d],lastSelectedCardId:d});return}let p=f.ctrlKey||f.metaKey,x=f.shiftKey;if(p)r.selectedCardIds.includes(d)?a({selectedCardIds:r.selectedCardIds.filter(b=>b!==d),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});else if(x&&r.lastSelectedCardId){let b=t.find(h=>h.id===d),g=t.find(h=>h.id===r.lastSelectedCardId);if(b&&g&&b.columnId===g.columnId){let h=t.filter(T=>T.columnId===b.columnId).sort((T,R)=>T.position-R.position),v=h.findIndex(T=>T.id===r.lastSelectedCardId),m=h.findIndex(T=>T.id===d),[k,w]=v<m?[v,m]:[m,v],y=h.slice(k,w+1).map(T=>T.id),C=Array.from(new Set([...r.selectedCardIds,...y]));a({selectedCardIds:C,lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});},[t,r,a]),s=useCallback(d=>{a({selectedCardIds:r.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=useCallback(()=>{a({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(d=>{r.selectedCardIds.includes(d)?s(d):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});},[r,s,a]),u=useCallback(()=>t.filter(d=>r.selectedCardIds.includes(d.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:o,deselectCard:s,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Mc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Lc(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Mc,...r}),[r]),[o,s]=useState([]),l=useCallback((b,g,h,v,m)=>{if(g.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:g,columnId:h,strategy:v,color:m,isExpanded:true,position:o.filter(w=>w.columnId===h).length,createdAt:new Date};s(w=>[...w,k]);},[n.minCardsPerStack,o]),c=useCallback(b=>{s(g=>g.filter(h=>h.id!==b));},[]),i=useCallback(b=>{s(g=>g.map(h=>h.id===b?{...h,isExpanded:!h.isExpanded}:h));},[]),u=useCallback((b,g)=>{s(h=>h.map(v=>v.id===b&&!v.cardIds.includes(g)?{...v,cardIds:[...v.cardIds,g]}:v));},[]),d=useCallback((b,g)=>{s(h=>h.map(v=>{if(v.id===b){let m=v.cardIds.filter(k=>k!==g);return m.length<n.minCardsPerStack?null:{...v,cardIds:m}}return v}).filter(v=>v!==null));},[n.minCardsPerStack]),f=useCallback(b=>o.filter(g=>g.columnId===b).sort((g,h)=>g.position-h.position),[o]),p=useCallback(async b=>{let g=t.filter(w=>w.columnId===b);if(g.length<n.minCardsPerStack*2)return [];let h=[],v=new Map;g.forEach(w=>{w.labels&&w.labels.length>0&&w.labels.forEach(y=>{v.has(y)||v.set(y,[]),v.get(y).push(w);});}),v.forEach((w,y)=>{w.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${y}`,cardIds:w.map(C=>C.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${w.length} cards with label "${y}"`,confidence:.85});});let m=new Map;g.forEach(w=>{w.assignedUserIds&&w.assignedUserIds.length>0&&w.assignedUserIds.forEach(y=>{m.has(y)||m.set(y,[]),m.get(y).push(w);});}),m.forEach((w,y)=>{w.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${y.slice(-4)}`,cardIds:w.map(C=>C.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${w.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(w=>{w.priority&&(k.has(w.priority)||k.set(w.priority,[]),k.get(w.priority).push(w));}),k.forEach((w,y)=>{if(w.length>=n.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[y.toLowerCase()]||"\u26AA";h.push({stack:{title:`${C} ${y} Priority`,cardIds:w.map(T=>T.id),columnId:b,strategy:"priority",color:y==="high"||y==="urgent"?"#ef4444":"#10b981"},reason:`${w.length} cards with ${y} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let w of g){let C=(await a.findSimilar(w,g)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(C.length>=n.minCardsPerStack-1){let T=[w.id,...C.map(E=>E.card.id)],R=C.reduce((E,O)=>E+O.similarity,0)/C.length;h.push({stack:{title:`\u2728 Similar to "${w.title.substring(0,30)}${w.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:R});}}return h.filter(w=>w.confidence>=n.autoStackConfidenceThreshold).sort((w,y)=>y.confidence-w.confidence).slice(0,5)},[t,n,a]),x=useCallback(b=>{l(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let h=await p(g),v=h[0];h.length>0&&v&&v.confidence>=.9&&x(v);});},[]),{stacks:o,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:f,getSuggestions:p,applySuggestion:x,config:n}}var Ac=createContext(null);function Bc({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let o=new Map,s=new Map;t?.columns?.forEach(c=>{let{Column:i}=$a("@libxai/core");o.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=$a("@libxai/core");s.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=$a("@libxai/core");l=new c(t.board);}a.current=new BoardStore({board:l,columns:o,cards:s});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsx(Ac.Provider,{value:{store:n},children:e})}function Hn(){let e=useContext(Ac);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ga(){let e=Hn(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[o,s]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),s(e.getAllCards());}),[e]);let l=useCallback(v=>{e.updateBoard(v);},[e]),c=useCallback(v=>{e.addColumn(v);},[e]),i=useCallback((v,m)=>{e.updateColumn(v,m);},[e]),u=useCallback(v=>{e.deleteColumn(v);},[e]),d=useCallback(v=>e.getColumn(v),[e]),f=useCallback(v=>{e.addCard(v);},[e]),p=useCallback((v,m)=>{e.updateCard(v,m);},[e]),x=useCallback(v=>{e.deleteCard(v);},[e]),b=useCallback((v,m,k)=>{e.moveCard(v,m,k);},[e]),g=useCallback(v=>e.getCard(v),[e]),h=useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:a,cards:o,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:f,updateCard:p,deleteCard:x,moveCard:b,getCard:g,getCardsByColumn:h}}function Oc(e){let{cards:t}=Ga();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function zc(e="position",t="asc"){let{cards:r}=Ga();return useMemo(()=>[...r].sort((n,o)=>{let s=0;switch(e){case "title":s=n.title.localeCompare(o.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=o.priority?l[o.priority]:0;s=c-i;break}case "createdAt":s=n.createdAt.getTime()-o.createdAt.getTime();break;case "updatedAt":s=n.updatedAt.getTime()-o.updatedAt.getTime();break;case "position":s=n.position-o.position;break}return t==="asc"?s:-s}),[r,e,t])}var Un=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vs.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];if(typeof s=="function")try{let l=await Promise.resolve(s.apply(o,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let o=n[t];typeof o=="function"&&a.push(Promise.resolve(o.apply(n,r)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,s,{plugin:n.id,hook:t});}));}await Promise.all(a);}},ig=new Un;function Uc({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:s=false,gap:l=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:l}),d=u.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:f,className:n,children:jsx("div",{style:p,children:d.map(x=>{let b=e[x.index];if(!b)return null;let g=c?c(b,x.index):x.index,h={position:"absolute",top:s?0:x.start,left:s?x.start:0,width:s?x.size:"100%",height:s?"100%":x.size};return jsx("div",{style:h,"data-index":x.index,children:a(b,x.index)},g)})})})}function Gc(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function $c({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:s=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:s,gap:l}),f=d.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},x={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:p,className:o,children:jsx("div",{style:x,children:f.map(b=>{let g=e[b.index];if(!g)return null;let h=c?c(g,b.index):b.index,v={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:v,"data-index":b.index,children:n(g,b.index)},h)})})})}function Wc(e){let t=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 Vc(e,t=10){return e>t}var Ss={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ns={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ds={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Es={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Rs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ps={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Is={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ms={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)"},Ls={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)"},As={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Bs={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Fs={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}},Gn={spacing:Ss,borderRadius:Ns,fontSize:Ds,fontWeight:Es,lineHeight:Rs,zIndex:Ps,duration:Is,easing:Ms,shadows:Ls,opacity:As,kanban:Bs,gantt:Fs};function Kc(e,t,r){return e[t]??r}function Os(e,t="",r={}){for(let[a,n]of Object.entries(e)){let o=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?Os(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function dg(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zs(e="asakaa"){let t=Os(Gn),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,s=dg(n);r.push(` ${o}: ${s};`);}return `:root {
49
+ ${r.join(`
50
+ `)}
51
+ }`}function _a(e,t="asakaa"){let r=[],a=Os(e);for(let[n,o]of Object.entries(a)){let s=`--${t}-color-${n}`;r.push(` ${s}: ${o};`);}return `:root {
52
+ ${r.join(`
53
+ `)}
54
+ }`}var _n={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:"#8b5cf6",dependency:"#6b7280",weekend:"#2a2a2a"}},Hs={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:"#8b5cf6",dependency:"#6b7280",weekend:"#f9fafb"}},Us={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#8b5cf6",dependency:"#71717a",weekend:"#27272a"}};function Gs(e=_n,t="asakaa"){let r=zs(t),a=_a(e,t);return `${r}
55
+
56
+ ${a}`}function jc(){return `/**
57
+ * ASAKAA Design Tokens
58
+ * Auto-generated from design-tokens.ts
59
+ * Do not edit this file directly
60
+ */
61
+
62
+ ${Gs(_n)}
63
+
64
+ /* Light theme */
65
+ [data-theme="light"] {
66
+ ${_a(Hs,"asakaa").split(`
67
+ `).slice(1,-1).join(`
68
+ `)}
69
+ }
70
+
71
+ /* Neutral theme */
72
+ [data-theme="neutral"] {
73
+ ${_a(Us,"asakaa").split(`
74
+ `).slice(1,-1).join(`
75
+ `)}
76
+ }
77
+ `}var ug=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children: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 jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),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 jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Yc({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:o}=ca();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(o).map(([s,l])=>{let c=s,i=c===a;return jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(ug,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
78
+ export{bc as AIUsageDashboard,$f as AI_FEATURES,bs as AI_MODELS,Pa as AttachmentUploader,Bc as BoardProvider,xn as BulkOperationsToolbar,Lo as BurnDownChart,sr as Card,Eo as CardDetailModal,Po as CardDetailModalV2,cc as CardHistoryReplay,ic as CardHistoryTimeline,pc as CardRelationshipsGraph,Af as CardStack,Uo as CardTemplateSelector,Kn as CircuitBreaker,aa as Column,Nn as ColumnManager,No as CommandPalette,Wo as ConfigMenu,ua as ContextMenu,Ia as DEFAULT_SHORTCUTS,Ho as DEFAULT_TEMPLATES,vo as DateRangePicker,yo as DependenciesSelector,Pn as DependencyLine,Ao as DistributionCharts,ko as EditableColumnTitle,oa as ErrorBoundary,_o as ExportImportModal,$o as FilterBar,ql as GanttBoard,Mn as GanttMilestone,Sn as GanttToolbar,kc as GenerateGanttTasksDialog,gc as GeneratePlanModal,Oo as GroupBySelector,yr as KanbanBoard,Ea as KanbanViewAdapter,zo as KeyboardShortcutsHelp,Rt as MenuIcons,Un as PluginManager,ho as PrioritySelector,_f as RATE_LIMITS,Bo as SwimlaneBoardView,En as TaskBar,tc as TaskFormModal,Dn as TaskGrid,Yo as ThemeModal,Sl as ThemeProvider,Yc as ThemeSwitcher,Ln as Timeline,bo as UserAssignmentSelector,Mo as VelocityChart,$c as VirtualGrid,Uc as VirtualList,$r as aiUsageTracker,Ns as borderRadius,Va as calculatePosition,Bn as cardToGanttTask,ac as cardsToGanttTasks,te as cn,il as createKanbanView,od as createRetryWrapper,Vo as darkTheme,_n as darkTokenTheme,wn as defaultTheme,Gn as designTokens,Is as duration,Ms as easing,jc as exportTokensToCSS,Ds as fontSize,Es as fontWeight,za as formatCost,rc as ganttTaskToCardUpdate,me as ganttThemes,Fs as ganttTokens,X as ganttUtils,zs as generateCSSVariables,Gs as generateCompleteCSS,td as generateInitialPositions,_a as generateThemeVariables,Kc as getToken,Bs as kanbanTokens,Ko as lightTheme,Hs as lightTokenTheme,Rs as lineHeight,jo as neutralTheme,Us as neutralTokenTheme,As as opacity,ig as pluginManager,nd as retrySyncOperation,Ka as retryWithBackoff,Ls as shadows,Vc as shouldVirtualizeGrid,Ss as spacing,zr as themes,Pc as useAI,Cc as useBoard,Ga as useBoardCore,Hn as useBoardStore,Lc as useCardStacking,Co as useDragState,Oc as useFilteredCards,Nc as useFilters,zn as useKanbanState,wl as useKeyboardShortcuts,Ic as useMultiSelect,ks as useSelectionState,zc as useSortedCards,ca as useTheme,Wc as useVirtualGrid,Gc as useVirtualList,To as withErrorBoundary,Ps as zIndex};//# sourceMappingURL=index.js.map
79
+ //# sourceMappingURL=index.js.map