@libxai/board 1.9.27 → 1.9.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Fb=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Fb__default=/*#__PURE__*/_interopDefault(Fb);var yi=(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 xi=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 [xi.Translate.toString(e),xi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function vi(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 Db(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function Zl(e,t){return e.length===0?1e3:t===0?vi(null,e[0].position):t>=e.length?vi(e[e.length-1].position,null):vi(e[t-1].position,e[t].position)}function Iu(e,t=100){return e>t}var Sb=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 Eb(e,t,r,a){let n=t*Math.pow(r,e-1),s=n*.2*Math.random();return Math.min(n+s,a)}async function wi(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Sb,onRetry:l}=t,c,i=0;for(let d=1;d<=r;d++){i=d;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(c=m,d===r||!o(c,d))return {error:c,attempts:i,success:false};let p=Eb(d,a,n,s);if(l)try{l(c,d,p);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,p));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Mb(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 Pb(e,t={}){return async(...r)=>wi(()=>e(...r),t)}var ec=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 Ru=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(Ru||{}),wo=class wo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:s,...o}=t,l=`[${r}] [${a}] [${s}]`,c=Object.keys(o).length>0;switch(a){case "DEBUG":console.debug(l,n,c?o:"");break;case "INFO":console.info(l,n,c?o:"");break;case "WARN":console.warn(l,n,c?o:"");break;case "ERROR":console.error(l,n,c?o:""),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",...wo.globalOptions};}static configure(t){wo.globalOptions={...wo.globalOptions,...t};}child(t){return new wo({...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 ki((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new ki(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Ru[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};wo.globalOptions={};var tc=wo,ki=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}},Bu=new tc;function Lb(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 Ab(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(s=>{let o=e.columns.find(l=>l.id===s.columnId);return [s.id,rc(s.title),rc(s.description||""),rc(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [r.join(","),...a.map(s=>s.join(","))].join(`
2
- `)}async function Ib(e,t,r){let a=t;if(!a){let o=document.querySelector(".asakaa-board");o&&(a=o.parentElement||o);}if(a)try{let o=await Fb__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),l=o.toDataURL("image/png"),c=297,i=210,d=o.width/o.height,m=c-20,u=m/d;u>i-20&&(u=i-20,m=u*d);let p=new jspdf.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 f=(c-m)/2;return p.addImage(l,"PNG",f,20,m,u),p}catch(o){console.error("Error capturing board:",o);}let n=new jspdf.jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(c=>c.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,s),s+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let d=n.splitTextToSize(c.description,160);n.text(d,25,s),s+=d.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 d=[];c.startDate&&d.push(`Start: ${c.startDate}`),c.endDate&&d.push(`End: ${c.endDate}`),i.push(d.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function rc(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Ou(e,t,r,a){switch(t){case "json":return Lb(e,a);case "csv":return Ab(e);case "pdf":return await Ib(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Hu(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${a}.pdf`;e.save(d);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Rb(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 Bb(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=Uu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Uu(t[o]||"");if(l.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${l.length})`);continue}for(;l.length<r.length;)l.push("");let i={};r.forEach((p,f)=>{i[p]=l[f]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let m=n.get(d),u={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.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(u),m.cardIds.push(u.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Uu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Wu(e,t){switch(t){case "json":return Rb(e);case "csv":return Bb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function zu(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);})}var ac=react.createContext(null);function Gu(){return react.useContext(ac)}var Vu=react.createContext(null);function ju({children:e,themeName:t}){return jsxRuntime.jsx(Vu.Provider,{value:{themeName:t},children:e})}function Ci(){return react.useContext(Vu)}function or({children:e,container:t}){let[r,a]=react.useState(false),n=Gu(),s=Ci();if(react.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):reactDom.createPortal(e,o)}var Xu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Vb="#BDC3C7",jb=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function ko({priority:e,onChange:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let p=c.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,h=160,b=220,y=4,v=p.right-h;v<10&&(v=p.left),v+h>x-10&&(v=x-h-10);let w=f-p.bottom,k=p.top,M;w>=b+y?M=p.bottom+y:k>=b+y?M=p.top-b-y:M=w>=k?p.bottom+y:Math.max(10,p.top-b-y),o({top:M,left:v}),n(true);};react.useEffect(()=>{let p=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),react.useEffect(()=>{let p=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let d=p=>{t(p),n(false);},m=e?Xu[e]:null,u=m?.color||Vb;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:m?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Xu).map(([p,f])=>jsxRuntime.jsxs("button",{onClick:()=>d(p),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:f.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:[jsxRuntime.jsx(jb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>d(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:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var _b=[{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 Ms({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=react.useState(false),[o,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=(Ci()?.themeName||"dark")==="dark",p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,B=380,T=4,C=v.left;C+M>k-10&&(C=k-M-10),C<10&&(C=10);let P=w-v.bottom,D=v.top,V;P>=B+T?V=v.bottom+T:D>=B+T?V=v.top-B-T:V=P>=D?v.bottom+T:Math.max(10,v.top-B-T),l({top:V,left:C}),s(true);};react.useEffect(()=>{let v=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),react.useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,k=C=>{let P=C.getFullYear(),D=String(C.getMonth()+1).padStart(2,"0"),V=String(C.getDate()).padStart(2,"0");return `${P}-${D}-${V}`},M=k(w),B=new Date(w);B.setDate(B.getDate()+v);let T=k(B);r(M,T),s(false);},x=()=>{if(!e||!t)return "Set date";let v=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=B.split("-").map(Number);if(T.length!==3||T.some(V=>isNaN(V)))return null;let C=T[0],P=T[1],D=T[2];return C===void 0||P===void 0||D===void 0?null:new Date(C,P-1,D)},w=v(e),k=v(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=e&&t,y=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):p(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:u?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:_b.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function To({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[l,c]=react.useState(""),[i,d]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),p=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,k=300,M=380,B=4,T=y.right-k;T<10&&(T=y.left),T+k>w-10&&(T=w-k-10);let C=v-y.bottom,P=y.top,D;C>=M+B?D=y.bottom+B:P>=M+B?D=y.top-M-B:D=C>=P?y.bottom+B:Math.max(10,y.top-M-B),d({top:D,left:T}),o(true);};react.useEffect(()=>{let y=v=>{m.current&&!m.current.contains(v.target)&&!u.current?.contains(v.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let v=e.some(w=>w.id===y.id);r(v?e.filter(w=>w.id!==y.id):[...e,y]);},x=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?o(false):p(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:m,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(y=>{let v=e.some(w=>w.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>f(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),o(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 Ti(e,t,r){let a=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(d=>{if(typeof d=="string")return d;let m=d;return m.taskId||m.targetId||""}).filter(Boolean);a.set(c.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=a.get(c)||[];for(let d of i){if(!s.has(d)&&l(d))return true;if(o.has(d))return true}}return o.delete(c),false};return l(r)}function Fs({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(t.length>0),[p,f]=react.useState({top:0,left:0}),[x,h]=react.useState(null),b=react.useRef(null),y=react.useRef(null),v=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),C=window.innerHeight,P=window.innerWidth,D=300,V=m?380:120,$=4,ee=T.right-D;ee<10&&(ee=T.left),ee+D>P-10&&(ee=P-D-10);let L=C-T.bottom,Le=T.top,W;L>=V+$?W=T.bottom+$:Le>=V+$?W=T.top-V-$:W=L>=Le?T.bottom+$:Math.max(10,T.top-V-$),f({top:W,left:ee}),c(true);};react.useEffect(()=>{if(!l||!y.current)return;let T=y.current.getBoundingClientRect(),C=window.innerHeight,P=window.innerWidth,D=300,V=m?380:120,$=4,ee=T.right-D;ee<10&&(ee=T.left),ee+D>P-10&&(ee=P-D-10);let L=C-T.bottom,Le=T.top,W;L>=V+$?W=T.bottom+$:Le>=V+$?W=T.top-V-$:W=L>=Le?T.bottom+$:Math.max(10,T.top-V-$),f({top:W,left:ee});},[m,l]),react.useEffect(()=>{let T=C=>{b.current&&!b.current.contains(C.target)&&!y.current?.contains(C.target)&&(c(false),d(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{let T=C=>{C.key==="Escape"&&(c(false),d(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let w=T=>{let C=t.includes(T),P=r.find(D=>D.id===T);if(h(null),C){let D=t.filter(V=>V!==T);a(D),D.length===0&&u(false);}else {if(s&&Ti(r,T,e)){let V=`Cannot add "${P?.title||T}" as dependency - would create circular reference`;h(V),o?.(T,P?.title||T),setTimeout(()=>h(null),3e3);return}a([...t,T]),u(true);}},k=()=>{let T=!m;u(T),T||a([]);},M=r.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?c(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:B,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:B},children:t.length})]}),l&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:T=>d(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):M.map(T=>{let C=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:C?"#00E5CC":"transparent",borderColor:C?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:C&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),u(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var An=react.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:d,setNodeRef:m,transform:u,transition:p,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:xi.Transform.toString(u),transition:p};if(t)return jsxRuntime.jsx("div",{ref:m,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:m,style:v,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,k)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&y.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ko,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ms,{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:(w,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(To,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Fs,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsxRuntime.jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var Ni={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"}},sp=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function ip({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=react.useState(false),[o,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),d=[...Object.entries(Ni).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Ni).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let h=Ni[e];if(h)return {...h,id:e};let b=a.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Ni.todo,id:"todo"}},u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,v=180,w=280,k=4,M=h.right-v;M<10&&(M=h.left),M+v>y-10&&(M=y-v-10);let B=b-h.bottom,T=h.top,C;B>=w+k?C=h.bottom+k:T>=w+k?C=h.top-w-k:C=B>=T?h.bottom+k:Math.max(10,h.top-w-k),l({top:C,left:M}),s(true);};react.useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let p=h=>{t(h),s(false);},f=m(),x=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):u(),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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsxRuntime.jsx(sp,{icon:f.icon,color:x})}),n&&jsxRuntime.jsx(or,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(h=>jsxRuntime.jsxs("button",{onClick:()=>p(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(sp,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var lp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function cp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=lp[s]||lp.en,[l,c]=react.useState(false),[i,d]=react.useState(false),[m,u]=react.useState(e),[p,f]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),react.useEffect(()=>{let k=M=>{x.current&&!x.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),d(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),d(false),u(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{d(true),u(e);},v=()=>{let k=m.trim();k&&k!==e&&t(k),d(false),c(false),u(e);},w=k=>{k.key==="Enter"?v():k.key==="Escape"&&(d(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(or,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${p.top}px`,left:`${p.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:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:k=>u(k.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{r(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Yo=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:d,cardHeight:m=120,isCollapsed:u,onToggleCollapse:p,onColumnRename:f,onColumnDelete:x,isDeletable:h=false,className:b,renderMetrics:y,locale:v})=>{let{setNodeRef:w,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),M=react.useRef(null),B=d??Iu(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>m,enabled:B});if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),D=P.state==="exceeded",V=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g(V()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),P.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),P.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),P.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(cp,{columnTitle:e.title,onRename:$=>f?.(e.id,$),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),p&&jsxRuntime.jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!u&&jsxRuntime.jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:B?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map($=>$.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):B?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map($=>{let ee=t[$.index];return ee?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsxRuntime.jsx(An,{card:ee,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},ee.id):null})}):t.map($=>jsxRuntime.jsx(An,{card:$,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i},$.id))})})]})});Yo.displayName="Column";function lc({title:e,onSave:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.select());},[a]);let c=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?c():d.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:c,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ph(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function fp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),d=c.split(/\s+/);return !!(i===s||c===s||d.some(m=>m===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function mh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var fh=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function bp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:d=true,enableAttachments:m=true,pendingFiles:u=[],onFilesSelect:p,onRemoveFile:f,maxFileSizeMB:x=10}){let h=l==="dark",[b,y]=react.useState(false),[v,w]=react.useState([]),[k,M]=react.useState(0),[B,T]=react.useState(null),[C,P]=react.useState(false),D=react.useRef(null),V=react.useRef(null),$=react.useRef(null),ee=react.useRef(null),L=react.useCallback((J,De)=>{let se=ph(J,De);if(T(se),se){let He=a.filter(Se=>Se.name.toLowerCase().includes(se.query)||Se.email&&Se.email.toLowerCase().includes(se.query)).slice(0,5);w(He),y(He.length>0),M(0);}else y(false),w([]);},[a]),Le=J=>{let De=J.target.value;if(t(De),L(De,J.target.selectionStart||0),D.current){D.current.style.height="24px";let se=D.current.scrollHeight,He=280,Se=Math.min(se,He);D.current.style.height=`${Se}px`,D.current.style.overflowY=se>He?"auto":"hidden";}},W=()=>{D.current&&L(e,D.current.selectionStart||0);},Ce=react.useCallback(J=>{if(!B||!D.current)return;let De=e.slice(0,B.start),se=e.slice(B.end),He=`@${J.name.replace(/\s+/g,"")} `,Se=De+He+se;t(Se),y(false),T(null),setTimeout(()=>{if(D.current){let Pe=B.start+He.length;D.current.selectionStart=Pe,D.current.selectionEnd=Pe,D.current.focus();}},0);},[B,e,t]),I=J=>{if(b&&v.length>0)switch(J.key){case "ArrowDown":J.preventDefault(),M(De=>De<v.length-1?De+1:0);break;case "ArrowUp":J.preventDefault(),M(De=>De>0?De-1:v.length-1);break;case "Enter":{J.preventDefault();let De=v[k];De&&Ce(De);break}case "Tab":{J.preventDefault();let De=v[k];De&&Ce(De);break}case "Escape":J.preventDefault(),y(false);break}else J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),r());};react.useEffect(()=>{let J=De=>{V.current&&!V.current.contains(De.target)&&D.current&&!D.current.contains(De.target)&&y(false),ee.current&&!ee.current.contains(De.target)&&P(false);};return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[]);let z=react.useCallback(J=>{if(!D.current)return;let De=D.current.selectionStart||e.length,se=e.slice(0,De)+J+e.slice(De);t(se),P(false),setTimeout(()=>{if(D.current){let He=De+J.length;D.current.selectionStart=He,D.current.selectionEnd=He,D.current.focus();}},0);},[e,t]),Oe=react.useCallback(J=>{if(!p||!J.target.files)return;let De=Array.from(J.target.files),se=x*1024*1024,He=De.filter(Se=>Se.size>se?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);He.length>0&&p(He),J.target.value="";},[p,x]),We=react.useCallback(J=>J.type.startsWith("image/")?lucideReact.Image:J.type.includes("pdf")||J.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&V.current){let J=V.current.children[k];J&&J.scrollIntoView({block:"nearest"});}},[k,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(J=>{let De=We(J.file),se=J.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[se&&J.preview?jsxRuntime.jsx("img",{src:J.preview,alt:J.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(De,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:J.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:gh(J.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(J.id),className:g("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},J.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!C),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{ref:ee,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:fh.map(J=>jsxRuntime.jsx("button",{type:"button",onClick:()=>z(J),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:J},J))})})})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:Oe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:D,value:e,onChange:Le,onSelect:W,onKeyDown:I,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:r,disabled:o||!e.trim()&&u.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((J,De)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ce(J),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",De===k?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:J.color||"#8B5CF6"},children:mh(J.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:J.name}),J.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:J.email})]})]},J.id))})})]})]})]})}function hp({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Pi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Xo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[l,c]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(false),[p,f]=react.useState(Pi[10]||"#00E5CC"),[x,h]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),v=react.useRef(null),w=react.useRef(null),k=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),M=t.some(D=>D.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let D=y.current.getBoundingClientRect();h({top:D.bottom+6,left:D.left});}},[l]),react.useEffect(()=>{let D=V=>{let $=V.target,ee=b.current?.contains($),L=v.current?.contains($);!ee&&!L&&(c(false),d(""),u(false));};if(l)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let B=D=>{let V=e.some($=>$.id===D.id);r(V?e.filter($=>$.id!==D.id):[...e,D]);},T=async()=>{if(!(!a||!i.trim())){u(true);try{let D=await a(i.trim(),p);D&&(r([...e,D]),d(""),f(Pi[Math.floor(Math.random()*Pi.length)]||"#00E5CC"));}finally{u(false);}}},C=(D,V)=>{V.stopPropagation(),r(e.filter($=>$.id!==D));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:D=>d(D.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:D=>{D.key==="Enter"&&i.trim()&&!M&&a&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${D.color}20`,color:D.color},onClick:V=>C(D.id,V),children:[D.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},D.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(D=>{let V=e.some($=>$.id===D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${D.color}15`:"transparent",color:n.textPrimary},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:$=>{V||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:D.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&a&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Pi.map(D=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:p===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:p,color:"#FFFFFF",opacity:m?.7:1},children:[m?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function dc({tag:e,onRemove:t,size:r="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function xp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsxRuntime.jsx(dc,{tag:s,size:r},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var Do=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function vp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function Th(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Nh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function uc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Th(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=vp(e.loggedMinutes),i=e.estimateMinutes?vp(e.estimateMinutes):null,d=r&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(a?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsxRuntime.jsx(Nh,{className:l[t]}),jsxRuntime.jsx("span",{children:d})]})}function Dh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Li(e){let t=Dh(e);return t!==null?String(t):e}function kp(e){let r=Li(e).trim().toLowerCase();if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Ai(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Mh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function Ph({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Fh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Cp({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Lh({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function pc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:d,className:m}){let[u,p]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?Ai(t.estimateMinutes):""),[h,b]=react.useState(""),[y,v]=react.useState(false),[w,k]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{M.current?.focus();},[]);let B=async()=>{let P=kp(u);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),p(""),b("");}finally{v(false);}}},T=async()=>{if(!o)return;let P=f.trim()?kp(f):null;await o(P),k(false);},C=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),B()),P.key==="Escape"&&d?.();};return jsxRuntime.jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",m),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Cp,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Mh(n)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Fh,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Cp,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Ph,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Lh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:M,type:"text",value:u,onChange:P=>p(P.target.value),onKeyDown:C,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:B,disabled:y||!u.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:P=>b(P.target.value),onKeyDown:C,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ai(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&T(),P.key==="Escape"&&k(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ai(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Ai(P.durationMinutes)})]},P.id))})]})]})}function $h(e){let r=Li(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Oh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function wn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[l,c]=react.useState(Oh(a)),[i,d]=react.useState(""),[m,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{p.current?.focus();},[]);let f=async()=>{u(true);let v=$h(l);await n(v&&v>0?v:null,i||void 0),u(false);},x=async()=>{u(true),await n(null),u(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxRuntime.jsxs("div",{className:g("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:p,type:"text",value:l,onChange:v=>c(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:m||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:m?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Hh(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Uh(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function gc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Hh(e.health),s=Uh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsxRuntime.jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsxRuntime.jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Jo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function zh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Gh(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Vh(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function jh({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",l=r?"text-[#9CA3AF]":"text-gray-500",c=r?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",Jo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:Jo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:Jo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function _h({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",l=r?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:g("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Jo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Jo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":l),children:[n,Jo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Gh(e.status,r),zh(e.status,r)),children:Vh(e.status,t)})})]})}function fc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",u=o?"bg-[#050505]/50":"bg-gray-50",p=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",l,n),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:g("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",m),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(jh,{summary:e.summary,locale:r,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:u,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:p.map(f=>jsxRuntime.jsx(_h,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",m),children:r==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Qo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function sy(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Ap(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function iy(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function So({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:u,availableTasks:p=[],comments:f=[],onAddComment:x,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:B=0,onTimeLog:T,onEstimateUpdate:C,onSoldEffortUpdate:P,onTimerStart:D,onTimerStop:V,onTimerDiscard:$,blurFinancials:ee=false}){let L=s==="dark",Le={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},W=e&&"title"in e&&!("name"in e),Ce=e,[I,z]=react.useState(e?Ap(e,l):null),[Oe,We]=react.useState(false),[J,De]=react.useState(false),[se,He]=react.useState(false),[Se,Pe]=react.useState(null),[ze,Ze]=react.useState(new Date),[le,tt]=react.useState(false),[je,$e]=react.useState(false),[bt,mt]=react.useState(""),[Ve,Ie]=react.useState(false),[dt,zt]=react.useState(false),[Fe,nt]=react.useState(false),[F,X]=react.useState(false),[R,Y]=react.useState(""),de=react.useRef(null),he=react.useRef(null),[Be,j]=react.useState(""),ye=react.useRef(null),[Ae,Ue]=react.useState(""),[kt,Ye]=react.useState(false),[Nt,gt]=react.useState([]),[Jt,vr]=react.useState(""),[Mr,Rt]=react.useState(false),Hr=react.useRef(null);react.useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let N=Ap(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:N?.id,taskName:N?.name,soldEffortMinutes:N?.soldEffortMinutes,quotedMinutes:N?.quotedMinutes,effortMinutes:N?.effortMinutes,timeLoggedMinutes:N?.timeLoggedMinutes}),z(N),Y(N.description||""),j(N.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!R)return;let N=setTimeout(()=>{let H=he.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(N)},[t,R]),react.useEffect(()=>()=>{de.current&&clearTimeout(de.current),ye.current&&clearTimeout(ye.current);},[]),react.useEffect(()=>{t&&Hr.current&&f.length>0&&setTimeout(()=>{Hr.current&&(Hr.current.scrollTop=Hr.current.scrollHeight);},100);},[t,f.length]);let $t=react.useCallback(N=>{z(N),W&&n&&Ce?n(iy(N,Ce)):a&&a(N);},[W,Ce,n,a]),wr=react.useCallback(()=>{We(false),De(false),He(false),Pe(null),$e(false),mt(""),Ie(false);},[]),Gt=react.useCallback((N,H)=>{if(!I)return;let me={...I,[N]:H};$t(me);},[I,$t]),Qt=react.useCallback(()=>{let N=he.current;N&&(N.style.height="auto",N.style.height=`${Math.max(100,N.scrollHeight)}px`);},[]),Vr=react.useCallback(N=>{Y(N),setTimeout(Qt,0),de.current&&clearTimeout(de.current),de.current=setTimeout(()=>{if(I){let H={...I,description:N};$t(H);}},800);},[I,$t,Qt]),wa=react.useCallback(N=>{j(N),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>{if(I&&N.trim()){let H={...I,name:N.trim()};$t(H);}},800);},[I,$t]),et=react.useCallback(N=>{let H=N.map(me=>{let K={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:me};return me.type.startsWith("image/")&&(K.preview=URL.createObjectURL(me)),K});gt(me=>[...me,...H]);},[]),_e=react.useCallback(N=>{gt(H=>{let me=H.find(K=>K.id===N);return me?.preview&&URL.revokeObjectURL(me.preview),H.filter(K=>K.id!==N)});},[]),fa=react.useCallback(async()=>{if(!(!I||!Ae.trim()&&Nt.length===0||!x)){Ye(true);try{let N=fp(Ae,b),H=[];if(Nt.length>0&&y){let me=Nt.map(K=>K.file);H=await y(me);}await x(I.id,Ae.trim(),N.length>0?N:void 0,H.length>0?H:void 0),Ue(""),Nt.forEach(me=>{me.preview&&URL.revokeObjectURL(me.preview);}),gt([]);}finally{Ye(false);}}},[I,Ae,Nt,x,b,y]),jr=react.useCallback(()=>{if(!I||!Jt.trim())return;let N=I.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:N.length},me=[...N,H],K={...I,subtasks:me};$t(K),vr(""),Rt(false);},[I,Jt,$t]),Zr=react.useCallback(N=>{if(!I?.subtasks)return;let H=I.subtasks.map(K=>K.id===N?{...K,progress:K.progress===100?0:100}:K),me={...I,subtasks:H};$t(me);},[I,$t]),lr=react.useCallback(N=>{if(!I?.subtasks)return;let H=I.subtasks.filter(K=>K.id!==N),me={...I,subtasks:H};$t(me);},[I,$t]),Ba=react.useCallback(N=>{let H=typeof N=="string"?new Date(N):N,K=new Date().getTime()-H.getTime(),we=Math.floor(K/6e4),ot=Math.floor(K/36e5),ae=Math.floor(K/864e5);return we<1?o==="es"?"Ahora":"Just now":we<60?o==="es"?`Hace ${we} min`:`${we}m ago`:ot<24?o==="es"?`Hace ${ot}h`:`${ot}h ago`:ae<7?o==="es"?`Hace ${ae}d`:`${ae}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ne=react.useCallback(N=>{if(!I)return;let H=I.progress||0;N==="completed"?H=100:N==="in-progress"&&H===0?H=10:N==="todo"&&(H=0);let me={...I,status:N,progress:H};$t(me),We(false);},[I,$t]),ue=react.useCallback((N,H)=>{if(!I)return;let me={...I,startDate:N,endDate:H};$t(me);},[I,$t]),ft=react.useCallback(()=>{let N=ze.getFullYear(),H=ze.getMonth(),me=new Date(N,H,1),we=new Date(N,H+1,0).getDate(),ot=me.getDay(),ae=[],lt=new Date(N,H,0).getDate();for(let Bt=ot-1;Bt>=0;Bt--)ae.push({date:new Date(N,H-1,lt-Bt),isCurrentMonth:false});for(let Bt=1;Bt<=we;Bt++)ae.push({date:new Date(N,H,Bt),isCurrentMonth:true});let st=42-ae.length;for(let Bt=1;Bt<=st;Bt++)ae.push({date:new Date(N,H+1,Bt),isCurrentMonth:false});return ae},[ze]),_=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),nt(false),!I||!m)return;let H=Array.from(N.dataTransfer.files);if(H.length!==0){X(true);try{await m(I.id,H);}finally{X(false);}}},[I,m]),fe=react.useCallback(async N=>{if(!I||!m||!N.target.files)return;let H=Array.from(N.target.files);if(H.length!==0){X(true);try{await m(I.id,H);}finally{X(false);}N.target.value="";}},[I,m]),Z=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),nt(true);},[]),O=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),nt(false);},[]),re=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),ve=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!I?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:I.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=I.progress===100?0:100,me={...I,progress:N,status:N===100?"completed":"todo"};$t(me);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",I.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Be,onChange:N=>wa(N.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",I.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{wr(),We(!Oe);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",I.progress===100||I.status==="completed"?"bg-green-500/20 text-green-400":I.progress&&I.progress>0||I.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.progress===100||I.status==="completed"?o==="es"?"COMPLETADO":"DONE":I.progress&&I.progress>0||I.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>ne(N.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",I.status===N.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{wr(),He(!se);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[I.assignees&&I.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[I.assignees.slice(0,3).map((N,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},H)),I.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",I.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(N=>{let H=I.assignees?.some(me=>me.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let me=I.assignees||[],K;H?K=me.filter(we=>we.name!==N.name):K=[...me,N],Gt("assignees",K);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",H&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:N.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Pe(Se?null:"start"),Ze(I.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[I.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:g("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),I.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,H=new Date(N);H.setDate(N.getDate()+1);let me=new Date(N);me.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let K=new Date(N);K.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let we=new Date(N);we.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let ot=new Date(N);ot.setDate(N.getDate()+14);let ae=new Date(N);return ae.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:me,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:K,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:we,display:we.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:ot,display:ot.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((st,Bt)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let gr=I.endDate&&st.date>I.endDate?st.date:I.endDate;ue(st.date,gr),Pe("end");}else {let gr=I.startDate&&st.date<I.startDate?st.date:I.startDate;ue(gr,st.date),Pe(null);}},children:[jsxRuntime.jsx("span",{children:st.label}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:st.display})]},Bt))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{ue(void 0,void 0),Pe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",L?"text-white":"text-gray-900"),children:ze.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>Ze(new Date),className:g("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ze(new Date(ze.getFullYear(),ze.getMonth()-1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>Ze(new Date(ze.getFullYear(),ze.getMonth()+1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ft().map((N,H)=>{let me=N.date.toDateString()===new Date().toDateString(),K=I.startDate?.toDateString()===N.date.toDateString(),we=I.endDate?.toDateString()===N.date.toDateString(),ot=K||we,ae=I.startDate&&I.endDate&&N.date>=I.startDate&&N.date<=I.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let lt=new Date(N.date);if(Se==="start"){let st=I.endDate&&lt>I.endDate?lt:I.endDate;ue(lt,st),Pe("end");}else {let st=I.startDate&&lt<I.startDate?lt:I.startDate;ue(st,lt),Pe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(L?"text-white":"text-gray-900"),me&&"ring-2 ring-[#00E5CC]",K&&"bg-[#00E5CC] text-white",we&&!K&&"bg-[#7C3AED] text-white",ae&&!ot&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!ot&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},H)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{wr(),De(!J);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",I.priority==="high"||I.priority==="urgent"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":I.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.priority?I.priority==="high"||I.priority==="urgent"?o==="es"?"Alta":"High":I.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>De(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{Gt("priority",N.id),De(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",I.priority===N.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:I.startDate&&I.endDate?`${Math.ceil((I.endDate.getTime()-I.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[le?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:I.progress||0,onChange:N=>{let H=parseInt(N.target.value),me=I.status;H===100?me="completed":H>0?me="in-progress":me="todo";let K={...I,progress:H,status:me};$t(K);},onBlur:()=>tt(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>tt(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",I.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${I.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[I.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Qo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("estimate"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Qo(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("estimate"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="estimate"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async N=>{await C?.(I.id,N),zt(false);},onClose:()=>zt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:ee?jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:I.quotedMinutes?Qo(I.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):I.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("quoted"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Qo(I.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("quoted"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="quoted"&&!ee&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"quoted",locale:o,isDark:L,currentValue:I.quotedMinutes||null,onSave:async N=>{P?(await P(I.id,N),z(H=>H?{...H,quotedMinutes:N}:null)):Gt("quotedMinutes",N),zt(false);},onClose:()=>zt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[I.status==="completed"||I.progress===100?jsxRuntime.jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxRuntime.jsxs("button",{type:"button",onClick:()=>V?.(I.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),sy(B||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>D?.(I.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),I.status==="completed"||I.progress===100?jsxRuntime.jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>zt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[Qo(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",Qo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="log"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(N,H)=>{N&&await T?.(I.id,{durationMinutes:N,note:H,source:"manual"}),zt(false);},onClose:()=>zt(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Xo,{selectedTags:I.tags||[],availableTags:c,onChange:N=>{Gt("tags",N);},onCreateTag:i,theme:Le})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[I.dependencies&&I.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:I.dependencies.map(N=>{let H=p.find(me=>me.id===N);return jsxRuntime.jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[H?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let me=(I.dependencies||[]).filter(K=>K!==N);Gt("dependencies",me);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{wr(),$e(!je);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),mt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:bt,onChange:N=>mt(N.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:p.length>0?p.filter(N=>N.id!==I.id).filter(N=>bt===""||N.name.toLowerCase().includes(bt.toLowerCase())).map(N=>{let H=I.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let me=I.dependencies||[],K;H?K=me.filter(we=>we!==N.id):K=[...me,N.id],Gt("dependencies",K);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",H&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:g("block truncate",L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{wr(),Ie(!Ve);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:I.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:Do.find(N=>N.value===I.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Do.map(N=>{let H=I.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{Gt("color",N.value),Ie(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:H?N.value:void 0},title:N.name,children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:I.isMilestone||false,onChange:N=>Gt("isMilestone",N.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",I.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:he,value:R,onChange:N=>Vr(N.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",I.subtasks.filter(N=>N.progress===100).length,"/",I.subtasks.length,")"]})]})}),I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...I.subtasks].sort((N,H)=>(N.position??0)-(H.position??0)).map(N=>jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>Zr(N.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",N.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",N.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("button",{onClick:()=>lr(N.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},N.id))}),Mr?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Jt,onChange:N=>vr(N.target.value),onKeyDown:N=>{N.key==="Enter"&&Jt.trim()?jr():N.key==="Escape"&&(Rt(false),vr(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsxRuntime.jsx("button",{onClick:jr,disabled:!Jt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Jt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Rt(false),vr("");},className:g("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>Rt(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:d.map(N=>{let H=ve(N.type),me=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[me&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(H,{className:g("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:re(N.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(N.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:Z,onDragLeave:O,onDrop:_,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Fe?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",F&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||F}),F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:g("w-6 h-6 mx-auto mb-2",Fe?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Fe?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsxRuntime.jsx("p",{className:g("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:g("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),Fb=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),recharts=require('recharts'),htmlToImage=require('html-to-image');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Fb__default=/*#__PURE__*/_interopDefault(Fb);var xi=(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 vi=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 [vi.Translate.toString(e),vi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function g(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function wi(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 Db(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function ec(e,t){return e.length===0?1e3:t===0?wi(null,e[0].position):t>=e.length?wi(e[e.length-1].position,null):wi(e[t-1].position,e[t].position)}function Ru(e,t=100){return e>t}var Sb=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 Eb(e,t,r,a){let n=t*Math.pow(r,e-1),s=n*.2*Math.random();return Math.min(n+s,a)}async function ki(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Sb,onRetry:l}=t,c,i=0;for(let d=1;d<=r;d++){i=d;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(c=m,d===r||!o(c,d))return {error:c,attempts:i,success:false};let p=Eb(d,a,n,s);if(l)try{l(c,d,p);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,p));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Mb(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 Pb(e,t={}){return async(...r)=>ki(()=>e(...r),t)}var tc=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 Bu=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(Bu||{}),wo=class wo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:s,...o}=t,l=`[${r}] [${a}] [${s}]`,c=Object.keys(o).length>0;switch(a){case "DEBUG":console.debug(l,n,c?o:"");break;case "INFO":console.info(l,n,c?o:"");break;case "WARN":console.warn(l,n,c?o:"");break;case "ERROR":console.error(l,n,c?o:""),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",...wo.globalOptions};}static configure(t){wo.globalOptions={...wo.globalOptions,...t};}child(t){return new wo({...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 Ci((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new Ci(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Bu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};wo.globalOptions={};var rc=wo,Ci=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}},$u=new rc;function Lb(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 Ab(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(s=>{let o=e.columns.find(l=>l.id===s.columnId);return [s.id,ac(s.title),ac(s.description||""),ac(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [r.join(","),...a.map(s=>s.join(","))].join(`
2
+ `)}async function Ib(e,t,r){let a=t;if(!a){let o=document.querySelector(".asakaa-board");o&&(a=o.parentElement||o);}if(a)try{let o=await Fb__default.default(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),l=o.toDataURL("image/png"),c=297,i=210,d=o.width/o.height,m=c-20,u=m/d;u>i-20&&(u=i-20,m=u*d);let p=new jspdf.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 f=(c-m)/2;return p.addImage(l,"PNG",f,20,m,u),p}catch(o){console.error("Error capturing board:",o);}let n=new jspdf.jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(c=>c.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,s),s+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let d=n.splitTextToSize(c.description,160);n.text(d,25,s),s+=d.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 d=[];c.startDate&&d.push(`Start: ${c.startDate}`),c.endDate&&d.push(`End: ${c.endDate}`),i.push(d.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function ac(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Hu(e,t,r,a){switch(t){case "json":return Lb(e,a);case "csv":return Ab(e);case "pdf":return await Ib(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Uu(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${a}.pdf`;e.save(d);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Rb(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 Bb(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=Wu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Wu(t[o]||"");if(l.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${l.length})`);continue}for(;l.length<r.length;)l.push("");let i={};r.forEach((p,f)=>{i[p]=l[f]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let m=n.get(d),u={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.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(u),m.cardIds.push(u.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Wu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function zu(e,t){switch(t){case "json":return Rb(e);case "csv":return Bb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Gu(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);})}var nc=react.createContext(null);function Vu(){return react.useContext(nc)}var ju=react.createContext(null);function _u({children:e,themeName:t}){return jsxRuntime.jsx(ju.Provider,{value:{themeName:t},children:e})}function Ti(){return react.useContext(ju)}function nr({children:e,container:t}){let[r,a]=react.useState(false),n=Vu(),s=Ti();if(react.useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):reactDom.createPortal(e,o)}var Ju={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Vb="#BDC3C7",jb=({color:e})=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function ko({priority:e,onChange:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState({top:0,left:0}),l=react.useRef(null),c=react.useRef(null),i=()=>{if(!c.current)return;let p=c.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,h=160,b=220,y=4,v=p.right-h;v<10&&(v=p.left),v+h>x-10&&(v=x-h-10);let w=f-p.bottom,k=p.top,M;w>=b+y?M=p.bottom+y:k>=b+y?M=p.top-b-y:M=w>=k?p.bottom+y:Math.max(10,p.top-b-y),o({top:M,left:v}),n(true);};react.useEffect(()=>{let p=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]),react.useEffect(()=>{let p=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[a]);let d=p=>{t(p),n(false);},m=e?Ju[e]:null,u=m?.color||Vb;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:m?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Ju).map(([p,f])=>jsxRuntime.jsxs("button",{onClick:()=>d(p),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:f.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:[jsxRuntime.jsx(jb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===p&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},p)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>d(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:p=>{p.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:p=>{p.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var _b=[{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 Ps({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=react.useState(false),[o,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),u=(Ti()?.themeName||"dark")==="dark",p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,B=380,T=4,C=v.left;C+M>k-10&&(C=k-M-10),C<10&&(C=10);let P=w-v.bottom,D=v.top,V;P>=B+T?V=v.bottom+T:D>=B+T?V=v.top-B-T:V=P>=D?v.bottom+T:Math.max(10,v.top-B-T),l({top:V,left:C}),s(true);};react.useEffect(()=>{let v=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),react.useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,k=C=>{let P=C.getFullYear(),D=String(C.getMonth()+1).padStart(2,"0"),V=String(C.getDate()).padStart(2,"0");return `${P}-${D}-${V}`},M=k(w),B=new Date(w);B.setDate(B.getDate()+v);let T=k(B);r(M,T),s(false);},x=()=>{if(!e||!t)return "Set date";let v=B=>{if(B instanceof Date)return B;if(typeof B!="string"||!B.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=B.split("-").map(Number);if(T.length!==3||T.some(V=>isNaN(V)))return null;let C=T[0],P=T[1],D=T[2];return C===void 0||P===void 0||D===void 0?null:new Date(C,P-1,D)},w=v(e),k=v(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=e&&t,y=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):p(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:u?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:_b.map(v=>jsxRuntime.jsx("button",{onClick:()=>f(v.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:v=>r(v.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:v=>r(e,v.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function To({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[l,c]=react.useState(""),[i,d]=react.useState({top:0,left:0}),m=react.useRef(null),u=react.useRef(null),p=()=>{if(!u.current)return;let y=u.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,k=300,M=380,B=4,T=y.right-k;T<10&&(T=y.left),T+k>w-10&&(T=w-k-10);let C=v-y.bottom,P=y.top,D;C>=M+B?D=y.bottom+B:P>=M+B?D=y.top-M-B:D=C>=P?y.bottom+B:Math.max(10,y.top-M-B),d({top:D,left:T}),o(true);};react.useEffect(()=>{let y=v=>{m.current&&!m.current.contains(v.target)&&!u.current?.contains(v.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let v=e.some(w=>w.id===y.id);r(v?e.filter(w=>w.id!==y.id):[...e,y]);},x=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:u,onClick:()=>s?o(false):p(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(y=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:m,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(y=>{let v=e.some(w=>w.id===y.id);return jsxRuntime.jsxs("button",{onClick:()=>f(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},y.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),o(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 Ni(e,t,r){let a=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(d=>{if(typeof d=="string")return d;let m=d;return m.taskId||m.targetId||""}).filter(Boolean);a.set(c.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=a.get(c)||[];for(let d of i){if(!s.has(d)&&l(d))return true;if(o.has(d))return true}}return o.delete(c),false};return l(r)}function Ls({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(t.length>0),[p,f]=react.useState({top:0,left:0}),[x,h]=react.useState(null),b=react.useRef(null),y=react.useRef(null),v=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),C=window.innerHeight,P=window.innerWidth,D=300,V=m?380:120,$=4,Z=T.right-D;Z<10&&(Z=T.left),Z+D>P-10&&(Z=P-D-10);let L=C-T.bottom,Ae=T.top,W;L>=V+$?W=T.bottom+$:Ae>=V+$?W=T.top-V-$:W=L>=Ae?T.bottom+$:Math.max(10,T.top-V-$),f({top:W,left:Z}),c(true);};react.useEffect(()=>{if(!l||!y.current)return;let T=y.current.getBoundingClientRect(),C=window.innerHeight,P=window.innerWidth,D=300,V=m?380:120,$=4,Z=T.right-D;Z<10&&(Z=T.left),Z+D>P-10&&(Z=P-D-10);let L=C-T.bottom,Ae=T.top,W;L>=V+$?W=T.bottom+$:Ae>=V+$?W=T.top-V-$:W=L>=Ae?T.bottom+$:Math.max(10,T.top-V-$),f({top:W,left:Z});},[m,l]),react.useEffect(()=>{let T=C=>{b.current&&!b.current.contains(C.target)&&!y.current?.contains(C.target)&&(c(false),d(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{let T=C=>{C.key==="Escape"&&(c(false),d(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let w=T=>{let C=t.includes(T),P=r.find(D=>D.id===T);if(h(null),C){let D=t.filter(V=>V!==T);a(D),D.length===0&&u(false);}else {if(s&&Ni(r,T,e)){let V=`Cannot add "${P?.title||T}" as dependency - would create circular reference`;h(V),o?.(T,P?.title||T),setTimeout(()=>h(null),3e3);return}a([...t,T]),u(true);}},k=()=>{let T=!m;u(T),T||a([]);},M=r.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),B=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?c(false):v(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:B,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:B},children:t.length})]}),l&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:i,onChange:T=>d(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):M.map(T=>{let C=t.includes(T.id);return jsxRuntime.jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:C?"#00E5CC":"transparent",borderColor:C?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:C&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),u(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var An=react.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:d,setNodeRef:m,transform:u,transition:p,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:vi.Transform.toString(u),transition:p};if(t)return jsxRuntime.jsx("div",{ref:m,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:m,style:v,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsxRuntime.jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,k)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&y.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(ko,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(Ps,{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:(w,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(To,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsxRuntime.jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(Ls,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsxRuntime.jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var Di={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"}},ip=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function lp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=react.useState(false),[o,l]=react.useState({top:0,left:0}),c=react.useRef(null),i=react.useRef(null),d=[...Object.entries(Di).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Di).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let h=Di[e];if(h)return {...h,id:e};let b=a.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Di.todo,id:"todo"}},u=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,v=180,w=280,k=4,M=h.right-v;M<10&&(M=h.left),M+v>y-10&&(M=y-v-10);let B=b-h.bottom,T=h.top,C;B>=w+k?C=h.bottom+k:T>=w+k?C=h.top-w-k:C=B>=T?h.bottom+k:Math.max(10,h.top-w-k),l({top:C,left:M}),s(true);};react.useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let p=h=>{t(h),s(false);},f=m(),x=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):u(),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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsxRuntime.jsx(ip,{icon:f.icon,color:x})}),n&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:d.map(h=>jsxRuntime.jsxs("button",{onClick:()=>p(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(ip,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var cp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function dp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=cp[s]||cp.en,[l,c]=react.useState(false),[i,d]=react.useState(false),[m,u]=react.useState(e),[p,f]=react.useState({top:0,left:0}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null);react.useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),react.useEffect(()=>{let k=M=>{x.current&&!x.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),d(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),d(false),u(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),react.useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{d(true),u(e);},v=()=>{let k=m.trim();k&&k!==e&&t(k),d(false),c(false),u(e);},w=k=>{k.key==="Enter"?v():k.key==="Escape"&&(d(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${p.top}px`,left:`${p.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:i?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsxRuntime.jsx("input",{ref:b,type:"text",value:m,onChange:k=>u(k.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{r(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Yo=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:d,cardHeight:m=120,isCollapsed:u,onToggleCollapse:p,onColumnRename:f,onColumnDelete:x,isDeletable:h=false,className:b,renderMetrics:y,locale:v})=>{let{setNodeRef:w,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),M=react.useRef(null),B=d??Ru(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>m,enabled:B});if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),D=P.state==="exceeded",V=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g(V()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),P.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),P.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),P.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsxRuntime.jsx(dp,{columnTitle:e.title,onRename:$=>f?.(e.id,$),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),p&&jsxRuntime.jsx("button",{onClick:p,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!u&&jsxRuntime.jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:B?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map($=>$.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?s?s(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):B?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map($=>{let Z=t[$.index];return Z?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsxRuntime.jsx(An,{card:Z,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},Z.id):null})}):t.map($=>jsxRuntime.jsx(An,{card:$,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i},$.id))})})]})});Yo.displayName="Column";function cc({title:e,onSave:t,className:r}){let[a,n]=react.useState(false),[s,o]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.select());},[a]);let c=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?c():d.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:c,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsxRuntime.jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function ph(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function bp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),d=c.split(/\s+/);return !!(i===s||c===s||d.some(m=>m===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function mh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function gh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var fh=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function hp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:d=true,enableAttachments:m=true,pendingFiles:u=[],onFilesSelect:p,onRemoveFile:f,maxFileSizeMB:x=10}){let h=l==="dark",[b,y]=react.useState(false),[v,w]=react.useState([]),[k,M]=react.useState(0),[B,T]=react.useState(null),[C,P]=react.useState(false),D=react.useRef(null),V=react.useRef(null),$=react.useRef(null),Z=react.useRef(null),L=react.useCallback((Q,De)=>{let oe=ph(Q,De);if(T(oe),oe){let He=a.filter(Se=>Se.name.toLowerCase().includes(oe.query)||Se.email&&Se.email.toLowerCase().includes(oe.query)).slice(0,5);w(He),y(He.length>0),M(0);}else y(false),w([]);},[a]),Ae=Q=>{let De=Q.target.value;if(t(De),L(De,Q.target.selectionStart||0),D.current){D.current.style.height="24px";let oe=D.current.scrollHeight,He=280,Se=Math.min(oe,He);D.current.style.height=`${Se}px`,D.current.style.overflowY=oe>He?"auto":"hidden";}},W=()=>{D.current&&L(e,D.current.selectionStart||0);},Ce=react.useCallback(Q=>{if(!B||!D.current)return;let De=e.slice(0,B.start),oe=e.slice(B.end),He=`@${Q.name.replace(/\s+/g,"")} `,Se=De+He+oe;t(Se),y(false),T(null),setTimeout(()=>{if(D.current){let Fe=B.start+He.length;D.current.selectionStart=Fe,D.current.selectionEnd=Fe,D.current.focus();}},0);},[B,e,t]),I=Q=>{if(b&&v.length>0)switch(Q.key){case "ArrowDown":Q.preventDefault(),M(De=>De<v.length-1?De+1:0);break;case "ArrowUp":Q.preventDefault(),M(De=>De>0?De-1:v.length-1);break;case "Enter":{Q.preventDefault();let De=v[k];De&&Ce(De);break}case "Tab":{Q.preventDefault();let De=v[k];De&&Ce(De);break}case "Escape":Q.preventDefault(),y(false);break}else Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),r());};react.useEffect(()=>{let Q=De=>{V.current&&!V.current.contains(De.target)&&D.current&&!D.current.contains(De.target)&&y(false),Z.current&&!Z.current.contains(De.target)&&P(false);};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]);let z=react.useCallback(Q=>{if(!D.current)return;let De=D.current.selectionStart||e.length,oe=e.slice(0,De)+Q+e.slice(De);t(oe),P(false),setTimeout(()=>{if(D.current){let He=De+Q.length;D.current.selectionStart=He,D.current.selectionEnd=He,D.current.focus();}},0);},[e,t]),Oe=react.useCallback(Q=>{if(!p||!Q.target.files)return;let De=Array.from(Q.target.files),oe=x*1024*1024,He=De.filter(Se=>Se.size>oe?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);He.length>0&&p(He),Q.target.value="";},[p,x]),ze=react.useCallback(Q=>Q.type.startsWith("image/")?lucideReact.Image:Q.type.includes("pdf")||Q.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&V.current){let Q=V.current.children[k];Q&&Q.scrollIntoView({block:"nearest"});}},[k,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(Q=>{let De=ze(Q.file),oe=Q.file.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[oe&&Q.preview?jsxRuntime.jsx("img",{src:Q.preview,alt:Q.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(De,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:Q.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:gh(Q.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(Q.id),className:g("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},Q.id)})}),jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[i&&jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxRuntime.jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!C),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsxRuntime.jsx(lucideReact.Smile,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:fh.map(Q=>jsxRuntime.jsx("button",{type:"button",onClick:()=>z(Q),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:Q},Q))})})})]}),m&&p&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})}),jsxRuntime.jsx("input",{ref:$,type:"file",multiple:true,onChange:Oe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:D,value:e,onChange:Ae,onSelect:W,onKeyDown:I,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsxRuntime.jsx("button",{onClick:r,disabled:o||!e.trim()&&u.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&v.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((Q,De)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ce(Q),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",De===k?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:Q.color||"#8B5CF6"},children:mh(Q.name)}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:Q.name}),Q.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:Q.email})]})]},Q.id))})})]})]})]})}function yp({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsxRuntime.jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((l,c)=>l.type==="mention"?jsxRuntime.jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},c):jsxRuntime.jsx("span",{children:l.value},c))})}var Fi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Xo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[l,c]=react.useState(false),[i,d]=react.useState(""),[m,u]=react.useState(false),[p,f]=react.useState(Fi[10]||"#00E5CC"),[x,h]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),v=react.useRef(null),w=react.useRef(null),k=t.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),M=t.some(D=>D.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let D=y.current.getBoundingClientRect();h({top:D.bottom+6,left:D.left});}},[l]),react.useEffect(()=>{let D=V=>{let $=V.target,Z=b.current?.contains($),L=v.current?.contains($);!Z&&!L&&(c(false),d(""),u(false));};if(l)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),react.useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let B=D=>{let V=e.some($=>$.id===D.id);r(V?e.filter($=>$.id!==D.id):[...e,D]);},T=async()=>{if(!(!a||!i.trim())){u(true);try{let D=await a(i.trim(),p);D&&(r([...e,D]),d(""),f(Fi[Math.floor(Math.random()*Fi.length)]||"#00E5CC"));}finally{u(false);}}},C=(D,V)=>{V.stopPropagation(),r(e.filter($=>$.id!==D));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxRuntime.jsxs("div",{ref:b,className:"relative",children:[jsxRuntime.jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(D=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsxRuntime.jsx("input",{ref:w,type:"text",value:i,onChange:D=>d(D.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:D=>{D.key==="Enter"&&i.trim()&&!M&&a&&T();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${D.color}20`,color:D.color},onClick:V=>C(D.id,V),children:[D.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},D.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(D=>{let V=e.some($=>$.id===D.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${D.color}15`:"transparent",color:n.textPrimary},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:$=>{V||($.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:D.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):i.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&a&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Fi.map(D=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:p===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxRuntime.jsxs("button",{type:"button",onClick:T,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:p,color:"#FFFFFF",opacity:m?.7:1},children:[m?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function uc({tag:e,onRemove:t,size:r="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function vp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsxRuntime.jsx(uc,{tag:s,size:r},s.id)),n>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var Do=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function wp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function Th(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Nh({className:e}){return jsxRuntime.jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function pc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Th(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=wp(e.loggedMinutes),i=e.estimateMinutes?wp(e.estimateMinutes):null,d=r&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxRuntime.jsxs(a?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsxRuntime.jsx(Nh,{className:l[t]}),jsxRuntime.jsx("span",{children:d})]})}function Dh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Ai(e){let t=Dh(e);return t!==null?String(t):e}function Cp(e){let r=Ai(e).trim().toLowerCase();if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Ii(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Mh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function Ph({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Fh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Tp({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Lh({className:e}){return jsxRuntime.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]})}function mc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:d,className:m}){let[u,p]=react.useState(""),[f,x]=react.useState(t.estimateMinutes?Ii(t.estimateMinutes):""),[h,b]=react.useState(""),[y,v]=react.useState(false),[w,k]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{M.current?.focus();},[]);let B=async()=>{let P=Cp(u);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),p(""),b("");}finally{v(false);}}},T=async()=>{if(!o)return;let P=f.trim()?Cp(f):null;await o(P),k(false);},C=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),B()),P.key==="Escape"&&d?.();};return jsxRuntime.jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",m),children:[jsxRuntime.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsxRuntime.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Tp,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:a?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"relative flex h-2 w-2",children:[jsxRuntime.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsxRuntime.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsxRuntime.jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Mh(n)})]}),jsxRuntime.jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsxRuntime.jsx(Fh,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsxRuntime.jsx(Tp,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:l,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsxRuntime.jsx(Ph,{className:"w-4 h-4"}),"Start Timer"]})}),jsxRuntime.jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"relative flex-1",children:[jsxRuntime.jsx(Lh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsxRuntime.jsx("input",{ref:M,type:"text",value:u,onChange:P=>p(P.target.value),onKeyDown:C,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsx("button",{onClick:B,disabled:y||!u.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsxRuntime.jsx("input",{type:"text",value:h,onChange:P=>b(P.target.value),onKeyDown:C,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-sm",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsxRuntime.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ii(t.loggedMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsxRuntime.jsx("div",{className:"flex items-center gap-1",children:jsxRuntime.jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&T(),P.key==="Escape"&&k(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsxRuntime.jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ii(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxRuntime.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntime.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxRuntime.jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"px-3 py-2",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsxRuntime.jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsxRuntime.jsx("span",{className:"font-medium ml-2",children:Ii(P.durationMinutes)})]},P.id))})]})]})}function $h(e){let r=Ai(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Oh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function wn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[l,c]=react.useState(Oh(a)),[i,d]=react.useState(""),[m,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{p.current?.focus();},[]);let f=async()=>{u(true);let v=$h(l);await n(v&&v>0?v:null,i||void 0),u(false);},x=async()=>{u(true),await n(null),u(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxRuntime.jsxs("div",{className:g("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsxRuntime.jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]}),jsxRuntime.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntime.jsx("input",{ref:p,type:"text",value:l,onChange:v=>c(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsxRuntime.jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsxRuntime.jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsxRuntime.jsx("button",{type:"button",onClick:f,disabled:m||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:m?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Hh(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Uh(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function fc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Hh(e.health),s=Uh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsxRuntime.jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsxRuntime.jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxRuntime.jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxRuntime.jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsxRuntime.jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),i&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxRuntime.jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Jo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function zh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Gh(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Vh(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function jh({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",l=r?"text-[#9CA3AF]":"text-gray-500",c=r?"text-[#E5E7EB]":"text-gray-900";return jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxRuntime.jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",Jo(Math.abs(e.totalVarianceMinutes))]}),jsxRuntime.jsxs("div",{className:g("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsxRuntime.jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxRuntime.jsxs("div",{className:"space-y-1 text-sm",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:Jo(e.totalSoldMinutes)})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:Jo(e.totalLoggedMinutes)})]}),jsxRuntime.jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsxRuntime.jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsxRuntime.jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function _h({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",l=r?"text-[#9CA3AF]":"text-gray-500";return jsxRuntime.jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxRuntime.jsxs("td",{className:"px-4 py-3",children:[jsxRuntime.jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsxRuntime.jsx("div",{className:g("text-xs mt-1",l),children:e.projectName})]}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Jo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Jo(e.loggedMinutes)}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":l),children:[n,Jo(Math.abs(e.varianceMinutes))]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxRuntime.jsxs("span",{className:g("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-center",children:jsxRuntime.jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Gh(e.status,r),zh(e.status,r)),children:Vh(e.status,t)})})]})}function bc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",u=o?"bg-[#050505]/50":"bg-gray-50",p=react.useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",m,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxRuntime.jsxs("div",{className:g("space-y-6 p-6",l,n),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:g("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",m),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(jh,{summary:e.summary,locale:r,isDark:o}),jsxRuntime.jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsxRuntime.jsx("thead",{className:u,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:p.map(f=>jsxRuntime.jsx(_h,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",m),children:r==="es"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Qo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function sy(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Ip(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function iy(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function So({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:u,availableTasks:p=[],comments:f=[],onAddComment:x,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:B=0,onTimeLog:T,onEstimateUpdate:C,onSoldEffortUpdate:P,onTimerStart:D,onTimerStop:V,onTimerDiscard:$,blurFinancials:Z=false}){let L=s==="dark",Ae={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},W=e&&"title"in e&&!("name"in e),Ce=e,[I,z]=react.useState(e?Ip(e,l):null),[Oe,ze]=react.useState(false),[Q,De]=react.useState(false),[oe,He]=react.useState(false),[Se,Fe]=react.useState(null),[Ge,Qe]=react.useState(new Date),[se,Ze]=react.useState(false),[_e,$e]=react.useState(false),[ft,pt]=react.useState(""),[je,Re]=react.useState(false),[dt,zt]=react.useState(false),[Le,st]=react.useState(false),[F,J]=react.useState(false),[R,Y]=react.useState(""),ue=react.useRef(null),he=react.useRef(null),[Be,j]=react.useState(""),xe=react.useRef(null),[Ie,Ue]=react.useState(""),[Ct,Xe]=react.useState(false),[Dt,mt]=react.useState([]),[Jt,xr]=react.useState(""),[Er,Rt]=react.useState(false),Hr=react.useRef(null);react.useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let N=Ip(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:N?.id,taskName:N?.name,soldEffortMinutes:N?.soldEffortMinutes,quotedMinutes:N?.quotedMinutes,effortMinutes:N?.effortMinutes,timeLoggedMinutes:N?.timeLoggedMinutes}),z(N),Y(N.description||""),j(N.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!R)return;let N=setTimeout(()=>{let H=he.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(N)},[t,R]),react.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),xe.current&&clearTimeout(xe.current);},[]),react.useEffect(()=>{t&&Hr.current&&f.length>0&&setTimeout(()=>{Hr.current&&(Hr.current.scrollTop=Hr.current.scrollHeight);},100);},[t,f.length]);let Bt=react.useCallback(N=>{z(N),W&&n&&Ce?n(iy(N,Ce)):a&&a(N);},[W,Ce,n,a]),vr=react.useCallback(()=>{ze(false),De(false),He(false),Fe(null),$e(false),pt(""),Re(false);},[]),Gt=react.useCallback((N,H)=>{if(!I)return;let me={...I,[N]:H};Bt(me);},[I,Bt]),Qt=react.useCallback(()=>{let N=he.current;N&&(N.style.height="auto",N.style.height=`${Math.max(100,N.scrollHeight)}px`);},[]),Zr=react.useCallback(N=>{Y(N),setTimeout(Qt,0),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{if(I){let H={...I,description:N};Bt(H);}},800);},[I,Bt,Qt]),ba=react.useCallback(N=>{j(N),xe.current&&clearTimeout(xe.current),xe.current=setTimeout(()=>{if(I&&N.trim()){let H={...I,name:N.trim()};Bt(H);}},800);},[I,Bt]),et=react.useCallback(N=>{let H=N.map(me=>{let K={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:me};return me.type.startsWith("image/")&&(K.preview=URL.createObjectURL(me)),K});mt(me=>[...me,...H]);},[]),Ke=react.useCallback(N=>{mt(H=>{let me=H.find(K=>K.id===N);return me?.preview&&URL.revokeObjectURL(me.preview),H.filter(K=>K.id!==N)});},[]),sa=react.useCallback(async()=>{if(!(!I||!Ie.trim()&&Dt.length===0||!x)){Xe(true);try{let N=bp(Ie,b),H=[];if(Dt.length>0&&y){let me=Dt.map(K=>K.file);H=await y(me);}await x(I.id,Ie.trim(),N.length>0?N:void 0,H.length>0?H:void 0),Ue(""),Dt.forEach(me=>{me.preview&&URL.revokeObjectURL(me.preview);}),mt([]);}finally{Xe(false);}}},[I,Ie,Dt,x,b,y]),Vr=react.useCallback(()=>{if(!I||!Jt.trim())return;let N=I.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:N.length},me=[...N,H],K={...I,subtasks:me};Bt(K),xr(""),Rt(false);},[I,Jt,Bt]),ea=react.useCallback(N=>{if(!I?.subtasks)return;let H=I.subtasks.map(K=>K.id===N?{...K,progress:K.progress===100?0:100}:K),me={...I,subtasks:H};Bt(me);},[I,Bt]),jr=react.useCallback(N=>{if(!I?.subtasks)return;let H=I.subtasks.filter(K=>K.id!==N),me={...I,subtasks:H};Bt(me);},[I,Bt]),_r=react.useCallback(N=>{let H=typeof N=="string"?new Date(N):N,K=new Date().getTime()-H.getTime(),ve=Math.floor(K/6e4),nt=Math.floor(K/36e5),ie=Math.floor(K/864e5);return ve<1?o==="es"?"Ahora":"Just now":ve<60?o==="es"?`Hace ${ve} min`:`${ve}m ago`:nt<24?o==="es"?`Hace ${nt}h`:`${nt}h ago`:ie<7?o==="es"?`Hace ${ie}d`:`${ie}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ce=react.useCallback(N=>{if(!I)return;let H=I.progress||0;N==="completed"?H=100:N==="in-progress"&&H===0?H=10:N==="todo"&&(H=0);let me={...I,status:N,progress:H};Bt(me),ze(false);},[I,Bt]),de=react.useCallback((N,H)=>{if(!I)return;let me={...I,startDate:N,endDate:H};Bt(me);},[I,Bt]),ut=react.useCallback(()=>{let N=Ge.getFullYear(),H=Ge.getMonth(),me=new Date(N,H,1),ve=new Date(N,H+1,0).getDate(),nt=me.getDay(),ie=[],ot=new Date(N,H,0).getDate();for(let Mt=nt-1;Mt>=0;Mt--)ie.push({date:new Date(N,H-1,ot-Mt),isCurrentMonth:false});for(let Mt=1;Mt<=ve;Mt++)ie.push({date:new Date(N,H,Mt),isCurrentMonth:true});let bt=42-ie.length;for(let Mt=1;Mt<=bt;Mt++)ie.push({date:new Date(N,H+1,Mt),isCurrentMonth:false});return ie},[Ge]),_=react.useCallback(async N=>{if(N.preventDefault(),N.stopPropagation(),st(false),!I||!m)return;let H=Array.from(N.dataTransfer.files);if(H.length!==0){J(true);try{await m(I.id,H);}finally{J(false);}}},[I,m]),fe=react.useCallback(async N=>{if(!I||!m||!N.target.files)return;let H=Array.from(N.target.files);if(H.length!==0){J(true);try{await m(I.id,H);}finally{J(false);}N.target.value="";}},[I,m]),ee=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),st(true);},[]),O=react.useCallback(N=>{N.preventDefault(),N.stopPropagation(),st(false);},[]),te=react.useCallback(N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`,[]),we=react.useCallback(N=>N.startsWith("image/")?lucideReact.Image:N.includes("pdf")||N.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!I?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:I.id.slice(0,8)})]}),jsxRuntime.jsx("div",{className:"flex-1"})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let N=I.progress===100?0:100,me={...I,progress:N,status:N===100?"completed":"todo"};Bt(me);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",I.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:I.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Be,onChange:N=>ba(N.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",I.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{vr(),ze(!Oe);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",I.progress===100||I.status==="completed"?"bg-green-500/20 text-green-400":I.progress&&I.progress>0||I.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.progress===100||I.status==="completed"?o==="es"?"COMPLETADO":"DONE":I.progress&&I.progress>0||I.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>ce(N.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",I.status===N.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:N.label})]},N.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),He(!oe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[I.assignees&&I.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[I.assignees.slice(0,3).map((N,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:N.color||"#8B5CF6"},title:N.name,children:N.initials||N.name.slice(0,2).toUpperCase()},H)),I.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",I.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(N=>{let H=I.assignees?.some(me=>me.name===N.name);return jsxRuntime.jsxs("button",{onClick:()=>{let me=I.assignees||[],K;H?K=me.filter(ve=>ve.name!==N.name):K=[...me,N],Gt("assignees",K);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",H&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:N.color||"#8B5CF6"},children:N.initials||N.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:N.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},N.name)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{Fe(Se?null:"start"),Qe(I.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[I.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:g("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),I.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:N=>N.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let N=new Date,H=new Date(N);H.setDate(N.getDate()+1);let me=new Date(N);me.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let K=new Date(N);K.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let ve=new Date(N);ve.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let nt=new Date(N);nt.setDate(N.getDate()+14);let ie=new Date(N);return ie.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:me,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:K,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ve,display:ve.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:nt,display:nt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:ie,display:ie.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Mt)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let ir=I.endDate&&bt.date>I.endDate?bt.date:I.endDate;de(bt.date,ir),Fe("end");}else {let ir=I.startDate&&bt.date<I.startDate?bt.date:I.startDate;de(ir,bt.date),Fe(null);}},children:[jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Mt))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{de(void 0,void 0),Fe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",L?"text-white":"text-gray-900"),children:Ge.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>Qe(new Date),className:g("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Qe(new Date(Ge.getFullYear(),Ge.getMonth()-1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("button",{onClick:()=>Qe(new Date(Ge.getFullYear(),Ge.getMonth()+1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:N},N))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:ut().map((N,H)=>{let me=N.date.toDateString()===new Date().toDateString(),K=I.startDate?.toDateString()===N.date.toDateString(),ve=I.endDate?.toDateString()===N.date.toDateString(),nt=K||ve,ie=I.startDate&&I.endDate&&N.date>=I.startDate&&N.date<=I.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let ot=new Date(N.date);if(Se==="start"){let bt=I.endDate&&ot>I.endDate?ot:I.endDate;de(ot,bt),Fe("end");}else {let bt=I.startDate&&ot<I.startDate?ot:I.startDate;de(bt,ot),Fe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),N.isCurrentMonth&&(L?"text-white":"text-gray-900"),me&&"ring-2 ring-[#00E5CC]",K&&"bg-[#00E5CC] text-white",ve&&!K&&"bg-[#7C3AED] text-white",ie&&!nt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!nt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:N.date.getDate()},H)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{vr(),De(!Q);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",I.priority==="high"||I.priority==="urgent"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":I.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:I.priority?I.priority==="high"||I.priority==="urgent"?o==="es"?"Alta":"High":I.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>De(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(N=>jsxRuntime.jsxs("button",{onClick:()=>{Gt("priority",N.id),De(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",I.priority===N.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",N.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:N.label})]},N.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:I.startDate&&I.endDate?`${Math.ceil((I.endDate.getTime()-I.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:I.progress||0,onChange:N=>{let H=parseInt(N.target.value),me=I.status;H===100?me="completed":H>0?me="in-progress":me="todo";let K={...I,progress:H,status:me};Bt(K);},onBlur:()=>Ze(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>Ze(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",I.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${I.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[I.progress||0,"%"]})]})]}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Hourglass,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Qo(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("estimate"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Qo(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("estimate"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="estimate"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async N=>{await C?.(I.id,N),zt(false);},onClose:()=>zt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:Z?jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):I.status==="completed"||I.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:I.quotedMinutes?Qo(I.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):I.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("quoted"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Qo(I.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>zt("quoted"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="quoted"&&!Z&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"quoted",locale:o,isDark:L,currentValue:I.quotedMinutes||null,onSave:async N=>{P?(await P(I.id,N),z(H=>H?{...H,quotedMinutes:N}:null)):Gt("quotedMinutes",N),zt(false);},onClose:()=>zt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[I.status==="completed"||I.progress===100?jsxRuntime.jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxRuntime.jsxs("button",{type:"button",onClick:()=>V?.(I.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsxRuntime.jsx(lucideReact.Square,{className:"w-3.5 h-3.5 fill-current"}),sy(B||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>D?.(I.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsxRuntime.jsx(lucideReact.Play,{className:"w-3.5 h-3.5 fill-current"})}),I.status==="completed"||I.progress===100?jsxRuntime.jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxRuntime.jsxs("button",{type:"button",onClick:()=>zt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[Qo(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",Qo(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsxRuntime.jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt==="log"&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsxRuntime.jsx(wn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(N,H)=>{N&&await T?.(I.id,{durationMinutes:N,note:H,source:"manual"}),zt(false);},onClose:()=>zt(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Xo,{selectedTags:I.tags||[],availableTags:c,onChange:N=>{Gt("tags",N);},onCreateTag:i,theme:Ae})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[I.dependencies&&I.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:I.dependencies.map(N=>{let H=p.find(me=>me.id===N);return jsxRuntime.jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[H?.name||N.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let me=(I.dependencies||[]).filter(K=>K!==N);Gt("dependencies",me);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},N)})}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),$e(!_e);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),pt("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ft,onChange:N=>pt(N.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsxRuntime.jsx("div",{className:"max-h-[240px] overflow-y-auto",children:p.length>0?p.filter(N=>N.id!==I.id).filter(N=>ft===""||N.name.toLowerCase().includes(ft.toLowerCase())).map(N=>{let H=I.dependencies?.includes(N.id);return jsxRuntime.jsxs("button",{onClick:()=>{let me=I.dependencies||[],K;H?K=me.filter(ve=>ve!==N.id):K=[...me,N.id],Gt("dependencies",K);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",H&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:g("block truncate",L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:N.id.slice(0,8)})]})]},N.id)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Palette,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),Re(!je);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:I.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:Do.find(N=>N.value===I.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsxRuntime.jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Do.map(N=>{let H=I.color===N.value;return jsxRuntime.jsx("button",{onClick:()=>{Gt("color",N.value),Re(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:N.value,outlineColor:H?N.value:void 0},title:N.name,children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},N.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:I.isMilestone||false,onChange:N=>Gt("isMilestone",N.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",I.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:he,value:R,onChange:N=>Zr(N.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-between mb-3",children:jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",I.subtasks.filter(N=>N.progress===100).length,"/",I.subtasks.length,")"]})]})}),I.subtasks&&I.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...I.subtasks].sort((N,H)=>(N.position??0)-(H.position??0)).map(N=>jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>ea(N.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",N.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:N.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",N.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("button",{onClick:()=>jr(N.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-3.5 h-3.5"})})]},N.id))}),Er?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:Jt,onChange:N=>xr(N.target.value),onKeyDown:N=>{N.key==="Enter"&&Jt.trim()?Vr():N.key==="Escape"&&(Rt(false),xr(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsxRuntime.jsx("button",{onClick:Vr,disabled:!Jt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Jt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx("button",{onClick:()=>{Rt(false),xr("");},className:g("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}):jsxRuntime.jsxs("button",{onClick:()=>Rt(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:d.map(N=>{let H=we(N.type),me=N.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[me&&N.thumbnailUrl?jsxRuntime.jsx("img",{src:N.thumbnailUrl,alt:N.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(H,{className:g("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:N.name}),jsxRuntime.jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:te(N.size)})]}),u&&jsxRuntime.jsx("button",{onClick:()=>u(N.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},N.id)})}),jsxRuntime.jsxs("div",{onDragOver:ee,onDragLeave:O,onDrop:_,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Le?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",F&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||F}),F?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:g("w-6 h-6 mx-auto mb-2",Le?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Le?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsxRuntime.jsx("p",{className:g("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:g("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -15,8 +15,8 @@
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
16
  background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:Hr,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((N,H)=>{let me=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,K=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return me.getTime()-K.getTime()}).map(N=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:g("text-sm font-medium",L?"text-white":"text-gray-900"),children:N.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Ba(N.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(hp,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(H=>{let me=H.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[me?jsxRuntime.jsx(lucideReact.Image,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:H.name})]},H.id)})})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:g("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:g("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(bp,{value:Ae,onChange:Ue,onSubmit:fa,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:kt,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:Nt,onFilesSelect:et,onRemoveFile:_e})})]})]})]})})}function hc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function Zn({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:d,availableTags:m=[],onCreateTag:u,attachmentsByCard:p,onUploadAttachments:f,onDeleteAttachment:x,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:B,timeEntries:T,timerState:C,onLogTime:P,onUpdateEstimate:D,onUpdateSoldEffort:V,onStartTimer:$,onStopTimer:ee,onDiscardTimer:L,blurFinancials:Le=false,sidePanel:W,renderColumnMetrics:Ce,suppressDetailModal:I=false}){let[z,Oe]=hc(),[We,J]=react.useState(null),[De,se]=react.useState(false),He=react.useRef(null),Se=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Pe=n?.theme||"dark",ze=Pe==="dark"||Pe==="neutral",Ze=ze?"dark":"",le=react.useCallback((F,X)=>{t.onCardUpdate?.(F,X);},[t]),tt=react.useCallback((F,X)=>{t.onColumnUpdate?.(F,{title:X});},[t]),je=react.useCallback(F=>{t.onColumnDelete?.(F);},[t]),$e=["todo","in-progress","completed"],bt=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),mt=react.useMemo(()=>{let F=new Map;return e.columns.forEach(X=>{let R=X.cardIds.map(Y=>e.cards.find(de=>de.id===Y)).filter(Y=>Y!==void 0).sort((Y,de)=>Y.position-de.position);F.set(X.id,R);}),F},[e.cards,e.columns]);react.useEffect(()=>{let F=He.current;if(!F)return;let X=he=>{let Be=he.target,j=he.button===1,ye=Be===F||Be.classList.contains("asakaa-column")&&!Be.closest(".asakaa-card");(j||he.button===0&&ye&&!z.isDragging)&&(he.preventDefault(),se(true),Se.current={x:he.clientX,y:he.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},F.style.cursor="grabbing",F.style.userSelect="none");},R=he=>{if(!De)return;let Be=he.clientX-Se.current.x,j=he.clientY-Se.current.y;F.scrollLeft=Se.current.scrollLeft-Be,F.scrollTop=Se.current.scrollTop-j;},Y=()=>{De&&(se(false),F.style.cursor="",F.style.userSelect="");},de=()=>{De&&(se(false),F.style.cursor="",F.style.userSelect="");};return F.addEventListener("mousedown",X),document.addEventListener("mousemove",R),document.addEventListener("mouseup",Y),F.addEventListener("mouseleave",de),()=>{F.removeEventListener("mousedown",X),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",Y),F.removeEventListener("mouseleave",de);}},[De,z.isDragging]);let Ve=react.useMemo(()=>e.cards.map(F=>({id:F.id,name:F.title,startDate:F.startDate?new Date(F.startDate):void 0,endDate:F.endDate?new Date(F.endDate):void 0,progress:F.progress||0,status:F.columnId,priority:F.priority?.toLowerCase(),dependencies:Array.isArray(F.dependencies)?F.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Ie=react.useCallback(F=>{let{active:X}=F,R=e.cards.find(Y=>Y.id===X.id);R&&Oe({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Oe]),dt=react.useCallback(F=>{let{active:X,over:R}=F;if(!R||!e.cards.find(he=>he.id===X.id))return;let de=null;R.data.current?.type==="column"?de=R.id:R.data.current?.type==="card"&&(de=e.cards.find(Be=>Be.id===R.id)?.columnId||null),de&&de!==z.targetColumnId&&Oe({...z,targetColumnId:de});},[e.cards,z,Oe]),zt=react.useCallback(async F=>{let{active:X,over:R}=F;if(Oe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let Y=e.cards.find(j=>j.id===X.id);if(!Y)return;let de,he;if(R.data.current?.type==="column"){de=R.id;let j=mt.get(de)||[];he=Zl(j,0);}else {let j=e.cards.find(Ue=>Ue.id===R.id);if(!j)return;de=j.columnId;let ye=mt.get(de)||[],Ae=ye.findIndex(Ue=>Ue.id===R.id);he=Zl(ye,Ae);}let Be=e.columns.find(j=>j.id===de);if(Be&&Be.wipLimit&&Be.wipLimitType==="hard"){let j=mt.get(de)||[];if(Y.columnId!==de&&j.length>=Be.wipLimit){t.onWipLimitExceeded?.(Be,Y);return}}(Y.columnId!==de||Y.position!==he)&&await t.onCardMove?.(Y.id,de,he);},[e.cards,e.columns,mt,t,Oe]),Fe=react.useCallback(F=>{I||J(F),r?.(F),w?.(F.id);},[r,w,I]),nt=react.useCallback(F=>{t.onCardUpdate?.(F.id,F),J(F);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",Ze,o),style:l,children:jsxRuntime.jsx(xy,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",Ze,o),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(ju,{themeName:Pe,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",W?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:bt,collisionDetection:core$1.closestCorners,onDragStart:Ie,onDragOver:dt,onDragEnd:zt,children:[jsxRuntime.jsxs("div",{ref:He,className:g("asakaa-board",W?"flex-1":"",Ze,o),style:{...l,cursor:De?"grabbing":void 0},"data-theme":Pe,children:[e.columns.sort((F,X)=>F.position-X.position).map(F=>{let X=mt.get(F.id)||[],R=!$e.includes(F.id),Y=a?.renderColumnFooter?.(F);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Yo,{column:F,cards:X,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:Ce?(de,he)=>Ce(de,he):void 0,onCardClick:Fe,onCardUpdate:le,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?je:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),Y]},F.id)}),d]}),jsxRuntime.jsx(core$1.DragOverlay,{children:z.draggedCardId?jsxRuntime.jsx(An,{card:e.cards.find(F=>F.id===z.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),W]}),!I&&jsxRuntime.jsx(So,{task:We,isOpen:!!We,onClose:()=>J(null),onCardUpdate:nt,theme:ze?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:u,attachments:We?p?.get(We.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:Ve,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:B,timeEntries:T,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:D,onSoldEffortUpdate:V,onTimerStart:$,onTimerStop:ee,onTimerDiscard:L,blurFinancials:Le})]})}function xy({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var Ty={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ny={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Dy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Sy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ey({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n||a.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function My({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let p=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),!(r||a||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),u=async(p,f)=>{if(f){c(p);try{await f();}catch(x){console.error(`Export ${p} failed:`,x);}finally{c(null),o(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(p.id,p.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===p.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Py({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function xc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:d,toolbarEndContent:m}){let u=a==="dark"?Ty:Ny,p={...n==="es"?Dy:Sy,...i},f=o||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:u.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(My,{theme:u,t:p,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),m,t&&(s?jsxRuntime.jsx(Ey,{columns:e,onSelect:t,theme:u,t:p,createTaskLabel:r}):jsxRuntime.jsx(Py,{onClick:()=>t(),label:r||p.newTask}))]})})}function wc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let u=l.trim();u&&(e(u),c(""),o(false));},[l,e]),d=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(c(""),o(false));},[i]),m=react.useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:u=>c(u.target.value),onKeyDown:d,onBlur:m,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:g("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Hs({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[d,m]=react.useState(void 0),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(false),[y,v]=react.useState(false),[w,k]=react.useState(false),[M,B]=react.useState(s||new Date),T=react.useRef(null),C=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let D=react.useCallback(()=>{b(false),v(false),k(false);},[]),V=react.useCallback(()=>{i(""),m(void 0),p(null),x(null),D(),t();},[t,D]),$=f||s||new Date,ee=react.useCallback(()=>{let W=c.trim();if(!W)return;let Ce=r.find(z=>z.id===u),I=$;e({name:W,priority:d,assignee:Ce||void 0,assigneeId:u,startDate:I,endDate:I}),i(""),m(void 0),p(null),x(null),D(),T.current?.focus();},[c,d,u,$,r,e,D]),L=react.useCallback(W=>{W.key==="Enter"&&c.trim()&&(W.preventDefault(),ee()),W.key==="Escape"&&V();},[ee,V,c]),Le=$;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>D(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:c,onChange:W=>i(W.target.value),placeholder:C?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:L})}),jsxRuntime.jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:W=>{W.stopPropagation(),b(!h),v(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[{id:"urgent",label:C?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:C?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:C?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:C?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:C?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(W=>jsxRuntime.jsxs("button",{onClick:()=>{m(W.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===W.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",W.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:W.label})]},W.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:W=>{W.stopPropagation(),k(!w),b(false),v(false),B(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),Le.toLocaleDateString(C?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let W=new Date,Ce=new Date(W);Ce.setDate(W.getDate()+1);let I=new Date(W);I.setDate(W.getDate()+((6-W.getDay()+7)%7||7));let z=new Date(W);z.setDate(W.getDate()+((1-W.getDay()+7)%7||7));let Oe=new Date(W);Oe.setDate(W.getDate()+14);let We=new Date(W);We.setDate(W.getDate()+28);let J=C?"es-ES":"en-US";return [{label:C?"Hoy":"Today",date:W,display:W.toLocaleDateString(J,{weekday:"short"}).slice(0,3)+"."},{label:C?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(J,{weekday:"short"}).slice(0,3)+"."},{label:C?"Este fin de semana":"This weekend",date:I,display:C?"s\xE1b.":"sat."},{label:C?"Pr\xF3xima semana":"Next week",date:z,display:C?"lun.":"mon."},{label:C?"2 semanas":"2 weeks",date:Oe,display:Oe.toLocaleDateString(J,{day:"numeric",month:"short"})},{label:C?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(J,{day:"numeric",month:"short"})}].map((se,He)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(se.date),k(false);},children:[jsxRuntime.jsx("span",{children:se.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:se.display})]},He))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:g("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:M.toLocaleDateString(C?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:C?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(C?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(W=>jsxRuntime.jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:W},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let W=M.getFullYear(),Ce=M.getMonth(),I=new Date(W,Ce,1).getDay(),z=new Date(W,Ce+1,0).getDate(),Oe=new Date(W,Ce,0).getDate(),We=new Date().toDateString(),J=[];for(let se=I-1;se>=0;se--)J.push({dayNum:Oe-se,isCurrent:false,date:new Date(W,Ce-1,Oe-se)});for(let se=1;se<=z;se++)J.push({dayNum:se,isCurrent:true,date:new Date(W,Ce,se)});let De=42-J.length;for(let se=1;se<=De;se++)J.push({dayNum:se,isCurrent:false,date:new Date(W,Ce+1,se)});return J.map((se,He)=>{let Se=se.date.toDateString()===We,Pe=(f||s)?.toDateString()===se.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!se.isCurrent&&(a?"text-white/20":"text-gray-300"),se.isCurrent&&(a?"text-white":"text-gray-900"),Se&&"ring-1 ring-[#007FFF]",Pe&&"bg-[#007FFF] text-white",!Pe&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(se.date),k(false);},children:se.dayNum},He)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:W=>{W.stopPropagation(),v(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:u?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(W=>W.id===u)?.color||"#007FFF"},children:r.find(W=>W.id===u)?.initials||r.find(W=>W.id===u)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(null),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!u&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:a?"text-white/40":"text-gray-500",children:C?"Sin asignar":"Unassigned"})]}),r.map(W=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(W.id),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===W.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:W.color||"#007FFF"},children:W.initials||W.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:W.name})]},W.id)),r.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:C?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:ee,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:C?"Guardar":"Save"})]})]})}function Dc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=react.useState(false),d=react.useRef(null),m=react.useRef(null),[u,p]=react.useState({}),[f,x]=react.useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!d.current)return;let w=90,k=()=>{let M=d.current.getBoundingClientRect(),T=window.innerHeight-M.bottom<w+8;x(T),p({position:"fixed",...T?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),react.useEffect(()=>{if(!c)return;let w=k=>{let M=k.target;m.current&&!m.current.contains(M)&&d.current&&!d.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let v=react.useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:d,className:g("asakaa-add-card",a),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:u,className:g("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Hs,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Ws=class extends core.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=client.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(jsxRuntime.jsx(Zn,{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(s=>s.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(`
19
- `)}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,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Yp(e={}){return new Ws(e)}var Zo=class extends react.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:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function Sc(e,t){let r=a=>jsxRuntime.jsx(Zo,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Mc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:d=""}){let[m,u]=react.useState(false),[p,f]=react.useState(""),[x,h]=react.useState("home"),[b,y]=react.useState(""),[v,w]=react.useState("");react.useEffect(()=>{let T=C=>{(C.metaKey||C.ctrlKey)&&C.key===i&&(C.preventDefault(),u(P=>!P)),C.key==="Escape"&&(u(false),h("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),react.useEffect(()=>{m||(h("home"),f(""),y(""),w(""));},[m]);let k=react.useCallback(()=>{u(false);},[]),M=react.useCallback(T=>{let[C,P]=T.split(":");switch(C){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(r?.(P),k()):h("navigate");break;case "search":a?.(p),k();break;case "priority":h("priority");break;case "set-priority":v&&P&&(n?.(v,P),k());break;case "assign":h("assign");break;case "assign-user":v&&P&&(s?.(v,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[p,v,t,r,a,n,s,o,l,c,k]),B=react.useCallback(()=>{b&&p.trim()&&(t?.(b,p.trim()),k());},[b,p,t,k]);return m?jsxRuntime.jsx(or,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${d}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&x==="create-card"&&b&&B();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},T.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let C=e.columns.find(P=>P.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:M,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:C?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},T.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function Qp(e,t,r,a,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
18
+ `}),jsxRuntime.jsx("div",{ref:Hr,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((N,H)=>{let me=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,K=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return me.getTime()-K.getTime()}).map(N=>jsxRuntime.jsxs("div",{className:"flex gap-3",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsx("span",{className:g("text-sm font-medium",L?"text-white":"text-gray-900"),children:N.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:_r(N.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(yp,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(H=>{let me=H.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[me?jsxRuntime.jsx(lucideReact.Image,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:H.name})]},H.id)})})]})]},N.id))}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:g("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:g("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(hp,{value:Ie,onChange:Ue,onSubmit:sa,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:Ct,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:Dt,onFilesSelect:et,onRemoveFile:Ke})})]})]})]})})}function yc(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.dragStore.setState(a);},[]);return [e,r]}function eo({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:d,availableTags:m=[],onCreateTag:u,attachmentsByCard:p,onUploadAttachments:f,onDeleteAttachment:x,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:B,timeEntries:T,timerState:C,onLogTime:P,onUpdateEstimate:D,onUpdateSoldEffort:V,onStartTimer:$,onStopTimer:Z,onDiscardTimer:L,blurFinancials:Ae=false,sidePanel:W,renderColumnMetrics:Ce,suppressDetailModal:I=false}){let[z,Oe]=yc(),[ze,Q]=react.useState(null),[De,oe]=react.useState(false),He=react.useRef(null),Se=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Fe=n?.theme||"dark",Ge=Fe==="dark"||Fe==="neutral",Qe=Ge?"dark":"",se=react.useCallback((F,J)=>{t.onCardUpdate?.(F,J);},[t]),Ze=react.useCallback((F,J)=>{t.onColumnUpdate?.(F,{title:J});},[t]),_e=react.useCallback(F=>{t.onColumnDelete?.(F);},[t]),$e=["todo","in-progress","completed"],ft=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),pt=react.useMemo(()=>{let F=new Map;return e.columns.forEach(J=>{let R=J.cardIds.map(Y=>e.cards.find(ue=>ue.id===Y)).filter(Y=>Y!==void 0).sort((Y,ue)=>Y.position-ue.position);F.set(J.id,R);}),F},[e.cards,e.columns]);react.useEffect(()=>{let F=He.current;if(!F)return;let J=he=>{let Be=he.target,j=he.button===1,xe=Be===F||Be.classList.contains("asakaa-column")&&!Be.closest(".asakaa-card");(j||he.button===0&&xe&&!z.isDragging)&&(he.preventDefault(),oe(true),Se.current={x:he.clientX,y:he.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},F.style.cursor="grabbing",F.style.userSelect="none");},R=he=>{if(!De)return;let Be=he.clientX-Se.current.x,j=he.clientY-Se.current.y;F.scrollLeft=Se.current.scrollLeft-Be,F.scrollTop=Se.current.scrollTop-j;},Y=()=>{De&&(oe(false),F.style.cursor="",F.style.userSelect="");},ue=()=>{De&&(oe(false),F.style.cursor="",F.style.userSelect="");};return F.addEventListener("mousedown",J),document.addEventListener("mousemove",R),document.addEventListener("mouseup",Y),F.addEventListener("mouseleave",ue),()=>{F.removeEventListener("mousedown",J),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",Y),F.removeEventListener("mouseleave",ue);}},[De,z.isDragging]);let je=react.useMemo(()=>e.cards.map(F=>({id:F.id,name:F.title,startDate:F.startDate?new Date(F.startDate):void 0,endDate:F.endDate?new Date(F.endDate):void 0,progress:F.progress||0,status:F.columnId,priority:F.priority?.toLowerCase(),dependencies:Array.isArray(F.dependencies)?F.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),Re=react.useCallback(F=>{let{active:J}=F,R=e.cards.find(Y=>Y.id===J.id);R&&Oe({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Oe]),dt=react.useCallback(F=>{let{active:J,over:R}=F;if(!R||!e.cards.find(he=>he.id===J.id))return;let ue=null;R.data.current?.type==="column"?ue=R.id:R.data.current?.type==="card"&&(ue=e.cards.find(Be=>Be.id===R.id)?.columnId||null),ue&&ue!==z.targetColumnId&&Oe({...z,targetColumnId:ue});},[e.cards,z,Oe]),zt=react.useCallback(async F=>{let{active:J,over:R}=F;if(Oe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let Y=e.cards.find(j=>j.id===J.id);if(!Y)return;let ue,he;if(R.data.current?.type==="column"){ue=R.id;let j=pt.get(ue)||[];he=ec(j,0);}else {let j=e.cards.find(Ue=>Ue.id===R.id);if(!j)return;ue=j.columnId;let xe=pt.get(ue)||[],Ie=xe.findIndex(Ue=>Ue.id===R.id);he=ec(xe,Ie);}let Be=e.columns.find(j=>j.id===ue);if(Be&&Be.wipLimit&&Be.wipLimitType==="hard"){let j=pt.get(ue)||[];if(Y.columnId!==ue&&j.length>=Be.wipLimit){t.onWipLimitExceeded?.(Be,Y);return}}(Y.columnId!==ue||Y.position!==he)&&await t.onCardMove?.(Y.id,ue,he);},[e.cards,e.columns,pt,t,Oe]),Le=react.useCallback(F=>{I||Q(F),r?.(F),w?.(F.id);},[r,w,I]),st=react.useCallback(F=>{t.onCardUpdate?.(F.id,F),Q(F);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",Qe,o),style:l,children:jsxRuntime.jsx(xy,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",Qe,o),style:l,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxRuntime.jsxs(_u,{themeName:Fe,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",W?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ft,collisionDetection:core$1.closestCorners,onDragStart:Re,onDragOver:dt,onDragEnd:zt,children:[jsxRuntime.jsxs("div",{ref:He,className:g("asakaa-board",W?"flex-1":"",Qe,o),style:{...l,cursor:De?"grabbing":void 0},"data-theme":Fe,children:[e.columns.sort((F,J)=>F.position-J.position).map(F=>{let J=pt.get(F.id)||[],R=!$e.includes(F.id),Y=a?.renderColumnFooter?.(F);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Yo,{column:F,cards:J,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:Ce?(ue,he)=>Ce(ue,he):void 0,onCardClick:Le,onCardUpdate:se,onColumnRename:t.onColumnUpdate?Ze:void 0,onColumnDelete:t.onColumnDelete?_e:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),Y]},F.id)}),d]}),jsxRuntime.jsx(core$1.DragOverlay,{children:z.draggedCardId?jsxRuntime.jsx(An,{card:e.cards.find(F=>F.id===z.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),W]}),!I&&jsxRuntime.jsx(So,{task:ze,isOpen:!!ze,onClose:()=>Q(null),onCardUpdate:st,theme:Ge?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:u,attachments:ze?p?.get(ze.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:je,comments:h,onAddComment:b,currentUser:y,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:B,timeEntries:T,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:D,onSoldEffortUpdate:V,onTimerStart:$,onTimerStop:Z,onTimerDiscard:L,blurFinancials:Ae})]})}function xy({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var Ty={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ny={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Dy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Sy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ey({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n||a.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function My({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=react.useState(false),[l,c]=react.useState(null),i=react.useRef(null);if(react.useEffect(()=>{let p=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),!(r||a||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(p=>p.handler),u=async(p,f)=>{if(f){c(p);try{await f();}catch(x){console.error(`Export ${p} failed:`,x);}finally{c(null),o(false);}}};return jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((p,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(p.id,p.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===p.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):p.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Py({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:t})]})}function vc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:d,toolbarEndContent:m}){let u=a==="dark"?Ty:Ny,p={...n==="es"?Dy:Sy,...i},f=o||l||c;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:u.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(My,{theme:u,t:p,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),m,t&&(s?jsxRuntime.jsx(Ey,{columns:e,onSelect:t,theme:u,t:p,createTaskLabel:r}):jsxRuntime.jsx(Py,{onClick:()=>t(),label:r||p.newTask}))]})})}function kc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=react.useState(false),[l,c]=react.useState(""),i=react.useCallback(()=>{let u=l.trim();u&&(e(u),c(""),o(false));},[l,e]),d=react.useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(c(""),o(false));},[i]),m=react.useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsxRuntime.jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:l,onChange:u=>c(u.target.value),onKeyDown:d,onBlur:m,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{c(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:g("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Us({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=react.useState(""),[d,m]=react.useState(void 0),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(false),[y,v]=react.useState(false),[w,k]=react.useState(false),[M,B]=react.useState(s||new Date),T=react.useRef(null),C=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{T.current?.focus();},[]);let D=react.useCallback(()=>{b(false),v(false),k(false);},[]),V=react.useCallback(()=>{i(""),m(void 0),p(null),x(null),D(),t();},[t,D]),$=f||s||new Date,Z=react.useCallback(()=>{let W=c.trim();if(!W)return;let Ce=r.find(z=>z.id===u),I=$;e({name:W,priority:d,assignee:Ce||void 0,assigneeId:u,startDate:I,endDate:I}),i(""),m(void 0),p(null),x(null),D(),T.current?.focus();},[c,d,u,$,r,e,D]),L=react.useCallback(W=>{W.key==="Enter"&&c.trim()&&(W.preventDefault(),Z()),W.key==="Escape"&&V();},[Z,V,c]),Ae=$;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>D(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:T,type:"text",value:c,onChange:W=>i(W.target.value),placeholder:C?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:L})}),jsxRuntime.jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:W=>{W.stopPropagation(),b(!h),v(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[{id:"urgent",label:C?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:C?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:C?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:C?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:C?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(W=>jsxRuntime.jsxs("button",{onClick:()=>{m(W.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===W.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",W.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:W.label})]},W.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:W=>{W.stopPropagation(),k(!w),b(false),v(false),B(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),Ae.toLocaleDateString(C?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let W=new Date,Ce=new Date(W);Ce.setDate(W.getDate()+1);let I=new Date(W);I.setDate(W.getDate()+((6-W.getDay()+7)%7||7));let z=new Date(W);z.setDate(W.getDate()+((1-W.getDay()+7)%7||7));let Oe=new Date(W);Oe.setDate(W.getDate()+14);let ze=new Date(W);ze.setDate(W.getDate()+28);let Q=C?"es-ES":"en-US";return [{label:C?"Hoy":"Today",date:W,display:W.toLocaleDateString(Q,{weekday:"short"}).slice(0,3)+"."},{label:C?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(Q,{weekday:"short"}).slice(0,3)+"."},{label:C?"Este fin de semana":"This weekend",date:I,display:C?"s\xE1b.":"sat."},{label:C?"Pr\xF3xima semana":"Next week",date:z,display:C?"lun.":"mon."},{label:C?"2 semanas":"2 weeks",date:Oe,display:Oe.toLocaleDateString(Q,{day:"numeric",month:"short"})},{label:C?"4 semanas":"4 weeks",date:ze,display:ze.toLocaleDateString(Q,{day:"numeric",month:"short"})}].map((oe,He)=>jsxRuntime.jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),k(false);},children:[jsxRuntime.jsx("span",{children:oe.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:oe.display})]},He))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:g("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:M.toLocaleDateString(C?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:C?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>B(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(C?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(W=>jsxRuntime.jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:W},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let W=M.getFullYear(),Ce=M.getMonth(),I=new Date(W,Ce,1).getDay(),z=new Date(W,Ce+1,0).getDate(),Oe=new Date(W,Ce,0).getDate(),ze=new Date().toDateString(),Q=[];for(let oe=I-1;oe>=0;oe--)Q.push({dayNum:Oe-oe,isCurrent:false,date:new Date(W,Ce-1,Oe-oe)});for(let oe=1;oe<=z;oe++)Q.push({dayNum:oe,isCurrent:true,date:new Date(W,Ce,oe)});let De=42-Q.length;for(let oe=1;oe<=De;oe++)Q.push({dayNum:oe,isCurrent:false,date:new Date(W,Ce+1,oe)});return Q.map((oe,He)=>{let Se=oe.date.toDateString()===ze,Fe=(f||s)?.toDateString()===oe.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(a?"text-white/20":"text-gray-300"),oe.isCurrent&&(a?"text-white":"text-gray-900"),Se&&"ring-1 ring-[#007FFF]",Fe&&"bg-[#007FFF] text-white",!Fe&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),k(false);},children:oe.dayNum},He)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:W=>{W.stopPropagation(),v(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:u?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(W=>W.id===u)?.color||"#007FFF"},children:r.find(W=>W.id===u)?.initials||r.find(W=>W.id===u)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(null),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!u&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:a?"text-white/40":"text-gray-500",children:C?"Sin asignar":"Unassigned"})]}),r.map(W=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{p(W.id),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===W.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:W.color||"#007FFF"},children:W.initials||W.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:W.name})]},W.id)),r.length===0&&jsxRuntime.jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:C?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:Z,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:C?"Guardar":"Save"})]})]})}function Sc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=react.useState(false),d=react.useRef(null),m=react.useRef(null),[u,p]=react.useState({}),[f,x]=react.useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!d.current)return;let w=90,k=()=>{let M=d.current.getBoundingClientRect(),T=window.innerHeight-M.bottom<w+8;x(T),p({position:"fixed",...T?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),react.useEffect(()=>{if(!c)return;let w=k=>{let M=k.target;m.current&&!m.current.contains(M)&&d.current&&!d.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let v=react.useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxRuntime.jsxs("div",{ref:d,className:g("asakaa-add-card",a),children:[jsxRuntime.jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:u,className:g("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Us,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var zs=class extends core.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=client.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(jsxRuntime.jsx(eo,{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(s=>s.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(`
19
+ `)}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,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Xp(e={}){return new zs(e)}var Zo=class extends react.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:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function Ec(e,t){let r=a=>jsxRuntime.jsx(Zo,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Pc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:d=""}){let[m,u]=react.useState(false),[p,f]=react.useState(""),[x,h]=react.useState("home"),[b,y]=react.useState(""),[v,w]=react.useState("");react.useEffect(()=>{let T=C=>{(C.metaKey||C.ctrlKey)&&C.key===i&&(C.preventDefault(),u(P=>!P)),C.key==="Escape"&&(u(false),h("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),react.useEffect(()=>{m||(h("home"),f(""),y(""),w(""));},[m]);let k=react.useCallback(()=>{u(false);},[]),M=react.useCallback(T=>{let[C,P]=T.split(":");switch(C){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(r?.(P),k()):h("navigate");break;case "search":a?.(p),k();break;case "priority":h("priority");break;case "set-priority":v&&P&&(n?.(v,P),k());break;case "assign":h("assign");break;case "assign-user":v&&P&&(s?.(v,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[p,v,t,r,a,n,s,o,l,c,k]),B=react.useCallback(()=>{b&&p.trim()&&(t?.(b,p.trim()),k());},[b,p,t,k]);return m?jsxRuntime.jsx(nr,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${d}`,onClick:T=>T.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:p,onValueChange:f,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&x==="create-card"&&b&&B();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:C},C))})]},T.id))})]}),x==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${T.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:T.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),x==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let C=e.columns.find(P=>P.id===T.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${T.id}`,onSelect:M,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:T.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:C?.title})]}),T.labels&&T.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},T.id)})})]}),x==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function Zp(e,t,r,a,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
20
20
  position: fixed !important;
21
21
  inset: 0 !important;
22
22
  z-index: 2147483647 !important;
@@ -82,7 +82,7 @@
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(m),o.appendChild(u),o.appendChild(p);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function jy(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 _y(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 Fc(e){return e.startsWith("image/")}function es({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=react.useState(false),[c,i]=react.useState(false),[d,m]=react.useState(null),u=react.useRef(null),p=react.useRef(e);p.current=e;let f=react.useCallback((T,C)=>{C.preventDefault(),C.stopPropagation();let P=p.current.filter($=>Fc($.type)),D=P.findIndex($=>$.id===T.id),V=$=>{let ee=p.current.filter(Le=>Fc(Le.type)),L=ee[$];L&&Qp(L.url,L.name,ee,$,V);};Qp(T.url,T.name,P,D,V);},[]),x=react.useCallback(T=>{let C=[],P=[];return e.length+T.length>s?(P.push(`Maximum ${s} files allowed`),{valid:C,errors:P}):(T.forEach(D=>{if(D.size/1048576>a){P.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some($=>D.type.match($))){P.push(`${D.name} has invalid file type`);return}C.push(D);}),{valid:C,errors:P})},[e.length,s,a,n]),h=react.useCallback(async T=>{let{valid:C,errors:P}=x(T);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(C.length!==0){i(true),m(null);try{await t?.(C);}catch(D){m(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),v=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let C=Array.from(T.dataTransfer.files);h(C);},[h]),k=react.useCallback(T=>{let C=T.target.files?Array.from(T.target.files):[];h(C),u.current&&(u.current.value="");},[h]),M=react.useCallback(()=>{u.current?.click();},[]),B=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&r?.(T);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:v,onDrop:w,onClick:M,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Fc(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:C=>f(T,C),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:_y(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:jy(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>B(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function ex({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Ac({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ex,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function cx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Ic({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(cx,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var yx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},sm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function xx({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,l=e+o*Math.cos(-r*(Math.PI/180)),c=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function im({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 jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Rc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||yx[c.name]||sm[e.indexOf(c)%sm.length]})),l=o.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?xx:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(im,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let d=i.payload,m=s>0?(d.value/s*100).toFixed(0):"0";return `${c} (${d.value} - ${m}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(im,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var ji=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,l]=react.useState(false),[c,i]=react.useState(false),[d,m]=react.useState(false),[u,p]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},y=w=>{let k=new Set;e.forEach(B=>{B.labels?.forEach(T=>k.add(T));});let M=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(f,{labels:M}),p(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsxRuntime.jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});ji.displayName="BulkOperationsToolbar";function Tx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,l,c,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(p=>{let f=r?.find(x=>x.id===p);o=`assignee-${p}`,l=f?.name||`User ${p}`,c=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:l,groupValue:p,cardIds:[],color:c,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=u.title,c=u.color,a.has(o)||a.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{o=`label-${p}`,l=p,c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:p,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Bc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p}){let[f,x]=react.useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),h=react.useMemo(()=>s||Tx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:l,config:c,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p},y=react.useCallback(v=>{x(w=>{let k=new Set(w);return k.has(v)?k.delete(v):k.add(v),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsxRuntime.jsx(Zn,{board:e,className:n,...b}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(v=>{let w=f.has(v.id),k=e.cards.filter(B=>v.cardIds.includes(B.id)),M={...e,cards:k};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>y(v.id)}):jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&y(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(Zn,{board:M,...b})})]},v.id)}),h.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var $c=[{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 Oc({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),l=$c.find(i=>i.value===e)||$c[0];react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:$c.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Gs=[{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 Sx(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||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function pm(e={}){let{shortcuts:t=Gs,enabled:r=true,preventDefault:a=true}=e,n=react.useRef(t),s=react.useRef(r);react.useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=react.useCallback(c=>{n.current=[...n.current,c];},[]),l=react.useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(Sx(i,m)){a&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:o,unregisterShortcut:l,isEnabled:r}}function Mx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Px(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 Fx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Px(e),a=t?Mx(t):"";return r?`${r} + ${a}`:a}function Lx(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 Hc({shortcuts:e=Gs,isOpen:t,onClose:r,className:a}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.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 o=Lx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Fx(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Uc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
85
+ `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(m),o.appendChild(u),o.appendChild(p);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function jy(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 _y(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 Lc(e){return e.startsWith("image/")}function es({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=react.useState(false),[c,i]=react.useState(false),[d,m]=react.useState(null),u=react.useRef(null),p=react.useRef(e);p.current=e;let f=react.useCallback((T,C)=>{C.preventDefault(),C.stopPropagation();let P=p.current.filter($=>Lc($.type)),D=P.findIndex($=>$.id===T.id),V=$=>{let Z=p.current.filter(Ae=>Lc(Ae.type)),L=Z[$];L&&Zp(L.url,L.name,Z,$,V);};Zp(T.url,T.name,P,D,V);},[]),x=react.useCallback(T=>{let C=[],P=[];return e.length+T.length>s?(P.push(`Maximum ${s} files allowed`),{valid:C,errors:P}):(T.forEach(D=>{if(D.size/1048576>a){P.push(`${D.name} is too large (max ${a}MB)`);return}if(n&&!n.some($=>D.type.match($))){P.push(`${D.name} has invalid file type`);return}C.push(D);}),{valid:C,errors:P})},[e.length,s,a,n]),h=react.useCallback(async T=>{let{valid:C,errors:P}=x(T);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(C.length!==0){i(true),m(null);try{await t?.(C);}catch(D){m(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),y=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),v=react.useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=react.useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let C=Array.from(T.dataTransfer.files);h(C);},[h]),k=react.useCallback(T=>{let C=T.target.files?Array.from(T.target.files):[];h(C),u.current&&(u.current.value="");},[h]),M=react.useCallback(()=>{u.current?.click();},[]),B=react.useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&r?.(T);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:v,onDrop:w,onClick:M,children:[jsxRuntime.jsx("input",{ref:u,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:n?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(T=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Lc(T.type)&&T.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:C=>f(T,C),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:_y(T.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:jy(T.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>B(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function ex({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," cards"]},a))]})}function Ic({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(recharts.LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(ex,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function cx({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsxRuntime.jsx("strong",{children:r.value})," tasks"]},a))]})}function Rc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:jsxRuntime.jsxs(n?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(cx,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var yx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},im=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function xx({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,l=e+o*Math.cos(-r*(Math.PI/180)),c=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsxRuntime.jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function lm({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 jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:r.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[n,"%"]})]})]})}function Bc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||yx[c.name]||im[e.indexOf(c)%im.length]})),l=o.map(c=>c.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?xx:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(lm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let d=i.payload,m=s>0?(d.value/s*100).toFixed(0):"0";return `${c} (${d.value} - ${m}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(lm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,i)=>jsxRuntime.jsx(recharts.Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var _i=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,l]=react.useState(false),[c,i]=react.useState(false),[d,m]=react.useState(false),[u,p]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},y=w=>{let k=new Set;e.forEach(B=>{B.labels?.forEach(T=>k.add(T));});let M=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(f,{labels:M}),p(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsxRuntime.jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),c&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});_i.displayName="BulkOperationsToolbar";function Tx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,l,c,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(p=>{let f=r?.find(x=>x.id===p);o=`assignee-${p}`,l=f?.name||`User ${p}`,c=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:l,groupValue:p,cardIds:[],color:c,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=u.title,c=u.color,a.has(o)||a.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(p=>{o=`label-${p}`,l=p,c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:p,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function $c({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p}){let[f,x]=react.useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),h=react.useMemo(()=>s||Tx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:l,config:c,onCardClick:i,suppressDetailModal:d,availableTags:m,attachmentsByCard:u,renderColumnMetrics:p},y=react.useCallback(v=>{x(w=>{let k=new Set(w);return k.has(v)?k.delete(v):k.add(v),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsxRuntime.jsx(eo,{board:e,className:n,...b}):jsxRuntime.jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(v=>{let w=f.has(v.id),k=e.cards.filter(B=>v.cardIds.includes(B.id)),M={...e,cards:k};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>y(v.id)}):jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&y(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(eo,{board:M,...b})})]},v.id)}),h.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Oc=[{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 Hc({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),l=Oc.find(i=>i.value===e)||Oc[0];react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:l.icon}),jsxRuntime.jsx("span",{children:l.label}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Oc.map(i=>jsxRuntime.jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Vs=[{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 Sx(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||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function mm(e={}){let{shortcuts:t=Vs,enabled:r=true,preventDefault:a=true}=e,n=react.useRef(t),s=react.useRef(r);react.useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=react.useCallback(c=>{n.current=[...n.current,c];},[]),l=react.useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return react.useEffect(()=>{function c(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(Sx(i,m)){a&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:o,unregisterShortcut:l,isEnabled:r}}function Mx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Px(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 Fx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Px(e),a=t?Mx(t):"";return r?`${r} + ${a}`:a}function Lx(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 Uc({shortcuts:e=Vs,isOpen:t,onClose:r,className:a}){let[n,s]=react.useState(false);if(react.useEffect(()=>{s(true);},[]),react.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 o=Lx(e);return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxRuntime.jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsxRuntime.jsx("button",{onClick:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,c])=>c.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsxRuntime.jsx("div",{className:"space-y-3",children:c.map(i=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Fx(i)})]},i.action))})]},l))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Wc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
86
86
  1.
87
87
 
88
88
  **Expected behavior:**
@@ -122,12 +122,12 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Wc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.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,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,d])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:d.map(m=>jsxRuntime.jsxs("button",{onClick:()=>l(m),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Gc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,l]=react.useState("export"),[c,i]=react.useState("json"),[d,m]=react.useState(null),u=react.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,h=await Ou(e,c,x);Hu(h,c);},f=async x=>{let h=x.target.files?.[0];if(h){try{let b=await zu(h),y=h.name.endsWith(".json")?"json":"csv",v=Wu(b,y);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick: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"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[o==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var $x=["URGENT","HIGH","MEDIUM","LOW"],Ox=[{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"}],Hx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Vc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,h]=react.useState(true),b=react.useCallback(M=>{r({search:M.target.value});},[r]),y=react.useCallback(M=>{r({dateFilter:M.target.value});},[r]),v=react.useCallback(M=>{a({by:M.target.value});},[a]),w=react.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[m&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let B=M.target.value;r({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),$x.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let B=M.target.value;r({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let B=M.target.value;r({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Ox.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Hx.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function jc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:m,children:[jsxRuntime.jsxs("button",{onClick:()=>d(!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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>u(()=>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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var _c={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:"#00E5CC",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"}},Kc={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:"#00E5CC",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"}},qc={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"}},Mo={dark:_c,light:Kc,neutral:qc},Ki="dark";var qi=react.createContext(void 0),Yx="asakaa-theme";function fm({children:e,defaultTheme:t=Ki,storageKey:r=Yx}){let[a,n]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Mo[a];Object.entries(c.colors).forEach(([d,m])=>{m&&l.style.setProperty(`--theme-${Xx(d)}`,m);}),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(([d,m])=>{let u=c.colors[d];u&&l.style.setProperty(m,u);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:Mo};return jsxRuntime.jsx(qi.Provider,{value:o,children:e})}function as(){let e=react.useContext(qi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Xx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Yc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=as();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Mo).map(([s,o])=>jsxRuntime.jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:o.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),a===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var it={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function bm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return it[e]||it.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",it[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",it[e].bgSecondary),bgGrid:a("--theme-bg-card",it[e].bgGrid),bgWeekend:a("--theme-bg-hover",it[e].bgWeekend),border:a("--theme-border-primary",it[e].border),borderLight:a("--theme-border-subtle",it[e].borderLight),textPrimary:a("--theme-text-primary",it[e].textPrimary),textSecondary:a("--theme-text-secondary",it[e].textSecondary),textTertiary:a("--theme-text-tertiary",it[e].textTertiary),accent:a("--theme-accent-primary",it[e].accent),accentHover:a("--theme-accent-hover",it[e].accentHover),accentLight:a("--theme-accent-primary",it[e].accentLight),taskBarPrimary:a("--theme-accent-primary",it[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",it[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",it[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",it[e].dependency),dependencyHover:a("--theme-border-secondary",it[e].dependencyHover),criticalPath:a("--theme-error",it[e].criticalPath),criticalPathLight:a("--theme-error",it[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",it[e].today):e==="neutral"?a("--theme-text-primary",it[e].today):a("--theme-error",it[e].today),todayLight:e==="light"?a("--theme-accent-primary",it[e].todayLight):e==="neutral"?a("--theme-text-primary",it[e].todayLight):a("--theme-error",it[e].todayLight),milestone:a("--theme-warning",it[e].milestone),milestoneLight:a("--theme-warning",it[e].milestoneLight),statusTodo:a("--theme-text-tertiary",it[e].statusTodo),statusInProgress:a("--theme-accent-primary",it[e].statusInProgress),statusCompleted:a("--theme-success",it[e].statusCompleted),hoverBg:a("--theme-bg-hover",it[e].hoverBg),focusRing:a("--theme-accent-primary",it[e].focusRing),...it[e].dotGrid&&{dotGrid:it[e].dotGrid},...it[e].glassHeader&&{glassHeader:it[e].glassHeader},...it[e].glassToolbar&&{glassToolbar:it[e].glassToolbar},...it[e].forecastHud&&{forecastHud:it[e].forecastHud},...it[e].neonRedGlow&&{neonRedGlow:it[e].neonRedGlow},...it[e].executionBarBg&&{executionBarBg:it[e].executionBarBg}}}var Yi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},hm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Xc={en:Yi,es:hm};function ym(e){return Xc[e]||Xc.en}function Jc(e,t){let r=ym(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var os=react.createContext(Yi);function Ka(){return react.useContext(os)}function _s(e,t,r="left",a=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;r==="right"?c=o.right-a:c=o.left;let i=8;c+a>window.innerWidth-i&&(c=window.innerWidth-i-a),c<i&&(c=i),s({top:l,left:c});},[t,r,e,a]),n}function Sm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=react.useState(false),[i,d]=react.useState(null),m=react.useRef(null),u=react.useRef(null),p=Ka(),f=_s(m,l,"right",176);if(react.useEffect(()=>{if(!l)return;let y=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||r||a||n||s||o))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),b=async(y,v)=>{if(v){d(y);try{await v();}catch(w){console.error(`Export ${y} failed:`,w);}finally{d(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:m,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:u,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((y,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function vm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=react.useState(false),[c,i]=react.useState(null),[d,m]=react.useState(false),u=react.useRef(null),p=react.useRef(null),f=Ka(),x=_s(u,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let k=M=>{let B=M.target;u.current&&!u.current.contains(B)&&p.current&&!p.current.contains(B)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(k=>k.handler),v=async(k,M)=>{if(M){i(k);try{await M();}catch(B){console.error(`Export ${k} failed:`,B);}finally{i(null),l(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((k,M)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function yv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] 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&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,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}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function xv({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function wm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=react.useState(false),o=react.useRef(null),l=react.useRef(null),c=Ka(),i=_s(o,n,"left");react.useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(u.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:p<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function km({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=Ka(),d=_s(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,h=()=>f.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function vv({value:e,onChange:t,theme:r}){let a=Ka(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let l=e===o.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function wv({theme:e,forecast:t}){let r=Ka(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function kv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=react.useState(false),f=react.useRef(null),x=react.useRef(null),h=Ka(),b=_s(f,u,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!u)return;let M=B=>{let T=B.target;f.current&&!f.current.contains(T)&&x.current&&!x.current.contains(T)&&p(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]);let v=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((M,B)=>{let T=M.icon,C=M.disabled,P=M.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!C&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:C?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:C?"not-allowed":"pointer"},whileHover:C?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:B*.03},title:P,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:C?y?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,B)=>{let T=i===M.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+B)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Xi({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:y,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:k="execution",onViewModeChange:M,projectForecast:B,hideForecastHud:T,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportCSV:V,onExportJSON:$,onExportMSProject:ee,showCriticalPath:L=true,onShowCriticalPathChange:Le,showDependencies:W=true,onShowDependenciesChange:Ce,highlightWeekends:I=true,onHighlightWeekendsChange:z,showBaseline:Oe=false,onShowBaselineChange:We,onCopySnapshotLink:J,hasDependencies:De=true}){let se=Ka(),He=C||P||D||V||$||ee,Se=!!e.glassToolbar,Pe=[{value:"day",label:se.toolbar.day},{value:"week",label:se.toolbar.week},{value:"month",label:se.toolbar.month}],ze=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Ze=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let le=Ze?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:M&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Ze?"#000000":e.bgSecondary,border:`1px solid ${Ze?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?Ze?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:se.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?Ze?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:k==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:se.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(vv,{value:t,onChange:r,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),v&&jsxRuntime.jsx(wm,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsx(km,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),jsxRuntime.jsx(kv,{theme:e,showCriticalPath:L,onShowCriticalPathChange:Le,showBaseline:Oe,onShowBaselineChange:We,highlightWeekends:I,onHighlightWeekendsChange:z,showDependencies:W,onShowDependenciesChange:Ce,rowDensity:l,onRowDensityChange:c,hasDependencies:De}),jsxRuntime.jsx(vm,{theme:e,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),d&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Ze?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Ze?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||se.toolbar.createTask})]})]})]}),B&&!T&&jsxRuntime.jsx(wv,{theme:e,forecast:B})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(xv,{options:Pe,value:t,onChange:le=>r(le),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(wm,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(km,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||se.toolbar.createTask})]}),(He||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(vm,{theme:e,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportMSProject:ee,onCopySnapshotLink:J}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(yv,{options:ze,value:s,onChange:le=>o(le),theme:e})]})]})}function Ji({columns:e,onToggleColumn:t,theme:r}){let[a,n]=react.useState(false),[s,o]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!a)return;let d=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let d=c.current.getBoundingClientRect();o({x:d.left,y:d.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(or,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.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(d=>jsxRuntime.jsxs("button",{onClick:()=>{t(d.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:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:d.label}),d.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function ls({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=react.useRef(null),[l,c]=react.useState({x:t,y:r});if(react.useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,h=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(h=f-m-u,h<u&&(h=u)),c({x,y:h});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(d=>jsxRuntime.jsxs("div",{children:[d.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var rr={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Im({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=react.useRef(false),f=react.useCallback(v=>{p.current=v;},[]),x=react.useCallback(v=>{let w=[],k=M=>{for(let B of M)w.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&k(B.subtasks);};return k(v),w},[]),h=react.useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=react.useCallback((v,w)=>{let k=x(e);if(k.length===0)return;let M=h();if(!M){r(k[0].id,false);return}let B=k.findIndex(P=>P.id===M.id);if(B===-1)return;let T=v==="up"?B-1:B+1;if(T<0||T>=k.length)return;let C=k[T];r(C.id,w);},[e,h,x,r]),y=react.useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,T=Array.from(t),C=h();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(C&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){C.subtasks&&C.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!C.isExpanded||v.key==="ArrowLeft"&&C.isExpanded)&&d(C.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){T.length>0&&(v.preventDefault(),o(T,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){T.length>0&&(v.preventDefault(),l(T));return}if(v.key==="Tab"&&v.shiftKey){T.length>0&&(v.preventDefault(),c(T));return}if(v.key==="Enter"&&!v.shiftKey&&!B){C&&(v.preventDefault(),a(C.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!B){C&&(v.preventDefault(),a(C.id,"above"));return}if(v.key==="Enter"&&B){C&&(v.preventDefault(),m(C.id));return}if(v.key==="F2"){C&&(v.preventDefault(),i(C.id));return}if(v.key==="Delete"||v.key==="Backspace"&&B){T.length>0&&(v.preventDefault(),n(T));return}if(v.key==="d"&&B&&!v.shiftKey){T.length>0&&(v.preventDefault(),s(T));return}},[u,t,h,b,a,n,s,o,l,c,i,d,m]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[u,y]),{setIsEditing:f}}function Bm(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=react.useCallback(u=>{r(new Set([u])),n(u);},[]),o=react.useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),l=react.useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let h=Math.min(f,x),b=Math.max(f,x),y=p.slice(h,b+1);r(new Set(y)),n(u);},[a,s]),c=react.useCallback((u,p,f,x)=>{x?l(u,p):f?o(u):s(u);},[s,o,l]),i=react.useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=react.useCallback(()=>{r(new Set),n(null);},[]),m=react.useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function rd(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function Fo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,s+1);}};return r(e),t}function cs(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=cs(r.subtasks,t);if(a)return a}}return null}function td(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=td(r.subtasks,t);if(a)return a}return null}function ad(e,t){if(t.length===0)return e;let r=Fo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(h=>{if(p.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,p);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,p,f)}:x),c=new Set(t),{tasks:i,removed:d}=o(e,c),m=l(i,s.id,d);return rd(m)}function nd(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=td(r,a);if(!n)continue;let s=td(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},l=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&l(p.subtasks,d,m);return i},c=o(r,n.id,a);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(r,n.id,c));}return rd(r)}function od(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(m=>m.id===l);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,l,c))return true;return false}let d=c==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function sd(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function qs(e,t){let r=[...e],a=[];for(let n of t){let s=(c,i)=>c.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=c=>{let i=c.findIndex(p=>p.id===n);if(i===-1){for(let p of c)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=c[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return c.splice(i+1,0,u),u},l=o(r);l&&a.push(l);}return {tasks:r,duplicatedTasks:a}}function $m(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(m=>m.id===t);if(i===-1){for(let m of c)if(m.subtasks&&l(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return c.splice(d,0,o),true};return l(a),{tasks:a,newTask:o}}function id(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:id(a.subtasks,t,r)}:a)}function ld(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ld(r.subtasks,t)}:r)}function cd(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,l=a?.endDate||s,c=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=c(p.subtasks);if(f>=0)return f}}return 0},i=c(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Om(e,t,r,a){if(t===r)return e;let n=cs(e,t);if(!n)return e;if(r){let l=(c,i)=>{if(!c.subtasks)return false;for(let d of c.subtasks)if(d.id===i||l(d,i))return true;return false};if(l(n,r))return e}let s=l=>{let c=l.filter(d=>d.id!==t),i=c.length<l.length;return c.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let l=a!==void 0?a:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function qa(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=qa(t.subtasks),a=r.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((l,c)=>l+c,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Zi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:B,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:P,onTaskReparent:D,allTasks:V,scrollContainerRef:$,showCriticalPath:ee=false}){let L=react.useContext(os),[Le,W]=react.useState(null),[Ce,I]=react.useState(null),[z,Oe]=react.useState(""),We=react.useRef(null),[J,De]=react.useState(null),[se,He]=react.useState(0),[Se,Pe]=react.useState(0),[ze,Ze]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[le,tt]=react.useState(null),[je,$e]=react.useState(null),[bt,mt]=react.useState(null),Ve=react.useRef(0),Ie=5,dt=react.useRef(false),[zt,Fe]=react.useState(null),[nt,F]=react.useState(false),X=react.useRef(null),[R,Y]=react.useState(null),[de,he]=react.useState(null),[Be,j]=react.useState(false),ye=react.useRef(null);react.useEffect(()=>{function ne(ue){ye.current&&!ye.current.contains(ue.target)&&j(false);}if(Be)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[Be]),react.useEffect(()=>{Ce&&We.current&&(We.current.focus(),We.current.select());},[Ce]),react.useEffect(()=>{if(!J)return;let ne=ft=>{let _=ft.clientX-se,fe=Se+_;f?.(J,fe);},ue=()=>{De(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[J,se,Se,f]);let{selectedTaskIds:Ae,handleTaskClick:Ue,isTaskSelected:kt}=Bm(l),{setIsEditing:Ye}=Im({tasks:e,selectedTaskIds:Ae,onTaskSelect:(ne,ue)=>{let _=Fo(e).map(fe=>fe.id);Ue(ne,_,ue||false,false),o?.(ne);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ne=>{let ue=Fo(e).find(ft=>ft.id===ne);ue&&wr(ue);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ne=>{let ue=Fo(e).find(ft=>ft.id===ne);ue&&C&&C(ue);},enableKeyboard:true}),Nt=(ne,ue=0,ft="")=>{let _=[],fe=[...ne].sort((Z,O)=>(Z.position??0)-(O.position??0));for(let Z=0;Z<fe.length;Z++){let O=fe[Z],re=Z+1,ve=ft?`${ft}.${re}`:`${re}.0`,N=O.wbsCode||ve;if(O.wbsCode=N,_.push({task:O,level:ue}),O.subtasks&&O.subtasks.length>0&&O.isExpanded){let me=O.wbsCode?.replace(/\.0$/,"")||(ft?`${ft}.${re}`:`${re}`);_.push(...Nt(O.subtasks,ue+1,me));}}return _},gt=Nt(e),Jt=48,vr=Math.max(gt.length*r,600-Jt),Mr=(ne,ue)=>ue==="assignees"?ne.assignees:ue==="startDate"?ne.startDate:ne.endDate,Rt=(ne,ue,ft,_)=>{ne.preventDefault(),ne.stopPropagation(),Y({sourceTaskId:ue,column:ft,sourceIndex:_,targetIndex:_}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=ne.currentTarget.closest("[data-grid-body]"),Z=we=>{let ot=fe?.getBoundingClientRect().top??0,ae=Math.floor((we-ot)/r);return ae=Math.max(0,Math.min(gt.length-1,ae)),ae<_&&(ae=_),ae},O=ne.clientY,re=$?.current??null,ve=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},N=()=>{let we=Z(O);Y(ot=>ot&&{...ot,targetIndex:we});},H=()=>{if(ve(),!re)return;let we=re.getBoundingClientRect(),ot=60,ae=12,lt=O-we.top,st=we.bottom-O;if(st<ot&&re.scrollTop<re.scrollHeight-re.clientHeight){let Bt=Math.max(1,Math.round(ae*(1-Math.max(0,st)/ot))),gr=()=>{re.scrollTop+=Bt,N(),re.scrollTop<re.scrollHeight-re.clientHeight&&(X.current=requestAnimationFrame(gr));};X.current=requestAnimationFrame(gr);}else if(lt<ot&&re.scrollTop>0){let Bt=Math.max(1,Math.round(ae*(1-Math.max(0,lt)/ot))),gr=()=>{re.scrollTop-=Bt,N(),re.scrollTop>0&&(X.current=requestAnimationFrame(gr));};X.current=requestAnimationFrame(gr);}},me=we=>{O=we.clientY,N(),H();},K=we=>{window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",K),ve(),document.body.style.cursor="",document.body.style.userSelect="",Y(null);let ot=Z(we.clientY),ae=gt.find(_r=>_r.task.id===ue)?.task;if(!ae)return;let lt=Mr(ae,ft),st=Math.min(_,ot),Bt=Math.max(_,ot),gr=[];for(let _r=st;_r<=Bt;_r++){if(_r===_)continue;let Ur=gt[_r]?.task;!Ur||Ur.subtasks&&Ur.subtasks.length>0||gr.push(Ur.id);}gr.length!==0&&h?.(gr,ft,lt);};window.addEventListener("mousemove",me),window.addEventListener("mouseup",K);},Hr=ne=>{if(!R)return false;let ue=Math.min(R.sourceIndex,R.targetIndex),ft=Math.max(R.sourceIndex,R.targetIndex);return ne>=ue&&ne<=ft},$t=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,wr=ne=>{I(ne.id),Oe(ne.name),Ye(true);},Gt=ne=>{z.trim()&&z!==e.find(ue=>ue.id===ne)?.name&&B?.(ne,z.trim()),I(null),Oe(""),Ye(false);},Qt=()=>{I(null),Oe(""),Ye(false);},Vr=(ne,ue)=>{ue.stopPropagation(),T?.(ne.id);},wa=(ne,ue)=>{ue.preventDefault(),Ve.current=ue.clientY,tt(ne),dt.current=false,F(false),Fe({x:ue.clientX,y:ue.clientY});},et=ne=>{if(!le||(Math.abs(ne.clientY-Ve.current)>Ie&&!dt.current&&(dt.current=true,F(true)),Fe({x:ne.clientX,y:ne.clientY}),!dt.current))return;if($?.current){let Z=$.current,O=Z.getBoundingClientRect(),re=60,ve=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let N=ne.clientY-O.top,H=O.bottom-ne.clientY;if(N<re&&Z.scrollTop>0){let me=Math.round(ve*(1-N/re)),K=()=>{Z.scrollTop-=me,dt.current&&Z.scrollTop>0&&(X.current=requestAnimationFrame(K));};X.current=requestAnimationFrame(K);}else if(H<re&&Z.scrollTop<Z.scrollHeight-Z.clientHeight){let me=Math.round(ve*(1-H/re)),K=()=>{Z.scrollTop+=me,dt.current&&Z.scrollTop<Z.scrollHeight-Z.clientHeight&&(X.current=requestAnimationFrame(K));};X.current=requestAnimationFrame(K);}}let ft=document.querySelectorAll("[data-task-row]"),_=null,fe=null;ft.forEach(Z=>{let O=Z.getBoundingClientRect(),re=Z.getAttribute("data-task-row");if(re&&re!==le&&ne.clientY>=O.top&&ne.clientY<=O.bottom){_=re;let ve=ne.clientY-O.top,N=O.height;ve<N*.25?fe="above":ve>N*.75?fe="below":fe="child";}}),$e(_),mt(fe);},_e=()=>{if(dt.current&&le&&je&&bt){if(bt==="child")D?.(le,je);else if(bt==="above"||bt==="below"){let ne=(Z,O,re=null)=>{for(let ve of Z){if(ve.id===O)return re;if(ve.subtasks){let N=ne(ve.subtasks,O,ve.id);if(N!==void 0)return N}}},ue=V&&V.length>0?V:e,ft=ne(ue,le,null),_=ne(ue,je,null),fe=(Z,O,re,ve)=>{let N=Z.findIndex(K=>K.id===O),H=ve?Z.findIndex(K=>K.id===re):-1,me=bt==="below"?N+1:N;return ve&&H!==-1&&H<N&&(me-=1),Math.max(0,me)};if(_===null){let O=fe(ue,je,le,ft===null);D?.(le,null,O);}else {let Z=cs(ue,_);if(Z?.subtasks){let O=ft===_,re=fe(Z.subtasks,je,le,O);D?.(le,_,re);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),tt(null),$e(null),mt(null),Fe(null),dt.current=false,F(false);};react.useEffect(()=>{if(le)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",_e),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",_e),document.body.style.cursor="",document.body.style.userSelect="";}},[le,je,bt]);let fa=(ne,ue,ft)=>{let _=ue.subtasks&&ue.subtasks.length>0;switch(ne.id){case "name":let fe=Ce===ue.id,Z=Le===ue.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ft*20}px`},children:[D&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Z?1:.3},onMouseDown:ae=>wa(ue.id,ae),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),d?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),fe?jsxRuntime.jsx("input",{ref:We,type:"text",value:z,onChange:ae=>Oe(ae.target.value),onKeyDown:ae=>{ae.key==="Enter"?Gt(ue.id):ae.key==="Escape"&&Qt();},onBlur:()=>Gt(ue.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:ae=>ae.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),ee&&ue.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ee&&ue.cpmData&&jsxRuntime.jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),Z&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ae=>Vr(ue,ae),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),wr(ue);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let re=ne.id==="startDate"?"startDate":"endDate",ve=ue[re],N=de?.taskId===ue.id&&de?.field===re,H=ae=>ae?(typeof ae=="string"?new Date(ae):ae).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:ae=>{if(!_)if(N)he(null);else {let lt=ae.currentTarget.getBoundingClientRect();he({taskId:ue.id,field:re,month:ve?typeof ve=="string"?new Date(ve):ve:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:H(ve)}),_&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),N&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:de?.position.top,left:de?.position.left},onClick:ae=>ae.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ae=new Date,lt=new Date(ae);lt.setDate(ae.getDate()+1);let st=new Date(ae);st.setDate(ae.getDate()+7);let Bt=new Date(ae);return Bt.setDate(ae.getDate()+14),[{label:"Hoy",date:ae},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:st},{label:"2 semanas",date:Bt}].map((_r,Ur)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:en=>en.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:en=>en.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[re]:_r.date}),he(null);},children:_r.label},Ur))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(ue.id,{[re]:void 0}),he(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:de?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ae=>ae?{...ae,month:new Date(ae.month.getFullYear(),ae.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ae,lt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ae},lt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ae=de?.month||new Date,lt=ae.getFullYear(),st=ae.getMonth(),Bt=new Date(lt,st,1).getDay(),gr=new Date(lt,st+1,0).getDate(),_r=new Date,Ur=[];for(let ar=Bt-1;ar>=0;ar--)Ur.push({day:new Date(lt,st,-ar).getDate(),date:new Date(lt,st-1,new Date(lt,st,-ar).getDate()),isCurrentMonth:false});for(let ar=1;ar<=gr;ar++)Ur.push({day:ar,date:new Date(lt,st,ar),isCurrentMonth:true});let en=42-Ur.length;for(let ar=1;ar<=en;ar++)Ur.push({day:ar,date:new Date(lt,st+1,ar),isCurrentMonth:false});return Ur.map((ar,$a)=>{let zo=ar.date.toDateString()===_r.toDateString(),_n=(ve?typeof ve=="string"?new Date(ve):ve:null)?.toDateString()===ar.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ar.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:zo&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(ue.id,{[re]:ar.date}),he(null);},children:ar.day},$a)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:$t(ue)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let me=a.filter(ae=>ue.assignees?.some(lt=>lt.id?lt.id===ae.id:lt.name===ae.name||lt.initials===ae.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(To,{assignedUsers:me,availableUsers:a,onChange:ae=>{let lt=ae.map(st=>({id:st.id,name:st.name,initials:st.initials,color:st.color}));x?.(ue.id,{assignees:lt});}})});case "status":if(_){let ae=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ae})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(ip,{status:ue.status||"todo",onChange:ae=>{x?.(ue.id,{status:ae,progress:ae==="completed"?100:ue.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ue.progress}%`,backgroundColor:ue.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ue.progress,"%"]})]});case "priority":let K={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},we={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ot=K[ue.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ae=>ae.stopPropagation(),children:jsxRuntime.jsx(ko,{priority:ot,onChange:ae=>{ae&&x?.(ue.id,{priority:we[ae]||"medium"});}})});default:return null}},jr=ne=>[{id:"hide",label:"Hide Column",icon:rr.Hide,onClick:()=>p(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:rr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:rr.SortDesc,onClick:()=>{}}],Zr=ne=>{let ue=ne.subtasks&&ne.subtasks.length>0,ft=Fo(e),_=Ae.size>1&&Ae.has(ne.id),fe=_?ft.filter(N=>Ae.has(N.id)):[ne],Z=fe.map(N=>N.id),O=fe.filter(N=>!(N.subtasks&&N.subtasks.length>0)),re=_?` (${Z.length})`:"",ve=()=>{P?P(Z,ne.name):w?.(Z);};return ue?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:rr.Add,onClick:()=>{T?.(ne.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+re,icon:rr.Duplicate,onClick:()=>{k?.(Z);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+re,icon:rr.Delete,onClick:ve}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:rr.Pencil,onClick:()=>{c?.(ne);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:rr.Add,onClick:()=>{T?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+re,icon:rr.MarkIncomplete,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"todo",progress:0}));},disabled:O.length===0||O.every(N=>N.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+re,icon:rr.SetInProgress,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"in-progress"}));},disabled:O.length===0||O.every(N=>N.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+re,icon:rr.MarkComplete,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"completed",progress:100}));},disabled:O.length===0||O.every(N=>N.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+re,icon:rr.Duplicate,onClick:()=>{k?.(Z);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:rr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+re,icon:rr.Delete,onClick:ve}]},lr=u.filter(ne=>ne.visible),Ba=lr.reduce((ne,ue)=>ne+ue.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ba},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:lr.map((ne,ue)=>{let ft=ue===lr.length-1,_=ne.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(_?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:_&&lr.length===1?1:0,flexGrow:_&&lr.length===1?1:0,borderRight:ft?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Ze({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:ne.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),De(ne.id),He(fe.clientX),Pe(ne.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===ne.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Ji,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!Be),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Be&&jsxRuntime.jsxs("div",{ref:ye,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:ne=>ne.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:vr},children:gt.map(({task:ne,level:ue},ft)=>{let _=kt(ne.id),fe=Hr(ft),Z=je===ne.id,O=Z&&bt==="above",re=Z&&bt==="below",ve=Z&&bt==="child",N={};return ve&&(N.backgroundColor=`${t.accent}15`,N.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${le===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:ve?`${t.accent}15`:ft%2===0?t.bgPrimary:t.bgGrid,opacity:ee?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...N},onMouseEnter:()=>W(ne.id),onMouseLeave:()=>W(null),onClick:H=>{let K=Fo(e).map(ae=>ae.id),ot=navigator.platform.toUpperCase().indexOf("MAC")>=0?H.metaKey:H.ctrlKey;Ue(ne.id,K,ot,H.shiftKey),o?.(ne.id),!ot&&!H.shiftKey&&s?.(ne);},onDoubleClick:H=>{H.stopPropagation(),c?.(ne);},onContextMenu:H=>{H.preventDefault(),Ze({isOpen:true,x:H.clientX,y:H.clientY,type:"task",task:ne}),i?.(ne,H);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[O&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),re&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),lr.map((H,me)=>{let K=me===lr.length-1,we=H.id==="name",ot=!!(ne.subtasks&&ne.subtasks.length>0),ae=H.id==="assignees"||H.id==="startDate"||H.id==="endDate"?H.id:null,st=!!ae&&!ot&&Le===ne.id&&!R,Bt=fe&&!!R&&R.column===H.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${we?"justify-start":"justify-center"}`,style:{position:"relative",width:`${H.width}px`,minWidth:`${H.minWidth??(we?200:60)}px`,maxWidth:`${H.maxWidth??2e3}px`,flexShrink:we&&lr.length===1?1:0,flexGrow:we&&lr.length===1?1:0,borderRight:K?"none":`1px solid ${Le===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Bt?`${t.accent}22`:void 0,boxShadow:Bt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[fa(H,ne,we?ue:0),st&&ae&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:gr=>Rt(gr,ne.id,ae,ft),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ne.id}-${H.id}`)})]},ne.id)})}),jsxRuntime.jsx(ls,{isOpen:ze.isOpen,x:ze.x,y:ze.y,items:ze.type==="header"&&ze.columnId?jr(ze.columnId):ze.type==="task"&&ze.task?Zr(ze.task):[],onClose:()=>Ze({...ze,isOpen:false}),theme:t}),nt&&zt&&le&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:zt.x+12,top:zt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=gt.find(ue=>ue.task.id===le)?.task;return ne?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function Gm(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,l]=react.useState(e),[c,i]=react.useState(t),[d,m]=react.useState(null),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(0),[w,k]=react.useState(0),[M,B]=react.useState(null),[T,C]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:B,isHovered:T,setIsHovered:C,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(ee,L)=>{a("none"),m(null),p(null),l(ee),i(L),k(0),b(null),v(0);}}}function el({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:v=false,onProgressChange:w}){let k=Gm(t,a),M=react.useRef(null),B=react.useRef(false),T=react.useRef(null),C=react.useRef(null),{dragMode:P,setDragMode:D,dragOffset:V,setDragOffset:$,ghostX:ee,setGhostX:L,ghostWidth:Le,setGhostWidth:W,connectionLine:Ce,setConnectionLine:I,hoveredTaskId:z,setHoveredTaskId:Oe,activeZone:We,setActiveZone:J,draggedSegmentIndex:De,setDraggedSegmentIndex:se,draggedSegmentStartX:He,setDraggedSegmentStartX:Se,segmentDragOffsetX:Pe,setSegmentDragOffsetX:ze,hoveredSegmentIndex:Ze,setHoveredSegmentIndex:le,isHovered:tt,setIsHovered:je,isDragging:$e,isResizing:bt,isConnecting:mt,resetDragState:Ve}=k,Ie=18,dt=!!n.executionBarBg,zt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Fe=dt?3:6,nt=e.subtasks&&e.subtasks.length>0,F=react.useRef(null),[X,R]=(()=>{let _=react.useRef(null),[,fe]=react.useState(0);return [_.current,Z=>{_.current=Z,fe(O=>O+1);}]})(),Y=!!w&&!v&&!nt&&!e.segments&&!!e.startDate&&!!e.endDate,de=e.endDate&&(()=>{let _=new Date;_.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<_})()&&e.progress<100,he=y&&e.isCriticalPath,Be=n.name==="neutral"||n.today==="#1C1917",j=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ue=y&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:n.taskBarPrimary,kt=v?"default":$e?mt?"crosshair":bt?"ew-resize":"grabbing":"grab",Ye=v?"default":"ew-resize",gt=(_=>_>=80?20:_>=60?15:_>=50?12:10)(a),Jt=a<50,vr=a<40;react.useEffect(()=>{x&&(!tt||$e||e.segments)&&x(null);},[tt,$e,e.segments,x]);let Mr=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Rt=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},Hr=_=>Math.round(_/s)*s,$t=_=>{let fe=Math.round(_/s),Z=new Date(o);return Z.setDate(Z.getDate()+fe),Z},wr=(_,fe)=>{for(let Z of p){if(Z.id===e.id)continue;let O=5;if(_>=Z.x-O&&_<=Z.x+Z.width+O&&fe>=Z.y-O&&fe<=Z.y+Z.height+O)return Z.id}return null},Gt=react.useCallback((_,fe,Z)=>{if(v)return;_.preventDefault(),_.stopPropagation();let O=M.current?.ownerSVGElement;if(!O)return;let re=O.createSVGPoint();re.x=_.clientX,re.y=_.clientY;let ve=re.matrixTransform(O.getScreenCTM()?.inverse()),N=Z!==void 0?Z:t,H=fe;if(!H){let me=ve.x-N;_.shiftKey?(H="connect",I({x:t+a,y:r+Ie/2})):_.ctrlKey||_.metaKey?H="move":_.altKey?H=me<a/2?"resize-start":"resize-end":vr?me<a/2?H="move":H="resize-end":Jt?me<=gt/2?H="resize-start":me>=a-gt/2?H="resize-end":H="move":me<=gt?H="resize-start":me>=a-gt?H="resize-end":H="move";}B.current=false,D(H),je(false),J(null),H==="move"?$(ve.x-N):H==="connect"?I({x:t+a,y:r+Ie/2}):$(0),L(N),W(a);},[t,a,r,Ie,v]),Qt=react.useCallback(_=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let Z=fe.closest(".gantt-timeline-scroll");if(!Z)return;let O=Z.getBoundingClientRect(),re=60,ve=15,N=0;if(_.clientX<O.left+re){let H=O.left+re-_.clientX;N=-Math.min(ve,H/2);}else if(_.clientX>O.right-re){let H=_.clientX-(O.right-re);N=Math.min(ve,H/2);}return N!==0&&(Z.scrollLeft+=N),N!==0},[]),Vr=react.useCallback(_=>{if(P==="none")return;B.current=true,C.current=_;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let re=Qt(_);re&&!T.current?T.current=window.setInterval(()=>{C.current&&(Qt(C.current),Vr(C.current));},16):!re&&T.current&&(window.clearInterval(T.current),T.current=null);}let Z=fe.createSVGPoint();Z.x=_.clientX,Z.y=_.clientY;let O=Z.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){I({x:O.x,y:O.y});let re=wr(O.x,O.y);Oe(re);}else if(P==="move"){let re=O.x-V,ve=Hr(re);L(ve),W(a);let N=Math.round((ve-t)/s);if(f?.(e.id,N,true),e.segments&&e.segments.length>0&&De!==null){let H=ve-He;ze(H);}}else if(P==="resize-start"){let re=O.x,ve=Hr(re),N=t+a-ve;N>=s&&(L(ve),W(N));}else if(P==="resize-end"){let re=O.x,N=Hr(re)-t;N>=s&&W(N);}},[P,t,a,s,V,e,Hr,De,He,wr,Oe,I,L,W,ze,f,Qt]),wa=react.useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),C.current=null,P!=="none"){if(P==="connect")z&&u&&u(e,z),I(null),Oe(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),fe,Z,O=true;if(P==="move"){if(fe=$t(ee),Z=new Date(fe.getTime()+_),e.segments&&e.segments.length>0&&De!==null){let re=Math.round(Pe/s),ve=e.segments.map((K,we)=>{if(we===De){let ot=new Date(K.startDate),ae=new Date(K.endDate);return ot.setDate(ot.getDate()+re),ae.setDate(ae.getDate()+re),{startDate:ot,endDate:ae}}return K}),N=ve.flatMap(K=>[K.startDate,K.endDate]),H=new Date(Math.min(...N.map(K=>K.getTime()))),me=new Date(Math.max(...N.map(K=>K.getTime())));m?.({...e,segments:ve},H,me),Ve(t,a);return}}else P==="resize-start"?(fe=$t(ee),Z=e.endDate,fe>Z&&(console.warn("Invalid date range: start date must be before or equal to end date"),O=false)):P==="resize-end"?(fe=e.startDate,Z=$t(ee+Le),Z.setDate(Z.getDate()-1),Z<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),O=false)):O=false;O&&fe&&Z&&(Z.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,Z));}f?.(e.id,0,false),Ve(t,a);}},[P,ee,Le,e,m,z,u,t,a,s,$t,Pe,De,Ve,f]);react.useEffect(()=>{if(P==="none")return;let _=Z=>{Vr(Z);},fe=()=>{wa();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",fe),T.current&&(window.clearInterval(T.current),T.current=null);}},[P,Vr,wa]);let et=$e&&!mt?ee:t,_e=$e&&!mt?Le:a,fa=l.taskClass(e),jr=24,Zr=y?e.isCriticalPath?1:.25:1,lr=react.useCallback(_=>{if(!Y)return;_.stopPropagation(),_.preventDefault();let Z=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;F.current={barRect:Z,initialPct:e.progress||0},_.currentTarget.setPointerCapture(_.pointerId),R(e.progress||0);},[Y,e.progress,R]),Ba=react.useCallback(_=>{let fe=F.current;if(!fe)return;let O=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!O||O.width<=0)return;let re=(_.clientX-O.left)/O.width,ve=Math.round(Math.max(0,Math.min(1,re))*100);_.shiftKey&&(ve=Math.round(ve/25)*25),R(ve);},[R]),ne=react.useCallback(_=>{let fe=F.current;if(!fe)return;_.stopPropagation(),_.preventDefault();try{_.currentTarget.releasePointerCapture(_.pointerId);}catch{}let Z=X;F.current=null,R(null),Z!=null&&Z!==fe.initialPct&&w&&w(e,Z);},[X,w,e,R]),ue=react.useCallback(_=>{_.stopPropagation(),_.preventDefault();},[]),ft=X??(e.progress||0);return jsxRuntime.jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:Zr,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!B.current&&c?.(e),B.current=false;},onDoubleClick:_=>{!$e&&!B.current&&(_.stopPropagation(),i?.(e));},onContextMenu:_=>{_.preventDefault(),d?.(e,_);},onMouseEnter:()=>!$e&&je(true),onMouseMove:_=>{x&&tt&&!$e&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Ie,showBelow:false,mouseX:_.clientX,mouseY:_.clientY});},onMouseLeave:()=>{$e||(je(false),J(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+jr,height:Ie,fill:"transparent",style:{pointerEvents:"all"}}),tt&&!$e&&!Jt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:gt,height:Ie,fill:We==="resize-start"?n.accent:"transparent",opacity:We==="resize-start"?.15:0,style:{cursor:Ye,pointerEvents:"all"},onMouseEnter:()=>J("resize-start"),onMouseDown:_=>Gt(_,"resize-start")}),jsxRuntime.jsx("rect",{x:t+gt,y:r,width:a-gt*2,height:Ie,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:_=>Gt(_,"move")}),jsxRuntime.jsx("rect",{x:t+a-gt,y:r,width:gt,height:Ie,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.15:0,style:{cursor:Ye,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:_=>Gt(_,"resize-end")})]}),tt&&!$e&&vr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Ie,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>J("move"),onMouseDown:_=>Gt(_,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Ie,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.2:0,style:{cursor:Ye,pointerEvents:"all"},onMouseEnter:()=>J("resize-end"),onMouseDown:_=>Gt(_,"resize-end")}),tt&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Ie-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee,y:r,width:Le,height:Ie,rx:Fe,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let _=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),Z=o.getTime(),O=864e5,re=(_-Z)/O,ve=(fe-_)/O,N=re*s,H=Math.max(ve*s,s),me=et+_e,K=N+H,we=e.endDate?.getTime()??0,ot=Math.ceil((we-fe)/O),ae=ot>0,lt=ot<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:N,y:r,width:H,height:Ie,rx:Fe,fill:"none",stroke:zt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ae&&me>K&&jsxRuntime.jsx("rect",{x:K,y:r,width:me-K,height:Ie,rx:0,fill:"#EF4444",opacity:.2}),ae&&jsxRuntime.jsxs("text",{x:Math.max(me,K)+6,y:r+Ie/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ot,"d"]}),lt&&jsxRuntime.jsxs("text",{x:me+6,y:r+Ie/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ot,"d"]})]})})(),!e.segments&&dt&&nt&&(()=>{let fe=r+(Ie-8)/2,Z=4,O=e.progress||0,re=new Date;re.setHours(0,0,0,0);let ve=e.startDate&&re>=e.startDate,N=e.endDate&&(()=>{let ae=new Date(e.endDate);return ae.setHours(0,0,0,0),re>ae})(),H=e.startDate&&re<e.startDate,me=1;if(ve&&e.startDate&&e.endDate&&!H){let ae=new Date(e.startDate);ae.setHours(0,0,0,0);let lt=new Date(e.endDate);lt.setHours(0,0,0,0);let st=Math.max(1,(lt.getTime()-ae.getTime())/(1e3*60*60*24)),gr=Math.min((re.getTime()-ae.getTime())/(1e3*60*60*24),st)/st*100;me=gr>0?O/gr:1;}let K;O>=100?K="#00E5CC":H?K="#4B5563":N&&O<100?K="#EF4444":me>=.95?K="#22C55E":me>=.8?K="#F59E0B":K="#EF4444";let we=Math.max(O/100*_e,O>0?Z*2:0),ot=_e>100&&O>0;return jsxRuntime.jsxs("g",{"data-task-class":fa,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:et,y:fe,width:_e,height:8,rx:Z,fill:"rgba(255,255,255,0.10)"}),O>0&&jsxRuntime.jsx("rect",{x:et,y:fe,width:we,height:8,rx:Z,fill:K}),ot&&jsxRuntime.jsxs("text",{x:et+we+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(O),"%"]})]})})(),!e.segments&&dt&&!nt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:_e,height:Ie,rx:Fe,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":fa,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!mt?.15:e.parentId?.6:1,scale:tt&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>Gt(_),style:{cursor:kt,pointerEvents:"all"}}),!e.segments&&!dt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:_e,height:Ie,rx:Fe,fill:Ue,"data-task-class":fa,initial:{opacity:0,scale:.95},animate:{opacity:$e&&!mt?.15:e.parentId?.6:tt?.9:.8,scale:tt&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:nt?void 0:_=>Gt(_),style:{cursor:nt?"default":kt,pointerEvents:"all"}}),dt&&(de||he)&&!e.segments&&jsxRuntime.jsx("rect",{x:et,y:r,width:_e,height:Ie,rx:Fe,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&ft>0&&!nt&&jsxRuntime.jsx("rect",{x:et,y:r,width:Math.max(_e*(ft/100),Fe*2),height:Ie,rx:Fe,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!nt&&e.progress<100&&(()=>{let _=e.progress>0?_e*(e.progress/100):0,fe=et+_,Z=_e-_,O=e.progress===0?Fe:0,re=e.progress===0?et:fe,ve=e.progress===0?_e:Z;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:re,y:r,width:ve,height:Ie,rx:O,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:re,y:r,width:ve,height:Ie,rx:O,fill:"none",stroke:Ue,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),dt&&!e.segments&&e.progress>0&&e.progress<100&&!nt&&!$e&&X===null&&(()=>{let _=et+_e*(e.progress/100),fe=8,Z=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:_,cy:r+Ie/2,r:fe,fill:Z?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:_,y:r+Ie/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Z?.initials||Z?.name?.charAt(0)?.toUpperCase()||""})]})})(),Y&&!$e&&_e>=40&&(X!==null||ft<88)&&(()=>{let _=et+_e*(ft/100),fe=r+Ie/2,Z=X!==null,O=Z?7:tt?6:5,re=Z||tt?1:.35,ve=et+_e-_,N=Math.max(4,Math.min(12,ve-10)),H=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:_-H,y:fe-12,width:H+N,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:lr,onPointerMove:Ba,onPointerUp:ne,onPointerCancel:ne,onClick:ue,onDoubleClick:ue,onMouseDown:me=>me.stopPropagation()}),jsxRuntime.jsx("circle",{cx:_,cy:fe,r:O,fill:"#FFFFFF",stroke:Ue,strokeWidth:2,opacity:re,style:{pointerEvents:"none",filter:Z?`drop-shadow(0 0 4px ${Ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),Z&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:_-20,y:fe-28,width:40,height:18,rx:4,fill:zt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ue,strokeWidth:1}),jsxRuntime.jsxs("text",{x:_,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:zt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((_,fe)=>{let Z=(_.startDate.getTime()-o.getTime())/864e5*s,re=(_.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-Z+s,ve=$e&&P==="move"&&De===fe,N=Ze===fe,H=ve?Z+Pe:Z;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$e&&le(fe),onMouseLeave:()=>!$e&&le(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:H,y:r,width:re,height:Ie,rx:Fe,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:ve||e.parentId?.6:N?.9:.8,scale:N&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:me=>{me.stopPropagation(),se(fe),Se(Z),Gt(me,void 0,Z);},style:{cursor:kt,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:H,y:r,width:re*(e.progress/100),height:Ie,rx:Fe,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),Be&&(de||he)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[he&&!de&&jsxRuntime.jsx("rect",{x:et,y:r,width:_e,height:Ie,rx:Fe,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsxRuntime.jsx("rect",{x:et,y:r,width:_e,height:Ie,rx:Fe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&_e>60&&!e.segments&&!(dt&&nt)&&(()=>{let _=l.taskLabel(e),fe=typeof _=="string"?_:e.name,Z=fe.length>Math.floor(_e/8)?`${fe.substring(0,Math.floor(_e/8))}...`:fe;return jsxRuntime.jsx("text",{x:et+8,y:r+Ie/2,dominantBaseline:"middle",fill:j?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:j?"line-through":"none"},children:Z})})(),!$e&&!e.segments&&!nt&&e.progress>0&&e.progress<100&&(dt?jsxRuntime.jsxs("text",{x:et+_e+6,y:r+Ie/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):_e>100?jsxRuntime.jsxs("text",{x:et+_e-12,y:r+Ie/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,"%"]}):null),e.status&&_e>80&&!$e&&!e.segments&&!(dt&&nt)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:et+_e-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:et+_e-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(tt||bt)&&!mt&&!e.segments&&!nt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et-2,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Ye},onMouseEnter:()=>J("resize-start"),onMouseLeave:()=>J(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+4,y:r+8,width:3,height:Ie-16,rx:1.5,fill:We==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et+_e-14,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Ye},onMouseEnter:()=>J("resize-end"),onMouseLeave:()=>J(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+_e-7,y:r+8,width:3,height:Ie-16,rx:1.5,fill:We==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&!$e&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+a+10,cy:r+Ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>J("connect"),onMouseLeave:()=>J(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+10,cy:r+Ie/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:We==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),mt&&Ce&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Ie/2,x2:Ce.x,y2:Ce.y,stroke:z?n.statusCompleted:n.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Ce.x,cy:Ce.y,r:z?8:6,fill:z?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(tt||$e)&&!mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et-1,y:r-1,width:_e+2,height:Ie+2,rx:Fe+1,fill:"none",stroke:$e?n.accent:dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:dt?1:2,opacity:$e||dt?.6:.4,initial:{opacity:0},animate:{opacity:$e||dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),bt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:ee+Le,y1:0,x2:ee+Le,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:tt&&!$e&&!e.segments&&!x&&(()=>{let Z=r<100,O=Z?r+Ie+13:r-82-13,re=Z?`M ${et+_e/2-6} ${r+Ie+3} L ${et+_e/2} ${r+Ie+13} L ${et+_e/2+6} ${r+Ie+3}`:`M ${et+_e/2-6} ${r-13} L ${et+_e/2} ${r-3} L ${et+_e/2+6} ${r-13}`,ve=O+22,N=O+40,H=O+55,me=O+70,K=Z?O+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Z?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Z?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:re,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:et+_e/2-120,y:O,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))"}),jsxRuntime.jsx("text",{x:et+_e/2,y:ve,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}),jsxRuntime.jsx("text",{x:et+_e/2-110,y:N,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:et+_e/2-70,y:N,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Mr(e.startDate)}),jsxRuntime.jsx("text",{x:et+_e/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:et+_e/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Mr(e.endDate)}),jsxRuntime.jsx("text",{x:et+_e/2+10,y:N,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:et+_e/2+65,y:N,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Rt()}),jsxRuntime.jsx("text",{x:et+_e/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:et+_e/2+65,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:et+_e/2-110,y:me,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:et+_e/2-50,y:me,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(we=>we.name).join(", ").substring(0,30),e.assignees.map(we=>we.name).join(", ").length>30?"...":""]})]}),!Z&&jsxRuntime.jsx("text",{x:et+_e/2,y:K,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:vr?"Left: move \u2022 Right: resize":Jt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var dd=260,us=8,_m=16,uw=-12;function Km({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:k}=e,M=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,B=v.lastActivity!=null,T=(M?155:105)+(B?28:0),C=w+_m,P=k+uw-T;C+dd>window.innerWidth-us&&(C=w-dd-_m),C<us&&(C=us);let D=P<us;D&&(P=k+20),P+T>window.innerHeight-us&&(P=window.innerHeight-us-T),s({left:C,top:P,showBelow:D});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,B=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;B.getTime()<=T.getTime();){let P=B.getDay();v[P]&&!w.has(k(B))&&M++,B.setDate(B.getDate()+1);}let C=Math.max(0,M);return r==="es"?`${C} d\xEDa${C!==1?"s":""}`:`${C} day${C!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),k=v%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:dd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(tl,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(tl,{label:c.duration,value:d(),labelColor:u,valueColor:p}),jsxRuntime.jsx(tl,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(tl,{label:c.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),l&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:o.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.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,d)=>{let m=d.category||"Other";return i[m]||(i[m]=[]),i[m].push(d),i},{});return jsxRuntime.jsxs("div",{className:g("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:o,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:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,d])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:d.map(m=>jsxRuntime.jsxs("button",{onClick:()=>l(m),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:m.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Vc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,l]=react.useState("export"),[c,i]=react.useState("json"),[d,m]=react.useState(null),u=react.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,h=await Hu(e,c,x);Uu(h,c);},f=async x=>{let h=x.target.files?.[0];if(h){try{let b=await Gu(h),y=h.name.endsWith(".json")?"json":"csv",v=zu(b,y);m(v),v.success&&a&&a(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick: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"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[o==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:u,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),d&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var $x=["URGENT","HIGH","MEDIUM","LOW"],Ox=[{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"}],Hx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function jc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:m=true,compact:u=false,groupBy:p="none",onGroupByChange:f}){let[x,h]=react.useState(true),b=react.useCallback(M=>{r({search:M.target.value});},[r]),y=react.useCallback(M=>{r({dateFilter:M.target.value});},[r]),v=react.useCallback(M=>{a({by:M.target.value});},[a]),w=react.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${u?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[m&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let B=M.target.value;r({priorities:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),$x.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let B=M.target.value;r({assignees:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsxRuntime.jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let B=M.target.value;r({labels:B==="all"?[]:[B]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsxRuntime.jsx("option",{value:M,children:M},M))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:v,className:"filter-bar__select filter-bar__select--sm",children:Ox.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Hx.map(M=>jsxRuntime.jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function _c({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let p=f=>{m.current&&!m.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let u=p=>{p(),d(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:m,children:[jsxRuntime.jsxs("button",{onClick:()=>d(!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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>u(()=>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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>u(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:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Kc={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:"#00E5CC",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"}},qc={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:"#00E5CC",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"}},Yc={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"}},Mo={dark:Kc,light:qc,neutral:Yc},qi="dark";var Yi=react.createContext(void 0),Yx="asakaa-theme";function bm({children:e,defaultTheme:t=qi,storageKey:r=Yx}){let[a,n]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Mo[a];Object.entries(c.colors).forEach(([d,m])=>{m&&l.style.setProperty(`--theme-${Xx(d)}`,m);}),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(([d,m])=>{let u=c.colors[d];u&&l.style.setProperty(m,u);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:Mo};return jsxRuntime.jsx(Yi.Provider,{value:o,children:e})}function as(){let e=react.useContext(Yi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Xx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Xc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=as();return e?jsxRuntime.jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Mo).map(([s,o])=>jsxRuntime.jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:o.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),a===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var it={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function hm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return it[e]||it.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",it[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",it[e].bgSecondary),bgGrid:a("--theme-bg-card",it[e].bgGrid),bgWeekend:a("--theme-bg-hover",it[e].bgWeekend),border:a("--theme-border-primary",it[e].border),borderLight:a("--theme-border-subtle",it[e].borderLight),textPrimary:a("--theme-text-primary",it[e].textPrimary),textSecondary:a("--theme-text-secondary",it[e].textSecondary),textTertiary:a("--theme-text-tertiary",it[e].textTertiary),accent:a("--theme-accent-primary",it[e].accent),accentHover:a("--theme-accent-hover",it[e].accentHover),accentLight:a("--theme-accent-primary",it[e].accentLight),taskBarPrimary:a("--theme-accent-primary",it[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",it[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",it[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",it[e].dependency),dependencyHover:a("--theme-border-secondary",it[e].dependencyHover),criticalPath:a("--theme-error",it[e].criticalPath),criticalPathLight:a("--theme-error",it[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",it[e].today):e==="neutral"?a("--theme-text-primary",it[e].today):a("--theme-error",it[e].today),todayLight:e==="light"?a("--theme-accent-primary",it[e].todayLight):e==="neutral"?a("--theme-text-primary",it[e].todayLight):a("--theme-error",it[e].todayLight),milestone:a("--theme-warning",it[e].milestone),milestoneLight:a("--theme-warning",it[e].milestoneLight),statusTodo:a("--theme-text-tertiary",it[e].statusTodo),statusInProgress:a("--theme-accent-primary",it[e].statusInProgress),statusCompleted:a("--theme-success",it[e].statusCompleted),hoverBg:a("--theme-bg-hover",it[e].hoverBg),focusRing:a("--theme-accent-primary",it[e].focusRing),...it[e].dotGrid&&{dotGrid:it[e].dotGrid},...it[e].glassHeader&&{glassHeader:it[e].glassHeader},...it[e].glassToolbar&&{glassToolbar:it[e].glassToolbar},...it[e].forecastHud&&{forecastHud:it[e].forecastHud},...it[e].neonRedGlow&&{neonRedGlow:it[e].neonRedGlow},...it[e].executionBarBg&&{executionBarBg:it[e].executionBarBg}}}var Xi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},ym={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Jc={en:Xi,es:ym};function xm(e){return Jc[e]||Jc.en}function Qc(e,t){let r=xm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var os=react.createContext(Xi);function qa(){return react.useContext(os)}function Ks(e,t,r="left",a=208){let[n,s]=react.useState({top:0,left:0});return react.useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;r==="right"?c=o.right-a:c=o.left;let i=8;c+a>window.innerWidth-i&&(c=window.innerWidth-i-a),c<i&&(c=i),s({top:l,left:c});},[t,r,e,a]),n}function Em({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=react.useState(false),[i,d]=react.useState(null),m=react.useRef(null),u=react.useRef(null),p=qa(),f=Ks(m,l,"right",176);if(react.useEffect(()=>{if(!l)return;let y=v=>{let w=v.target;m.current&&!m.current.contains(w)&&u.current&&!u.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||r||a||n||s||o))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),b=async(y,v)=>{if(v){d(y);try{await v();}catch(w){console.error(`Export ${y} failed:`,w);}finally{d(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:m,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:p.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{ref:u,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:h.map((y,v)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsxRuntime.jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function wm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=react.useState(false),[c,i]=react.useState(null),[d,m]=react.useState(false),u=react.useRef(null),p=react.useRef(null),f=qa(),x=Ks(u,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";react.useEffect(()=>{if(!o)return;let k=M=>{let B=M.target;u.current&&!u.current.contains(B)&&p.current&&!p.current.contains(B)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(k=>k.handler),v=async(k,M)=>{if(M){i(k);try{await M();}catch(B){console.error(`Export ${k} failed:`,B);}finally{i(null),l(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:u,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsxRuntime.jsx(lucideReact.Share2,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:y.map((k,M)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>v(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),y.length>0&&s&&jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsxRuntime.jsx("div",{className:"py-0.5 pb-1.5",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"}):jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function yv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] 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&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:n,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}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function xv({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:n.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function km({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=react.useState(false),o=react.useRef(null),l=react.useRef(null),c=qa(),i=Ks(o,n,"left");react.useEffect(()=>{if(!n)return;let u=p=>{let f=p.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let d=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(u,p)=>({value:p+1,label:`L${p+1}`}))],m=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsxRuntime.jsx("div",{className:"py-1",children:d.map((u,p)=>{let f=t===u.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(u.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:p<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:u.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(u.value))})})})}),document.body)]})}function Cm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=react.useState(false),l=react.useRef(null),c=react.useRef(null),i=qa(),d=Ks(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],u=t!=="all"||a,p=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:u?p?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${u?p?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:u?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:i.toolbar.filter||"Filters"}),u&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:p?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${p?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:p?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:p?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!a,h=()=>f.value==="all"?x?jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?p?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:p?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":p?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:p?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function vv({value:e,onChange:t,theme:r}){let a=qa(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsxRuntime.jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let l=e===o.value;return jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function wv({theme:e,forecast:t}){let r=qa(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,u=t?.currency||"$",p=m!=null?m>=1e6?`${u}${(m/1e6).toFixed(2)}M`:m>=1e3?`${u}${(m/1e3).toFixed(1)}K`:`${u}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&l&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsxRuntime.jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:p}),x&&h&&jsxRuntime.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function kv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:d,hasDependencies:m=true}){let[u,p]=react.useState(false),f=react.useRef(null),x=react.useRef(null),h=qa(),b=Ks(f,u,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!u)return;let M=B=>{let T=B.target;f.current&&!f.current.contains(T)&&x.current&&!x.current.contains(T)&&p(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]);let v=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:lucideReact.GitBranch,active:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:f,onClick:()=>p(!u),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:u?e.accent:e.textTertiary,backgroundColor:u?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"})}),reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsxRuntime.jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsxRuntime.jsx("div",{className:"py-0.5",children:w.map((M,B)=>{let T=M.icon,C=M.disabled,P=M.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!C&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:C?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:C?"not-allowed":"pointer"},whileHover:C?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:B*.03},title:P,children:[jsxRuntime.jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:C?y?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsxRuntime.jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxRuntime.jsxs("div",{className:"py-0.5",children:[jsxRuntime.jsx("div",{className:"px-3 pt-2 pb-1",children:jsxRuntime.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,B)=>{let T=i===M.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+B)*.03},children:[jsxRuntime.jsx("span",{style:{color:T?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),T&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Ji({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:m,onCreateTask:u,taskFilter:p="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:b,wbsLevel:y,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:k="execution",onViewModeChange:M,projectForecast:B,hideForecastHud:T,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportCSV:V,onExportJSON:$,onExportMSProject:Z,showCriticalPath:L=true,onShowCriticalPathChange:Ae,showDependencies:W=true,onShowDependenciesChange:Ce,highlightWeekends:I=true,onHighlightWeekendsChange:z,showBaseline:Oe=false,onShowBaselineChange:ze,onCopySnapshotLink:Q,hasDependencies:De=true}){let oe=qa(),He=C||P||D||V||$||Z,Se=!!e.glassToolbar,Fe=[{value:"day",label:oe.toolbar.day},{value:"week",label:oe.toolbar.week},{value:"month",label:oe.toolbar.month}],Ge=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],Qe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Se){let se=Qe?"rgba(255,255,255,0.08)":e.borderLight;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:M&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Qe?"#000000":e.bgSecondary,border:`1px solid ${Qe?"rgba(255,255,255,0.08)":e.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?Qe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:oe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>M("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?Qe?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:k==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:oe.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(vv,{value:t,onChange:r,theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),v&&jsxRuntime.jsx(km,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsx(Cm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h}),b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),b]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:se}}),jsxRuntime.jsx(kv,{theme:e,showCriticalPath:L,onShowCriticalPathChange:Ae,showBaseline:Oe,onShowBaselineChange:ze,highlightWeekends:I,onHighlightWeekendsChange:z,showDependencies:W,onShowDependenciesChange:Ce,rowDensity:l,onRowDensityChange:c,hasDependencies:De}),jsxRuntime.jsx(wm,{theme:e,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportMSProject:Z,onCopySnapshotLink:Q}),d&&u&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Qe?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Qe?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||oe.toolbar.createTask})]})]})]}),B&&!T&&jsxRuntime.jsx(wv,{theme:e,forecast:B})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(xv,{options:Fe,value:t,onChange:se=>r(se),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),v&&jsxRuntime.jsx(km,{theme:e,value:y??"all",onChange:v,maxDepth:w}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Cm,{theme:e,value:p,onChange:f,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[b,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:m||oe.toolbar.createTask})]}),(He||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsxRuntime.jsx(wm,{theme:e,onExportPNG:C,onExportPDF:P,onExportExcel:D,onExportMSProject:Z,onCopySnapshotLink:Q}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsxRuntime.jsx(yv,{options:Ge,value:s,onChange:se=>o(se),theme:e})]})]})}function Qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=react.useState(false),[s,o]=react.useState({x:0,y:0}),l=react.useRef(null),c=react.useRef(null);react.useEffect(()=>{if(!a)return;let d=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let d=c.current.getBoundingClientRect();o({x:d.left,y:d.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(nr,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.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(d=>jsxRuntime.jsxs("button",{onClick:()=>{t(d.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:m=>{m.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:d.label}),d.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function ls({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=react.useRef(null),[l,c]=react.useState({x:t,y:r});if(react.useEffect(()=>{if(!e)return;let d=200,m=a.length*36+8,u=8,p=window.innerWidth,f=window.innerHeight,x=t,h=r;t+d+u>p&&(x=t-d,x<u&&(x=u)),r+m+u>f&&(h=f-m-u,h<u&&(h=u)),c({x,y:h});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let d=u=>{o.current&&!o.current.contains(u.target)&&n();},m=u=>{u.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(d=>jsxRuntime.jsxs("div",{children:[d.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:m=>{d.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var tr={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Rm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:m,enableKeyboard:u=true}){let p=react.useRef(false),f=react.useCallback(v=>{p.current=v;},[]),x=react.useCallback(v=>{let w=[],k=M=>{for(let B of M)w.push(B),B.subtasks&&B.subtasks.length>0&&B.isExpanded&&k(B.subtasks);};return k(v),w},[]),h=react.useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=react.useCallback((v,w)=>{let k=x(e);if(k.length===0)return;let M=h();if(!M){r(k[0].id,false);return}let B=k.findIndex(P=>P.id===M.id);if(B===-1)return;let T=v==="up"?B-1:B+1;if(T<0||T>=k.length)return;let C=k[T];r(C.id,w);},[e,h,x,r]),y=react.useCallback(v=>{if(!u)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){v.key==="Escape"&&(w.blur(),p.current=false);return}let B=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,T=Array.from(t),C=h();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(C&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){C.subtasks&&C.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!C.isExpanded||v.key==="ArrowLeft"&&C.isExpanded)&&d(C.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){T.length>0&&(v.preventDefault(),o(T,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){T.length>0&&(v.preventDefault(),l(T));return}if(v.key==="Tab"&&v.shiftKey){T.length>0&&(v.preventDefault(),c(T));return}if(v.key==="Enter"&&!v.shiftKey&&!B){C&&(v.preventDefault(),a(C.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!B){C&&(v.preventDefault(),a(C.id,"above"));return}if(v.key==="Enter"&&B){C&&(v.preventDefault(),m(C.id));return}if(v.key==="F2"){C&&(v.preventDefault(),i(C.id));return}if(v.key==="Delete"||v.key==="Backspace"&&B){T.length>0&&(v.preventDefault(),n(T));return}if(v.key==="d"&&B&&!v.shiftKey){T.length>0&&(v.preventDefault(),s(T));return}},[u,t,h,b,a,n,s,o,l,c,i,d,m]);return react.useEffect(()=>{if(u)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[u,y]),{setIsEditing:f}}function $m(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(u=>u.size===1&&u.has(e)?u:new Set([e])),n(u=>u===e?u:e));},[e]);let s=react.useCallback(u=>{r(new Set([u])),n(u);},[]),o=react.useCallback(u=>{r(p=>{let f=new Set(p);return f.has(u)?f.delete(u):f.add(u),f}),n(u);},[]),l=react.useCallback((u,p)=>{if(!a){s(u);return}let f=p.indexOf(a),x=p.indexOf(u);if(f===-1||x===-1){s(u);return}let h=Math.min(f,x),b=Math.max(f,x),y=p.slice(h,b+1);r(new Set(y)),n(u);},[a,s]),c=react.useCallback((u,p,f,x)=>{x?l(u,p):f?o(u):s(u);},[s,o,l]),i=react.useCallback((u,p)=>{p?r(f=>{let x=new Set(f);return x.add(u),x}):s(u);},[s]),d=react.useCallback(()=>{r(new Set),n(null);},[]),m=react.useCallback(u=>t.has(u),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:d,isTaskSelected:m}}function ad(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?ad(t.subtasks):t.subtasks}))}function Fo(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,s+1);}};return r(e),t}function cs(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=cs(r.subtasks,t);if(a)return a}}return null}function rd(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=rd(r.subtasks,t);if(a)return a}return null}function nd(e,t){if(t.length===0)return e;let r=Fo(e),a=t[0],n=r.findIndex(u=>u.id===a);if(n<=0)return e;let s=r[n-1],o=(u,p)=>{let f=[];return {tasks:u.filter(h=>{if(p.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,p);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(u,p,f)=>u.map(x=>x.id===p?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,p,f)}:x),c=new Set(t),{tasks:i,removed:d}=o(e,c),m=l(i,s.id,d);return ad(m)}function od(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=rd(r,a);if(!n)continue;let s=rd(r,n.id),o=(i,d,m)=>{for(let u=0;u<i.length;u++){let p=i[u];if(p.id===d&&p.subtasks){let f=p.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=p.subtasks.splice(f,1);return x}}if(p.subtasks){let f=o(p.subtasks,d,m);if(f)return f}}return null},l=(i,d,m)=>{let u=i.findIndex(p=>p.id===d);if(u!==-1)return i.splice(u+1,0,m),i;for(let p of i)p.subtasks&&l(p.subtasks,d,m);return i},c=o(r,n.id,a);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(r,n.id,c));}return ad(r)}function sd(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(m=>m.id===l);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,l,c))return true;return false}let d=c==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function id(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function Ys(e,t){let r=[...e],a=[];for(let n of t){let s=(c,i)=>c.map((d,m)=>({...d,id:`${d.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${m}`):void 0})),o=c=>{let i=c.findIndex(p=>p.id===n);if(i===-1){for(let p of c)if(p.subtasks){let f=o(p.subtasks);if(f)return f}return null}let d=c[i],m=`${d.id}-copy-${Date.now()}`,u={...d,id:m,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,m):void 0};return c.splice(i+1,0,u),u},l=o(r);l&&a.push(l);}return {tasks:r,duplicatedTasks:a}}function Om(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(m=>m.id===t);if(i===-1){for(let m of c)if(m.subtasks&&l(m.subtasks))return true;return false}let d=r==="above"?i:i+1;return c.splice(d,0,o),true};return l(a),{tasks:a,newTask:o}}function ld(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:ld(a.subtasks,t,r)}:a)}function cd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:cd(r.subtasks,t)}:r)}function dd(e,t){let r=u=>{for(let p of u){if(p.id===t)return p;if(p.subtasks){let f=r(p.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,l=a?.endDate||s,c=u=>{for(let p of u){if(p.id===t)return (p.subtasks||[]).length;if(p.subtasks){let f=c(p.subtasks);if(f>=0)return f}}return 0},i=c(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:a?.color||"#00E5CC",position:i,parentId:t},m=u=>u.map(p=>{if(p.id===t){let f=p.subtasks||[];return {...p,subtasks:[...f,d],isExpanded:true}}return p.subtasks?{...p,subtasks:m(p.subtasks)}:p});return {tasks:m(e),newTask:d}}function Hm(e,t,r,a){if(t===r)return e;let n=cs(e,t);if(!n)return e;if(r){let l=(c,i)=>{if(!c.subtasks)return false;for(let d of c.subtasks)if(d.id===i||l(d,i))return true;return false};if(l(n,r))return e}let s=l=>{let c=l.filter(d=>d.id!==t),i=c.length<l.length;return c.map((d,m)=>{let u=i?{...d,position:m}:d;return u.subtasks&&u.subtasks.length>0?{...u,subtasks:s(u.subtasks)}:u})},o=s(e);if(r===null){let l=a!==void 0?a:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===r){let d=i.subtasks||[],m=a!==void 0?a:d.length,u=[...d];u.splice(m,0,{...n,parentId:r});let p=u.map((f,x)=>({...f,position:x}));return {...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Ya(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ya(t.subtasks),a=r.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((l,c)=>l+c,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function el({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:d,scrollTop:m,columns:u,onToggleColumn:p,onColumnResize:f,onTaskUpdate:x,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:v,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:B,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:P,onTaskReparent:D,allTasks:V,scrollContainerRef:$,showCriticalPath:Z=false}){let L=react.useContext(os),[Ae,W]=react.useState(null),[Ce,I]=react.useState(null),[z,Oe]=react.useState(""),ze=react.useRef(null),[Q,De]=react.useState(null),[oe,He]=react.useState(0),[Se,Fe]=react.useState(0),[Ge,Qe]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[se,Ze]=react.useState(null),[_e,$e]=react.useState(null),[ft,pt]=react.useState(null),je=react.useRef(0),Re=5,dt=react.useRef(false),[zt,Le]=react.useState(null),[st,F]=react.useState(false),J=react.useRef(null),[R,Y]=react.useState(null),[ue,he]=react.useState(null),[Be,j]=react.useState(false),xe=react.useRef(null);react.useEffect(()=>{function ce(de){xe.current&&!xe.current.contains(de.target)&&j(false);}if(Be)return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[Be]),react.useEffect(()=>{Ce&&ze.current&&(ze.current.focus(),ze.current.select());},[Ce]),react.useEffect(()=>{if(!Q)return;let ce=ut=>{let _=ut.clientX-oe,fe=Se+_;f?.(Q,fe);},de=()=>{De(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ce),document.addEventListener("mouseup",de),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",de),document.body.style.cursor="",document.body.style.userSelect="";}},[Q,oe,Se,f]);let{selectedTaskIds:Ie,handleTaskClick:Ue,isTaskSelected:Ct}=$m(l),{setIsEditing:Xe}=Rm({tasks:e,selectedTaskIds:Ie,onTaskSelect:(ce,de)=>{let _=Fo(e).map(fe=>fe.id);Ue(ce,_,de||false,false),o?.(ce);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ce=>{let de=Fo(e).find(ut=>ut.id===ce);de&&vr(de);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ce=>{let de=Fo(e).find(ut=>ut.id===ce);de&&C&&C(de);},enableKeyboard:true}),Dt=(ce,de=0,ut="")=>{let _=[],fe=[...ce].sort((ee,O)=>(ee.position??0)-(O.position??0));for(let ee=0;ee<fe.length;ee++){let O=fe[ee],te=ee+1,we=ut?`${ut}.${te}`:`${te}.0`,N=O.wbsCode||we;if(O.wbsCode=N,_.push({task:O,level:de}),O.subtasks&&O.subtasks.length>0&&O.isExpanded){let me=O.wbsCode?.replace(/\.0$/,"")||(ut?`${ut}.${te}`:`${te}`);_.push(...Dt(O.subtasks,de+1,me));}}return _},mt=Dt(e),Jt=48,xr=Math.max(mt.length*r,600-Jt),Er=(ce,de)=>de==="assignees"?ce.assignees:de==="startDate"?ce.startDate:ce.endDate,Rt=(ce,de,ut,_)=>{ce.preventDefault(),ce.stopPropagation(),Y({sourceTaskId:de,column:ut,sourceIndex:_,targetIndex:_}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=ce.currentTarget.closest("[data-grid-body]"),ee=ve=>{let nt=fe?.getBoundingClientRect().top??0,ie=Math.floor((ve-nt)/r);return ie=Math.max(0,Math.min(mt.length-1,ie)),ie<_&&(ie=_),ie},O=ce.clientY,te=$?.current??null,we=()=>{J.current&&(cancelAnimationFrame(J.current),J.current=null);},N=()=>{let ve=ee(O);Y(nt=>nt&&{...nt,targetIndex:ve});},H=()=>{if(we(),!te)return;let ve=te.getBoundingClientRect(),nt=60,ie=12,ot=O-ve.top,bt=ve.bottom-O;if(bt<nt&&te.scrollTop<te.scrollHeight-te.clientHeight){let Mt=Math.max(1,Math.round(ie*(1-Math.max(0,bt)/nt))),ir=()=>{te.scrollTop+=Mt,N(),te.scrollTop<te.scrollHeight-te.clientHeight&&(J.current=requestAnimationFrame(ir));};J.current=requestAnimationFrame(ir);}else if(ot<nt&&te.scrollTop>0){let Mt=Math.max(1,Math.round(ie*(1-Math.max(0,ot)/nt))),ir=()=>{te.scrollTop-=Mt,N(),te.scrollTop>0&&(J.current=requestAnimationFrame(ir));};J.current=requestAnimationFrame(ir);}},me=ve=>{O=ve.clientY,N(),H();},K=ve=>{window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",K),we(),document.body.style.cursor="",document.body.style.userSelect="",Y(null);let nt=ee(ve.clientY),ie=mt.find(ha=>ha.task.id===de)?.task;if(!ie)return;let ot=Er(ie,ut),bt=Math.min(_,nt),Mt=Math.max(_,nt),ir=[];for(let ha=bt;ha<=Mt;ha++){if(ha===_)continue;let mr=mt[ha]?.task;!mr||mr.subtasks&&mr.subtasks.length>0||ir.push(mr.id);}ir.length!==0&&h?.(ir,ut,ot);};window.addEventListener("mousemove",me),window.addEventListener("mouseup",K);},Hr=ce=>{if(!R)return false;let de=Math.min(R.sourceIndex,R.targetIndex),ut=Math.max(R.sourceIndex,R.targetIndex);return ce>=de&&ce<=ut},Bt=ce=>!ce.startDate||!ce.endDate?"-":`${Math.ceil((ce.endDate.getTime()-ce.startDate.getTime())/(1e3*60*60*24))}d`,vr=ce=>{I(ce.id),Oe(ce.name),Xe(true);},Gt=ce=>{z.trim()&&z!==e.find(de=>de.id===ce)?.name&&B?.(ce,z.trim()),I(null),Oe(""),Xe(false);},Qt=()=>{I(null),Oe(""),Xe(false);},Zr=(ce,de)=>{de.stopPropagation(),T?.(ce.id);},ba=(ce,de)=>{de.preventDefault(),je.current=de.clientY,Ze(ce),dt.current=false,F(false),Le({x:de.clientX,y:de.clientY});},et=ce=>{if(!se||(Math.abs(ce.clientY-je.current)>Re&&!dt.current&&(dt.current=true,F(true)),Le({x:ce.clientX,y:ce.clientY}),!dt.current))return;if($?.current){let ee=$.current,O=ee.getBoundingClientRect(),te=60,we=12;J.current&&(cancelAnimationFrame(J.current),J.current=null);let N=ce.clientY-O.top,H=O.bottom-ce.clientY;if(N<te&&ee.scrollTop>0){let me=Math.round(we*(1-N/te)),K=()=>{ee.scrollTop-=me,dt.current&&ee.scrollTop>0&&(J.current=requestAnimationFrame(K));};J.current=requestAnimationFrame(K);}else if(H<te&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let me=Math.round(we*(1-H/te)),K=()=>{ee.scrollTop+=me,dt.current&&ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(J.current=requestAnimationFrame(K));};J.current=requestAnimationFrame(K);}}let ut=document.querySelectorAll("[data-task-row]"),_=null,fe=null;ut.forEach(ee=>{let O=ee.getBoundingClientRect(),te=ee.getAttribute("data-task-row");if(te&&te!==se&&ce.clientY>=O.top&&ce.clientY<=O.bottom){_=te;let we=ce.clientY-O.top,N=O.height;we<N*.25?fe="above":we>N*.75?fe="below":fe="child";}}),$e(_),pt(fe);},Ke=()=>{if(dt.current&&se&&_e&&ft){if(ft==="child")D?.(se,_e);else if(ft==="above"||ft==="below"){let ce=(ee,O,te=null)=>{for(let we of ee){if(we.id===O)return te;if(we.subtasks){let N=ce(we.subtasks,O,we.id);if(N!==void 0)return N}}},de=V&&V.length>0?V:e,ut=ce(de,se,null),_=ce(de,_e,null),fe=(ee,O,te,we)=>{let N=ee.findIndex(K=>K.id===O),H=we?ee.findIndex(K=>K.id===te):-1,me=ft==="below"?N+1:N;return we&&H!==-1&&H<N&&(me-=1),Math.max(0,me)};if(_===null){let O=fe(de,_e,se,ut===null);D?.(se,null,O);}else {let ee=cs(de,_);if(ee?.subtasks){let O=ut===_,te=fe(ee.subtasks,_e,se,O);D?.(se,_,te);}}}}J.current&&(cancelAnimationFrame(J.current),J.current=null),Ze(null),$e(null),pt(null),Le(null),dt.current=false,F(false);};react.useEffect(()=>{if(se)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[se,_e,ft]);let sa=(ce,de,ut)=>{let _=de.subtasks&&de.subtasks.length>0;switch(ce.id){case "name":let fe=Ce===de.id,ee=Ae===de.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ut*20}px`},children:[D&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ee?1:.3},onMouseDown:ie=>ba(de.id,ie),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),de.subtasks&&de.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),d?.(de.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:de.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0"}),fe?jsxRuntime.jsx("input",{ref:ze,type:"text",value:z,onChange:ie=>Oe(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?Gt(de.id):ie.key==="Escape"&&Qt();},onBlur:()=>Gt(de.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ie=>ie.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:de.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:de.parentId?"13px":"14px",fontWeight:de.isMilestone?600:de.parentId?400:600,letterSpacing:de.parentId?"0":"-0.01em"},title:de.name,children:[de.wbsCode&&jsxRuntime.jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:de.wbsCode}),de.isHighlighted&&de.status==="completed"&&jsxRuntime.jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsxRuntime.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:de.name}),de.subtasks&&de.subtasks.length>0&&jsxRuntime.jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(de.progress||0),"%"]}),Z&&de.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),Z&&de.cpmData&&jsxRuntime.jsxs("span",{style:{color:de.cpmData.totalFloat<=0?"#EF4444":de.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(de.cpmData.totalFloat),"d"]})]}),ee&&!fe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>Zr(de,ie),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),vr(de);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let te=ce.id==="startDate"?"startDate":"endDate",we=de[te],N=ue?.taskId===de.id&&ue?.field===te,H=ie=>ie?(typeof ie=="string"?new Date(ie):ie).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:ie=>{if(!_)if(N)he(null);else {let ot=ie.currentTarget.getBoundingClientRect();he({taskId:de.id,field:te,month:we?typeof we=="string"?new Date(we):we:new Date,position:{top:ot.bottom+4,left:ot.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:H(we)}),_&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),N&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:ue?.position.top,left:ue?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,ot=new Date(ie);ot.setDate(ie.getDate()+1);let bt=new Date(ie);bt.setDate(ie.getDate()+7);let Mt=new Date(ie);return Mt.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:ot},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Mt}].map((ha,mr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:tn=>tn.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:tn=>tn.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(de.id,{[te]:ha.date}),he(null);},children:ha.label},mr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{x?.(de.id,{[te]:void 0}),he(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ue?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>he(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ie,ot)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},ot))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=ue?.month||new Date,ot=ie.getFullYear(),bt=ie.getMonth(),Mt=new Date(ot,bt,1).getDay(),ir=new Date(ot,bt+1,0).getDate(),ha=new Date,mr=[];for(let lr=Mt-1;lr>=0;lr--)mr.push({day:new Date(ot,bt,-lr).getDate(),date:new Date(ot,bt-1,new Date(ot,bt,-lr).getDate()),isCurrentMonth:false});for(let lr=1;lr<=ir;lr++)mr.push({day:lr,date:new Date(ot,bt,lr),isCurrentMonth:true});let tn=42-mr.length;for(let lr=1;lr<=tn;lr++)mr.push({day:lr,date:new Date(ot,bt+1,lr),isCurrentMonth:false});return mr.map((lr,Ma)=>{let zo=lr.date.toDateString()===ha.toDateString(),_n=(we?typeof we=="string"?new Date(we):we:null)?.toDateString()===lr.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:lr.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:zo&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{x?.(de.id,{[te]:lr.date}),he(null);},children:lr.day},Ma)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Bt(de)})});case "assignees":if(_)return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let me=a.filter(ie=>de.assignees?.some(ot=>ot.id?ot.id===ie.id:ot.name===ie.name||ot.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(To,{assignedUsers:me,availableUsers:a,onChange:ie=>{let ot=ie.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));x?.(de.id,{assignees:ot});}})});case "status":if(_){let ie=de.progress===100?"\u2713":de.progress>0?"\u25D0":"\u25CB";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsxRuntime.jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ie})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(lp,{status:de.status||"todo",onChange:ie=>{x?.(de.id,{status:ie,progress:ie==="completed"?100:de.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${de.progress}%`,backgroundColor:de.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[de.progress,"%"]})]});case "priority":let K={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ve={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},nt=K[de.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(ko,{priority:nt,onChange:ie=>{ie&&x?.(de.id,{priority:ve[ie]||"medium"});}})});default:return null}},Vr=ce=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>p(ce),disabled:ce==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:tr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:tr.SortDesc,onClick:()=>{}}],ea=ce=>{let de=ce.subtasks&&ce.subtasks.length>0,ut=Fo(e),_=Ie.size>1&&Ie.has(ce.id),fe=_?ut.filter(N=>Ie.has(N.id)):[ce],ee=fe.map(N=>N.id),O=fe.filter(N=>!(N.subtasks&&N.subtasks.length>0)),te=_?` (${ee.length})`:"",we=()=>{P?P(ee,ce.name):w?.(ee);};return de?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{T?.(ce.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{k?.(ee);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:we}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{c?.(ce);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{T?.(ce.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+te,icon:tr.MarkIncomplete,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"todo",progress:0}));},disabled:O.length===0||O.every(N=>N.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+te,icon:tr.SetInProgress,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"in-progress"}));},disabled:O.length===0||O.every(N=>N.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+te,icon:tr.MarkComplete,onClick:()=>{O.forEach(N=>x?.(N.id,{status:"completed",progress:100}));},disabled:O.length===0||O.every(N=>N.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+te,icon:tr.Duplicate,onClick:()=>{k?.(ee);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+te,icon:tr.Delete,onClick:we}]},jr=u.filter(ce=>ce.visible),_r=jr.reduce((ce,de)=>ce+de.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:_r},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:jr.map((ce,de)=>{let ut=de===jr.length-1,_=ce.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(_?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:_&&jr.length===1?1:0,flexGrow:_&&jr.length===1?1:0,borderRight:ut?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),Qe({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:ce.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ce.label,children:ce.label}),ce.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Q===ce.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),De(ce.id),He(fe.clientX),Fe(ce.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Q===ce.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ce.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsxRuntime.jsx(Qi,{columns:u,onToggleColumn:p,theme:t}),jsxRuntime.jsx("button",{onClick:()=>j(!Be),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Be&&jsxRuntime.jsxs("div",{ref:xe,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:ce=>ce.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>j(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:xr},children:mt.map(({task:ce,level:de},ut)=>{let _=Ct(ce.id),fe=Hr(ut),ee=_e===ce.id,O=ee&&ft==="above",te=ee&&ft==="below",we=ee&&ft==="child",N={};return we&&(N.backgroundColor=`${t.accent}15`,N.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":ce.id,className:`flex items-center cursor-pointer group ${se===ce.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:we?`${t.accent}15`:ut%2===0?t.bgPrimary:t.bgGrid,opacity:Z?ce.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...N},onMouseEnter:()=>W(ce.id),onMouseLeave:()=>W(null),onClick:H=>{let K=Fo(e).map(ie=>ie.id),nt=navigator.platform.toUpperCase().indexOf("MAC")>=0?H.metaKey:H.ctrlKey;Ue(ce.id,K,nt,H.shiftKey),o?.(ce.id),!nt&&!H.shiftKey&&s?.(ce);},onDoubleClick:H=>{H.stopPropagation(),c?.(ce);},onContextMenu:H=>{H.preventDefault(),Qe({isOpen:true,x:H.clientX,y:H.clientY,type:"task",task:ce}),i?.(ce,H);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[O&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),te&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),jr.map((H,me)=>{let K=me===jr.length-1,ve=H.id==="name",nt=!!(ce.subtasks&&ce.subtasks.length>0),ie=H.id==="assignees"||H.id==="startDate"||H.id==="endDate"?H.id:null,bt=!!ie&&!nt&&Ae===ce.id&&!R,Mt=fe&&!!R&&R.column===H.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${ve?"justify-start":"justify-center"}`,style:{position:"relative",width:`${H.width}px`,minWidth:`${H.minWidth??(ve?200:60)}px`,maxWidth:`${H.maxWidth??2e3}px`,flexShrink:ve&&jr.length===1?1:0,flexGrow:ve&&jr.length===1?1:0,borderRight:K?"none":`1px solid ${Ae===ce.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Mt?`${t.accent}22`:void 0,boxShadow:Mt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[sa(H,ce,ve?de:0),bt&&ie&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ir=>Rt(ir,ce.id,ie,ut),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ce.id}-${H.id}`)})]},ce.id)})}),jsxRuntime.jsx(ls,{isOpen:Ge.isOpen,x:Ge.x,y:Ge.y,items:Ge.type==="header"&&Ge.columnId?Vr(Ge.columnId):Ge.type==="task"&&Ge.task?ea(Ge.task):[],onClose:()=>Qe({...Ge,isOpen:false}),theme:t}),st&&zt&&se&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:zt.x+12,top:zt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=mt.find(de=>de.task.id===se)?.task;return ce?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ce.name})}):null})()}),document.body)]})}function Vm(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,l]=react.useState(e),[c,i]=react.useState(t),[d,m]=react.useState(null),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(0),[w,k]=react.useState(0),[M,B]=react.useState(null),[T,C]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:d,setConnectionLine:m,hoveredTaskId:u,setHoveredTaskId:p,activeZone:f,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:B,isHovered:T,setIsHovered:C,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(Z,L)=>{a("none"),m(null),p(null),l(Z),i(L),k(0),b(null),v(0);}}}function tl({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:d,onDateChange:m,onDependencyCreate:u,allTaskPositions:p=[],onDragMove:f,onHoverChange:x,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:v=false,onProgressChange:w}){let k=Vm(t,a),M=react.useRef(null),B=react.useRef(false),T=react.useRef(null),C=react.useRef(null),{dragMode:P,setDragMode:D,dragOffset:V,setDragOffset:$,ghostX:Z,setGhostX:L,ghostWidth:Ae,setGhostWidth:W,connectionLine:Ce,setConnectionLine:I,hoveredTaskId:z,setHoveredTaskId:Oe,activeZone:ze,setActiveZone:Q,draggedSegmentIndex:De,setDraggedSegmentIndex:oe,draggedSegmentStartX:He,setDraggedSegmentStartX:Se,segmentDragOffsetX:Fe,setSegmentDragOffsetX:Ge,hoveredSegmentIndex:Qe,setHoveredSegmentIndex:se,isHovered:Ze,setIsHovered:_e,isDragging:$e,isResizing:ft,isConnecting:pt,resetDragState:je}=k,Re=18,dt=!!n.executionBarBg,zt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Le=dt?3:6,st=e.subtasks&&e.subtasks.length>0,F=react.useRef(null),[J,R]=(()=>{let _=react.useRef(null),[,fe]=react.useState(0);return [_.current,ee=>{_.current=ee,fe(O=>O+1);}]})(),Y=!!w&&!v&&!st&&!e.segments&&!!e.startDate&&!!e.endDate,ue=e.endDate&&(()=>{let _=new Date;_.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<_})()&&e.progress<100,he=y&&e.isCriticalPath,Be=n.name==="neutral"||n.today==="#1C1917",j=e.status==="completed"||e.progress===100,xe={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ue=y&&e.isCriticalPath||ue?"#EF4444":e.color?e.color:e.priority&&xe[e.priority]?xe[e.priority]:n.taskBarPrimary,Ct=v?"default":$e?pt?"crosshair":ft?"ew-resize":"grabbing":"grab",Xe=v?"default":"ew-resize",mt=(_=>_>=80?20:_>=60?15:_>=50?12:10)(a),Jt=a<50,xr=a<40;react.useEffect(()=>{x&&(!Ze||$e||e.segments)&&x(null);},[Ze,$e,e.segments,x]);let Er=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Rt=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},Hr=_=>Math.round(_/s)*s,Bt=_=>{let fe=Math.round(_/s),ee=new Date(o);return ee.setDate(ee.getDate()+fe),ee},vr=(_,fe)=>{for(let ee of p){if(ee.id===e.id)continue;let O=5;if(_>=ee.x-O&&_<=ee.x+ee.width+O&&fe>=ee.y-O&&fe<=ee.y+ee.height+O)return ee.id}return null},Gt=react.useCallback((_,fe,ee)=>{if(v)return;_.preventDefault(),_.stopPropagation();let O=M.current?.ownerSVGElement;if(!O)return;let te=O.createSVGPoint();te.x=_.clientX,te.y=_.clientY;let we=te.matrixTransform(O.getScreenCTM()?.inverse()),N=ee!==void 0?ee:t,H=fe;if(!H){let me=we.x-N;_.shiftKey?(H="connect",I({x:t+a,y:r+Re/2})):_.ctrlKey||_.metaKey?H="move":_.altKey?H=me<a/2?"resize-start":"resize-end":xr?me<a/2?H="move":H="resize-end":Jt?me<=mt/2?H="resize-start":me>=a-mt/2?H="resize-end":H="move":me<=mt?H="resize-start":me>=a-mt?H="resize-end":H="move";}B.current=false,D(H),_e(false),Q(null),H==="move"?$(we.x-N):H==="connect"?I({x:t+a,y:r+Re/2}):$(0),L(N),W(a);},[t,a,r,Re,v]),Qt=react.useCallback(_=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let ee=fe.closest(".gantt-timeline-scroll");if(!ee)return;let O=ee.getBoundingClientRect(),te=60,we=15,N=0;if(_.clientX<O.left+te){let H=O.left+te-_.clientX;N=-Math.min(we,H/2);}else if(_.clientX>O.right-te){let H=_.clientX-(O.right-te);N=Math.min(we,H/2);}return N!==0&&(ee.scrollLeft+=N),N!==0},[]),Zr=react.useCallback(_=>{if(P==="none")return;B.current=true,C.current=_;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let te=Qt(_);te&&!T.current?T.current=window.setInterval(()=>{C.current&&(Qt(C.current),Zr(C.current));},16):!te&&T.current&&(window.clearInterval(T.current),T.current=null);}let ee=fe.createSVGPoint();ee.x=_.clientX,ee.y=_.clientY;let O=ee.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){I({x:O.x,y:O.y});let te=vr(O.x,O.y);Oe(te);}else if(P==="move"){let te=O.x-V,we=Hr(te);L(we),W(a);let N=Math.round((we-t)/s);if(f?.(e.id,N,true),e.segments&&e.segments.length>0&&De!==null){let H=we-He;Ge(H);}}else if(P==="resize-start"){let te=O.x,we=Hr(te),N=t+a-we;N>=s&&(L(we),W(N));}else if(P==="resize-end"){let te=O.x,N=Hr(te)-t;N>=s&&W(N);}},[P,t,a,s,V,e,Hr,De,He,vr,Oe,I,L,W,Ge,f,Qt]),ba=react.useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),C.current=null,P!=="none"){if(P==="connect")z&&u&&u(e,z),I(null),Oe(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),fe,ee,O=true;if(P==="move"){if(fe=Bt(Z),ee=new Date(fe.getTime()+_),e.segments&&e.segments.length>0&&De!==null){let te=Math.round(Fe/s),we=e.segments.map((K,ve)=>{if(ve===De){let nt=new Date(K.startDate),ie=new Date(K.endDate);return nt.setDate(nt.getDate()+te),ie.setDate(ie.getDate()+te),{startDate:nt,endDate:ie}}return K}),N=we.flatMap(K=>[K.startDate,K.endDate]),H=new Date(Math.min(...N.map(K=>K.getTime()))),me=new Date(Math.max(...N.map(K=>K.getTime())));m?.({...e,segments:we},H,me),je(t,a);return}}else P==="resize-start"?(fe=Bt(Z),ee=e.endDate,fe>ee&&(console.warn("Invalid date range: start date must be before or equal to end date"),O=false)):P==="resize-end"?(fe=e.startDate,ee=Bt(Z+Ae),ee.setDate(ee.getDate()-1),ee<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),O=false)):O=false;O&&fe&&ee&&(ee.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,ee));}f?.(e.id,0,false),je(t,a);}},[P,Z,Ae,e,m,z,u,t,a,s,Bt,Fe,De,je,f]);react.useEffect(()=>{if(P==="none")return;let _=ee=>{Zr(ee);},fe=()=>{ba();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",fe),T.current&&(window.clearInterval(T.current),T.current=null);}},[P,Zr,ba]);let et=$e&&!pt?Z:t,Ke=$e&&!pt?Ae:a,sa=l.taskClass(e),Vr=24,ea=y?e.isCriticalPath?1:.25:1,jr=react.useCallback(_=>{if(!Y)return;_.stopPropagation(),_.preventDefault();let ee=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;F.current={barRect:ee,initialPct:e.progress||0},_.currentTarget.setPointerCapture(_.pointerId),R(e.progress||0);},[Y,e.progress,R]),_r=react.useCallback(_=>{let fe=F.current;if(!fe)return;let O=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!O||O.width<=0)return;let te=(_.clientX-O.left)/O.width,we=Math.round(Math.max(0,Math.min(1,te))*100);_.shiftKey&&(we=Math.round(we/25)*25),R(we);},[R]),ce=react.useCallback(_=>{let fe=F.current;if(!fe)return;_.stopPropagation(),_.preventDefault();try{_.currentTarget.releasePointerCapture(_.pointerId);}catch{}let ee=J;F.current=null,R(null),ee!=null&&ee!==fe.initialPct&&w&&w(e,ee);},[J,w,e,R]),de=react.useCallback(_=>{_.stopPropagation(),_.preventDefault();},[]),ut=J??(e.progress||0);return jsxRuntime.jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:ea,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!B.current&&c?.(e),B.current=false;},onDoubleClick:_=>{!$e&&!B.current&&(_.stopPropagation(),i?.(e));},onContextMenu:_=>{_.preventDefault(),d?.(e,_);},onMouseEnter:()=>!$e&&_e(true),onMouseMove:_=>{x&&Ze&&!$e&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Re,showBelow:false,mouseX:_.clientX,mouseY:_.clientY});},onMouseLeave:()=>{$e||(_e(false),Q(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+Vr,height:Re,fill:"transparent",style:{pointerEvents:"all"}}),Ze&&!$e&&!Jt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:mt,height:Re,fill:ze==="resize-start"?n.accent:"transparent",opacity:ze==="resize-start"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>Q("resize-start"),onMouseDown:_=>Gt(_,"resize-start")}),jsxRuntime.jsx("rect",{x:t+mt,y:r,width:a-mt*2,height:Re,fill:ze==="move"?n.accent:"transparent",opacity:ze==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:_=>Gt(_,"move")}),jsxRuntime.jsx("rect",{x:t+a-mt,y:r,width:mt,height:Re,fill:ze==="resize-end"?n.accent:"transparent",opacity:ze==="resize-end"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:_=>Gt(_,"resize-end")})]}),Ze&&!$e&&xr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Re,fill:ze==="move"?n.accent:"transparent",opacity:ze==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:_=>Gt(_,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Re,fill:ze==="resize-end"?n.accent:"transparent",opacity:ze==="resize-end"?.2:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:_=>Gt(_,"resize-end")}),Ze&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Re-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Z,y:r,width:Ae,height:Re,rx:Le,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let _=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),ee=o.getTime(),O=864e5,te=(_-ee)/O,we=(fe-_)/O,N=te*s,H=Math.max(we*s,s),me=et+Ke,K=N+H,ve=e.endDate?.getTime()??0,nt=Math.ceil((ve-fe)/O),ie=nt>0,ot=nt<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:N,y:r,width:H,height:Re,rx:Le,fill:"none",stroke:zt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ie&&me>K&&jsxRuntime.jsx("rect",{x:K,y:r,width:me-K,height:Re,rx:0,fill:"#EF4444",opacity:.2}),ie&&jsxRuntime.jsxs("text",{x:Math.max(me,K)+6,y:r+Re/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",nt,"d"]}),ot&&jsxRuntime.jsxs("text",{x:me+6,y:r+Re/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[nt,"d"]})]})})(),!e.segments&&dt&&st&&(()=>{let fe=r+(Re-8)/2,ee=4,O=e.progress||0,te=new Date;te.setHours(0,0,0,0);let we=e.startDate&&te>=e.startDate,N=e.endDate&&(()=>{let ie=new Date(e.endDate);return ie.setHours(0,0,0,0),te>ie})(),H=e.startDate&&te<e.startDate,me=1;if(we&&e.startDate&&e.endDate&&!H){let ie=new Date(e.startDate);ie.setHours(0,0,0,0);let ot=new Date(e.endDate);ot.setHours(0,0,0,0);let bt=Math.max(1,(ot.getTime()-ie.getTime())/(1e3*60*60*24)),ir=Math.min((te.getTime()-ie.getTime())/(1e3*60*60*24),bt)/bt*100;me=ir>0?O/ir:1;}let K;O>=100?K="#00E5CC":H?K="#4B5563":N&&O<100?K="#EF4444":me>=.95?K="#22C55E":me>=.8?K="#F59E0B":K="#EF4444";let ve=Math.max(O/100*Ke,O>0?ee*2:0),nt=Ke>100&&O>0;return jsxRuntime.jsxs("g",{"data-task-class":sa,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:et,y:fe,width:Ke,height:8,rx:ee,fill:"rgba(255,255,255,0.10)"}),O>0&&jsxRuntime.jsx("rect",{x:et,y:fe,width:ve,height:8,rx:ee,fill:K}),nt&&jsxRuntime.jsxs("text",{x:et+ve+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(O),"%"]})]})})(),!e.segments&&dt&&!st&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:Ke,height:Re,rx:Le,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":sa,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!pt?.15:e.parentId?.6:1,scale:Ze&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>Gt(_),style:{cursor:Ct,pointerEvents:"all"}}),!e.segments&&!dt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et,y:r,width:Ke,height:Re,rx:Le,fill:Ue,"data-task-class":sa,initial:{opacity:0,scale:.95},animate:{opacity:$e&&!pt?.15:e.parentId?.6:Ze?.9:.8,scale:Ze&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:st?void 0:_=>Gt(_),style:{cursor:st?"default":Ct,pointerEvents:"all"}}),dt&&(ue||he)&&!e.segments&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Re,rx:Le,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&ut>0&&!st&&jsxRuntime.jsx("rect",{x:et,y:r,width:Math.max(Ke*(ut/100),Le*2),height:Re,rx:Le,fill:Ue,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!st&&e.progress<100&&(()=>{let _=e.progress>0?Ke*(e.progress/100):0,fe=et+_,ee=Ke-_,O=e.progress===0?Le:0,te=e.progress===0?et:fe,we=e.progress===0?Ke:ee;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:te,y:r,width:we,height:Re,rx:O,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:te,y:r,width:we,height:Re,rx:O,fill:"none",stroke:Ue,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),dt&&!e.segments&&e.progress>0&&e.progress<100&&!st&&!$e&&J===null&&(()=>{let _=et+Ke*(e.progress/100),fe=8,ee=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:_,cy:r+Re/2,r:fe,fill:ee?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:_,y:r+Re/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ee?.initials||ee?.name?.charAt(0)?.toUpperCase()||""})]})})(),Y&&!$e&&Ke>=40&&(J!==null||ut<88)&&(()=>{let _=et+Ke*(ut/100),fe=r+Re/2,ee=J!==null,O=ee?7:Ze?6:5,te=ee||Ze?1:.35,we=et+Ke-_,N=Math.max(4,Math.min(12,we-10)),H=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:_-H,y:fe-12,width:H+N,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:jr,onPointerMove:_r,onPointerUp:ce,onPointerCancel:ce,onClick:de,onDoubleClick:de,onMouseDown:me=>me.stopPropagation()}),jsxRuntime.jsx("circle",{cx:_,cy:fe,r:O,fill:"#FFFFFF",stroke:Ue,strokeWidth:2,opacity:te,style:{pointerEvents:"none",filter:ee?`drop-shadow(0 0 4px ${Ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ee&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:_-20,y:fe-28,width:40,height:18,rx:4,fill:zt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ue,strokeWidth:1}),jsxRuntime.jsxs("text",{x:_,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:zt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((_,fe)=>{let ee=(_.startDate.getTime()-o.getTime())/864e5*s,te=(_.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ee+s,we=$e&&P==="move"&&De===fe,N=Qe===fe,H=we?ee+Fe:ee;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!$e&&se(fe),onMouseLeave:()=>!$e&&se(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:H,y:r,width:te,height:Re,rx:Le,fill:Ue,initial:{opacity:0,scale:.95},animate:{opacity:we||e.parentId?.6:N?.9:.8,scale:N&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:me=>{me.stopPropagation(),oe(fe),Se(ee),Gt(me,void 0,ee);},style:{cursor:Ct,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:H,y:r,width:te*(e.progress/100),height:Re,rx:Le,fill:Ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),Be&&(ue||he)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[he&&!ue&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Re,rx:Le,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ue&&jsxRuntime.jsx("rect",{x:et,y:r,width:Ke,height:Re,rx:Le,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ke>60&&!e.segments&&!(dt&&st)&&(()=>{let _=l.taskLabel(e),fe=typeof _=="string"?_:e.name,ee=fe.length>Math.floor(Ke/8)?`${fe.substring(0,Math.floor(Ke/8))}...`:fe;return jsxRuntime.jsx("text",{x:et+8,y:r+Re/2,dominantBaseline:"middle",fill:j?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:j?"line-through":"none"},children:ee})})(),!$e&&!e.segments&&!st&&e.progress>0&&e.progress<100&&(dt?jsxRuntime.jsxs("text",{x:et+Ke+6,y:r+Re/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ke>100?jsxRuntime.jsxs("text",{x:et+Ke-12,y:r+Re/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,"%"]}):null),e.status&&Ke>80&&!$e&&!e.segments&&!(dt&&st)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:et+Ke-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:et+Ke-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ze||ft)&&!pt&&!e.segments&&!st&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et-2,y:r,width:16,height:Re,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>Q("resize-start"),onMouseLeave:()=>Q(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+4,y:r+8,width:3,height:Re-16,rx:1.5,fill:ze==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:et+Ke-14,y:r,width:16,height:Re,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>Q("resize-end"),onMouseLeave:()=>Q(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:et+Ke-7,y:r+8,width:3,height:Re-16,rx:1.5,fill:ze==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&!$e&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+a+10,cy:r+Re/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Q("connect"),onMouseLeave:()=>Q(null),onMouseDown:_=>{_.stopPropagation(),Gt(_,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+10,cy:r+Re/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ze==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),pt&&Ce&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Re/2,x2:Ce.x,y2:Ce.y,stroke:z?n.statusCompleted:n.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:Ce.x,cy:Ce.y,r:z?8:6,fill:z?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsxRuntime.jsx(framerMotion.motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(Ze||$e)&&!pt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:et-1,y:r-1,width:Ke+2,height:Re+2,rx:Le+1,fill:"none",stroke:$e?n.accent:dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:dt?1:2,opacity:$e||dt?.6:.4,initial:{opacity:0},animate:{opacity:$e||dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ft&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:Z,y1:0,x2:Z,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Z+Ae,y1:0,x2:Z+Ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ze&&!$e&&!e.segments&&!x&&(()=>{let ee=r<100,O=ee?r+Re+13:r-82-13,te=ee?`M ${et+Ke/2-6} ${r+Re+3} L ${et+Ke/2} ${r+Re+13} L ${et+Ke/2+6} ${r+Re+3}`:`M ${et+Ke/2-6} ${r-13} L ${et+Ke/2} ${r-3} L ${et+Ke/2+6} ${r-13}`,we=O+22,N=O+40,H=O+55,me=O+70,K=ee?O+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ee?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ee?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:te,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:et+Ke/2-120,y:O,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))"}),jsxRuntime.jsx("text",{x:et+Ke/2,y:we,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}),jsxRuntime.jsx("text",{x:et+Ke/2-110,y:N,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:et+Ke/2-70,y:N,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Er(e.startDate)}),jsxRuntime.jsx("text",{x:et+Ke/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:et+Ke/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Er(e.endDate)}),jsxRuntime.jsx("text",{x:et+Ke/2+10,y:N,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:et+Ke/2+65,y:N,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Rt()}),jsxRuntime.jsx("text",{x:et+Ke/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:et+Ke/2+65,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:et+Ke/2-110,y:me,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:et+Ke/2-50,y:me,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ve=>ve.name).join(", ").substring(0,30),e.assignees.map(ve=>ve.name).join(", ").length>30?"...":""]})]}),!ee&&jsxRuntime.jsx("text",{x:et+Ke/2,y:K,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:xr?"Left: move \u2022 Right: resize":Jt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var ud=260,us=8,Km=16,uw=-12;function qm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=react.useState(null);if(react.useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:k}=e,M=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,B=v.lastActivity!=null,T=(M?155:105)+(B?28:0),C=w+Km,P=k+uw-T;C+ud>window.innerWidth-us&&(C=w-ud-Km),C<us&&(C=us);let D=P<us;D&&(P=k+20),P+T>window.innerHeight-us&&(P=window.innerHeight-us-T),s({left:C,top:P,showBelow:D});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,B=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;B.getTime()<=T.getTime();){let P=B.getDay();v[P]&&!w.has(k(B))&&M++,B.setDate(B.getDate()+1);}let C=Math.max(0,M);return r==="es"?`${C} d\xEDa${C!==1?"s":""}`:`${C} day${C!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),k=v%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},u=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxRuntime.jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxRuntime.jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsxRuntime.jsx(rl,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(rl,{label:c.duration,value:d(),labelColor:u,valueColor:p}),jsxRuntime.jsx(rl,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:u,valueColor:p}),jsxRuntime.jsx(rl,{label:c.progress,value:`${o.progress}%`,labelColor:u,valueColor:p})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:p,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(v=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${v.color}22`,color:v.color,border:`1px solid ${v.color}55`,whiteSpace:"nowrap"},children:v.name},v.id))})]}),l&&jsxRuntime.jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:u},children:[c.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:p,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxRuntime.jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:u,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:p},children:o.lastActivity.userName})," ",jsxRuntime.jsx("span",{children:o.lastActivity.summary})," ",jsxRuntime.jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsxRuntime.jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return reactDom.createPortal(y,document.body)}function tl({label:e,value:t,labelColor:r,valueColor:a}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:r},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Xs({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:m,glowFilter:u}){let[,p]=react.useState(false),[f,x]=react.useState(null),h=a-t,b=h>0,y=Math.abs(h)<5,v=20,w=!y&&r<=e,k,M,B=r-e,T=e+B/2;M=T;let C=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${r} ${a}`;else if(w){let Se=e+15,Pe=r-v,ze=b?t+20:t-20;M=Pe;let Ze=b?1:-1;k=`M ${e} ${t} L ${Se-C} ${t} Q ${Se} ${t} ${Se} ${t+Ze*C} L ${Se} ${ze-Ze*C} Q ${Se} ${ze} ${Se-C} ${ze} L ${Pe+C} ${ze} Q ${Pe} ${ze} ${Pe} ${ze+Ze*C} L ${Pe} ${a-Ze*C} Q ${Pe} ${a} ${Pe+C} ${a} L ${r} ${a}`;}else {M=r-v;let He=b?1:-1;k=`M ${e} ${t} L ${M-C} ${t} Q ${M} ${t} ${M} ${t+He*C} L ${M} ${a-He*C} Q ${M} ${a} ${M+C} ${a} L ${r} ${a}`;}else k=`M ${e} ${t} C ${T} ${t}, ${T} ${a}, ${r} ${a}`;let P=6,D=5,V=`M ${r} ${a} L ${r-P} ${a-D/2} L ${r-P} ${a+D/2} Z`,$=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ee=d||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=m||1,Le=n.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),W="#f87171",Ce="rgba(248, 113, 113, 0.15)",I=M,z=(t+a)/2;if(f)if(o==="squared")if(y)I=Math.max(e+10,Math.min(r-10,f.x)),z=t;else if(w){let He=e+15,Se=r-v,Pe=b?t+20:t-20,ze=[[e,t,He,t],[He,t,He,Pe],[He,Pe,Se,Pe],[Se,Pe,Se,a],[Se,a,r,a]],Ze=1/0,le={x:I,y:z};for(let tt of ze){let je=Oe(f.x,f.y,tt[0],tt[1],tt[2],tt[3]),$e=Math.hypot(f.x-je.x,f.y-je.y);$e<Ze&&(Ze=$e,le=je);}I=le.x,z=le.y;}else {let He=[[e,t,M,t],[M,t,M,a],[M,a,r,a]],Se=1/0,Pe={x:I,y:z};for(let ze of He){let Ze=Oe(f.x,f.y,ze[0],ze[1],ze[2],ze[3]),le=Math.hypot(f.x-Ze.x,f.y-Ze.y);le<Se&&(Se=le,Pe=Ze);}I=Pe.x,z=Pe.y;}else {let He=T,Se=t,Pe=T,ze=a,Ze=1/0,le=I,tt=z;for(let je=0;je<=1;je+=.02){let $e=1-je,bt=$e*$e*$e*e+3*$e*$e*je*He+3*$e*je*je*Pe+je*je*je*r,mt=$e*$e*$e*t+3*$e*$e*je*Se+3*$e*je*je*ze+je*je*je*a,Ve=Math.hypot(f.x-bt,f.y-mt);Ve<Ze&&(Ze=Ve,le=bt,tt=mt);}I=le,z=tt;}function Oe(He,Se,Pe,ze,Ze,le){let tt=Ze-Pe,je=le-ze,$e=tt*tt+je*je;if($e===0)return {x:Pe,y:ze};let bt=((He-Pe)*tt+(Se-ze)*je)/$e;return bt=Math.max(0,Math.min(1,bt)),{x:Pe+bt*tt,y:ze+bt*je}}let We=He=>{let Se=He.currentTarget.ownerSVGElement;if(!Se)return;let Pe=Se.getScreenCTM();if(!Pe)return;let ze=Pe.inverse();x({x:ze.a*He.clientX+ze.c*He.clientY+ze.e,y:ze.b*He.clientX+ze.d*He.clientY+ze.f});},J=()=>{p(false),x(null),c?.(false);},De=()=>{p(true),c?.(true);},se=He=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:He,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:I,cy:z,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:I,cy:z,r:9,fill:Ce,stroke:W,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:I-3,y1:z-3,x2:I+3,y2:z+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:I+3,y1:z-3,x2:I-3,y2:z+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:J,onMouseMove:We,children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Le,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Le,opacity:.9,style:{pointerEvents:"none"}}),se({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:De,onMouseLeave:J,onMouseMove:We,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Le,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Le,style:{pointerEvents:"none"}}),se({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:De,onMouseLeave:J,onMouseMove:We,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:ee,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:u||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:V,fill:ee,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:ee,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function ol({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.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:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.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}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y: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))"}),jsxRuntime.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}),jsxRuntime.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})`}),jsxRuntime.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}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.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"})]})]})})]})}var Te={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(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,l=new Set,c=i=>{if(!o.has(i)){o.add(i),l.add(i);let d=a.get(i)||[];for(let m of d){if(!o.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Te.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Te.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Te.findTaskById(e,n);if(s)r.unshift(s),n=s.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=Te.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[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(s.join(","));}),a.join(`
130
+ `})]});return reactDom.createPortal(y,document.body)}function rl({label:e,value:t,labelColor:r,valueColor:a}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("span",{style:{color:r},children:[e,": "]}),jsxRuntime.jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Js({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:m,glowFilter:u}){let[,p]=react.useState(false),[f,x]=react.useState(null),h=a-t,b=h>0,y=Math.abs(h)<5,v=20,w=!y&&r<=e,k,M,B=r-e,T=e+B/2;M=T;let C=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${r} ${a}`;else if(w){let Se=e+15,Fe=r-v,Ge=b?t+20:t-20;M=Fe;let Qe=b?1:-1;k=`M ${e} ${t} L ${Se-C} ${t} Q ${Se} ${t} ${Se} ${t+Qe*C} L ${Se} ${Ge-Qe*C} Q ${Se} ${Ge} ${Se-C} ${Ge} L ${Fe+C} ${Ge} Q ${Fe} ${Ge} ${Fe} ${Ge+Qe*C} L ${Fe} ${a-Qe*C} Q ${Fe} ${a} ${Fe+C} ${a} L ${r} ${a}`;}else {M=r-v;let He=b?1:-1;k=`M ${e} ${t} L ${M-C} ${t} Q ${M} ${t} ${M} ${t+He*C} L ${M} ${a-He*C} Q ${M} ${a} ${M+C} ${a} L ${r} ${a}`;}else k=`M ${e} ${t} C ${T} ${t}, ${T} ${a}, ${r} ${a}`;let P=6,D=5,V=`M ${r} ${a} L ${r-P} ${a-D/2} L ${r-P} ${a+D/2} Z`,$=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),Z=d||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=m||1,Ae=n.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),W="#f87171",Ce="rgba(248, 113, 113, 0.15)",I=M,z=(t+a)/2;if(f)if(o==="squared")if(y)I=Math.max(e+10,Math.min(r-10,f.x)),z=t;else if(w){let He=e+15,Se=r-v,Fe=b?t+20:t-20,Ge=[[e,t,He,t],[He,t,He,Fe],[He,Fe,Se,Fe],[Se,Fe,Se,a],[Se,a,r,a]],Qe=1/0,se={x:I,y:z};for(let Ze of Ge){let _e=Oe(f.x,f.y,Ze[0],Ze[1],Ze[2],Ze[3]),$e=Math.hypot(f.x-_e.x,f.y-_e.y);$e<Qe&&(Qe=$e,se=_e);}I=se.x,z=se.y;}else {let He=[[e,t,M,t],[M,t,M,a],[M,a,r,a]],Se=1/0,Fe={x:I,y:z};for(let Ge of He){let Qe=Oe(f.x,f.y,Ge[0],Ge[1],Ge[2],Ge[3]),se=Math.hypot(f.x-Qe.x,f.y-Qe.y);se<Se&&(Se=se,Fe=Qe);}I=Fe.x,z=Fe.y;}else {let He=T,Se=t,Fe=T,Ge=a,Qe=1/0,se=I,Ze=z;for(let _e=0;_e<=1;_e+=.02){let $e=1-_e,ft=$e*$e*$e*e+3*$e*$e*_e*He+3*$e*_e*_e*Fe+_e*_e*_e*r,pt=$e*$e*$e*t+3*$e*$e*_e*Se+3*$e*_e*_e*Ge+_e*_e*_e*a,je=Math.hypot(f.x-ft,f.y-pt);je<Qe&&(Qe=je,se=ft,Ze=pt);}I=se,z=Ze;}function Oe(He,Se,Fe,Ge,Qe,se){let Ze=Qe-Fe,_e=se-Ge,$e=Ze*Ze+_e*_e;if($e===0)return {x:Fe,y:Ge};let ft=((He-Fe)*Ze+(Se-Ge)*_e)/$e;return ft=Math.max(0,Math.min(1,ft)),{x:Fe+ft*Ze,y:Ge+ft*_e}}let ze=He=>{let Se=He.currentTarget.ownerSVGElement;if(!Se)return;let Fe=Se.getScreenCTM();if(!Fe)return;let Ge=Fe.inverse();x({x:Ge.a*He.clientX+Ge.c*He.clientY+Ge.e,y:Ge.b*He.clientX+Ge.d*He.clientY+Ge.f});},Q=()=>{p(false),x(null),c?.(false);},De=()=>{p(true),c?.(true);},oe=He=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:He,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Se=>{Se.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:I,cy:z,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:I,cy:z,r:9,fill:Ce,stroke:W,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:I-3,y1:z-3,x2:I+3,y2:z+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:I+3,y1:z-3,x2:I-3,y2:z+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:Q,onMouseMove:ze,children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Ae,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Ae,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Ae,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Ae,opacity:.9,style:{pointerEvents:"none"}}),oe({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:De,onMouseLeave:Q,onMouseMove:ze,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Ae,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Ae,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Ae,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Ae,style:{pointerEvents:"none"}}),oe({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:De,onMouseLeave:Q,onMouseMove:ze,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:Z,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:u||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:V,fill:Z,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:Z,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function sl({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=react.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.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:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.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}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y: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))"}),jsxRuntime.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}),jsxRuntime.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})`}),jsxRuntime.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}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.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"})]})]})})]})}var Te={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(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,l=new Set,c=i=>{if(!o.has(i)){o.add(i),l.add(i);let d=a.get(i)||[];for(let m of d){if(!o.has(m)&&c(m))return true;if(l.has(m))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Te.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Te.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Te.findTaskById(e,n);if(s)r.unshift(s),n=s.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=Te.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[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(s.join(","));}),a.join(`
131
131
  `)},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=Te.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=Te.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)=>Te.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=Te.findTaskById(e,t);return !r||!r.dependencies?[]:Te.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>Te.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>Te.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=Te.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 s=t[n];if(!r||s===void 0||s>=r.length||(a=r[s],!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=>Te.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,s=Te.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Te.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Te.formatDate(c.startDate):"N/A",c.endDate?Te.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});a(n,{head:o,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}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t,r)=>{let a=await import('xlsx'),n=Te.flattenTasks(e),s=r?.rateMap,o=r?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return o;let b=h.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return b.length===0?o:b.reduce((y,v)=>y+v,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(v.id,k),v.subtasks?.length&&i(v.subtasks,k);});};i(e);let d=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),m=n.map(h=>{let b=h.startDate&&h.endDate?Te.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,v=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof v=="number"?+(v/60).toFixed(1):0,B=typeof w=="number"?+(w/60).toFixed(1):0,T=h._costRate>0?h._costRate:l(h),C={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Te.formatDate(h.startDate):"","End Date":h.endDate?Te.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(D=>D.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":B||""};d&&(C["$ Estimated"]=k>0&&T>0?Math.round(k*T):"",C["$ Executed"]=M>0&&T>0?Math.round(M*T):"",C["$ Quoted"]=B>0&&T>0?Math.round(B*T):"",C["Rate ($/h)"]=T>0?T:"");let P=h.weight;return C["Weight (%)"]=typeof P=="number"&&P>0?P:"",C["Is Milestone"]=h.isMilestone?"Yes":"No",C}),u=r?.projectName||"";if(u||m.length>0){let h=0,b=0,y=0,v=0,w=0,k=0,M=0,B=0,T=n.filter(D=>D.startDate).map(D=>D.startDate.getTime()),C=n.filter(D=>D.endDate).map(D=>D.endDate.getTime());for(let D of m)typeof D["Estimated (h)"]=="number"&&(h+=D["Estimated (h)"]),typeof D["Logged (h)"]=="number"&&(b+=D["Logged (h)"]),typeof D["Quoted (h)"]=="number"&&(y+=D["Quoted (h)"]),d&&(typeof D["$ Estimated"]=="number"&&(v+=D["$ Estimated"]),typeof D["$ Executed"]=="number"&&(w+=D["$ Executed"]),typeof D["$ Quoted"]=="number"&&(k+=D["$ Quoted"])),typeof D["Progress (%)"]=="number"&&(M+=D["Progress (%)"],B++);let P={WBS:"0","Task Name":`\u{1F4CB} ${u||"PROJECT TOTAL"}`,"Start Date":T.length>0?Te.formatDate(new Date(Math.min(...T))):"","End Date":C.length>0?Te.formatDate(new Date(Math.max(...C))):"","Duration (days)":T.length>0&&C.length>0?Te.calculateDuration(new Date(Math.min(...T)),new Date(Math.max(...C))):"","Progress (%)":B>0?Math.round(M/B):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};d&&(P["$ Estimated"]=v||"",P["$ Executed"]=w||"",P["$ Quoted"]=k||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",m.unshift(P);}let p=a.utils.json_to_sheet(m),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...d?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];p["!cols"]=f;let x=a.utils.book_new();if(a.utils.book_append_sheet(x,p,"Gantt Tasks"),!t){let h=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}a.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=Te.flattenTasks(e),n=new Map;a.forEach((u,p)=>{n.set(u.id,p+1);});let s=u=>u.toISOString().replace("Z",""),o=Te.getEarliestStartDate(e)||new Date,l=Te.getLatestEndDate(e)||new Date,c=a.map((u,p)=>{let f=n.get(u.id),x=u.startDate&&u.endDate?Te.calculateDuration(u.startDate,u.endDate):0,h=(u.dependencies||[]).filter(b=>n.has(b)).map(b=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${n.get(b)}</PredecessorUID>
@@ -358,14 +358,14 @@
358
358
  </Calendars>
359
359
  <Tasks>${c}
360
360
  </Tasks>
361
- </Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(d),m.download=r,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Te.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 d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let f=t.find(x=>x.id===p);if(f){n(f);let x=a.get(p)?.ef||0;m=Math.max(m,x);}}let u=m+d;a.set(i.id,{es:m,ef:u});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),u=s;if(m.length>0)for(let f of m){l(f);let x=o.get(f.id)?.ls||0;u=Math.min(u,x);}let p=u-d;o.set(i.id,{ls:p,lf:u});};r.forEach(l);let c=[];for(let i of r){let d=a.get(i.id),m=o.get(i.id);if(d&&m){let u=m.ls-d.es;Math.abs(u)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,a=Te.flattenTasks(e).filter(u=>u.startDate&&u.endDate);if(a.length===0)return t;let n=new Map(a.map(u=>[u.id,u])),s=new Map;for(let u of a)s.has(u.id)||s.set(u.id,[]);for(let u of a)if(u.dependencies){for(let p of u.dependencies)if(n.has(p)){let f=s.get(p);f&&f.push(u.id);}}let o=new Map;for(let u of a)o.set(u.id,0);for(let u of a)if(u.dependencies)for(let p of u.dependencies)n.has(p)&&o.set(u.id,(o.get(u.id)||0)+1);let l=new Map,c=[],i=[];for(let u of a)(o.get(u.id)||0)===0&&i.push(u.id);for(;i.length>0;){let u=i.shift();c.push(u);let p=n.get(u);if(!p||!p.startDate||!p.endDate)continue;let f=Te.calculateDuration(p.startDate,p.endDate),x=0;if(p.dependencies)for(let b of p.dependencies){let y=l.get(b);y&&(x=Math.max(x,y.ef));}l.set(u,{es:x,ef:x+f});let h=s.get(u)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<a.length)return t;let d=Math.max(...Array.from(l.values()).map(u=>u.ef)),m=new Map;for(let u=c.length-1;u>=0;u--){let p=c[u];if(!p)continue;let f=n.get(p);if(!f||!f.startDate||!f.endDate)continue;let x=Te.calculateDuration(f.startDate,f.endDate),h=s.get(p)||[],b=d;if(h.length>0)for(let y of h){let v=m.get(y);v&&(b=Math.min(b,v.ls));}m.set(p,{ls:b-x,lf:b});}for(let u of c){let p=l.get(u),f=m.get(u),x=f.ls-p.es,h=s.get(u)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-p.ef:b=d-p.ef,t.set(u,{earlyStart:p.es,earlyFinish:p.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Te.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Te.calculateCriticalPath(e).includes(t))return 0;let n=Te.getDependentTasks(e,t);if(n.length===0){let l=Te.getLatestEndDate(e);if(!l)return null;let c=Te.calculateDuration(r.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=Te.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Te.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Te.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Te.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=Te.calculateDuration(c.startDate,c.endDate),d;if(r!==void 0?(d=new Date(c.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let p=new Date(s.endDate),f=new Date(p);f.setDate(f.getDate()+1),d<f&&(d=f);}let m=Te.calculateEndDate(d,i),u=p=>p.map(f=>f.id===c.id?{...f,startDate:d,endDate:m}:f.subtasks?{...f,subtasks:u(f.subtasks)}:f);l=u(l),l=Te.autoScheduleDependents(l,c.id,r,n);}return l},calculateCascadePreview:(e,t,r,a,n,s,o,l)=>{if(r===0)return [];let c=[],i=n.getTime(),d=1e3*60*60*24,m=Te.findTaskById(e,t);if(!m||!m.endDate)return [];let u=(p,f,x=new Set)=>{if(x.has(p))return;x.add(p);let h=Te.getDependentTasks(e,p);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(D=>D.id===b.id);if(y===-1)continue;let v=b.startDate.getTime(),k=(b.endDate.getTime()-v)/d,B=(v-i)/d*s,T=B+f*s,C=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:B,previewX:T,width:C,y:P,rowIndex:y,daysDelta:f,color:b.color}),u(b.id,f,x);}};return u(t,r),c},splitTask:(e,t,r,a=3)=>{let n=Te.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 s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=d=>d.map(m=>m.id===n.id?{...m,endDate:l,segments:c}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function sl({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:m,onTaskDblClick:u,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:k,onTaskProgressDrag:M,workingDaysConfig:B}){let C=Ka(),P=react.useRef(null),[D,V]=react.useState([]),[$,ee]=react.useState(null),[L,Le]=react.useState(null),[W,Ce]=react.useState(null),I=react.useRef(false),[z,Oe]=react.useState(new Set),[We,J]=react.useState(null),De=react.useCallback(R=>{if(W&&!I.current){let Y=R.target,de=false;for(;Y&&Y!==R.currentTarget;){if(Y.getAttribute?.("data-dependency-line")==="true"||Y.getAttribute?.("data-dependency-hover-overlay")==="true"){de=true;break}Y=Y.parentElement;}de||Ce(null);}},[W]),se=react.useCallback(R=>{Le(R);},[]),He=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=a==="day"?60:a==="week"?20:8,Pe=He*Se*o,ze=R=>{let Y=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),de=Y.getUTCDay()||7;Y.setUTCDate(Y.getUTCDate()+4-de);let he=new Date(Date.UTC(Y.getUTCFullYear(),0,1));return Math.ceil(((Y.getTime()-he.getTime())/864e5+1)/7)},Ze=R=>{let Y=R.getDay();return Y===0||Y===6},le=react.useMemo(()=>{let R=B?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[B?.holidayDates]),tt=R=>{if(!le)return false;let Y=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return le.has(Y)},je=react.useCallback(R=>{let Y=Math.round(R/(Se*o)),de=new Date(n);return de.setDate(de.getDate()+Y),de},[n,Se,o]),$e=react.useCallback((R,Y)=>{if(Y.startDate&&Y.endDate)return;let de=R.currentTarget.ownerSVGElement;if(!de)return;let he=de.createSVGPoint();he.x=R.clientX,he.y=R.clientY;let Be=he.matrixTransform(de.getScreenCTM()?.inverse()),j=je(Be.x),ye=new Date(j);ye.setDate(ye.getDate()+1),J(null),f?.(Y,j,ye);},[je,f]),bt=react.useCallback((R,Y,de)=>{let he=R.currentTarget.ownerSVGElement;if(!he)return;let Be=he.createSVGPoint();Be.x=R.clientX,Be.y=R.clientY;let j=Be.matrixTransform(he.getScreenCTM()?.inverse()),ye=je(j.x),Ue=Math.round(j.x/(Se*o))*Se*o;J({taskId:Y.id,x:Ue,y:de*r+r/2,date:ye});},[je,Se,o,r]),mt=react.useCallback(()=>{J(null);},[]),Ve=react.useMemo(()=>{let R=Be=>Be.map(j=>{if(j.subtasks&&j.subtasks.length>0){let ye=R(j.subtasks),Ae=ye.filter(Ue=>Ue.startDate&&Ue.endDate);if(Ae.length>0){let Ue=Ae.map(gt=>gt.startDate.getTime()),kt=Ae.map(gt=>gt.endDate.getTime()),Ye=new Date(Math.min(...Ue)),Nt=new Date(Math.max(...kt));return {...j,subtasks:ye,startDate:Ye,endDate:Nt}}return {...j,subtasks:ye}}return j}),Y=(Be,j=[])=>{let ye=[...Be].sort((Ae,Ue)=>(Ae.position??0)-(Ue.position??0));for(let Ae of ye)j.push(Ae),Ae.subtasks&&Ae.subtasks.length>0&&(Ae.isExpanded===void 0||Ae.isExpanded)&&Y(Ae.subtasks,j);return j},de=R(e);return Y(de)},[e]),Ie=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let Y=R.startDate.getTime(),de=R.endDate.getTime(),he=n.getTime(),Be=(Y-he)/(1e3*60*60*24),j=(de-Y)/(1e3*60*60*24)+1,ye=Be*Se*o,Ae=Math.max(Se*o,40),Ue=Math.max(j*Se*o,Ae);return {x:ye,width:Ue}},[n,Se,o]),dt=react.useMemo(()=>Ve.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:Y,width:de}=Ie(R),Be=Ve.findIndex(j=>j.id===R.id)*r+(r-18)/2;return {id:R.id,x:Y,y:Be,width:de,height:18}}),[Ve,Ie]),zt=react.useCallback((R,Y,de)=>{if(!de){V([]),ee(null);return}if(ee({taskId:R,daysDelta:Y}),Y===0){V([]);return}let he=Te.calculateCascadePreview(e,R,Y,Ve,n,Se*o,r,48);V(he);},[e,Ve,n,Se,o,r,48]),Fe=react.useCallback((R,Y)=>{if(!$)return Y;let de=Se*o,he=$.daysDelta*de;if(R===$.taskId)return {x:Y.x+he,width:Y.width};let Be=D.find(j=>j.taskId===R);return Be?{x:Be.previewX,width:Be.width}:Y},[$,D,Se,o]),nt=react.useMemo(()=>{let R=[],Y=new Date(n);for(;Y<=s;){let Be=(Y.getTime()-n.getTime())/864e5*Se*o;if(a==="day")R.push({date:new Date(Y),label:Y.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Be}),Y.setDate(Y.getDate()+1);else if(a==="week"){let j=ze(Y);R.push({date:new Date(Y),label:`${C.labels.week} ${j}`,x:Be}),Y.setDate(Y.getDate()+7);}else R.push({date:new Date(Y),label:Y.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Be}),Y.setMonth(Y.getMonth()+1);}return R},[n,s,a,Se,o,l,C.labels.week]),F=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),X=Math.max(Ve.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Pe,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Pe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),nt.map((R,Y)=>jsxRuntime.jsxs("g",{children:[Y>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!Ze(R.date)&&tt(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${Y}`)),F>=0&&F<=Pe&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:F,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:F,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${F-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:C.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(Pe,1e3),height:X,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:De,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Pe,1e3),height:X,fill:t.bgPrimary}),Ve.map((R,Y)=>jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Math.max(Pe,1e3),height:r,fill:Y%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),nt.map((R,Y)=>Y>0?jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Ve.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Y}`):null),nt.map((R,Y)=>{let de=nt[Y+1]?.x||Pe,he=w&&Ze(R.date),Be=a==="day"&&!Ze(R.date)&&tt(R.date);return he||Be?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:R.x,y:0,width:de-R.x,height:Ve.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:R.x,y:0,width:de-R.x,height:Ve.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Y}`):null}),Ve.map((R,Y)=>{let de=R.startDate&&R.endDate;return jsxRuntime.jsx("g",{children:!de&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Pe,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:he=>$e(he,R),onMouseMove:he=>bt(he,R,Y),onMouseLeave:()=>{mt();}},`clickable-${R.id}`),We&&We.taskId===R.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:We.x,y1:Y*r+4,x2:We.x,y2:Y*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:We.x,cy:We.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:We.x,cy:We.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${We.x}, ${Y*r-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:We.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!We||We.taskId!==R.id)&&jsxRuntime.jsx("text",{x:F>0?F:100,y:Y*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:C.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),Ve.map((R,Y)=>{if(!R.startDate||!R.endDate)return null;let{x:de,width:he}=Ie(R),Be=Y*r+(r-18)/2,j=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsxRuntime.jsx(ol,{task:R,x:de+he/2,y:Be+12,theme:t,onClick:m},R.id);if(j){let ye=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ae=8,Ue=Be+(r-18)/2+(18-Ae)/2,kt=4,Ye=R.progress||0,Nt=new Date;Nt.setHours(0,0,0,0);let gt=R.startDate&&Nt>=R.startDate,Jt=R.endDate&&(()=>{let Qt=new Date(R.endDate);return Qt.setHours(0,0,0,0),Nt>Qt})(),vr=R.startDate&&Nt<R.startDate,Mr=1;if(gt&&R.startDate&&R.endDate&&!vr){let Qt=new Date(R.startDate);Qt.setHours(0,0,0,0);let Vr=new Date(R.endDate);Vr.setHours(0,0,0,0);let wa=Math.max(1,(Vr.getTime()-Qt.getTime())/(1e3*60*60*24)),_e=Math.min((Nt.getTime()-Qt.getTime())/(1e3*60*60*24),wa)/wa*100;Mr=_e>0?Ye/_e:1;}let Rt;Ye>=100?Rt="#00E5CC":vr?Rt="#4B5563":Jt&&Ye<100?Rt="#EF4444":Mr>=.95?Rt="#22C55E":Mr>=.8?Rt="#F59E0B":Rt="#EF4444";let Hr=Math.max(Ye/100*he,Ye>0?kt*2:0),$t=he>100&&Ye>0,wr=R.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>m?.(R),onContextMenu:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),p?.(R,Qt);},onMouseMove:Qt=>{se({task:R,x:de,y:Ue,width:he,height:Ae,showBelow:Ue<100,mouseX:Qt.clientX,mouseY:Qt.clientY});},onMouseLeave:()=>se(null),style:{cursor:"default",opacity:y?wr?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:de,y:Be,width:he,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:de,y:Ue,width:he,height:Ae,rx:kt,fill:ye?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ye>0&&jsxRuntime.jsx("rect",{x:de,y:Ue,width:Hr,height:Ae,rx:kt,fill:Rt}),y&&wr&&jsxRuntime.jsx("rect",{x:de,y:Ue,width:he,height:Ae,rx:kt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),$t&&jsxRuntime.jsxs("text",{x:de+Hr+6,y:Ue+Ae/2,dominantBaseline:"central",fill:ye?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Ye),"%"]})]},R.id)}return jsxRuntime.jsx(el,{task:R,x:de,y:Be,width:he,theme:t,dayWidth:Se*o,startDate:n,templates:c,onClick:m,onDoubleClick:u,onContextMenu:p,onDateChange:f,onDependencyCreate:x,allTaskPositions:dt,onDragMove:zt,onHoverChange:se,showBaseline:b,showTaskBarLabels:d,showCriticalPath:y,readOnly:k?!k(R):false,onProgressChange:M},R.id)}),v&&Ve.map((R,Y)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(de=>{let he=Ve.find(Rt=>Rt.id===de);if(!he||!he.startDate||!he.endDate)return null;let Be=Ve.findIndex(Rt=>Rt.id===de),j=Fe(he.id,Ie(he)),ye=Fe(R.id,Ie(R)),Ae=j.x+j.width,Ue=Be*r+26,kt=ye.x,Ye=Y*r+26,Nt=`dep-${de}-${R.id}`;if(z.has(Nt))return null;let gt=y&&R.isCriticalPath&&he.isCriticalPath;return jsxRuntime.jsx(Xs,{x1:Ae,y1:Ue,x2:kt,y2:Ye,theme:t,lineStyle:i,colorOverride:y?gt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?gt?2:1:void 0,glowFilter:gt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,de),onHoverChange:Rt=>{I.current=Rt,Rt&&Ce({key:Nt,fromId:de,toId:R.id,exitX:Ae,exitY:Ue,enterX:kt,enterY:Ye});}},Nt)})),D.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&W&&jsxRuntime.jsx(Xs,{x1:W.exitX,y1:W.exitY,x2:W.enterX,y2:W.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=W.key;Ce(null),I.current=false,Oe(Y=>new Set(Y).add(R)),h?.(W.toId,W.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{I.current=R,R||Ce(null);}},`${W.key}-hover-overlay`),F>=0&&F<=Pe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:F,y1:0,x2:F,y2:X,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:F,y1:0,x2:F,y2:X,stroke:t.today,strokeWidth:1,opacity:1})]})]}),L&&jsxRuntime.jsx(Km,{tooltipData:L,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:B})]})}var fw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Xm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),bw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),hw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),xw=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function cl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,d]=react.useState(false),[m,u]=react.useState(false),[p,f]=react.useState([]),[x,h]=react.useState(""),[b,y]=react.useState(false),[v,w]=react.useState(true),[k,M]=react.useState(""),[B,T]=react.useState(-1),[C,P]=react.useState(false),[D,V]=react.useState(0),$=react.useRef(null),ee=react.useRef(null),L=react.useRef(null),Le=react.useRef(null),{enabled:W=true,placeholder:Ce='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:z,suggestions:Oe=fw,maxHistory:We=50,persistHistory:J,mentionableUsers:De=[]}=r,se=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",He=se?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=se?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Pe=se?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",ze=se?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ze=se?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",le=se?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=se?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",je=se?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=se?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",bt=se?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",mt=se?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Ve=se?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ie=se?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",dt=se?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",zt=se?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Fe=se?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",nt=se?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",F=se?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",X=se?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=se?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Y="rgba(0, 229, 204, 0.04)",de=se?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",he=se?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Be=se?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",j=se?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ye=se?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Ae=se?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ue=se?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",kt=se?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Ye="rgba(0, 229, 204, 0.06)",Nt=se?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",gt=se?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Jt=se?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",vr=se?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Mr=se?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Rt=se?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Hr=se?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",$t=se?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",wr=se?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Gt=se?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Qt=se?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Vr=se?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",wa=se?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",et=se?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",_e=se?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",fa=J?.storageKey||"gantt-ai-history",jr=J?.maxMessages??5,Zr=De.filter(O=>{if(!k)return true;let re=k.toLowerCase();return O.name.toLowerCase().includes(re)||O.email&&O.email.toLowerCase().includes(re)}).slice(0,5),lr=react.useCallback(O=>{if(h(O),De.length===0)return;let re=$.current;if(!re)return;let ve=re.selectionStart||O.length,N=O.slice(0,ve),H=N.lastIndexOf("@");if(H>=0&&((H>0?N[H-1]:" ")===" "||H===0)){let K=N.slice(H+1);if(K.length<=40){M(K),T(H),P(true),V(0);return}}P(false),M(""),T(-1);},[De.length]),Ba=react.useCallback(O=>{let re=x.slice(0,B),ve=x.slice(B+1+k.length),N=`${re}@${O.name} ${ve}`;h(N),P(false),M(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[x,B,k]),ne=react.useCallback(O=>{if(!C||Zr.length===0)return false;if(O.key==="ArrowDown")return O.preventDefault(),V(re=>re<Zr.length-1?re+1:0),true;if(O.key==="ArrowUp")return O.preventDefault(),V(re=>re>0?re-1:Zr.length-1),true;if(O.key==="Enter"||O.key==="Tab"){O.preventDefault();let re=Zr[D];return re&&Ba(re),true}return O.key==="Escape"?(P(false),true):false},[C,Zr,D,Ba]);react.useEffect(()=>{if(J?.enabled)try{let O=localStorage.getItem(fa);if(O){let ve=JSON.parse(O).map(N=>({...N,timestamp:new Date(N.timestamp)}));f(ve.slice(-jr));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[J?.enabled,fa,jr]),react.useEffect(()=>{if(J?.enabled&&p.length>0)try{let O=p.filter(re=>!re.isLoading).slice(-jr);localStorage.setItem(fa,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[p,J?.enabled,fa,jr]),react.useEffect(()=>{ee.current&&ee.current.scrollIntoView({behavior:"smooth"});},[p]),react.useEffect(()=>{i&&!m&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,m]);let ue=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&n?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&o?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&l?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&c?.(O.taskId,O.dependencyFrom);break}},[n,s,o,l,c]),ft=react.useCallback(async O=>{if(!O.trim()||b)return;let re={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};f(N=>[...N.slice(-(We-1)),re]),h(""),w(false),y(true);let ve={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(N=>[...N,ve]);try{if(z){let N=p.filter(me=>!me.isLoading&&me.content).slice(-6).map(me=>({role:me.role,content:me.content})),H=await z(O,e,N);f(me=>{let K=me.filter(ot=>!ot.isLoading),we={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...K,we]}),ue(H);}else f(N=>[...N.filter(me=>!me.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(N){f(H=>[...H.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${N instanceof Error?N.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,We,z,e,ue]),_=O=>{O.preventDefault(),ft(x);},fe=O=>{h(O),$.current?.focus();};if(react.useEffect(()=>{let O=re=>{(re.metaKey||re.ctrlKey)&&re.key==="k"&&(re.preventDefault(),d(ve=>!ve),i||u(false)),re.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=ve=>{let N=ve.target;L.current&&!L.current.contains(N)&&d(false);},re=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(re),document.removeEventListener("mousedown",O);}},[i]),!W)return null;let Z={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Z[I]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:He,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Pe,overflow:"visible"},onClick:()=>d(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${ze}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Ze}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Xm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:je,background:le,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(d),m.download=r,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Te.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 d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let f=t.find(x=>x.id===p);if(f){n(f);let x=a.get(p)?.ef||0;m=Math.max(m,x);}}let u=m+d;a.set(i.id,{es:m,ef:u});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Te.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),u=s;if(m.length>0)for(let f of m){l(f);let x=o.get(f.id)?.ls||0;u=Math.min(u,x);}let p=u-d;o.set(i.id,{ls:p,lf:u});};r.forEach(l);let c=[];for(let i of r){let d=a.get(i.id),m=o.get(i.id);if(d&&m){let u=m.ls-d.es;Math.abs(u)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,a=Te.flattenTasks(e).filter(u=>u.startDate&&u.endDate);if(a.length===0)return t;let n=new Map(a.map(u=>[u.id,u])),s=new Map;for(let u of a)s.has(u.id)||s.set(u.id,[]);for(let u of a)if(u.dependencies){for(let p of u.dependencies)if(n.has(p)){let f=s.get(p);f&&f.push(u.id);}}let o=new Map;for(let u of a)o.set(u.id,0);for(let u of a)if(u.dependencies)for(let p of u.dependencies)n.has(p)&&o.set(u.id,(o.get(u.id)||0)+1);let l=new Map,c=[],i=[];for(let u of a)(o.get(u.id)||0)===0&&i.push(u.id);for(;i.length>0;){let u=i.shift();c.push(u);let p=n.get(u);if(!p||!p.startDate||!p.endDate)continue;let f=Te.calculateDuration(p.startDate,p.endDate),x=0;if(p.dependencies)for(let b of p.dependencies){let y=l.get(b);y&&(x=Math.max(x,y.ef));}l.set(u,{es:x,ef:x+f});let h=s.get(u)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<a.length)return t;let d=Math.max(...Array.from(l.values()).map(u=>u.ef)),m=new Map;for(let u=c.length-1;u>=0;u--){let p=c[u];if(!p)continue;let f=n.get(p);if(!f||!f.startDate||!f.endDate)continue;let x=Te.calculateDuration(f.startDate,f.endDate),h=s.get(p)||[],b=d;if(h.length>0)for(let y of h){let v=m.get(y);v&&(b=Math.min(b,v.ls));}m.set(p,{ls:b-x,lf:b});}for(let u of c){let p=l.get(u),f=m.get(u),x=f.ls-p.es,h=s.get(u)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-p.ef:b=d-p.ef,t.set(u,{earlyStart:p.es,earlyFinish:p.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Te.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Te.calculateCriticalPath(e).includes(t))return 0;let n=Te.getDependentTasks(e,t);if(n.length===0){let l=Te.getLatestEndDate(e);if(!l)return null;let c=Te.calculateDuration(r.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=Te.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Te.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Te.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Te.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=Te.calculateDuration(c.startDate,c.endDate),d;if(r!==void 0?(d=new Date(c.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let p=new Date(s.endDate),f=new Date(p);f.setDate(f.getDate()+1),d<f&&(d=f);}let m=Te.calculateEndDate(d,i),u=p=>p.map(f=>f.id===c.id?{...f,startDate:d,endDate:m}:f.subtasks?{...f,subtasks:u(f.subtasks)}:f);l=u(l),l=Te.autoScheduleDependents(l,c.id,r,n);}return l},calculateCascadePreview:(e,t,r,a,n,s,o,l)=>{if(r===0)return [];let c=[],i=n.getTime(),d=1e3*60*60*24,m=Te.findTaskById(e,t);if(!m||!m.endDate)return [];let u=(p,f,x=new Set)=>{if(x.has(p))return;x.add(p);let h=Te.getDependentTasks(e,p);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(D=>D.id===b.id);if(y===-1)continue;let v=b.startDate.getTime(),k=(b.endDate.getTime()-v)/d,B=(v-i)/d*s,T=B+f*s,C=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:B,previewX:T,width:C,y:P,rowIndex:y,daysDelta:f,color:b.color}),u(b.id,f,x);}};return u(t,r),c},splitTask:(e,t,r,a=3)=>{let n=Te.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 s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=d=>d.map(m=>m.id===n.id?{...m,endDate:l,segments:c}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function il({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:m,onTaskDblClick:u,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:k,onTaskProgressDrag:M,workingDaysConfig:B}){let C=qa(),P=react.useRef(null),[D,V]=react.useState([]),[$,Z]=react.useState(null),[L,Ae]=react.useState(null),[W,Ce]=react.useState(null),I=react.useRef(false),[z,Oe]=react.useState(new Set),[ze,Q]=react.useState(null),De=react.useCallback(R=>{if(W&&!I.current){let Y=R.target,ue=false;for(;Y&&Y!==R.currentTarget;){if(Y.getAttribute?.("data-dependency-line")==="true"||Y.getAttribute?.("data-dependency-hover-overlay")==="true"){ue=true;break}Y=Y.parentElement;}ue||Ce(null);}},[W]),oe=react.useCallback(R=>{Ae(R);},[]),He=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=a==="day"?60:a==="week"?20:8,Fe=He*Se*o,Ge=R=>{let Y=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),ue=Y.getUTCDay()||7;Y.setUTCDate(Y.getUTCDate()+4-ue);let he=new Date(Date.UTC(Y.getUTCFullYear(),0,1));return Math.ceil(((Y.getTime()-he.getTime())/864e5+1)/7)},Qe=R=>{let Y=R.getDay();return Y===0||Y===6},se=react.useMemo(()=>{let R=B?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[B?.holidayDates]),Ze=R=>{if(!se)return false;let Y=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return se.has(Y)},_e=react.useCallback(R=>{let Y=Math.round(R/(Se*o)),ue=new Date(n);return ue.setDate(ue.getDate()+Y),ue},[n,Se,o]),$e=react.useCallback((R,Y)=>{if(Y.startDate&&Y.endDate)return;let ue=R.currentTarget.ownerSVGElement;if(!ue)return;let he=ue.createSVGPoint();he.x=R.clientX,he.y=R.clientY;let Be=he.matrixTransform(ue.getScreenCTM()?.inverse()),j=_e(Be.x),xe=new Date(j);xe.setDate(xe.getDate()+1),Q(null),f?.(Y,j,xe);},[_e,f]),ft=react.useCallback((R,Y,ue)=>{let he=R.currentTarget.ownerSVGElement;if(!he)return;let Be=he.createSVGPoint();Be.x=R.clientX,Be.y=R.clientY;let j=Be.matrixTransform(he.getScreenCTM()?.inverse()),xe=_e(j.x),Ue=Math.round(j.x/(Se*o))*Se*o;Q({taskId:Y.id,x:Ue,y:ue*r+r/2,date:xe});},[_e,Se,o,r]),pt=react.useCallback(()=>{Q(null);},[]),je=react.useMemo(()=>{let R=Be=>Be.map(j=>{if(j.subtasks&&j.subtasks.length>0){let xe=R(j.subtasks),Ie=xe.filter(Ue=>Ue.startDate&&Ue.endDate);if(Ie.length>0){let Ue=Ie.map(mt=>mt.startDate.getTime()),Ct=Ie.map(mt=>mt.endDate.getTime()),Xe=new Date(Math.min(...Ue)),Dt=new Date(Math.max(...Ct));return {...j,subtasks:xe,startDate:Xe,endDate:Dt}}return {...j,subtasks:xe}}return j}),Y=(Be,j=[])=>{let xe=[...Be].sort((Ie,Ue)=>(Ie.position??0)-(Ue.position??0));for(let Ie of xe)j.push(Ie),Ie.subtasks&&Ie.subtasks.length>0&&(Ie.isExpanded===void 0||Ie.isExpanded)&&Y(Ie.subtasks,j);return j},ue=R(e);return Y(ue)},[e]),Re=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let Y=R.startDate.getTime(),ue=R.endDate.getTime(),he=n.getTime(),Be=(Y-he)/(1e3*60*60*24),j=(ue-Y)/(1e3*60*60*24)+1,xe=Be*Se*o,Ie=Math.max(Se*o,40),Ue=Math.max(j*Se*o,Ie);return {x:xe,width:Ue}},[n,Se,o]),dt=react.useMemo(()=>je.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:Y,width:ue}=Re(R),Be=je.findIndex(j=>j.id===R.id)*r+(r-18)/2;return {id:R.id,x:Y,y:Be,width:ue,height:18}}),[je,Re]),zt=react.useCallback((R,Y,ue)=>{if(!ue){V([]),Z(null);return}if(Z({taskId:R,daysDelta:Y}),Y===0){V([]);return}let he=Te.calculateCascadePreview(e,R,Y,je,n,Se*o,r,48);V(he);},[e,je,n,Se,o,r,48]),Le=react.useCallback((R,Y)=>{if(!$)return Y;let ue=Se*o,he=$.daysDelta*ue;if(R===$.taskId)return {x:Y.x+he,width:Y.width};let Be=D.find(j=>j.taskId===R);return Be?{x:Be.previewX,width:Be.width}:Y},[$,D,Se,o]),st=react.useMemo(()=>{let R=[],Y=new Date(n);for(;Y<=s;){let Be=(Y.getTime()-n.getTime())/864e5*Se*o;if(a==="day")R.push({date:new Date(Y),label:Y.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Be}),Y.setDate(Y.getDate()+1);else if(a==="week"){let j=Ge(Y);R.push({date:new Date(Y),label:`${C.labels.week} ${j}`,x:Be}),Y.setDate(Y.getDate()+7);}else R.push({date:new Date(Y),label:Y.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Be}),Y.setMonth(Y.getMonth()+1);}return R},[n,s,a,Se,o,l,C.labels.week]),F=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),J=Math.max(je.length*r,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(Fe,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),st.map((R,Y)=>jsxRuntime.jsxs("g",{children:[Y>0&&jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!Qe(R.date)&&Ze(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${Y}`)),F>=0&&F<=Fe&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:F,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:F,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${F-18}, 2)`,children:[jsxRuntime.jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsxRuntime.jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:C.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(Fe,1e3),height:J,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:De,children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsxRuntime.jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxRuntime.jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsxRuntime.jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsxRuntime.jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:J,fill:t.bgPrimary}),je.map((R,Y)=>jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Math.max(Fe,1e3),height:r,fill:Y%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),st.map((R,Y)=>Y>0?jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:je.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Y}`):null),st.map((R,Y)=>{let ue=st[Y+1]?.x||Fe,he=w&&Qe(R.date),Be=a==="day"&&!Qe(R.date)&&Ze(R.date);return he||Be?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:R.x,y:0,width:ue-R.x,height:je.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:R.x,y:0,width:ue-R.x,height:je.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Y}`):null}),je.map((R,Y)=>{let ue=R.startDate&&R.endDate;return jsxRuntime.jsx("g",{children:!ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:Y*r,width:Fe,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:he=>$e(he,R),onMouseMove:he=>ft(he,R,Y),onMouseLeave:()=>{pt();}},`clickable-${R.id}`),ze&&ze.taskId===R.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:ze.x,y1:Y*r+4,x2:ze.x,y2:Y*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:ze.x,cy:ze.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:ze.x,cy:ze.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${ze.x}, ${Y*r-8})`,children:[jsxRuntime.jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:ze.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!ze||ze.taskId!==R.id)&&jsxRuntime.jsx("text",{x:F>0?F:100,y:Y*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:C.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),je.map((R,Y)=>{if(!R.startDate||!R.endDate)return null;let{x:ue,width:he}=Re(R),Be=Y*r+(r-18)/2,j=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsxRuntime.jsx(sl,{task:R,x:ue+he/2,y:Be+12,theme:t,onClick:m},R.id);if(j){let xe=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ie=8,Ue=Be+(r-18)/2+(18-Ie)/2,Ct=4,Xe=R.progress||0,Dt=new Date;Dt.setHours(0,0,0,0);let mt=R.startDate&&Dt>=R.startDate,Jt=R.endDate&&(()=>{let Qt=new Date(R.endDate);return Qt.setHours(0,0,0,0),Dt>Qt})(),xr=R.startDate&&Dt<R.startDate,Er=1;if(mt&&R.startDate&&R.endDate&&!xr){let Qt=new Date(R.startDate);Qt.setHours(0,0,0,0);let Zr=new Date(R.endDate);Zr.setHours(0,0,0,0);let ba=Math.max(1,(Zr.getTime()-Qt.getTime())/(1e3*60*60*24)),Ke=Math.min((Dt.getTime()-Qt.getTime())/(1e3*60*60*24),ba)/ba*100;Er=Ke>0?Xe/Ke:1;}let Rt;Xe>=100?Rt="#00E5CC":xr?Rt="#4B5563":Jt&&Xe<100?Rt="#EF4444":Er>=.95?Rt="#22C55E":Er>=.8?Rt="#F59E0B":Rt="#EF4444";let Hr=Math.max(Xe/100*he,Xe>0?Ct*2:0),Bt=he>100&&Xe>0,vr=R.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>m?.(R),onContextMenu:Qt=>{Qt.preventDefault(),Qt.stopPropagation(),p?.(R,Qt);},onMouseMove:Qt=>{oe({task:R,x:ue,y:Ue,width:he,height:Ie,showBelow:Ue<100,mouseX:Qt.clientX,mouseY:Qt.clientY});},onMouseLeave:()=>oe(null),style:{cursor:"default",opacity:y?vr?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:ue,y:Be,width:he,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ue,y:Ue,width:he,height:Ie,rx:Ct,fill:xe?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Xe>0&&jsxRuntime.jsx("rect",{x:ue,y:Ue,width:Hr,height:Ie,rx:Ct,fill:Rt}),y&&vr&&jsxRuntime.jsx("rect",{x:ue,y:Ue,width:he,height:Ie,rx:Ct,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Bt&&jsxRuntime.jsxs("text",{x:ue+Hr+6,y:Ue+Ie/2,dominantBaseline:"central",fill:xe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Xe),"%"]})]},R.id)}return jsxRuntime.jsx(tl,{task:R,x:ue,y:Be,width:he,theme:t,dayWidth:Se*o,startDate:n,templates:c,onClick:m,onDoubleClick:u,onContextMenu:p,onDateChange:f,onDependencyCreate:x,allTaskPositions:dt,onDragMove:zt,onHoverChange:oe,showBaseline:b,showTaskBarLabels:d,showCriticalPath:y,readOnly:k?!k(R):false,onProgressChange:M},R.id)}),v&&je.map((R,Y)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(ue=>{let he=je.find(Rt=>Rt.id===ue);if(!he||!he.startDate||!he.endDate)return null;let Be=je.findIndex(Rt=>Rt.id===ue),j=Le(he.id,Re(he)),xe=Le(R.id,Re(R)),Ie=j.x+j.width,Ue=Be*r+26,Ct=xe.x,Xe=Y*r+26,Dt=`dep-${ue}-${R.id}`;if(z.has(Dt))return null;let mt=y&&R.isCriticalPath&&he.isCriticalPath;return jsxRuntime.jsx(Js,{x1:Ie,y1:Ue,x2:Ct,y2:Xe,theme:t,lineStyle:i,colorOverride:y?mt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?mt?2:1:void 0,glowFilter:mt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,ue),onHoverChange:Rt=>{I.current=Rt,Rt&&Ce({key:Dt,fromId:ue,toId:R.id,exitX:Ie,exitY:Ue,enterX:Ct,enterY:Xe});}},Dt)})),D.map(R=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsxRuntime.jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&W&&jsxRuntime.jsx(Js,{x1:W.exitX,y1:W.exitY,x2:W.enterX,y2:W.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=W.key;Ce(null),I.current=false,Oe(Y=>new Set(Y).add(R)),h?.(W.toId,W.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{I.current=R,R||Ce(null);}},`${W.key}-hover-overlay`),F>=0&&F<=Fe&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:F,y1:0,x2:F,y2:J,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:F,y1:0,x2:F,y2:J,stroke:t.today,strokeWidth:1,opacity:1})]})]}),L&&jsxRuntime.jsx(qm,{tooltipData:L,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:B})]})}var fw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Jm=({size:e=16})=>jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),bw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),hw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),yw=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),xw=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function dl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,d]=react.useState(false),[m,u]=react.useState(false),[p,f]=react.useState([]),[x,h]=react.useState(""),[b,y]=react.useState(false),[v,w]=react.useState(true),[k,M]=react.useState(""),[B,T]=react.useState(-1),[C,P]=react.useState(false),[D,V]=react.useState(0),$=react.useRef(null),Z=react.useRef(null),L=react.useRef(null),Ae=react.useRef(null),{enabled:W=true,placeholder:Ce='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:z,suggestions:Oe=fw,maxHistory:ze=50,persistHistory:Q,mentionableUsers:De=[]}=r,oe=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",He=oe?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Fe=oe?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ge=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Qe=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",se=oe?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ze=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",_e=oe?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=oe?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ft=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",pt=oe?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",je=oe?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Re=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",dt=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",zt=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Le=oe?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",st=oe?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",F=oe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=oe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Y="rgba(0, 229, 204, 0.04)",ue=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",he=oe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Be=oe?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",j=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",xe=oe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Ie=oe?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ue=oe?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Ct=oe?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xe="rgba(0, 229, 204, 0.06)",Dt=oe?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Jt=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",xr=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Er=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Rt=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Hr=oe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Bt=oe?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",vr=oe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Gt=oe?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Qt=oe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Zr=oe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ba=oe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",et=oe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ke=oe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",sa=Q?.storageKey||"gantt-ai-history",Vr=Q?.maxMessages??5,ea=De.filter(O=>{if(!k)return true;let te=k.toLowerCase();return O.name.toLowerCase().includes(te)||O.email&&O.email.toLowerCase().includes(te)}).slice(0,5),jr=react.useCallback(O=>{if(h(O),De.length===0)return;let te=$.current;if(!te)return;let we=te.selectionStart||O.length,N=O.slice(0,we),H=N.lastIndexOf("@");if(H>=0&&((H>0?N[H-1]:" ")===" "||H===0)){let K=N.slice(H+1);if(K.length<=40){M(K),T(H),P(true),V(0);return}}P(false),M(""),T(-1);},[De.length]),_r=react.useCallback(O=>{let te=x.slice(0,B),we=x.slice(B+1+k.length),N=`${te}@${O.name} ${we}`;h(N),P(false),M(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[x,B,k]),ce=react.useCallback(O=>{if(!C||ea.length===0)return false;if(O.key==="ArrowDown")return O.preventDefault(),V(te=>te<ea.length-1?te+1:0),true;if(O.key==="ArrowUp")return O.preventDefault(),V(te=>te>0?te-1:ea.length-1),true;if(O.key==="Enter"||O.key==="Tab"){O.preventDefault();let te=ea[D];return te&&_r(te),true}return O.key==="Escape"?(P(false),true):false},[C,ea,D,_r]);react.useEffect(()=>{if(Q?.enabled)try{let O=localStorage.getItem(sa);if(O){let we=JSON.parse(O).map(N=>({...N,timestamp:new Date(N.timestamp)}));f(we.slice(-Vr));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[Q?.enabled,sa,Vr]),react.useEffect(()=>{if(Q?.enabled&&p.length>0)try{let O=p.filter(te=>!te.isLoading).slice(-Vr);localStorage.setItem(sa,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[p,Q?.enabled,sa,Vr]),react.useEffect(()=>{Z.current&&Z.current.scrollIntoView({behavior:"smooth"});},[p]),react.useEffect(()=>{i&&!m&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,m]);let de=react.useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&n?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&o?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&l?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&c?.(O.taskId,O.dependencyFrom);break}},[n,s,o,l,c]),ut=react.useCallback(async O=>{if(!O.trim()||b)return;let te={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};f(N=>[...N.slice(-(ze-1)),te]),h(""),w(false),y(true);let we={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(N=>[...N,we]);try{if(z){let N=p.filter(me=>!me.isLoading&&me.content).slice(-6).map(me=>({role:me.role,content:me.content})),H=await z(O,e,N);f(me=>{let K=me.filter(nt=>!nt.isLoading),ve={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...K,ve]}),de(H);}else f(N=>[...N.filter(me=>!me.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(N){f(H=>[...H.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${N instanceof Error?N.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,ze,z,e,de]),_=O=>{O.preventDefault(),ut(x);},fe=O=>{h(O),$.current?.focus();};if(react.useEffect(()=>{let O=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"&&(te.preventDefault(),d(we=>!we),i||u(false)),te.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),react.useEffect(()=>{if(!i)return;let O=we=>{let N=we.target;L.current&&!L.current.contains(N)&&d(false);},te=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(te),document.removeEventListener("mousedown",O);}},[i]),!W)return null;let ee={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ee[I]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:He,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Fe,overflow:"visible"},onClick:()=>d(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ge}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(Jm,{size:18}),jsxRuntime.jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:_e,background:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ze}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Z[I]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${bt}`,boxShadow:mt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ve,borderBottom:`1px solid ${Ie}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:dt,border:`1px solid ${zt}`,color:"#00E5CC"},children:jsxRuntime.jsx(Xm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Fe},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>u(O=>!O),className:"p-1.5 rounded-lg transition-colors",style:{color:nt},onMouseEnter:O=>{O.currentTarget.style.background=X,O.currentTarget.style.color=F;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=nt;},children:jsxRuntime.jsx(yw,{})}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:nt},onMouseEnter:O=>{O.currentTarget.style.background=X,O.currentTarget.style.color=F;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=nt;},children:jsxRuntime.jsx(hw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!m&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[p.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Oe.slice(0,4).map((O,re)=>jsxRuntime.jsx("button",{onClick:()=>fe(O),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Y,color:he,border:`1px solid ${de}`},onMouseEnter:ve=>{ve.currentTarget.style.borderColor=Be,ve.currentTarget.style.color="#00E5CC";},onMouseLeave:ve=>{ve.currentTarget.style.borderColor=de,ve.currentTarget.style.color=he;},children:O.length>30?O.slice(0,30)+"...":O},re))})]}),p.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?j:Ae,color:O.role==="user"?"#00E5CC":kt,border:O.role==="user"?`1px solid ${ye}`:`1px solid ${Ue}`},children:[O.isLoading?jsxRuntime.jsx(xw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:O.command.success?"#10B981":"#EF4444",border:`1px solid ${O.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:ee})]}),jsxRuntime.jsxs("form",{onSubmit:O=>{if(C&&Zr.length>0){O.preventDefault();return}_(O);},className:"p-3 relative",style:{borderTop:`1px solid ${Ye}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&Zr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Le,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:$t,border:`1px solid ${wr}`,boxShadow:Gt,backdropFilter:"blur(12px)"},children:Zr.map((O,re)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Ba(O),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:re===D?Qt:"transparent",color:Vr},onMouseEnter:()=>V(re),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:et,border:`1px solid ${_e}`,color:"#00E5CC"},children:O.name.split(" ").map(ve=>ve[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:O.name}),O.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:wa},children:O.email})]})]},O.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Nt,border:`1px solid ${gt}`},children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:x,onChange:O=>lr(O.target.value),onKeyDown:O=>{ne(O);},placeholder:Ce,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Jt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?vr:"transparent",color:x.trim()?"#00E5CC":Rt,border:x.trim()?`1px solid ${Mr}`:"1px solid transparent"},children:jsxRuntime.jsx(bw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Hr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Jm(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,d=true)=>{a(m=>{let u=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:u};if(!d)return {...m,present:u};let p=[...m.past,m.present];return p.length>t&&p.shift(),{past:p,present:u,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:d,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:m}});},[]),c=react.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Qm({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var Cw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Te.formatDate(e.startDate)} - ${Te.formatDate(e.endDate)}`);let r=Te.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=>Te.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Zm(e){return {...Cw,...e}}var Fw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},ag=react.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:d,projectName:m,availableUsers:u=[],templates:p,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:v,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:B,onCreateTask:T,taskFilter:C,onTaskFilterChange:P,toolbarRightContent:D,showBaseline:V,viewMode:$,onViewModeChange:ee,projectForecast:L,hideForecastHud:Le,onThemeChange:W,onTaskClick:Ce,onTaskSelectionChange:I,selectedTaskId:z,onTaskDblClick:Oe,onTaskContextMenu:We,onTaskUpdate:J,onDependentTasksScheduled:De,onProgressChange:se,onTaskEdit:He,onTaskAddSubtask:Se,onTaskMarkIncomplete:Pe,onTaskSetInProgress:ze,onDependencyCreate:Ze,onDependencyDelete:le,onBeforeTaskAdd:tt,onAfterTaskAdd:je,onBeforeTaskUpdate:$e,onAfterTaskUpdate:bt,onBeforeTaskDelete:mt,onAfterTaskDelete:Ve,permissions:Ie,onCopySnapshotLink:dt}=r,Fe=react.useContext(qi)?.theme,[nt,F]=react.useState(Fe||s||"dark"),[X,R]=react.useState(o),[Y,de]=react.useState(l),[he,Be]=react.useState(1),[j,ye]=react.useState("all"),[Ae,Ue]=react.useState($||"execution"),kt=$??Ae,Ye=react.useCallback(E=>{Ue(E),ee?.(E);},[ee]),Nt=V??kt==="oracle",[gt,Jt]=react.useState(r.showCriticalPath!==false),[vr,Mr]=react.useState(r.showDependencies!==false),[Rt,Hr]=react.useState(r.highlightWeekends!==false),$t=react.useCallback(E=>{Jt(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),wr=react.useCallback(E=>{Mr(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),Gt=react.useCallback(E=>{Hr(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(X);},[X]),react.useEffect(()=>{r.onZoomChange?.(he);},[he]);let Qt=react.useRef(r.onDateRangeChange);Qt.current=r.onDateRangeChange;let Vr=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[wa,et]=react.useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let U=JSON.parse(A);if(U.taskFilter)return U.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),_e=C??wa,fa=P??et,[jr,Zr]=react.useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let U=JSON.parse(A);if(typeof U.hideCompleted=="boolean")return U.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=Vr();if(E)try{let A={taskFilter:_e,hideCompleted:jr};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[_e,jr,Vr]);let lr=react.useRef(y);react.useEffect(()=>{if(lr.current!==y&&y!==void 0){et("all"),Zr(false);let E=Vr();if(E)try{localStorage.removeItem(E);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}lr.current=y;},[y,Vr]);let[Ba,ne]=react.useState(0),[ue,ft]=react.useState(false),[_,fe]=react.useState(null),[Z,O]=react.useState({isOpen:false,x:0,y:0,task:null}),[re,ve]=react.useState(null),[N,H]=react.useState(null);react.useEffect(()=>{Fe&&Fe!==nt&&F(Fe);},[Fe]),react.useEffect(()=>{s&&s!==nt&&F(s);},[s]);let me=react.useCallback(E=>{F(E),W?.(E);},[W]),{state:K,setState:we,undo:ot,redo:ae,canUndo:lt,canRedo:st,clearHistory:Bt}=Jm(t,50),gr=react.useMemo(()=>{let E=(A,U=0)=>{let q=U;for(let ce of A)ce.subtasks?.length&&(q=Math.max(q,E(ce.subtasks,U+1)));return q};return E(K)+1},[K]),_r=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Ur=react.useRef(new Map),en=react.useRef(false);if(!en.current&&x){en.current=true;let E=typeof x=="string"?x:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let U=JSON.parse(A);Array.isArray(U)&&(Ur.current=new Map(U));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let ar=react.useCallback(()=>{let E=_r();if(E)try{let A=Array.from(Ur.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[_r]),$a=react.useRef(0),zo=react.useRef(K);react.useEffect(()=>{zo.current=K;},[K]);let Pn=react.useRef(false),_n=react.useCallback(E=>{ye(E),$a.current+=1,we(A=>{let U=(ce,ge=0)=>ce.map(Ke=>{let qe=E==="all"||ge<E-1;return Ke.subtasks?.length&&Ur.current.set(Ke.id,qe),{...Ke,isExpanded:qe,subtasks:Ke.subtasks?U(Ke.subtasks,ge+1):void 0}}),q=U(A);return ar(),q});},[we,ar]);react.useEffect(()=>{if($a.current>0){$a.current-=1;return}let E=U=>{let q=new Map;for(let ce of U){let ge=ce.id;q.get(ge)||q.set(ge,ce);}return Array.from(q.values())},A=U=>U.map(q=>{let ce=Ur.current.get(q.id),ge=ce!==void 0?{...q,isExpanded:ce}:q;if(ge.subtasks?.length){let Ke=E(ge.subtasks);return {...ge,subtasks:A(Ke)}}return ge});if(Ur.current.size>0)we(qa(A(t)));else {let U=q=>q.map(ce=>ce.subtasks?.length?{...ce,subtasks:E(U(ce.subtasks))}:ce);we(qa(U(t)));}},[t,we]);let Go=react.useRef(t),fi=react.useRef(true);react.useEffect(()=>{if(fi.current){fi.current=false,Go.current=K;return}if(Pn.current){Pn.current=false,Go.current=K;return}if(!a)return;let E=JSON.stringify(Go.current),A=JSON.stringify(K);E!==A&&(Go.current=K,a(K));},[K,a]);let Kr=react.useMemo(()=>Jc(w,k),[w,k]),Ds=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Ea=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Ma,yn]=react.useState(()=>{let E=Ds(Kr);if(!b)return E;try{let A=typeof b=="string"?b:"gantt-columns-state",U=localStorage.getItem(A);if(!U)return E;let q=JSON.parse(U),ce=new Map(q.map(ge=>[ge.id,ge]));return E.map(ge=>{let Ke=ce.get(ge.id);return Ke?{...ge,visible:Ke.visible??ge.visible,width:Ke.width??ge.width}:ge})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),E}}),bo=react.useRef(Ea);react.useEffect(()=>{if(bo.current===Ea)return;bo.current=Ea;let E=Ds(Kr);if(!Ea){yn(E);return}try{let A=localStorage.getItem(Ea);if(!A){yn(E);return}let U=JSON.parse(A),q=new Map(U.map(ce=>[ce.id,ce]));yn(E.map(ce=>{let ge=q.get(ce.id);return ge?{...ce,visible:ge.visible??ce.visible,width:ge.width??ce.width}:ce}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),yn(E);}},[Ea,Ds,Kr]),react.useEffect(()=>{if(Ea&&bo.current===Ea)try{let E=Ma.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(Ea,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Ma,Ea]),react.useEffect(()=>{yn(E=>E.map(A=>({...A,label:Kr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Kr]);let Fn=react.useMemo(()=>Ma.filter(A=>A.visible).reduce((A,U)=>A+U.width,0),[Ma]),S=react.useRef(Ma.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Ma.filter(q=>q.visible),A=E.map(q=>q.id).join(","),U=S.current;if(A!==U){let q=E.some(ge=>ge.id!=="name"),ce=U.includes(",");q?!ce&&q&&fe(null):fe(null),S.current=A;}},[Ma]);let Q=60,pe=.6,ke=react.useMemo(()=>{let A=Fn+Q,U=typeof window<"u"?window.innerWidth*pe:800,q=Math.max(A,U);return _!==null?Math.max(200,Math.min(_,q)):Math.max(200,A)},[_,Fn]),xe=react.useRef(null),Xe=react.useRef(null),te=react.useRef(null),Ee=react.useRef(null),Je=react.useRef(null),Re=react.useMemo(()=>bm(nt),[nt]),Ut=react.useMemo(()=>({theme:Re,themeName:nt}),[Re,nt]),ut=react.useMemo(()=>Zm(p),[p]),pt=react.useMemo(()=>{if(!f||!gt)return K;let E=Te.calculateCriticalPathFull(K),A=U=>U.map(q=>{let ce=E.get(q.id),ge=q.subtasks?A(q.subtasks):void 0,Ke=ge?.some(er=>er.isCriticalPath||er.subtasks&&er.subtasks.some(Ot=>Ot.isCriticalPath))||false,qe=ce?ce.isCritical:Ke;return {...q,isCriticalPath:qe,cpmData:ce||void 0,subtasks:ge}});return A(K)},[K,f,gt]),fr=react.useMemo(()=>Te.flattenTasks(K).some(A=>A.dependencies&&A.dependencies.length>0),[K]),cr=react.useMemo(()=>{let E=(A,U="")=>[...A].sort((ce,ge)=>(ce.position??0)-(ge.position??0)).map((ce,ge)=>{let Ke=ge+1,qe=U?`${U}.${Ke}`:`${Ke}.0`,er=U?`${U}.${Ke}`:`${Ke}`;return {...ce,wbsCode:qe,subtasks:ce.subtasks?.length?E(ce.subtasks,er):ce.subtasks}});return E(pt)},[pt]),ea=react.useMemo(()=>{if(_e==="all"&&!jr)return cr;let E=A=>{let U=[];for(let q of A){let ce=q.subtasks?.length?E(q.subtasks):void 0,ge=false;if(jr)ge=q.progress<100;else switch(_e){case "all":ge=true;break;case "incomplete":ge=q.progress<100;break;case "in_progress":ge=q.progress>0&&q.progress<100;break;case "completed":ge=q.progress===100;break}(ge||ce&&ce.length>0)&&U.push({...q,subtasks:ce});}return U};return E(cr)},[cr,_e,jr]),Mt=Fw(Y);Qm({undo:ot,redo:ae,canUndo:lt,canRedo:st,enabled:true}),react.useImperativeHandle(n,()=>({getTask:E=>Te.findTaskById(K,E),addTask:(E,A)=>{we(U=>{if(!A)return [...U,{...E,level:0}];let q=ce=>ce.map(ge=>ge.id===A?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:A,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(U)});},updateTask:(E,A)=>{we(U=>{let q=ce=>ce.map(ge=>ge.id===E?{...ge,...A}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(U)});},deleteTask:E=>{we(A=>{let U=q=>q.filter(ce=>ce.id===E?false:(ce.subtasks&&(ce.subtasks=U(ce.subtasks)),true));return U(A)});},deleteTasks:E=>{we(A=>sd(A,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let A=Te.findTaskById(K,E);A&&r.onTaskDuplicate(A);}else we(A=>qs(A,[E]).tasks);},splitTask:(E,A,U=3)=>{we(q=>Te.splitTask(q,E,A,U));},calculateEndDate:Te.calculateEndDate,calculateDuration:Te.calculateDuration,validateDependency:(E,A)=>!Te.validateDependencies(K,E,A),getAllTasks:()=>Te.flattenTasks(K),getTasksByStatus:E=>Te.flattenTasks(K).filter(A=>A.status===E),getTasksByParent:E=>E?Te.findTaskById(K,E)?.subtasks||[]:K.filter(U=>!U.parentId),getCriticalPath:()=>Te.flattenTasks(K).filter(E=>E.isCriticalPath),indentTask:E=>{we(A=>qa(ad(A,[E])));},outdentTask:E=>{we(A=>qa(nd(A,[E])));},moveTask:(E,A)=>{we(U=>od(U,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:U}=cd(K,E);if(tt){let q=tt({...U,parentId:E});if((q instanceof Promise?await q:q)===false)return}we(qa(A)),je&&je({...U,parentId:E});},scrollToTask:E=>{let U=Te.flattenTasks(K).findIndex(q=>q.id===E);if(U!==-1&&xe.current){let q=U*Mt;xe.current.scrollTo({top:q,behavior:"smooth"}),te.current&&te.current.scrollTo({top:q,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{we(A=>{let U=q=>q.map(ce=>ce.id===E?{...ce,isExpanded:true}:ce.subtasks?{...ce,subtasks:U(ce.subtasks)}:ce);return U(A)});},collapseTask:E=>{we(A=>{let U=q=>q.map(ce=>ce.id===E?{...ce,isExpanded:false}:ce.subtasks?{...ce,subtasks:U(ce.subtasks)}:ce);return U(A)});},expandAll:()=>{we(E=>{let A=U=>U.map(q=>({...q,isExpanded:true,subtasks:q.subtasks?A(q.subtasks):void 0}));return A(E)});},collapseAll:()=>{we(E=>{let A=U=>U.map(q=>({...q,isExpanded:false,subtasks:q.subtasks?A(q.subtasks):void 0}));return A(E)});},collapseToLevel:E=>{_n(E);},undo:ot,redo:ae,canUndo:()=>lt,canRedo:()=>st,clearHistory:Bt,exportToPNG:async()=>{if(!Ee.current||!xe.current||!te.current)throw new Error("Gantt container not found");let E=Ee.current,A=xe.current,U=Xe.current||A.querySelector(".gantt-grid-scroll"),q=te.current,ce=U?.scrollTop||0,ge=q.scrollTop,Ke=E.style.overflow,qe=E.style.height,er=A.style.overflow;try{let Ot=U?.querySelector(".gantt-taskgrid-content"),nr=q.querySelector("svg"),pa=Ot?.scrollHeight||U?.scrollHeight||600,Oa=nr?.getBoundingClientRect().height||q.scrollHeight,vo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(pa,Oa)+20;U&&(U.scrollTop=0),q.scrollTop=0,E.style.overflow="visible",E.style.height=`${vo}px`,A.style.overflow="visible",await new Promise(_o=>setTimeout(_o,100));let xn=await htmlToImage.toPng(E,{backgroundColor:Re.bgPrimary,pixelRatio:2,filter:_o=>{if(!(_o instanceof Element))return !0;let bi=window.getComputedStyle(_o),Es=parseInt(bi.zIndex,10);return (isNaN(Es)||Es<50)&&bi.position!=="fixed"}});return await(await fetch(xn)).blob()}finally{E.style.overflow=Ke,E.style.height=qe,A.style.overflow=er,U&&(U.scrollTop=ce),q.scrollTop=ge;}},exportToPDF:async E=>{await Te.exportToPDF(K,E);},exportToExcel:async E=>{await Te.exportToExcel(K,E,Kl.current);},exportToJSON:()=>Te.exportToJSON(K),exportToCSV:()=>Te.exportToCSV(K),importFromJSON:E=>{let A=Te.importFromJSON(E);we(A);},getTasks:()=>K,refresh:()=>{we(E=>[...E]);},clearAll:()=>{we([]);},scrollToToday:()=>{let E=te.current,A=Je.current;if(!E||!A)return;let q=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),ce=A.timeScale==="day"?60:A.timeScale==="week"?20:8,ge=q*ce*A.zoom,Ke=E.clientWidth,qe=Math.max(0,ge-Ke/2);E.scrollTo({left:qe,behavior:"smooth"});}}),[K,ot,ae,lt,st,Bt,Re,Mt]);let Kt=react.useCallback(E=>{yn(A=>A.map(U=>U.id===E?{...U,visible:!U.visible}:U));},[]),Dt=react.useCallback((E,A)=>{yn(U=>U.map(q=>{if(q.id!==E)return q;let ce=q.minWidth??100,ge=q.maxWidth??800,Ke=Math.max(ce,Math.min(ge,A));return {...q,width:Ke}}));},[]),Pt=react.useCallback(E=>{we(A=>{let U=ld(A,E),q=ce=>{for(let ge of ce){if(ge.id===E){Ur.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&q(ge.subtasks);}};return q(U),ar(),U}),r.onTaskToggleExpand?.(E);},[r,ar]),Zt=react.useCallback((E,A)=>{if($e&&$e(E,A)===false)return;let q=Te.findTaskById(K,E)?.progress,ce=Ke=>Ke.map(qe=>qe.id===E?{...qe,...A}:qe.subtasks?{...qe,subtasks:ce(qe.subtasks)}:qe);we(Ke=>ce(Ke));let ge=Te.findTaskById(ce(K),E);ge&&(J?.(ge),bt?.(ge),A.progress!==void 0&&q!==void 0&&A.progress!==q&&se?.(E,q,A.progress));},[K,J,$e,bt,se]),ba=react.useCallback((E,A,U)=>{if(E.length===0)return;let q=new Set(E),ce=ge=>ge.map(Ke=>{let qe=q.has(Ke.id)?{...Ke,[A]:U}:Ke;return qe.subtasks?{...qe,subtasks:ce(qe.subtasks)}:qe});we(ge=>{let Ke=ce(ge);return r.onBulkFill?.(E,A,U,Ke),Ke});},[r]),ka=react.useCallback(E=>{E.length!==0&&($a.current+=1,Pn.current=true,we(A=>qa(ad(A,E))),r.onTaskIndent?.(E[0]));},[r]),ua=react.useCallback(E=>{E.length!==0&&($a.current+=1,Pn.current=true,we(A=>qa(nd(A,E))),r.onTaskOutdent?.(E[0]));},[r]),qr=react.useCallback((E,A,U)=>{$a.current+=1,Pn.current=true,we(q=>qa(Om(q,E,A,U))),r.onTaskReparent?.(E,A,U);},[r]),ho=react.useCallback((E,A)=>{E.length!==0&&($a.current+=1,Pn.current=true,we(U=>od(U,E,A)),r.onTaskMove?.(E[0],A));},[r]),yo=react.useCallback(async E=>{let A=[];for(let U of E)mt&&await Promise.resolve(mt(U))===false||A.push(U);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(we(U=>qa(sd(U,A))),A.forEach(U=>r.onTaskDelete?.(U))),Ve&&A.forEach(U=>Ve(U)));},[r,mt,Ve]),xo=react.useCallback(E=>{r.onTaskDuplicate?E.forEach(A=>{let U=Te.findTaskById(K,A);U&&r.onTaskDuplicate(U);}):we(A=>qs(A,E).tasks);},[r,K]),lb=react.useCallback((E,A)=>{we(U=>{let{tasks:q,newTask:ce}=$m(U,E,A);return tt&&tt(ce)===false?U:(r.onTaskCreate?.(ce.parentId,ce.position||0),je?.(ce),q)});},[r,tt,je]),cb=react.useCallback((E,A)=>{we(U=>id(U,E,A)),r.onTaskRename?.(E,A);},[r]),jl=react.useCallback(E=>{let{onTaskAddSubtask:A}=r;if(A){let U=cs(K,E);if(U){A(U);return}}we(U=>{let{tasks:q}=cd(U,E);return r.onTaskCreate?.(E,0),q});},[r,K]),db=react.useCallback((E,A)=>{let U=Math.max(0,Math.min(100,Math.round(A))),q={progress:U};U===100?q.status="completed":U>0?q.status="in-progress":q.status="todo",Zt(E.id,q);},[Zt]),ub=react.useCallback((E,A,U)=>{let q=!E.startDate&&!E.endDate,ce=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Ot=>Ot.map(nr=>nr.id===E.id?{...nr,startDate:A,endDate:U,...E.segments&&{segments:E.segments}}:nr.subtasks?{...nr,subtasks:ge(nr.subtasks)}:nr),Ke=ge(K),qe=Ke;Ke=Te.autoScheduleDependents(Ke,E.id,ce),Ke=qa(Ke),we(Ke);let er={...E,startDate:A,endDate:U};if(q&&r?.onTaskDateChange?r.onTaskDateChange(E,A,U):J?.(er),De&&ce!==0){let Ot=Te.flattenTasks(qe),nr=Te.flattenTasks(Ke),pa=[];for(let Oa of nr){if(Oa.id===E.id)continue;let Kn=Ot.find(xn=>xn.id===Oa.id);if(!Kn)continue;let jo=Oa.startDate?.getTime()!==Kn.startDate?.getTime(),vo=Oa.endDate?.getTime()!==Kn.endDate?.getTime();(jo||vo)&&pa.push(Oa);}pa.length>0&&De(pa);}},[K,J,De,r]),pb=react.useCallback((E,A)=>{We?.(E,A),O({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[We]),mb=react.useCallback((E,A)=>{let U=Te.splitTask(K,E.id,A);we(U),O({isOpen:false,x:0,y:0,task:null});},[K]),Cu=react.useCallback(E=>{let A=Te.findTaskById(K,E.id)||E;Oe?.(A),He||ve(A);},[K,Oe,He]),Tu=react.useCallback((E,A,U)=>{let q=new Map,ce=Ot=>{Ot.forEach(nr=>{nr.dependencies&&q.set(nr.id,nr.dependencies),nr.subtasks&&ce(nr.subtasks);});};ce(U);let ge=q.get(A)||[];q.set(A,[...ge,E]);let Ke=new Set,qe=new Set,er=Ot=>{if(!Ke.has(Ot)){Ke.add(Ot),qe.add(Ot);let nr=q.get(Ot)||[];for(let pa of nr){if(!Ke.has(pa)&&er(pa))return true;if(qe.has(pa))return true}}return qe.delete(Ot),false};return er(A)},[]),Nu=react.useCallback((E,A)=>{if(Tu(E.id,A,zo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ee[I]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ft}`,boxShadow:pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:je,borderBottom:`1px solid ${Re}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:dt,border:`1px solid ${zt}`,color:"#00E5CC"},children:jsxRuntime.jsx(Jm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Le},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>u(O=>!O),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:O=>{O.currentTarget.style.background=J,O.currentTarget.style.color=F;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=st;},children:jsxRuntime.jsx(yw,{})}),jsxRuntime.jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:st},onMouseEnter:O=>{O.currentTarget.style.background=J,O.currentTarget.style.color=F;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=st;},children:jsxRuntime.jsx(hw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!m&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[p.length===0&&v&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Oe.slice(0,4).map((O,te)=>jsxRuntime.jsx("button",{onClick:()=>fe(O),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Y,color:he,border:`1px solid ${ue}`},onMouseEnter:we=>{we.currentTarget.style.borderColor=Be,we.currentTarget.style.color="#00E5CC";},onMouseLeave:we=>{we.currentTarget.style.borderColor=ue,we.currentTarget.style.color=he;},children:O.length>30?O.slice(0,30)+"...":O},te))})]}),p.map(O=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?j:Ie,color:O.role==="user"?"#00E5CC":Ct,border:O.role==="user"?`1px solid ${xe}`:`1px solid ${Ue}`},children:[O.isLoading?jsxRuntime.jsx(xw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:O.command.success?"#10B981":"#EF4444",border:`1px solid ${O.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[O.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsxRuntime.jsx("div",{ref:Z})]}),jsxRuntime.jsxs("form",{onSubmit:O=>{if(C&&ea.length>0){O.preventDefault();return}_(O);},className:"p-3 relative",style:{borderTop:`1px solid ${Xe}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&ea.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Ae,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Bt,border:`1px solid ${vr}`,boxShadow:Gt,backdropFilter:"blur(12px)"},children:ea.map((O,te)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>_r(O),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:te===D?Qt:"transparent",color:Zr},onMouseEnter:()=>V(te),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:et,border:`1px solid ${Ke}`,color:"#00E5CC"},children:O.name.split(" ").map(we=>we[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:O.name}),O.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:ba},children:O.email})]})]},O.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Dt,border:`1px solid ${mt}`},children:[jsxRuntime.jsx("input",{ref:$,type:"text",value:x,onChange:O=>jr(O.target.value),onKeyDown:O=>{ce(O);},placeholder:Ce,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Jt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?xr:"transparent",color:x.trim()?"#00E5CC":Rt,border:x.trim()?`1px solid ${Er}`:"1px solid transparent"},children:jsxRuntime.jsx(bw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Hr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Qm(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,d=true)=>{a(m=>{let u=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:u};if(!d)return {...m,present:u};let p=[...m.past,m.present];return p.length>t&&p.shift(),{past:p,present:u,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:d,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:m}});},[]),c=react.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Zm({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){react.useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var Cw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Te.formatDate(e.startDate)} - ${Te.formatDate(e.endDate)}`);let r=Te.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=>Te.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function eg(e){return {...Cw,...e}}var Fw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},ng=react.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:d,projectName:m,availableUsers:u=[],templates:p,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:v,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:B,onCreateTask:T,taskFilter:C,onTaskFilterChange:P,toolbarRightContent:D,showBaseline:V,viewMode:$,onViewModeChange:Z,projectForecast:L,hideForecastHud:Ae,onThemeChange:W,onTaskClick:Ce,onTaskSelectionChange:I,selectedTaskId:z,onTaskDblClick:Oe,onTaskContextMenu:ze,onTaskUpdate:Q,onDependentTasksScheduled:De,onProgressChange:oe,onTaskEdit:He,onTaskAddSubtask:Se,onTaskMarkIncomplete:Fe,onTaskSetInProgress:Ge,onDependencyCreate:Qe,onDependencyDelete:se,onBeforeTaskAdd:Ze,onAfterTaskAdd:_e,onBeforeTaskUpdate:$e,onAfterTaskUpdate:ft,onBeforeTaskDelete:pt,onAfterTaskDelete:je,permissions:Re,onCopySnapshotLink:dt}=r,Le=react.useContext(Yi)?.theme,[st,F]=react.useState(Le||s||"dark"),[J,R]=react.useState(o),[Y,ue]=react.useState(l),[he,Be]=react.useState(1),[j,xe]=react.useState("all"),[Ie,Ue]=react.useState($||"execution"),Ct=$??Ie,Xe=react.useCallback(E=>{Ue(E),Z?.(E);},[Z]),Dt=V??Ct==="oracle",[mt,Jt]=react.useState(r.showCriticalPath!==false),[xr,Er]=react.useState(r.showDependencies!==false),[Rt,Hr]=react.useState(r.highlightWeekends!==false),Bt=react.useCallback(E=>{Jt(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),vr=react.useCallback(E=>{Er(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),Gt=react.useCallback(E=>{Hr(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(J);},[J]),react.useEffect(()=>{r.onZoomChange?.(he);},[he]);let Qt=react.useRef(r.onDateRangeChange);Qt.current=r.onDateRangeChange;let Zr=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[ba,et]=react.useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let U=JSON.parse(A);if(U.taskFilter)return U.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ke=C??ba,sa=P??et,[Vr,ea]=react.useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let U=JSON.parse(A);if(typeof U.hideCompleted=="boolean")return U.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=Zr();if(E)try{let A={taskFilter:Ke,hideCompleted:Vr};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[Ke,Vr,Zr]);let jr=react.useRef(y);react.useEffect(()=>{if(jr.current!==y&&y!==void 0){et("all"),ea(false);let E=Zr();if(E)try{localStorage.removeItem(E);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}jr.current=y;},[y,Zr]);let[_r,ce]=react.useState(0),[de,ut]=react.useState(false),[_,fe]=react.useState(null),[ee,O]=react.useState({isOpen:false,x:0,y:0,task:null}),[te,we]=react.useState(null),[N,H]=react.useState(null);react.useEffect(()=>{Le&&Le!==st&&F(Le);},[Le]),react.useEffect(()=>{s&&s!==st&&F(s);},[s]);let me=react.useCallback(E=>{F(E),W?.(E);},[W]),{state:K,setState:ve,undo:nt,redo:ie,canUndo:ot,canRedo:bt,clearHistory:Mt}=Qm(t,50),ir=react.useMemo(()=>{let E=(A,U=0)=>{let q=U;for(let le of A)le.subtasks?.length&&(q=Math.max(q,E(le.subtasks,U+1)));return q};return E(K)+1},[K]),ha=react.useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),mr=react.useRef(new Map),tn=react.useRef(false);if(!tn.current&&x){tn.current=true;let E=typeof x=="string"?x:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let U=JSON.parse(A);Array.isArray(U)&&(mr.current=new Map(U));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let lr=react.useCallback(()=>{let E=ha();if(E)try{let A=Array.from(mr.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[ha]),Ma=react.useRef(0),zo=react.useRef(K);react.useEffect(()=>{zo.current=K;},[K]);let Pn=react.useRef(false),_n=react.useCallback(E=>{xe(E),Ma.current+=1,ve(A=>{let U=(le,ge=0)=>le.map(qe=>{let Ye=E==="all"||ge<E-1;return qe.subtasks?.length&&mr.current.set(qe.id,Ye),{...qe,isExpanded:Ye,subtasks:qe.subtasks?U(qe.subtasks,ge+1):void 0}}),q=U(A);return lr(),q});},[ve,lr]);react.useEffect(()=>{if(Ma.current>0){Ma.current-=1;return}let E=U=>{let q=new Map;for(let le of U){let ge=le.id;q.get(ge)||q.set(ge,le);}return Array.from(q.values())},A=U=>U.map(q=>{let le=mr.current.get(q.id),ge=le!==void 0?{...q,isExpanded:le}:q;if(ge.subtasks?.length){let qe=E(ge.subtasks);return {...ge,subtasks:A(qe)}}return ge});if(mr.current.size>0)ve(Ya(A(t)));else {let U=q=>q.map(le=>le.subtasks?.length?{...le,subtasks:E(U(le.subtasks))}:le);ve(Ya(U(t)));}},[t,ve]);let Go=react.useRef(t),bi=react.useRef(true);react.useEffect(()=>{if(bi.current){bi.current=false,Go.current=K;return}if(Pn.current){Pn.current=false,Go.current=K;return}if(!a)return;let E=JSON.stringify(Go.current),A=JSON.stringify(K);E!==A&&(Go.current=K,a(K));},[K,a]);let Kr=react.useMemo(()=>Qc(w,k),[w,k]),Ds=react.useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Ga=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Va,Ba]=react.useState(()=>{let E=Ds(Kr);if(!b)return E;try{let A=typeof b=="string"?b:"gantt-columns-state",U=localStorage.getItem(A);if(!U)return E;let q=JSON.parse(U),le=new Map(q.map(ge=>[ge.id,ge]));return E.map(ge=>{let qe=le.get(ge.id);return qe?{...ge,visible:qe.visible??ge.visible,width:qe.width??ge.width}:ge})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),E}}),ho=react.useRef(Ga);react.useEffect(()=>{if(ho.current===Ga)return;ho.current=Ga;let E=Ds(Kr);if(!Ga){Ba(E);return}try{let A=localStorage.getItem(Ga);if(!A){Ba(E);return}let U=JSON.parse(A),q=new Map(U.map(le=>[le.id,le]));Ba(E.map(le=>{let ge=q.get(le.id);return ge?{...le,visible:ge.visible??le.visible,width:ge.width??le.width}:le}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),Ba(E);}},[Ga,Ds,Kr]),react.useEffect(()=>{if(Ga&&ho.current===Ga)try{let E=Va.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(Ga,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Va,Ga]),react.useEffect(()=>{Ba(E=>E.map(A=>({...A,label:Kr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Kr]);let Kn=react.useMemo(()=>Va.filter(A=>A.visible).reduce((A,U)=>A+U.width,0),[Va]),yo=react.useRef(Va.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Va.filter(q=>q.visible),A=E.map(q=>q.id).join(","),U=yo.current;if(A!==U){let q=E.some(ge=>ge.id!=="name"),le=U.includes(",");q?!le&&q&&fe(null):fe(null),yo.current=A;}},[Va]);let S=60,X=.6,pe=react.useMemo(()=>{let A=Kn+S,U=typeof window<"u"?window.innerWidth*X:800,q=Math.max(A,U);return _!==null?Math.max(200,Math.min(_,q)):Math.max(200,A)},[_,Kn]),ye=react.useRef(null),ke=react.useRef(null),We=react.useRef(null),re=react.useRef(null),Pe=react.useRef(null),Ee=react.useMemo(()=>hm(st),[st]),at=react.useMemo(()=>({theme:Ee,themeName:st}),[Ee,st]),$t=react.useMemo(()=>eg(p),[p]),lt=react.useMemo(()=>{if(!f||!mt)return K;let E=Te.calculateCriticalPathFull(K),A=U=>U.map(q=>{let le=E.get(q.id),ge=q.subtasks?A(q.subtasks):void 0,qe=ge?.some(Zt=>Zt.isCriticalPath||Zt.subtasks&&Zt.subtasks.some(Ht=>Ht.isCriticalPath))||false,Ye=le?le.isCritical:qe;return {...q,isCriticalPath:Ye,cpmData:le||void 0,subtasks:ge}});return A(K)},[K,f,mt]),gt=react.useMemo(()=>Te.flattenTasks(K).some(A=>A.dependencies&&A.dependencies.length>0),[K]),rr=react.useMemo(()=>{let E=(A,U="")=>[...A].sort((le,ge)=>(le.position??0)-(ge.position??0)).map((le,ge)=>{let qe=ge+1,Ye=U?`${U}.${qe}`:`${qe}.0`,Zt=U?`${U}.${qe}`:`${qe}`;return {...le,wbsCode:Ye,subtasks:le.subtasks?.length?E(le.subtasks,Zt):le.subtasks}});return E(lt)},[lt]),gr=react.useMemo(()=>{if(Ke==="all"&&!Vr)return rr;let E=A=>{let U=[];for(let q of A){let le=q.subtasks?.length?E(q.subtasks):void 0,ge=false;if(Vr)ge=q.progress<100;else switch(Ke){case "all":ge=true;break;case "incomplete":ge=q.progress<100;break;case "in_progress":ge=q.progress>0&&q.progress<100;break;case "completed":ge=q.progress===100;break}(ge||le&&le.length>0)&&U.push({...q,subtasks:le});}return U};return E(rr)},[rr,Ke,Vr]),Ur=Fw(Y);Zm({undo:nt,redo:ie,canUndo:ot,canRedo:bt,enabled:true}),react.useImperativeHandle(n,()=>({getTask:E=>Te.findTaskById(K,E),addTask:(E,A)=>{ve(U=>{if(!A)return [...U,{...E,level:0}];let q=le=>le.map(ge=>ge.id===A?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:A,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(U)});},updateTask:(E,A)=>{ve(U=>{let q=le=>le.map(ge=>ge.id===E?{...ge,...A}:ge.subtasks?{...ge,subtasks:q(ge.subtasks)}:ge);return q(U)});},deleteTask:E=>{ve(A=>{let U=q=>q.filter(le=>le.id===E?false:(le.subtasks&&(le.subtasks=U(le.subtasks)),true));return U(A)});},deleteTasks:E=>{ve(A=>id(A,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let A=Te.findTaskById(K,E);A&&r.onTaskDuplicate(A);}else ve(A=>Ys(A,[E]).tasks);},splitTask:(E,A,U=3)=>{ve(q=>Te.splitTask(q,E,A,U));},calculateEndDate:Te.calculateEndDate,calculateDuration:Te.calculateDuration,validateDependency:(E,A)=>!Te.validateDependencies(K,E,A),getAllTasks:()=>Te.flattenTasks(K),getTasksByStatus:E=>Te.flattenTasks(K).filter(A=>A.status===E),getTasksByParent:E=>E?Te.findTaskById(K,E)?.subtasks||[]:K.filter(U=>!U.parentId),getCriticalPath:()=>Te.flattenTasks(K).filter(E=>E.isCriticalPath),indentTask:E=>{ve(A=>Ya(nd(A,[E])));},outdentTask:E=>{ve(A=>Ya(od(A,[E])));},moveTask:(E,A)=>{ve(U=>sd(U,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:U}=dd(K,E);if(Ze){let q=Ze({...U,parentId:E});if((q instanceof Promise?await q:q)===false)return}ve(Ya(A)),_e&&_e({...U,parentId:E});},scrollToTask:E=>{let U=Te.flattenTasks(K).findIndex(q=>q.id===E);if(U!==-1&&ye.current){let q=U*Ur;ye.current.scrollTo({top:q,behavior:"smooth"}),We.current&&We.current.scrollTo({top:q,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{ve(A=>{let U=q=>q.map(le=>le.id===E?{...le,isExpanded:true}:le.subtasks?{...le,subtasks:U(le.subtasks)}:le);return U(A)});},collapseTask:E=>{ve(A=>{let U=q=>q.map(le=>le.id===E?{...le,isExpanded:false}:le.subtasks?{...le,subtasks:U(le.subtasks)}:le);return U(A)});},expandAll:()=>{ve(E=>{let A=U=>U.map(q=>({...q,isExpanded:true,subtasks:q.subtasks?A(q.subtasks):void 0}));return A(E)});},collapseAll:()=>{ve(E=>{let A=U=>U.map(q=>({...q,isExpanded:false,subtasks:q.subtasks?A(q.subtasks):void 0}));return A(E)});},collapseToLevel:E=>{_n(E);},undo:nt,redo:ie,canUndo:()=>ot,canRedo:()=>bt,clearHistory:Mt,exportToPNG:async()=>{if(!re.current||!ye.current||!We.current)throw new Error("Gantt container not found");let E=re.current,A=ye.current,U=ke.current||A.querySelector(".gantt-grid-scroll"),q=We.current,le=U?.scrollTop||0,ge=q.scrollTop,qe=E.style.overflow,Ye=E.style.height,Zt=A.style.overflow;try{let Ht=U?.querySelector(".gantt-taskgrid-content"),ar=q.querySelector("svg"),ma=Ht?.scrollHeight||U?.scrollHeight||600,$a=ar?.getBoundingClientRect().height||q.scrollHeight,vo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ma,$a)+20;U&&(U.scrollTop=0),q.scrollTop=0,E.style.overflow="visible",E.style.height=`${vo}px`,A.style.overflow="visible",await new Promise(_o=>setTimeout(_o,100));let xn=await htmlToImage.toPng(E,{backgroundColor:Ee.bgPrimary,pixelRatio:2,filter:_o=>{if(!(_o instanceof Element))return !0;let hi=window.getComputedStyle(_o),Ms=parseInt(hi.zIndex,10);return (isNaN(Ms)||Ms<50)&&hi.position!=="fixed"}});return await(await fetch(xn)).blob()}finally{E.style.overflow=qe,E.style.height=Ye,A.style.overflow=Zt,U&&(U.scrollTop=le),q.scrollTop=ge;}},exportToPDF:async E=>{await Te.exportToPDF(K,E);},exportToExcel:async E=>{await Te.exportToExcel(K,E,ql.current);},exportToJSON:()=>Te.exportToJSON(K),exportToCSV:()=>Te.exportToCSV(K),importFromJSON:E=>{let A=Te.importFromJSON(E);ve(A);},getTasks:()=>K,refresh:()=>{ve(E=>[...E]);},clearAll:()=>{ve([]);},scrollToToday:()=>{let E=We.current,A=Pe.current;if(!E||!A)return;let q=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),le=A.timeScale==="day"?60:A.timeScale==="week"?20:8,ge=q*le*A.zoom,qe=E.clientWidth,Ye=Math.max(0,ge-qe/2);E.scrollTo({left:Ye,behavior:"smooth"});}}),[K,nt,ie,ot,bt,Mt,Ee,Ur]);let Ot=react.useCallback(E=>{Ba(A=>A.map(U=>U.id===E?{...U,visible:!U.visible}:U));},[]),Kt=react.useCallback((E,A)=>{Ba(U=>U.map(q=>{if(q.id!==E)return q;let le=q.minWidth??100,ge=q.maxWidth??800,qe=Math.max(le,Math.min(ge,A));return {...q,width:qe}}));},[]),St=react.useCallback(E=>{ve(A=>{let U=cd(A,E),q=le=>{for(let ge of le){if(ge.id===E){mr.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&q(ge.subtasks);}};return q(U),lr(),U}),r.onTaskToggleExpand?.(E);},[r,lr]),xt=react.useCallback((E,A)=>{if($e&&$e(E,A)===false)return;let q=Te.findTaskById(K,E)?.progress,le=qe=>qe.map(Ye=>Ye.id===E?{...Ye,...A}:Ye.subtasks?{...Ye,subtasks:le(Ye.subtasks)}:Ye);ve(qe=>le(qe));let ge=Te.findTaskById(le(K),E);ge&&(Q?.(ge),ft?.(ge),A.progress!==void 0&&q!==void 0&&A.progress!==q&&oe?.(E,q,A.progress));},[K,Q,$e,ft,oe]),Mr=react.useCallback((E,A,U)=>{if(E.length===0)return;let q=new Set(E),le=ge=>ge.map(qe=>{let Ye=q.has(qe.id)?{...qe,[A]:U}:qe;return Ye.subtasks?{...Ye,subtasks:le(Ye.subtasks)}:Ye});ve(ge=>{let qe=le(ge);return r.onBulkFill?.(E,A,U,qe),qe});},[r]),ya=react.useCallback(E=>{E.length!==0&&(Ma.current+=1,Pn.current=true,ve(A=>Ya(nd(A,E))),r.onTaskIndent?.(E[0]));},[r]),Ca=react.useCallback(E=>{E.length!==0&&(Ma.current+=1,Pn.current=true,ve(A=>Ya(od(A,E))),r.onTaskOutdent?.(E[0]));},[r]),pa=react.useCallback((E,A,U)=>{Ma.current+=1,Pn.current=true,ve(q=>Ya(Hm(q,E,A,U))),r.onTaskReparent?.(E,A,U);},[r]),qr=react.useCallback((E,A)=>{E.length!==0&&(Ma.current+=1,Pn.current=true,ve(U=>sd(U,E,A)),r.onTaskMove?.(E[0],A));},[r]),Fn=react.useCallback(async E=>{let A=[];for(let U of E)pt&&await Promise.resolve(pt(U))===false||A.push(U);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(ve(U=>Ya(id(U,A))),A.forEach(U=>r.onTaskDelete?.(U))),je&&A.forEach(U=>je(U)));},[r,pt,je]),Ss=react.useCallback(E=>{r.onTaskDuplicate?E.forEach(A=>{let U=Te.findTaskById(K,A);U&&r.onTaskDuplicate(U);}):ve(A=>Ys(A,E).tasks);},[r,K]),xo=react.useCallback((E,A)=>{ve(U=>{let{tasks:q,newTask:le}=Om(U,E,A);return Ze&&Ze(le)===false?U:(r.onTaskCreate?.(le.parentId,le.position||0),_e?.(le),q)});},[r,Ze,_e]),cb=react.useCallback((E,A)=>{ve(U=>ld(U,E,A)),r.onTaskRename?.(E,A);},[r]),_l=react.useCallback(E=>{let{onTaskAddSubtask:A}=r;if(A){let U=cs(K,E);if(U){A(U);return}}ve(U=>{let{tasks:q}=dd(U,E);return r.onTaskCreate?.(E,0),q});},[r,K]),db=react.useCallback((E,A)=>{let U=Math.max(0,Math.min(100,Math.round(A))),q={progress:U};U===100?q.status="completed":U>0?q.status="in-progress":q.status="todo",xt(E.id,q);},[xt]),ub=react.useCallback((E,A,U)=>{let q=!E.startDate&&!E.endDate,le=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Ht=>Ht.map(ar=>ar.id===E.id?{...ar,startDate:A,endDate:U,...E.segments&&{segments:E.segments}}:ar.subtasks?{...ar,subtasks:ge(ar.subtasks)}:ar),qe=ge(K),Ye=qe;qe=Te.autoScheduleDependents(qe,E.id,le),qe=Ya(qe),ve(qe);let Zt={...E,startDate:A,endDate:U};if(q&&r?.onTaskDateChange?r.onTaskDateChange(E,A,U):Q?.(Zt),De&&le!==0){let Ht=Te.flattenTasks(Ye),ar=Te.flattenTasks(qe),ma=[];for(let $a of ar){if($a.id===E.id)continue;let qn=Ht.find(xn=>xn.id===$a.id);if(!qn)continue;let jo=$a.startDate?.getTime()!==qn.startDate?.getTime(),vo=$a.endDate?.getTime()!==qn.endDate?.getTime();(jo||vo)&&ma.push($a);}ma.length>0&&De(ma);}},[K,Q,De,r]),pb=react.useCallback((E,A)=>{ze?.(E,A),O({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[ze]),mb=react.useCallback((E,A)=>{let U=Te.splitTask(K,E.id,A);ve(U),O({isOpen:false,x:0,y:0,task:null});},[K]),Tu=react.useCallback(E=>{let A=Te.findTaskById(K,E.id)||E;Oe?.(A),He||we(A);},[K,Oe,He]),Nu=react.useCallback((E,A,U)=>{let q=new Map,le=Ht=>{Ht.forEach(ar=>{ar.dependencies&&q.set(ar.id,ar.dependencies),ar.subtasks&&le(ar.subtasks);});};le(U);let ge=q.get(A)||[];q.set(A,[...ge,E]);let qe=new Set,Ye=new Set,Zt=Ht=>{if(!qe.has(Ht)){qe.add(Ht),Ye.add(Ht);let ar=q.get(Ht)||[];for(let ma of ar){if(!qe.has(ma)&&Zt(ma))return true;if(Ye.has(ma))return true}}return Ye.delete(Ht),false};return Zt(A)},[]),Du=react.useCallback((E,A)=>{if(Nu(E.id,A,zo.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
367
367
 
368
- Task dependencies must flow in one direction only.`);return}let U=q=>q.map(ce=>{if(ce.id===A){let ge=ce.dependencies||[];if(!ge.includes(E.id))return {...ce,dependencies:[...ge,E.id]}}return ce.subtasks?{...ce,subtasks:U(ce.subtasks)}:ce});$a.current+=1,we(q=>U(q)),Ze?.(E.id,A);},[Ze,Tu]),Du=react.useCallback((E,A)=>{let U=q=>q.map(ce=>{if(ce.id===E&&ce.dependencies){let ge=ce.dependencies.filter(Ke=>Ke!==A);return {...ce,dependencies:ge}}return ce.subtasks?{...ce,subtasks:U(ce.subtasks)}:ce});$a.current+=1,we(q=>U(q)),le?.(E,A);},[le]),{startDate:Ln,endDate:_l}=react.useMemo(()=>{let E=K.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,Ke=new Date(ge);Ke.setDate(Ke.getDate()-30);let qe=new Date(ge);return qe.setDate(qe.getDate()+60),{startDate:Ke,endDate:qe}}let A=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),U=new Date(Math.min(...A.map(ge=>ge.getTime()))),q=new Date(Math.max(...A.map(ge=>ge.getTime()))),ce=X==="day"?7:X==="week"?14:30;return U.setDate(U.getDate()-ce),q.setDate(q.getDate()+ce),{startDate:U,endDate:q}},[K,X]);react.useEffect(()=>{Qt.current?.(Ln,_l);},[Ln,_l]);let gb=react.useCallback(async()=>{if(!Ee.current||!xe.current||!te.current)return;await new Promise(vo=>setTimeout(vo,200));let E=Ee.current,A=xe.current,U=Xe.current||A.querySelector(".gantt-grid-scroll"),q=te.current,ce=U?.scrollTop||0,ge=U?.scrollLeft||0,Ke=q.scrollTop,qe=q.scrollLeft,er=E.style.overflow,Ot=E.style.height,nr=U?.style.overflow||"",pa=q.style.overflow,Oa=A.style.overflow,Kn=E.style.width,jo=q.style.width;try{let vo=U?.querySelector(".gantt-taskgrid-content"),xn=q.querySelector("svg"),Xl=xn?.getAttribute("height")?parseInt(xn.getAttribute("height"),10):xn?.getBoundingClientRect().height||0,_o=vo?.scrollHeight||U?.scrollHeight||600,bi=Math.max(Xl,q.scrollHeight),Es=xn?.getAttribute("width")?parseInt(xn.getAttribute("width"),10):xn?.getBoundingClientRect().width||q.scrollWidth,kb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Jl=Math.max(_o,bi,Xl),Pu=kb+Jl+50,Fu=(U?.offsetWidth||A.offsetWidth||300)+Es+10;U&&(U.scrollTop=0,U.scrollLeft=0),q.scrollTop=0,q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Pu}px`,E.style.width=`${Fu}px`,A.style.overflow="visible",U&&(U.style.overflow="visible",U.style.height=`${Jl+50}px`),q.style.overflow="visible",q.style.height=`${Jl+50}px`,q.style.width=`${Es+10}px`,await new Promise(hi=>setTimeout(hi,150));let Cb=await htmlToImage.toPng(E,{backgroundColor:Re.bgPrimary,pixelRatio:2,width:Fu,height:Pu,skipFonts:!1,filter:hi=>{if(!(hi instanceof Element))return !0;let Lu=window.getComputedStyle(hi),Au=parseInt(Lu.zIndex,10);return !(!isNaN(Au)&&Au>=50||Lu.position==="fixed")}}),Ql=document.createElement("a");Ql.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ql.href=Cb,Ql.click();}finally{E.style.overflow=er,E.style.height=Ot,E.style.width=Kn,A.style.overflow=Oa,U&&(U.style.overflow=nr,U.style.height="",U.scrollTop=ce,U.scrollLeft=ge),q.style.overflow=pa,q.style.height="",q.style.width=jo,q.scrollTop=Ke,q.scrollLeft=qe;}d?.("png");},[Re,d]),fb=react.useCallback(async()=>{await Te.exportToPDF(K),d?.("pdf");},[K,d]),Kl=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m});Kl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m};let bb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let E=new Date,A=ce=>String(ce).padStart(2,"0"),U=`${E.getFullYear()}-${A(E.getMonth()+1)}-${A(E.getDate())}_${A(E.getHours())}${A(E.getMinutes())}`,q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Te.exportToExcel(K,`${q}_${U}.xlsx`,Kl.current),d?.("excel");},[K,m,d,r.onExportExcel]),hb=react.useCallback(()=>{let E=Te.exportToCSV(K),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(A),U.download="gantt-chart.csv",U.click(),URL.revokeObjectURL(U.href),d?.("csv");},[K,d]),yb=react.useCallback(()=>{let E=Te.exportToJSON(K),A=new Blob([E],{type:"application/json;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(A),U.download="gantt-chart.json",U.click(),URL.revokeObjectURL(U.href),d?.("json");},[K,d]),xb=react.useCallback(()=>{Te.exportToMSProject(K,"Gantt Project","project.xml"),d?.("msproject");},[K,d]),vb=E=>{E.preventDefault(),ft(true);},Vo=react.useRef(false),[ql,Su]=react.useState(false),Ss=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=te.current,A=xe.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let U=()=>{if(Vo.current)return;Vo.current=true;let qe=E.scrollTop;ne(qe),A.scrollTop=qe,requestAnimationFrame(()=>{Vo.current=false;});},q=()=>{if(Vo.current)return;Vo.current=true;let qe=A.scrollTop;ne(qe),E.scrollTop=qe,requestAnimationFrame(()=>{Vo.current=false;});},ce=qe=>{if(ue&&A){let Ot=A.parentElement?.getBoundingClientRect()?.left||0,nr=qe.clientX-Ot,pa=200,Oa=Fn+Q,Kn=window.innerWidth*pe,jo=Math.max(Oa,Kn);nr>=pa&&nr<=jo&&fe(nr);}if(ql&&E){let er=qe.clientX-Ss.current.x,Ot=qe.clientY-Ss.current.y;E.scrollLeft=Ss.current.scrollLeft-er,E.scrollTop=Ss.current.scrollTop-Ot;}},ge=()=>{ft(false),Su(false);},Ke=qe=>{if(qe.button!==0)return;let er=qe.target;er.closest("[data-task-bar]")||er.closest("[data-dependency-line]")||er.closest("button")||er.closest('[role="button"]')||er.tagName==="rect"&&er.getAttribute("data-clickable")==="true"||(Su(true),Ss.current={x:qe.clientX,y:qe.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},qe.preventDefault());};return E.addEventListener("scroll",U),A.addEventListener("scroll",q),E.addEventListener("mousedown",Ke),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",U),A.removeEventListener("scroll",q),E.removeEventListener("mousedown",Ke),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",ge);}},[ue,ql,Fn]),Je.current={startDate:Ln,timeScale:X,zoom:he};let Yl=r.onTodayVisibilityChange,Eu=react.useRef(null);react.useEffect(()=>{if(!Yl)return;let E=te.current;if(!E)return;let A=X==="day"?60:X==="week"?20:8,U=()=>{let ge=(new Date().getTime()-Ln.getTime())/(1e3*60*60*24)*A*he,Ke=E.scrollLeft,qe=Ke+E.clientWidth,er=ge>=Ke&&ge<=qe;Eu.current!==er&&(Eu.current=er,Yl(er));};return U(),E.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{E.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[Yl,Ln,X,he]);let Mu=react.useRef(false),wb=react.useRef(null);return react.useLayoutEffect(()=>{if(Mu.current||K.length===0||!te.current)return;Mu.current=true,wb.current=Ln;let E=te.current,A=new Date,U=X==="day"?60:X==="week"?20:8,q=(A.getTime()-Ln.getTime())/(1e3*60*60*24),ce=E.clientWidth,Ke=q*U*he-ce/2;q>=0&&ce>0&&(E.scrollLeft=Math.max(0,Ke));},[K.length,Ln,X,he]),jsxRuntime.jsx(os.Provider,{value:Kr,children:jsxRuntime.jsx(ac.Provider,{value:Ut,children:jsxRuntime.jsxs("div",{ref:Ee,className:"flex flex-col h-full w-full",style:{backgroundColor:Re.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Re.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Re.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Xi,{theme:Re,timeScale:X,onTimeScaleChange:R,zoom:he,onZoomChange:Be,currentTheme:nt,onThemeChange:me,rowDensity:Y,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:M&&Ie?.canCreateTask!==false&&!Ie?.canCreateSubtaskOnly,createTaskLabel:B,onCreateTask:T,taskFilter:_e,onTaskFilterChange:fa,hideCompleted:jr,onHideCompletedChange:Zr,toolbarRightContent:D,wbsLevel:j,onWbsLevelChange:_n,maxWbsDepth:gr,viewMode:kt,onViewModeChange:Ye,projectForecast:L,hideForecastHud:Le,onExportPNG:i?gb:void 0,onExportPDF:i?fb:void 0,onExportExcel:i?bb:void 0,onExportCSV:i?hb:void 0,onExportJSON:i?yb:void 0,onExportMSProject:i?xb:void 0,showCriticalPath:gt,onShowCriticalPathChange:$t,showDependencies:vr,onShowDependenciesChange:wr,highlightWeekends:Rt,onHighlightWeekendsChange:Gt,showBaseline:Nt,onShowBaselineChange:E=>{E&&kt!=="oracle"&&Ye("oracle"),!E&&kt==="oracle"&&Ye("execution");},onCopySnapshotLink:dt,hasDependencies:fr})}),jsxRuntime.jsxs("div",{ref:xe,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Xe,className:"gantt-grid-scroll flex-shrink-0",style:{width:ke,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Zi,{tasks:ea,allTasks:cr,theme:Re,rowHeight:Mt,availableUsers:u,templates:ut,showCriticalPath:gt,onTaskClick:Ce,onTaskSelectionChange:I,selectedTaskId:z,onTaskDblClick:Cu,onTaskContextMenu:We,onTaskToggle:Pt,scrollTop:Ba,columns:Ma,onToggleColumn:Kt,onColumnResize:Dt,onTaskUpdate:Zt,onBulkFill:ba,onTaskIndent:ka,onTaskOutdent:ua,onTaskMove:ho,onMultiTaskDelete:yo,onTaskDuplicate:xo,onTaskCreate:lb,onTaskRename:cb,onCreateSubtask:jl,onOpenTaskModal:Ce?E=>Ce(E):void 0,onDeleteRequest:(E,A)=>H({taskIds:E,taskName:A}),onTaskReparent:qr,scrollContainerRef:Xe})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Re.border,zIndex:15},onMouseDown:vb}),jsxRuntime.jsx("div",{ref:te,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ql?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(sl,{tasks:ea,theme:Re,rowHeight:Mt,timeScale:X,startDate:Ln,endDate:_l,zoom:he,locale:w,templates:ut,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:Ce,onTaskDblClick:Cu,onTaskContextMenu:pb,onTaskDateChange:ub,onTaskProgressDrag:db,onDependencyCreate:Nu,onDependencyDelete:Du,showBaseline:Nt,showCriticalPath:gt,showDependencies:vr,highlightWeekends:Rt,canEditTask:Ie?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),Z.task&&jsxRuntime.jsx(ls,{isOpen:Z.isOpen,x:Z.x,y:Z.y,theme:Re,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Z.task;if(!E)return [];let A=Te.findTaskById(K,E.id)||E,U=A.subtasks&&A.subtasks.length>0,q=Ie?.canCreateTask!==false,ce=Ie?.canDeleteTask!==false;if(U){let Ot=[],nr=Ie?.canDuplicateTask!==false;return q&&Ot.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:rr.Add,onClick:()=>{Se?Se(A):jl(A.id);}}),nr&&Ot.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:rr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):we(pa=>qs(pa,[A.id]).tasks),O({isOpen:false,x:0,y:0,task:null});}}),ce&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:rr.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),Ot}let ge=Ie?.canUpdateTask!==false,Ke=Ie?.canDuplicateTask!==false,qe=[];return ge&&qe.push({id:"edit",label:Kr.contextMenu?.editTask||"Edit Task",icon:rr.Pencil,onClick:()=>{He?He(A):ve(A);}}),q&&qe.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:rr.Add,onClick:()=>{Se?Se(A):jl(A.id);}}),qe.length>0&&ge&&qe.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(qe.push({id:"markIncomplete",label:Kr.contextMenu?.markIncomplete||"Mark Incomplete",icon:rr.MarkIncomplete,onClick:()=>{Pe?Pe(A):Zt(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),qe.push({id:"setInProgress",label:Kr.contextMenu?.setInProgress||"Set In Progress",icon:rr.SetInProgress,onClick:()=>{ze?ze(A):Zt(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),qe.push({id:"markComplete",label:Kr.contextMenu?.markComplete||"Mark Complete",icon:rr.MarkComplete,onClick:()=>{Zt(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(Ke||ge&&A.startDate&&A.endDate)&&qe.length>0&&qe.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ke&&qe.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:rr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):we(Ot=>qs(Ot,[A.id]).tasks),O({isOpen:false,x:0,y:0,task:null});}}),ge&&A.startDate&&A.endDate&&qe.push({id:"split",label:Kr.contextMenu?.splitTask||"Split Task",icon:rr.Split,onClick:()=>{let Ot=A.startDate.getTime(),nr=A.endDate.getTime(),pa=Ot+(nr-Ot)/2,Oa=new Date(pa);mb(A,Oa);}}),ce&&(qe.length>0&&qe.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),qe.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:rr.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),qe})()}),jsxRuntime.jsx(So,{task:re,isOpen:!!re,onClose:()=>ve(null),onTaskUpdate:E=>{re&&(Zt(re.id,E),ve(null));},theme:nt==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>H(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Re.bgSecondary,border:`1px solid ${Re.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Re.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Re.textPrimary,fontFamily:"Inter, sans-serif"},children:[Kr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Re.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("p",{className:"text-sm leading-relaxed",style:{color:Re.textSecondary,fontFamily:"Inter, sans-serif"},children:N.taskIds.length>1?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Re.textPrimary},children:[N.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Re.textPrimary},children:['"',N.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Re.bgPrimary,borderTop:`1px solid ${Re.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>H(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Re.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Re.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{yo(N.taskIds),H(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsxRuntime.jsx(cl,{tasks:K,theme:Re,config:v,onTasksUpdate:we,onTaskUpdate:Zt,onTaskCreate:E=>{we(A=>[...A,E]);},onTaskDelete:E=>{yo([E]);},onDependencyCreate:(E,A)=>{let U=Te.findTaskById(K,E);U&&Nu(U,A);},onDependencyDelete:Du})]})})})});function zw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Gw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var pd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],md=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function sg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=r?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:m,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:f,defaultStatus:x}){let h=[...pd,...i.filter(F=>!pd.some(X=>X.id===F.id))],b=it[c]||it.dark,[y,v]=react.useState(false),[w,k]=react.useState(false),[M,B]=react.useState(false),[T,C]=react.useState(false),[P,D]=react.useState({top:0,left:0}),[V,$]=react.useState(null),[ee,L]=react.useState(new Date),[Le,W]=react.useState({top:0,left:0}),[Ce,I]=react.useState(false),[z,Oe]=react.useState([]),[We,J]=react.useState(false),[De,se]=react.useState(""),He=react.useRef(null),Se=react.useRef(null),Pe=react.useRef(null),ze=react.useRef(null),Ze=react.useRef(null),[le,tt]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[je,$e]=react.useState({});react.useEffect(()=>{r?(tt({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&I(true)):(tt({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),I(false),Oe([]));},[r,e,x]),react.useEffect(()=>{let F=X=>{He.current&&!He.current.contains(X.target)&&v(false),Se.current&&!Se.current.contains(X.target)&&k(false),Pe.current&&!Pe.current.contains(X.target)&&B(false),ze.current&&!ze.current.contains(X.target)&&C(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let bt=()=>{let F={};return le.name.trim()||(F.name="El nombre es requerido"),le.startDate&&le.endDate&&le.startDate>le.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(F),Object.keys(F).length===0},mt=async F=>{if(F.preventDefault(),!!bt())try{let X=l==="create"&&z.length>0?{...le,pendingFiles:z}:le;await s(X),Oe([]),t();}catch(X){console.error("Error submitting task:",X);}},Ve=(F,X)=>{tt(R=>{let Y={...R,[F]:X};if(F==="status"){let de=X;de==="todo"?Y.progress=0:de==="in-progress"?(R.progress===0||R.progress===100)&&(Y.progress=50):de==="completed"||de==="closed"?Y.progress=100:(de==="in-review"||de==="review")&&(Y.progress=75);}if(F==="progress"){let de=typeof X=="number"?X:parseInt(X,10);de===100&&R.status!=="completed"?Y.status="completed":de>0&&de<100&&R.status==="todo"?Y.status="in-progress":de===0&&R.status!=="todo"&&(Y.status="todo");}return Y}),je[F]&&$e(R=>{let Y={...R};return delete Y[F],Y});},Ie=h.find(F=>F.id===le.status)??pd[0],dt=md.find(F=>F.id===le.priority)??md[1],zt=Do.find(F=>F.value===le.color)??Do[0],Fe=c==="dark",nt={backgroundColor:Fe?"#1d1f27":b.bgSecondary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Fe?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Fe?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:F=>F.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:mt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:le.name,onChange:F=>Ve("name",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),je.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),je.name]}),jsxRuntime.jsx("textarea",{value:le.description||"",onChange:F=>Ve("description",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&v(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...nt,borderColor:Ie.color,backgroundColor:`${Ie.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Ie.color}}),jsxRuntime.jsx("span",{style:{color:Ie.color},children:Ie.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Ie.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(F=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ve("status",F.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,le.status===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsxRuntime.jsx("span",{children:dt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:md.map(F=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ve("priority",F.id),k(false);},children:[jsxRuntime.jsx("span",{children:F.icon}),F.label,le.priority===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&B(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[le.assignees&&le.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:le.assignees.slice(0,3).map((F,X)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:F.color||b.accent,borderColor:b.bgSecondary},children:F.initials},X))}),le.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",le.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(F=>{let X=le.assignees?.some(R=>R.name===F.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=X?(le.assignees||[]).filter(Y=>Y.name!==F.name):[...le.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(Y=>Y[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ve("assignees",R);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},F.id)})})})]}),jsxRuntime.jsxs("div",{ref:ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)C(false);else {if(ze.current){let F=ze.current.getBoundingClientRect(),X=window.innerHeight,R=120,de=X-F.bottom<R?F.top-R-8:F.bottom+8;D({top:de,left:F.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:le.color}}),jsxRuntime.jsx("span",{children:zt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Do.slice(0,18).map(F=>{let X=le.color===F.value;return jsxRuntime.jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),Ve("color",F.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:F.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:X?`2px solid ${F.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},F.value)})})})})]})})]}),d.length>0||m?jsxRuntime.jsx(Xo,{selectedTags:le.tags||[],availableTags:d,onChange:F=>Ve("tags",F),onCreateTag:m,theme:b,disabled:o}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Fe?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:Ze,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(V==="start")$(null);else {if(Ze.current){let F=Ze.current.getBoundingClientRect();W({top:F.bottom+8,left:Math.max(16,F.left-40)});}$("start"),L(le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...nt,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.startDate?le.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(V==="end")$(null);else {if(Ze.current){let F=Ze.current.getBoundingClientRect();W({top:F.bottom+8,left:Math.max(16,F.left-40)});}$("end"),L(le.endDate||le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...nt,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.endDate?le.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Le.top}px`,left:`${Le.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Fe?"#262626":b.border}`},children:[(()=>{let F=new Date,X=new Date(F);X.setDate(F.getDate()+1);let R=new Date(F);R.setDate(F.getDate()+7);let Y=new Date(F);return Y.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:Y}].map((he,Be)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(Ve("startDate",he.date),(!le.endDate||he.date>le.endDate)&&Ve("endDate",he.date),$("end")):(Ve("endDate",he.date),(!le.startDate||he.date<le.startDate)&&Ve("startDate",he.date),$(null));},children:he.label},Be))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ve("startDate",void 0),Ve("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ee.getFullYear(),ee.getMonth()-1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ee.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(ee.getFullYear(),ee.getMonth()+1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((F,X)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:F},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=ee.getFullYear(),X=ee.getMonth(),R=new Date(F,X,1).getDay(),Y=new Date(F,X+1,0).getDate(),de=new Date,he=[];for(let j=R-1;j>=0;j--)he.push({day:new Date(F,X,-j).getDate(),date:new Date(F,X-1,new Date(F,X,-j).getDate()),isCurrentMonth:false});for(let j=1;j<=Y;j++)he.push({day:j,date:new Date(F,X,j),isCurrentMonth:true});let Be=42-he.length;for(let j=1;j<=Be;j++)he.push({day:j,date:new Date(F,X+1,j),isCurrentMonth:false});return he.map((j,ye)=>{let Ae=j.date.toDateString()===de.toDateString(),Ue=le.startDate?.toDateString()===j.date.toDateString(),kt=le.endDate?.toDateString()===j.date.toDateString(),Ye=le.startDate&&le.endDate&&j.date>=le.startDate&&j.date<=le.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:j.isCurrentMonth?Ue||kt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ue?b.accent:kt?"#7C3AED":Ye?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ae&&!Ue&&!kt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(Ve("startDate",j.date),le.endDate&&j.date>le.endDate&&Ve("endDate",j.date),$("end")):(Ve("endDate",j.date),le.startDate&&j.date<le.startDate&&Ve("startDate",j.date),$(null));},children:j.day},ye)})})()})]})]})]})})]}),je.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:je.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[le.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Fe?"#33343c":"#E5E7EB"},onClick:F=>{if(o)return;let X=F.currentTarget.getBoundingClientRect(),R=Math.round((F.clientX-X.left)/X.width*100/5)*5;Ve("progress",Math.max(0,Math.min(100,R)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${le.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>I(!Ce),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Ce?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:le.effortMinutes?zw(le.effortMinutes):"",onChange:F=>{let X=Gw(F.target.value);Ve("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:le.parentId||"",onChange:F=>Ve("parentId",F.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(F=>F.id!==r?.id).map(F=>jsxRuntime.jsx("option",{value:F.id,children:F.name},F.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:le.location||"",onChange:F=>Ve("location",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:le.equipment||"",onChange:F=>Ve("equipment",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(p||u.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?z.length>0&&`(${z.length})`:u.length>0&&`(${u.length})`]})]}),l==="create"?jsxRuntime.jsx(es,{cardId:"pending",attachments:z.map((F,X)=>({id:`pending-${X}`,cardId:"pending",name:F.name,size:F.size,type:F.type,url:URL.createObjectURL(F),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:F=>Oe(X=>[...X,...F]),onDelete:F=>{let X=parseInt(F.replace("pending-",""),10);Oe(R=>R.filter((Y,de)=>de!==X));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(es,{cardId:r?.id||"new",attachments:u,onUpload:p&&r?.id?F=>p(r.id,F):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&z.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[z.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:le.isMilestone,onChange:F=>Ve("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),le.dependencies&&le.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:le.dependencies.map(F=>{let X=a.find(R=>R.id===F);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[X?.name||F.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let R=(le.dependencies||[]).filter(Y=>Y!==F);Ve("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{J(!We),se("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:We&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{J(false),se("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:De,onChange:F=>se(F.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(F=>F.id!==r?.id).filter(F=>De===""||F.name.toLowerCase().includes(De.toLowerCase())).map(F=>{let X=le.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let R=le.dependencies||[],Y;X?Y=R.filter(de=>de!==F.id):Y=[...R,F.id],Ve("dependencies",Y);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${b.accent}10`:"transparent"},onMouseEnter:R=>{X||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=X?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?b.accent:"transparent",borderColor:X?b.accent:b.borderLight},children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:F.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:F.id.slice(0,8)})]})]},F.id)}),a.filter(F=>F.id!==r?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Fe?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:F=>F.currentTarget.style.color=b.textPrimary,onMouseLeave:F=>F.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:F=>!o&&(F.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:F=>!o&&(F.currentTarget.style.filter="brightness(1)"),children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var ig=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
368
+ Task dependencies must flow in one direction only.`);return}let U=q=>q.map(le=>{if(le.id===A){let ge=le.dependencies||[];if(!ge.includes(E.id))return {...le,dependencies:[...ge,E.id]}}return le.subtasks?{...le,subtasks:U(le.subtasks)}:le});Ma.current+=1,ve(q=>U(q)),Qe?.(E.id,A);},[Qe,Nu]),Su=react.useCallback((E,A)=>{let U=q=>q.map(le=>{if(le.id===E&&le.dependencies){let ge=le.dependencies.filter(qe=>qe!==A);return {...le,dependencies:ge}}return le.subtasks?{...le,subtasks:U(le.subtasks)}:le});Ma.current+=1,ve(q=>U(q)),se?.(E,A);},[se]),{startDate:Ln,endDate:Kl}=react.useMemo(()=>{let E=K.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,qe=new Date(ge);qe.setDate(qe.getDate()-30);let Ye=new Date(ge);return Ye.setDate(Ye.getDate()+60),{startDate:qe,endDate:Ye}}let A=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),U=new Date(Math.min(...A.map(ge=>ge.getTime()))),q=new Date(Math.max(...A.map(ge=>ge.getTime()))),le=J==="day"?7:J==="week"?14:30;return U.setDate(U.getDate()-le),q.setDate(q.getDate()+le),{startDate:U,endDate:q}},[K,J]);react.useEffect(()=>{Qt.current?.(Ln,Kl);},[Ln,Kl]);let gb=react.useCallback(async()=>{if(!re.current||!ye.current||!We.current)return;await new Promise(vo=>setTimeout(vo,200));let E=re.current,A=ye.current,U=ke.current||A.querySelector(".gantt-grid-scroll"),q=We.current,le=U?.scrollTop||0,ge=U?.scrollLeft||0,qe=q.scrollTop,Ye=q.scrollLeft,Zt=E.style.overflow,Ht=E.style.height,ar=U?.style.overflow||"",ma=q.style.overflow,$a=A.style.overflow,qn=E.style.width,jo=q.style.width;try{let vo=U?.querySelector(".gantt-taskgrid-content"),xn=q.querySelector("svg"),Jl=xn?.getAttribute("height")?parseInt(xn.getAttribute("height"),10):xn?.getBoundingClientRect().height||0,_o=vo?.scrollHeight||U?.scrollHeight||600,hi=Math.max(Jl,q.scrollHeight),Ms=xn?.getAttribute("width")?parseInt(xn.getAttribute("width"),10):xn?.getBoundingClientRect().width||q.scrollWidth,kb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Ql=Math.max(_o,hi,Jl),Fu=kb+Ql+50,Lu=(U?.offsetWidth||A.offsetWidth||300)+Ms+10;U&&(U.scrollTop=0,U.scrollLeft=0),q.scrollTop=0,q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Fu}px`,E.style.width=`${Lu}px`,A.style.overflow="visible",U&&(U.style.overflow="visible",U.style.height=`${Ql+50}px`),q.style.overflow="visible",q.style.height=`${Ql+50}px`,q.style.width=`${Ms+10}px`,await new Promise(yi=>setTimeout(yi,150));let Cb=await htmlToImage.toPng(E,{backgroundColor:Ee.bgPrimary,pixelRatio:2,width:Lu,height:Fu,skipFonts:!1,filter:yi=>{if(!(yi instanceof Element))return !0;let Au=window.getComputedStyle(yi),Iu=parseInt(Au.zIndex,10);return !(!isNaN(Iu)&&Iu>=50||Au.position==="fixed")}}),Zl=document.createElement("a");Zl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Zl.href=Cb,Zl.click();}finally{E.style.overflow=Zt,E.style.height=Ht,E.style.width=qn,A.style.overflow=$a,U&&(U.style.overflow=ar,U.style.height="",U.scrollTop=le,U.scrollLeft=ge),q.style.overflow=ma,q.style.height="",q.style.width=jo,q.scrollTop=qe,q.scrollLeft=Ye;}d?.("png");},[Ee,d]),fb=react.useCallback(async()=>{await Te.exportToPDF(K),d?.("pdf");},[K,d]),ql=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m});ql.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:m};let bb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let E=new Date,A=le=>String(le).padStart(2,"0"),U=`${E.getFullYear()}-${A(E.getMonth()+1)}-${A(E.getDate())}_${A(E.getHours())}${A(E.getMinutes())}`,q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Te.exportToExcel(K,`${q}_${U}.xlsx`,ql.current),d?.("excel");},[K,m,d,r.onExportExcel]),hb=react.useCallback(()=>{let E=Te.exportToCSV(K),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(A),U.download="gantt-chart.csv",U.click(),URL.revokeObjectURL(U.href),d?.("csv");},[K,d]),yb=react.useCallback(()=>{let E=Te.exportToJSON(K),A=new Blob([E],{type:"application/json;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(A),U.download="gantt-chart.json",U.click(),URL.revokeObjectURL(U.href),d?.("json");},[K,d]),xb=react.useCallback(()=>{Te.exportToMSProject(K,"Gantt Project","project.xml"),d?.("msproject");},[K,d]),vb=E=>{E.preventDefault(),ut(true);},Vo=react.useRef(false),[Yl,Eu]=react.useState(false),Es=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=We.current,A=ye.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let U=()=>{if(Vo.current)return;Vo.current=true;let Ye=E.scrollTop;ce(Ye),A.scrollTop=Ye,requestAnimationFrame(()=>{Vo.current=false;});},q=()=>{if(Vo.current)return;Vo.current=true;let Ye=A.scrollTop;ce(Ye),E.scrollTop=Ye,requestAnimationFrame(()=>{Vo.current=false;});},le=Ye=>{if(de&&A){let Ht=A.parentElement?.getBoundingClientRect()?.left||0,ar=Ye.clientX-Ht,ma=200,$a=Kn+S,qn=window.innerWidth*X,jo=Math.max($a,qn);ar>=ma&&ar<=jo&&fe(ar);}if(Yl&&E){let Zt=Ye.clientX-Es.current.x,Ht=Ye.clientY-Es.current.y;E.scrollLeft=Es.current.scrollLeft-Zt,E.scrollTop=Es.current.scrollTop-Ht;}},ge=()=>{ut(false),Eu(false);},qe=Ye=>{if(Ye.button!==0)return;let Zt=Ye.target;Zt.closest("[data-task-bar]")||Zt.closest("[data-dependency-line]")||Zt.closest("button")||Zt.closest('[role="button"]')||Zt.tagName==="rect"&&Zt.getAttribute("data-clickable")==="true"||(Eu(true),Es.current={x:Ye.clientX,y:Ye.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},Ye.preventDefault());};return E.addEventListener("scroll",U),A.addEventListener("scroll",q),E.addEventListener("mousedown",qe),document.addEventListener("mousemove",le),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",U),A.removeEventListener("scroll",q),E.removeEventListener("mousedown",qe),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ge);}},[de,Yl,Kn]),Pe.current={startDate:Ln,timeScale:J,zoom:he};let Xl=r.onTodayVisibilityChange,Mu=react.useRef(null);react.useEffect(()=>{if(!Xl)return;let E=We.current;if(!E)return;let A=J==="day"?60:J==="week"?20:8,U=()=>{let ge=(new Date().getTime()-Ln.getTime())/(1e3*60*60*24)*A*he,qe=E.scrollLeft,Ye=qe+E.clientWidth,Zt=ge>=qe&&ge<=Ye;Mu.current!==Zt&&(Mu.current=Zt,Xl(Zt));};return U(),E.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{E.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[Xl,Ln,J,he]);let Pu=react.useRef(false),wb=react.useRef(null);return react.useLayoutEffect(()=>{if(Pu.current||K.length===0||!We.current)return;Pu.current=true,wb.current=Ln;let E=We.current,A=new Date,U=J==="day"?60:J==="week"?20:8,q=(A.getTime()-Ln.getTime())/(1e3*60*60*24),le=E.clientWidth,qe=q*U*he-le/2;q>=0&&le>0&&(E.scrollLeft=Math.max(0,qe));},[K.length,Ln,J,he]),jsxRuntime.jsx(os.Provider,{value:Kr,children:jsxRuntime.jsx(nc.Provider,{value:at,children:jsxRuntime.jsxs("div",{ref:re,className:"flex flex-col h-full w-full",style:{backgroundColor:Ee.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Ee.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Ee.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(Ji,{theme:Ee,timeScale:J,onTimeScaleChange:R,zoom:he,onZoomChange:Be,currentTheme:st,onThemeChange:me,rowDensity:Y,onRowDensityChange:ue,showThemeSelector:c,showCreateTaskButton:M&&Re?.canCreateTask!==false&&!Re?.canCreateSubtaskOnly,createTaskLabel:B,onCreateTask:T,taskFilter:Ke,onTaskFilterChange:sa,hideCompleted:Vr,onHideCompletedChange:ea,toolbarRightContent:D,wbsLevel:j,onWbsLevelChange:_n,maxWbsDepth:ir,viewMode:Ct,onViewModeChange:Xe,projectForecast:L,hideForecastHud:Ae,onExportPNG:i?gb:void 0,onExportPDF:i?fb:void 0,onExportExcel:i?bb:void 0,onExportCSV:i?hb:void 0,onExportJSON:i?yb:void 0,onExportMSProject:i?xb:void 0,showCriticalPath:mt,onShowCriticalPathChange:Bt,showDependencies:xr,onShowDependenciesChange:vr,highlightWeekends:Rt,onHighlightWeekendsChange:Gt,showBaseline:Dt,onShowBaselineChange:E=>{E&&Ct!=="oracle"&&Xe("oracle"),!E&&Ct==="oracle"&&Xe("execution");},onCopySnapshotLink:dt,hasDependencies:gt})}),jsxRuntime.jsxs("div",{ref:ye,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:ke,className:"gantt-grid-scroll flex-shrink-0",style:{width:pe,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(el,{tasks:gr,allTasks:rr,theme:Ee,rowHeight:Ur,availableUsers:u,templates:$t,showCriticalPath:mt,onTaskClick:Ce,onTaskSelectionChange:I,selectedTaskId:z,onTaskDblClick:Tu,onTaskContextMenu:ze,onTaskToggle:St,scrollTop:_r,columns:Va,onToggleColumn:Ot,onColumnResize:Kt,onTaskUpdate:xt,onBulkFill:Mr,onTaskIndent:ya,onTaskOutdent:Ca,onTaskMove:qr,onMultiTaskDelete:Fn,onTaskDuplicate:Ss,onTaskCreate:xo,onTaskRename:cb,onCreateSubtask:_l,onOpenTaskModal:Ce?E=>Ce(E):void 0,onDeleteRequest:(E,A)=>H({taskIds:E,taskName:A}),onTaskReparent:pa,scrollContainerRef:ke})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Ee.border,zIndex:15},onMouseDown:vb}),jsxRuntime.jsx("div",{ref:We,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Yl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(il,{tasks:gr,theme:Ee,rowHeight:Ur,timeScale:J,startDate:Ln,endDate:Kl,zoom:he,locale:w,templates:$t,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:Ce,onTaskDblClick:Tu,onTaskContextMenu:pb,onTaskDateChange:ub,onTaskProgressDrag:db,onDependencyCreate:Du,onDependencyDelete:Su,showBaseline:Dt,showCriticalPath:mt,showDependencies:xr,highlightWeekends:Rt,canEditTask:Re?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),ee.task&&jsxRuntime.jsx(ls,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:Ee,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let A=Te.findTaskById(K,E.id)||E,U=A.subtasks&&A.subtasks.length>0,q=Re?.canCreateTask!==false,le=Re?.canDeleteTask!==false;if(U){let Ht=[],ar=Re?.canDuplicateTask!==false;return q&&Ht.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Se?Se(A):_l(A.id);}}),ar&&Ht.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):ve(ma=>Ys(ma,[A.id]).tasks),O({isOpen:false,x:0,y:0,task:null});}}),le&&(Ht.length>0&&Ht.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ht.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),Ht}let ge=Re?.canUpdateTask!==false,qe=Re?.canDuplicateTask!==false,Ye=[];return ge&&Ye.push({id:"edit",label:Kr.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{He?He(A):we(A);}}),q&&Ye.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Se?Se(A):_l(A.id);}}),Ye.length>0&&ge&&Ye.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(Ye.push({id:"markIncomplete",label:Kr.contextMenu?.markIncomplete||"Mark Incomplete",icon:tr.MarkIncomplete,onClick:()=>{Fe?Fe(A):xt(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),Ye.push({id:"setInProgress",label:Kr.contextMenu?.setInProgress||"Set In Progress",icon:tr.SetInProgress,onClick:()=>{Ge?Ge(A):xt(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),Ye.push({id:"markComplete",label:Kr.contextMenu?.markComplete||"Mark Complete",icon:tr.MarkComplete,onClick:()=>{xt(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(qe||ge&&A.startDate&&A.endDate)&&Ye.length>0&&Ye.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),qe&&Ye.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):ve(Ht=>Ys(Ht,[A.id]).tasks),O({isOpen:false,x:0,y:0,task:null});}}),ge&&A.startDate&&A.endDate&&Ye.push({id:"split",label:Kr.contextMenu?.splitTask||"Split Task",icon:tr.Split,onClick:()=>{let Ht=A.startDate.getTime(),ar=A.endDate.getTime(),ma=Ht+(ar-Ht)/2,$a=new Date(ma);mb(A,$a);}}),le&&(Ye.length>0&&Ye.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ye.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:tr.Delete,onClick:()=>{H({taskIds:[A.id],taskName:A.name});}})),Ye})()}),jsxRuntime.jsx(So,{task:te,isOpen:!!te,onClose:()=>we(null),onTaskUpdate:E=>{te&&(xt(te.id,E),we(null));},theme:st==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>H(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ee.bgSecondary,border:`1px solid ${Ee.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ee.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Ee.textPrimary,fontFamily:"Inter, sans-serif"},children:[Kr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Ee.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsx("p",{className:"text-sm leading-relaxed",style:{color:Ee.textSecondary,fontFamily:"Inter, sans-serif"},children:N.taskIds.length>1?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Ee.textPrimary},children:[N.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Ee.textPrimary},children:['"',N.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ee.bgPrimary,borderTop:`1px solid ${Ee.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>H(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ee.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Ee.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Fn(N.taskIds),H(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsxRuntime.jsx(dl,{tasks:K,theme:Ee,config:v,onTasksUpdate:ve,onTaskUpdate:xt,onTaskCreate:E=>{ve(A=>[...A,E]);},onTaskDelete:E=>{Fn([E]);},onDependencyCreate:(E,A)=>{let U=Te.findTaskById(K,E);U&&Du(U,A);},onDependencyDelete:Su})]})})})});function zw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Gw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function ig({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=r?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:m,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:f,defaultStatus:x}){let h=[...md,...i.filter(F=>!md.some(J=>J.id===F.id))],b=it[c]||it.dark,[y,v]=react.useState(false),[w,k]=react.useState(false),[M,B]=react.useState(false),[T,C]=react.useState(false),[P,D]=react.useState({top:0,left:0}),[V,$]=react.useState(null),[Z,L]=react.useState(new Date),[Ae,W]=react.useState({top:0,left:0}),[Ce,I]=react.useState(false),[z,Oe]=react.useState([]),[ze,Q]=react.useState(false),[De,oe]=react.useState(""),He=react.useRef(null),Se=react.useRef(null),Fe=react.useRef(null),Ge=react.useRef(null),Qe=react.useRef(null),[se,Ze]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[_e,$e]=react.useState({});react.useEffect(()=>{r?(Ze({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&I(true)):(Ze({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),I(false),Oe([]));},[r,e,x]),react.useEffect(()=>{let F=J=>{He.current&&!He.current.contains(J.target)&&v(false),Se.current&&!Se.current.contains(J.target)&&k(false),Fe.current&&!Fe.current.contains(J.target)&&B(false),Ge.current&&!Ge.current.contains(J.target)&&C(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let ft=()=>{let F={};return se.name.trim()||(F.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(F),Object.keys(F).length===0},pt=async F=>{if(F.preventDefault(),!!ft())try{let J=l==="create"&&z.length>0?{...se,pendingFiles:z}:se;await s(J),Oe([]),t();}catch(J){console.error("Error submitting task:",J);}},je=(F,J)=>{Ze(R=>{let Y={...R,[F]:J};if(F==="status"){let ue=J;ue==="todo"?Y.progress=0:ue==="in-progress"?(R.progress===0||R.progress===100)&&(Y.progress=50):ue==="completed"||ue==="closed"?Y.progress=100:(ue==="in-review"||ue==="review")&&(Y.progress=75);}if(F==="progress"){let ue=typeof J=="number"?J:parseInt(J,10);ue===100&&R.status!=="completed"?Y.status="completed":ue>0&&ue<100&&R.status==="todo"?Y.status="in-progress":ue===0&&R.status!=="todo"&&(Y.status="todo");}return Y}),_e[F]&&$e(R=>{let Y={...R};return delete Y[F],Y});},Re=h.find(F=>F.id===se.status)??md[0],dt=gd.find(F=>F.id===se.priority)??gd[1],zt=Do.find(F=>F.value===se.color)??Do[0],Le=c==="dark",st={backgroundColor:Le?"#1d1f27":b.bgSecondary,border:`1px solid ${Le?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Le?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Le?"#0a0a0a":b.bgPrimary,border:`1px solid ${Le?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Le?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:F=>F.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:pt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:se.name,onChange:F=>je("name",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),_e.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),_e.name]}),jsxRuntime.jsx("textarea",{value:se.description||"",onChange:F=>je("description",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&v(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...st,borderColor:Re.color,backgroundColor:`${Re.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Re.color}}),jsxRuntime.jsx("span",{style:{color:Re.color},children:Re.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Re.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Le?"#0a0a0a":b.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(F=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("status",F.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,se.status===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),jsxRuntime.jsxs("div",{ref:Se,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsxRuntime.jsx("span",{children:dt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Le?"#0a0a0a":b.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(F=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("priority",F.id),k(false);},children:[jsxRuntime.jsx("span",{children:F.icon}),F.label,se.priority===F.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:Fe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&B(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[se.assignees&&se.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:se.assignees.slice(0,3).map((F,J)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:F.color||b.accent,borderColor:b.bgSecondary},children:F.initials},J))}),se.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",se.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Le?"#0a0a0a":b.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(F=>{let J=se.assignees?.some(R=>R.name===F.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=J?(se.assignees||[]).filter(Y=>Y.name!==F.name):[...se.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(Y=>Y[0]).join("").toUpperCase().slice(0,2),color:b.accent}];je("assignees",R);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:F.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},F.id)})})})]}),jsxRuntime.jsxs("div",{ref:Ge,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)C(false);else {if(Ge.current){let F=Ge.current.getBoundingClientRect(),J=window.innerHeight,R=120,ue=J-F.bottom<R?F.top-R-8:F.bottom+8;D({top:ue,left:F.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:st,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsxRuntime.jsx("span",{children:zt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Le?"#0a0a0a":b.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Do.slice(0,18).map(F=>{let J=se.color===F.value;return jsxRuntime.jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),je("color",F.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:F.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:J?`2px solid ${F.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},F.value)})})})})]})})]}),d.length>0||m?jsxRuntime.jsx(Xo,{selectedTags:se.tags||[],availableTags:d,onChange:F=>je("tags",F),onCreateTag:m,theme:b,disabled:o}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Le?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Le?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxRuntime.jsxs("div",{ref:Qe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="start")$(null);else {if(Qe.current){let F=Qe.current.getBoundingClientRect();W({top:F.bottom+8,left:Math.max(16,F.left-40)});}$("start"),L(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.startDate?se.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="end")$(null);else {if(Qe.current){let F=Qe.current.getBoundingClientRect();W({top:F.bottom+8,left:Math.max(16,F.left-40)});}$("end"),L(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...st,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.endDate?se.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Ae.top}px`,left:`${Ae.left}px`,zIndex:99999,backgroundColor:Le?"#0a0a0a":b.bgPrimary,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:F=>F.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Le?"#262626":b.border}`},children:[(()=>{let F=new Date,J=new Date(F);J.setDate(F.getDate()+1);let R=new Date(F);R.setDate(F.getDate()+7);let Y=new Date(F);return Y.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:Y}].map((he,Be)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(je("startDate",he.date),(!se.endDate||he.date>se.endDate)&&je("endDate",he.date),$("end")):(je("endDate",he.date),(!se.startDate||he.date<se.startDate)&&je("startDate",he.date),$(null));},children:he.label},Be))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("startDate",void 0),je("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(Z.getFullYear(),Z.getMonth()-1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Z.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(Z.getFullYear(),Z.getMonth()+1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((F,J)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:F},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=Z.getFullYear(),J=Z.getMonth(),R=new Date(F,J,1).getDay(),Y=new Date(F,J+1,0).getDate(),ue=new Date,he=[];for(let j=R-1;j>=0;j--)he.push({day:new Date(F,J,-j).getDate(),date:new Date(F,J-1,new Date(F,J,-j).getDate()),isCurrentMonth:false});for(let j=1;j<=Y;j++)he.push({day:j,date:new Date(F,J,j),isCurrentMonth:true});let Be=42-he.length;for(let j=1;j<=Be;j++)he.push({day:j,date:new Date(F,J+1,j),isCurrentMonth:false});return he.map((j,xe)=>{let Ie=j.date.toDateString()===ue.toDateString(),Ue=se.startDate?.toDateString()===j.date.toDateString(),Ct=se.endDate?.toDateString()===j.date.toDateString(),Xe=se.startDate&&se.endDate&&j.date>=se.startDate&&j.date<=se.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:j.isCurrentMonth?Ue||Ct?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Ue?b.accent:Ct?"#7C3AED":Xe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ie&&!Ue&&!Ct?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(je("startDate",j.date),se.endDate&&j.date>se.endDate&&je("endDate",j.date),$("end")):(je("endDate",j.date),se.startDate&&j.date<se.startDate&&je("startDate",j.date),$(null));},children:j.day},xe)})})()})]})]})]})})]}),_e.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:_e.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[se.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Le?"#33343c":"#E5E7EB"},onClick:F=>{if(o)return;let J=F.currentTarget.getBoundingClientRect(),R=Math.round((F.clientX-J.left)/J.width*100/5)*5;je("progress",Math.max(0,Math.min(100,R)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${se.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Le?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>I(!Ce),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Ce?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:se.effortMinutes?zw(se.effortMinutes):"",onChange:F=>{let J=Gw(F.target.value);je("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:se.parentId||"",onChange:F=>je("parentId",F.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(F=>F.id!==r?.id).map(F=>jsxRuntime.jsx("option",{value:F.id,children:F.name},F.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:se.location||"",onChange:F=>je("location",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:se.equipment||"",onChange:F=>je("equipment",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(p||u.length>0||l==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?z.length>0&&`(${z.length})`:u.length>0&&`(${u.length})`]})]}),l==="create"?jsxRuntime.jsx(es,{cardId:"pending",attachments:z.map((F,J)=>({id:`pending-${J}`,cardId:"pending",name:F.name,size:F.size,type:F.type,url:URL.createObjectURL(F),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:F=>Oe(J=>[...J,...F]),onDelete:F=>{let J=parseInt(F.replace("pending-",""),10);Oe(R=>R.filter((Y,ue)=>ue!==J));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(es,{cardId:r?.id||"new",attachments:u,onUpload:p&&r?.id?F=>p(r.id,F):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&z.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[z.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:F=>je("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),se.dependencies&&se.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:se.dependencies.map(F=>{let J=a.find(R=>R.id===F);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[J?.name||F.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let R=(se.dependencies||[]).filter(Y=>Y!==F);je("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},F)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{Q(!ze),oe("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Q(false),oe("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Le?"#0a0a0a":b.bgPrimary,backdropFilter:Le?"blur(16px)":void 0,border:`1px solid ${Le?"#262626":b.border}`,boxShadow:Le?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsxRuntime.jsx("input",{type:"text",value:De,onChange:F=>oe(F.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(F=>F.id!==r?.id).filter(F=>De===""||F.name.toLowerCase().includes(De.toLowerCase())).map(F=>{let J=se.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let R=se.dependencies||[],Y;J?Y=R.filter(ue=>ue!==F.id):Y=[...R,F.id],je("dependencies",Y);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${b.accent}10`:"transparent"},onMouseEnter:R=>{J||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=J?`${b.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?b.accent:"transparent",borderColor:J?b.accent:b.borderLight},children:J&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:F.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:F.id.slice(0,8)})]})]},F.id)}),a.filter(F=>F.id!==r?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Le?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Le?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:F=>F.currentTarget.style.color=b.textPrimary,onMouseLeave:F=>F.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:F=>!o&&(F.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:F=>!o&&(F.currentTarget.style.filter="brightness(1)"),children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var lg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -406,40 +406,40 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
406
406
 
407
407
  Always try to match task names case-insensitively and handle partial matches.
408
408
  If you can't find a task by name, search through the provided task list.
409
- If ambiguous, ask for clarification in the message field.`;function lg(e){return `CURRENT TASKS:
410
- ${cg(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",s=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",o=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${s}, ${a.progress}%, ${a.status||"todo"}) ${o}`}).join(`
409
+ If ambiguous, ask for clarification in the message field.`;function cg(e){return `CURRENT TASKS:
410
+ ${dg(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",s=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",o=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${s}, ${a.progress}%, ${a.status||"todo"}) ${o}`}).join(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function cg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=cg(e),a=t.toLowerCase().trim(),n=r.find(l=>l.name.toLowerCase()===a);if(n)return n;let s=r.find(l=>l.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function gd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let p={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(p!==void 0){let f=new Date(a),x=f.getDay(),h=p-x;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let l=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),p=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,p,u)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function fd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function bd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function dg(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function ug(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=gd(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=fd(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),m=Un(t,i),u=bd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),d=l[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function pg(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Vw(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 jw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function pl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>pl(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},l=o(e.startDate),c=o(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:Vw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function mg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.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:jw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function gg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>pl(a,e,t))}var hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},yd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},ml={en:hd,es:yd};function xd(e){return ml[e]||ml.en}function gl(e,t){let r=xd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var vd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function fg(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function bg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=fg(e),i=vd[0],d=vd.find(p=>p.value===c)??i,m=d.icon,u=p=>{switch(fg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:vd.map(p=>{let f=p.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var wd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function yg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let d=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let c=wd.find(d=>d.value===e)??wd[4],i=a==="es"?"es":"en";return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:wd.map(d=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function ti(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function kd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function hl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),p=x=>e.some(h=>h.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ti(x.name),color:x.color||kd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,h]);}l(false),i("");}};return s||!r?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ti(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&kd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ti(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:m,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ti(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(y=>y.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let h=p(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ti(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Tg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,d]=react.useState(false),[m,u]=react.useState(n),[p,f]=react.useState(()=>{let D=n==="start"?e:t;if(D){let V=D instanceof Date?D:new Date(D);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,v]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=V=>{let $=V.target;x.current&&x.current.contains($)||b.current&&b.current.contains($)||d(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let D=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let $=520,ee=360,L=window.innerHeight-V.bottom,Le=L<ee&&V.top>L,W=Le?V.top-4:V.bottom+4,Ce=Math.min(Math.max(V.left,8),window.innerWidth-$-8);v({top:W,left:Ce,flipUp:Le});};return D(),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}},[i]),react.useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let M=D=>D?D.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",B=react.useCallback(()=>{let D=p.getFullYear(),V=p.getMonth(),$=new Date(D,V,1),L=new Date(D,V+1,0).getDate(),Le=$.getDay(),W=[],I=new Date(D,V,0).getDate();for(let Oe=Le-1;Oe>=0;Oe--)W.push({date:new Date(D,V-1,I-Oe),isCurrentMonth:false});for(let Oe=1;Oe<=L;Oe++)W.push({date:new Date(D,V,Oe),isCurrentMonth:true});let z=42-W.length;for(let Oe=1;Oe<=z;Oe++)W.push({date:new Date(D,V+1,Oe),isCurrentMonth:false});return W},[p]),T=D=>{if(a)n==="start"?r(D,k||void 0):r(w||void 0,D),d(false);else if(m==="start"){let V=k&&D>k?D:k;r(D,V||void 0),u("end");}else {let V=w&&D<w?D:w;r(V||void 0,D),d(false);}},C=()=>{let D=new Date,V=new Date(D);V.setDate(D.getDate()+1);let $=new Date(D);$.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let ee=new Date(D);ee.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let L=new Date(D);L.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Le=new Date(D);Le.setDate(D.getDate()+14);let W=new Date(D);return W.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ee,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Le,display:Le.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(D)})]})}let P=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,onClick:D=>{D.stopPropagation(),d(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,V)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},V)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,k||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!a&&jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:B().map((D,V)=>{let $=D.date.toDateString()===new Date().toDateString(),ee=w?.toDateString()===D.date.toDateString(),L=k?.toDateString()===D.date.toDateString(),Le=ee||L,W=!a&&w&&k&&D.date>=w&&D.date<=k;return jsxRuntime.jsx("button",{onClick:()=>T(new Date(D.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),$&&"ring-2 ring-[#00E5CC]",ee&&"bg-[#00E5CC] text-white",L&&!ee&&"bg-[#7C3AED] text-white",W&&!Le&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Le&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},V)})})]})]}),document.body)]})}function xl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Tg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function bs(e=600){let[t,r]=react.useState(false),a=react.useRef(null),n=react.useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return react.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function vl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),d=react.useRef([]);return react.useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;c(true);for(let x=1;x<=n;x++){let h=setTimeout(()=>{let b=x/n,y=1-Math.pow(1-b,3),v=Math.round(m+p*y);o(v),x===n&&(c(false),o(u));},f*x);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Ng(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=react.useState(null),[o,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),d=react.useCallback(p=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(p),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,h=Math.min(x/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),l(0);},r);},[r,e]),m=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),a?.();},[a]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function Sg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),{isFlashing:m,triggerFlash:u}=bs(),{displayValue:p,isAnimating:f}=vl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,B=Math.round(M/k.width*100),T=Math.max(0,Math.min(100,B));T!==e&&(t(T),s&&u());},h=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);react.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=react.useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&u());}},[c,t,e,s,u]),y=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),v=p??e;return jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),o?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:d,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Pg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let d=()=>{l!==e&&t?.(l),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(c(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:u=>c(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Ag({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,d]=react.useState(false),[m,u]=react.useState(e?.toString()||""),p=react.useRef(null),{isFlashing:f,triggerFlash:x}=bs(),{displayValue:h,isAnimating:b}=vl(e,{enabled:l&&!i});react.useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(m);if(!isNaN(w)){let k=w;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&x());}d(false);},v=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsxRuntime.jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function Ig({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),l(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Bg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:d}=Ng(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?l?d():i(!e):t(!e));},u=l?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&u&&"ring-green-500/50",l&&!u&&"ring-red-500/50",l&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function $g({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&i(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let m=e.slice(0,l),u=e.length-m.length,p=e.length===0?n:m.join(", ")+(u>0?` +${u}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:p});let f=h=>{let b=e.includes(h),y=b?e.filter(v=>v!==h):[...e,h];!b&&o!=null&&e.length>=o||r(y);},x=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:p}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),c&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let b=e.includes(h),y=!b&&x;return jsxRuntime.jsxs("button",{disabled:y,onClick:v=>{v.stopPropagation(),f(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",y?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:h}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Lk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function Ug({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Lk(e);if(n.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return a?jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(s);},title:n.map(c=>c.name).join(`
414
- `),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:l})]}):jsxRuntime.jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function Gg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxRuntime.jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let l=parseFloat(a[1]),c=a[2]?parseInt(a[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=react.useState(false),[p,f]=react.useState(""),x=react.useRef(null),{isFlashing:h,triggerFlash:b}=bs(),y=c==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);react.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),C=e%60;T>0&&C>0?f(`${T}h ${C}m`):T>0?f(`${T}h`):f(`${C}m`);}else f("");},[e,m]);let k=()=>{let T=Bk(p);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let B=y?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsxRuntime.jsx("input",{ref:x,type:"text",value:p,onChange:T=>f(T.target.value),onBlur:k,onKeyDown:M,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function Kg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(r==null)return null;let c=n==="es";return r===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):r>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Yg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=r==="es",d=l==="financial"&&c>0,m=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,p]=react.useState(false),[f,x]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(v/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?v/w*100:0,C=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(x(false),b(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,h]);let D=W=>{if(W.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{x(false),b(W);},$=async(W,Ce)=>{h==="log"&&a&&W?a(e,W,Ce):h==="estimate"&&n?n(e,W):h==="quoted"&&s&&s(e,W),b(null);},ee=a||n||s||o,L=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Le=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&v===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ee&&jsxRuntime.jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(W=>jsxRuntime.jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Le||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let W=v===0,I=(w>0?v/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(B)]}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:I?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:I?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(C)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsxRuntime.jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(W=>jsxRuntime.jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Le||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Xg({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Jg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsxRuntime.jsx(Xg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?Vk(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Xg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Zg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function s0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?r0.es:r0.en,[v,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let C=b.current;if(!C)return;let P=C.getBoundingClientRect(),D=8,V=e.x,$=e.y;e.y+P.height>window.innerHeight-D&&($=Math.max(D,e.y-P.height)),e.x+P.width>window.innerWidth-D&&(V=Math.max(D,window.innerWidth-P.width-D)),(V!==e.x||$!==e.y)&&w({left:V,top:$});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let C=D=>{b.current&&!b.current.contains(D.target)&&t();},P=D=>{D.key==="Escape"&&t();};return document.addEventListener("mousedown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let C=[];return n&&C.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),C.push({id:"sep1",label:"",icon:null,separator:true}),l&&(C.push({id:"status",label:y.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),C.push({id:"priority",label:y.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),d.length>0&&C.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let D=e.task.assignees||[],$=D.some(ee=>ee.name===P.name)?D.filter(ee=>ee.name!==P.name):[...D,{name:P.name,initials:s1(P.name),color:P.color||i1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),m&&C.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&C.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&C.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),C},M=()=>{if(!e.columnId)return [];let C=[];return i&&(C.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(C.push({id:"sep-hide",label:"",icon:null,separator:true}),C.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:B.map(C=>C.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsxRuntime.jsx(l1,{item:C,isDark:r},C.id):jsxRuntime.jsxs("button",{onClick:C.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",C.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function l1({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var r0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var g0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"}),multiselect:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),person:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),file:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function b0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=react.useState(""),[m,u]=react.useState(null),[p,f]=react.useState(null),x=react.useRef(null),h=c==="es"?f0.es:f0.en;react.useLayoutEffect(()=>{if(!e||!x.current)return;let C=()=>{if(!x.current)return;let P=x.current.parentElement;if(P){let ee=P.getBoundingClientRect();f({top:ee.bottom+4,right:window.innerWidth-ee.right});}let D=x.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),react.useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{x.current&&!x.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),x._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),x._cleanup&&x._cleanup();}},[e,t]);let b=react.useMemo(()=>{let C=new Set([...N1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&C.add(P.type);}),Array.from(C)},[r]);if(!e)return null;let y=C=>{let P=h.columns[C];if(P)return P;let D=r.find(V=>V.type===C);return D?.label?D.label:C},v=C=>{if(C==="name")return;let P=r.map(D=>D.id===C?{...D,visible:!D.visible}:D);n(P);},w=(C,P)=>{let D=r.find($=>$.type===C&&(!P||$.customFieldId===P));if(D){v(D.id);return}let V={id:P||C,type:C,label:P?a.find($=>$.id===P)?.name||C:y(C),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(C=>C!=="assignees"&&(o||!k.includes(C))&&y(C).toLowerCase().includes(i.toLowerCase())),B=a.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),T=l?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:x,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",C.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color=l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:i,onChange:C=>d(C.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:C=>{C&&C.style.setProperty("--focus-border",T);},onFocus:C=>{C.currentTarget.style.borderColor=T,C.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:C=>{C.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",C.currentTarget.style.background=l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:M.map(C=>{let P=r.find($=>$.type===C&&!$.customFieldId),D=P?.visible??false,V=C==="name";return jsxRuntime.jsxs("button",{onClick:()=>{V||(P?v(P.id):w(C));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:g0[C]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(C),children:y(C)})]},C)})})]}),B.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(C.type,C.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:g0[C.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:C.name})]},C.id)})})]})]})]})}var f0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var I1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function x0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,d]=react.useState([""]),m=n==="es"?y0.es:y0.en;react.useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var y0={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var k0={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function C0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),d=s==="es"?k0.es:k0.en;react.useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(p.value),a(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function T0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function mo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function N0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxRuntime.jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsxRuntime.jsx("button",{onClick:a,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=c-d,u=c>0?Math.round(m/c*100):0,p=c-i,f=c>0?Math.round(p/c*100):0,x=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=v>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:mo(i)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=v>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:mo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:mo(d)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[p>=0?"+":"",mo(p),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsxRuntime.jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxRuntime.jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${mo(m)} ${o?"disponible (caja)":"available (cash)"}`:`${mo(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(c/i*100),100):0,p=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:T0(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:T0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxRuntime.jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,d=c<0,m=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let d=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var X1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function A0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...A0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ks(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ks(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ws(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function F0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,r+=c,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let d=i.effort_minutes||60;l+=(i.progress||0)*d,c+=d;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function Wd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Wd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function I0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:B=true,showCreateTaskButton:T=false,onCreateTask:C,persistFilter:P=false,financialBlur:D,healthSidebar:V,lens:$="hours",hourlyRate:ee=0,rateMap:L,aggregateParentHours:Le=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,I=gl(f,x),z=p==="dark",Oe=S=>{if(!L||!S.assignees||S.assignees.length===0)return ee;let Q=0,pe=0;for(let xe of S.assignees){let Xe=xe.id?L[xe.id]:void 0;if(Xe==null||Xe<=0)continue;let te=typeof xe.estimatedMinutes=="number"?xe.estimatedMinutes:0;te>0&&(Q+=Xe*te,pe+=te);}if(pe>0)return Q/pe;let ke=S.assignees.map(xe=>xe.id?L[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return ke.length===0?ee:ke.reduce((xe,Xe)=>xe+Xe,0)/ke.length},We=S=>{let Q=0,pe=0,ke=0,xe=Xe=>{for(let te of Xe)if(te.subtasks&&te.subtasks.length>0){let Ee={s:Q,a:pe,q:ke};if(xe(te.subtasks),Q-Ee.s+(pe-Ee.a)+(ke-Ee.q)===0){let Re=Oe(te);Q+=(te.timeLoggedMinutes??0)/60*Re,pe+=(te.effortMinutes??0)/60*Re,ke+=(te.soldEffortMinutes??0)/60*Re;}}else {let Ee=Oe(te);Q+=(te.timeLoggedMinutes??0)/60*Ee,pe+=(te.effortMinutes??0)/60*Ee,ke+=(te.soldEffortMinutes??0)/60*Ee;}};return S.subtasks&&xe(S.subtasks),{dollarSpent:Q,dollarAllocated:pe,dollarQuoted:ke}},J=react.useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let Q=JSON.parse(S);return {statusFilter:Q.statusFilter||"all",hideCompleted:Q.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),De=react.useMemo(()=>{function S(Q){let pe=0,ke=0,xe=0,Xe=0,te=0,Ee=0;for(let Je of Q)if(Je.subtasks&&Je.subtasks.length>0){let Re=S(Je.subtasks);if(Re.spent+Re.allocated+Re.quoted>0)pe+=Re.spent,ke+=Re.allocated,xe+=Re.quoted,Xe+=Re.dollarSpent,te+=Re.dollarAllocated,Ee+=Re.dollarQuoted;else {let ut=Je.timeLoggedMinutes??0,pt=Je.effortMinutes??0,fr=Je.soldEffortMinutes??0;pe+=ut,ke+=pt,xe+=fr;let cr=Oe(Je);Xe+=ut/60*cr,te+=pt/60*cr,Ee+=fr/60*cr;}}else {let Re=Je.timeLoggedMinutes??0,Ut=Je.effortMinutes??0,ut=Je.soldEffortMinutes??0;pe+=Re,ke+=Ut,xe+=ut;let pt=Oe(Je);Xe+=Re/60*pt,te+=Ut/60*pt,Ee+=ut/60*pt;}return {spent:pe,allocated:ke,quoted:xe,dollarSpent:Xe,dollarAllocated:te,dollarQuoted:Ee}}return S(e)},[e]),se=react.useMemo(()=>{let S=new Map;function Q(pe){let ke=0;for(let xe of pe)if(xe.subtasks&&xe.subtasks.length>0){let Xe=Q(xe.subtasks);S.set(xe.id,Xe),ke+=Xe;}else ke+=xe.weight||0;return ke}return Q(e),S},[e]),He=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Pe]=react.useState(true),[ze,Ze]=react.useState(null),[le,tt]=react.useState("position"),[je,$e]=react.useState("asc"),[bt,mt]=react.useState(""),[Ve,Ie]=react.useState(()=>J().statusFilter),[dt,zt]=react.useState(()=>J().hideCompleted),[Fe,nt]=react.useState(y||X1),[F,X]=react.useState(false),[R,Y]=react.useState(false),[de,he]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=react.useState(null),[ye,Ae]=react.useState(false),[Ue,kt]=react.useState(null),[Ye,Nt]=react.useState(null),[gt,Jt]=react.useState(null),vr=react.useRef(0),Mr=react.useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,$t]=react.useState(null),[wr,Gt]=react.useState(null),Qt=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,Vr=react.useRef([]),wa=react.useCallback((S,Q)=>{Rt&&(Q.preventDefault(),vr.current=Q.clientY,j(S),Mr.current=false,Ae(false),Jt({x:Q.clientX,y:Q.clientY}));},[Rt]),et=react.useCallback(S=>{if(!Be||(Math.abs(S.clientY-vr.current)>5&&!Mr.current&&(Mr.current=true,Ae(true)),Jt({x:S.clientX,y:S.clientY}),!Mr.current))return;let pe=document.querySelectorAll("[data-listview-row]"),ke=null,xe=null;pe.forEach(Xe=>{let te=Xe.getBoundingClientRect(),Ee=Xe.getAttribute("data-listview-row");if(Ee&&Ee!==Be&&S.clientY>=te.top&&S.clientY<=te.bottom){ke=Ee;let Je=S.clientY-te.top,Re=te.height;xe=Je<Re*.25?"above":Je>Re*.75?"below":"child";}}),kt(ke),Nt(xe);},[Be]),_e=react.useCallback(()=>{if(Mr.current&&Be&&Ue&&Ye){if(Ye==="child"&&r.onTaskReparent)r.onTaskReparent(Be,Ue);else if(Ye==="above"||Ye==="below"){let S=(ke,xe,Xe=null)=>{for(let te of ke){if(te.id===xe)return Xe;if(te.subtasks){let Ee=S(te.subtasks,xe,te.id);if(Ee!==void 0)return Ee}}},Q=S(e,Be,null),pe=S(e,Ue,null);if(r.onTaskReparent){let ke=(Re,Ut)=>{if(Ut===null)return Re;for(let ut of Re){if(ut.id===Ut)return ut.subtasks||[];if(ut.subtasks){let pt=ke(ut.subtasks,Ut);if(pt.length>0||ut.subtasks.some(fr=>fr.id===Ut))return pt}}return []},xe=ke(e,pe??null),Xe=xe.findIndex(Re=>Re.id===Ue),te=Q===pe,Ee=te?xe.findIndex(Re=>Re.id===Be):-1,Je=Ye==="below"?Xe+1:Xe;te&&Ee!==-1&&Ee<Xe&&(Je-=1),r.onTaskReparent(Be,pe??null,Math.max(0,Je));}}}j(null),kt(null),Nt(null),Jt(null),Mr.current=false,Ae(false);},[Be,Ue,Ye,e,r]),fa=(S,Q)=>Q==="assignees"?S.assignees:Q==="startDate"?S.startDate:S.endDate,jr=(S,Q,pe,ke)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let xe=Array.from(document.querySelectorAll("[data-listview-row]")),Xe=xe.map(Dt=>Dt.getAttribute("data-listview-row")||""),te=Math.max(0,Xe.indexOf(Q)),Ee=Dt=>Xe.slice(te,Dt+1);Gt({sourceTaskId:Q,column:pe,sourceIndex:ke,targetIndex:ke,rangeIds:new Set([Q])});let Re=(Dt=>{let Pt=Dt?.parentElement??null;for(;Pt;){let ka=window.getComputedStyle(Pt).overflowY;if((ka==="auto"||ka==="scroll")&&Pt.scrollHeight>Pt.clientHeight)return Pt;Pt=Pt.parentElement;}let Zt=document.scrollingElement;return Zt&&Zt.scrollHeight>Zt.clientHeight?Zt:null})(S.currentTarget),Ut=Dt=>{let Pt=te,Zt=false;xe.forEach((ka,ua)=>{let qr=ka.getBoundingClientRect();Dt>=qr.top&&Dt<=qr.bottom&&(Pt=ua,Zt=true);});let ba=xe[xe.length-1];if(!Zt&&ba){let ka=ba.getBoundingClientRect();Dt>ka.bottom&&(Pt=xe.length-1);}return Pt<te&&(Pt=te),Pt},ut=S.clientY,pt=null,fr=()=>{pt!==null&&(cancelAnimationFrame(pt),pt=null);},cr=()=>{let Dt=Ut(ut),Pt=new Set(Ee(Dt));Gt(Zt=>Zt&&{...Zt,targetIndex:Dt,rangeIds:Pt});},ea=()=>{if(fr(),!Re)return;let Dt=Re,Zt=Dt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Dt.getBoundingClientRect(),ba=60,ka=12,ua=ut-Zt.top,qr=Zt.bottom-ut,ho=Dt.scrollHeight-Dt.clientHeight;if(qr<ba&&Dt.scrollTop<ho){let yo=Math.max(1,Math.round(ka*(1-Math.max(0,qr)/ba))),xo=()=>{Dt.scrollTop+=yo,cr(),Dt.scrollTop<Dt.scrollHeight-Dt.clientHeight&&(pt=requestAnimationFrame(xo));};pt=requestAnimationFrame(xo);}else if(ua<ba&&Dt.scrollTop>0){let yo=Math.max(1,Math.round(ka*(1-Math.max(0,ua)/ba))),xo=()=>{Dt.scrollTop-=yo,cr(),Dt.scrollTop>0&&(pt=requestAnimationFrame(xo));};pt=requestAnimationFrame(xo);}},Mt=Dt=>{ut=Dt.clientY,cr(),ea();},Kt=Dt=>{window.removeEventListener("mousemove",Mt),window.removeEventListener("mouseup",Kt),fr(),document.body.style.cursor="",document.body.style.userSelect="",Gt(null);let Pt=Ut(Dt.clientY),Zt=new Map(Vr.current.map(qr=>[qr.id,qr])),ba=Zt.get(Q);if(!ba)return;let ka=fa(ba,pe),ua=[];for(let qr of Ee(Pt)){if(qr===Q)continue;let ho=Zt.get(qr);ho&&(ho.subtasks&&ho.subtasks.length>0||ua.push(qr));}ua.length>0&&r.onBulkFill?.(ua,pe,ka);};window.addEventListener("mousemove",Mt),window.addEventListener("mouseup",Kt);},Zr=S=>wr?wr.rangeIds.has(S):false;react.useEffect(()=>{if(Be)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",_e),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",_e),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,et,_e]);let[lr,Ba]=react.useState("all"),[ne,ue]=react.useState(false),ft=react.useRef(null),_=react.useRef(null),fe=react.useMemo(()=>{let S=0;function Q(pe,ke){for(let xe of pe)ke>S&&(S=ke),xe.subtasks?.length&&Q(xe.subtasks,ke+1);}return Q(e,1),S},[e]);react.useEffect(()=>{if(!ne)return;let S=Q=>{ft.current?.contains(Q.target)||_.current?.contains(Q.target)||ue(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[ne]),react.useEffect(()=>{if(lr==="all"){let pe=function(ke){for(let xe of ke)xe.subtasks?.length&&(xe.isExpanded===false&&r.onTaskToggleExpand?.(xe.id),pe(xe.subtasks));};pe(e);}else {let pe=function(ke,xe){for(let Xe of ke)if(Xe.subtasks?.length){let te=xe<lr,Ee=Xe.isExpanded!==false;te!==Ee&&r.onTaskToggleExpand?.(Xe.id),pe(Xe.subtasks,xe+1);}};pe(e,1);}},[lr]);let[Z,O]=react.useState(null),[re,ve]=react.useState(0),[N,H]=react.useState(0),me=react.useRef(null),[K,we]=react.useState(null),[ot,ae]=react.useState(null);react.useEffect(()=>{y&&nt(S=>{if(S.length===y.length){let Q=true;for(let pe=0;pe<S.length;pe++){let ke=S[pe],xe=y[pe];if(!ke||!xe||ke.id!==xe.id||ke.visible!==xe.visible||ke.width!==xe.width||ke.label!==xe.label){Q=false;break}}if(Q)return S}return y});},[y]),react.useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Ve,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,Ve,dt]);let lt=react.useMemo(()=>{let S=new Set;function Q(pe){for(let ke of pe)ke.subtasks?.length&&(ke.isExpanded!==false&&S.add(ke.id),Q(ke.subtasks));}return Q(e),S},[e]),st=react.useMemo(()=>Fe.filter(S=>S.visible),[Fe]),Bt=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),gr=react.useCallback(S=>{le===S?$e(Q=>Q==="asc"?"desc":"asc"):(tt(S),$e("asc")),r.onSortChange?.({column:S,direction:je==="asc"?"desc":"asc"});},[le,je,r]),_r=react.useCallback(S=>{nt(S),r.onColumnsChange?.(S);},[r]),Ur=react.useCallback(S=>{let Q=Fe.map(pe=>pe.id===S?{...pe,visible:false}:pe);_r(Q);},[Fe,_r]),en=react.useCallback((S,Q)=>{tt(S),$e(Q);},[]),ar=react.useCallback((S,Q,pe)=>{B&&(S.preventDefault(),he({isOpen:true,x:S.clientX,y:S.clientY,type:Q?"task":"header",task:Q,columnId:pe}));},[B]),$a=react.useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),zo=react.useCallback((S,Q)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let pe=Fe.find(ke=>ke.id===Q);pe&&(O(Q),ve(S.clientX),H(pe.width));},[Fe,M]);react.useEffect(()=>{if(!Z)return;let S=Fe,Q=ke=>{let xe=ke.clientX-re,Xe=Math.max(50,N+xe);S=S.map(te=>te.id===Z?{...te,width:Xe}:te),nt(S);},pe=()=>{r.onColumnsChange?.(S),O(null);};return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",pe);}},[Z,re,N,r]);let Pn=react.useCallback((S,Q)=>{if(Q==="name"){S.preventDefault();return}we(Q),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Q),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),_n=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),we(null),ae(null);},[]),Go=react.useCallback((S,Q)=>{S.preventDefault(),Q!=="name"&&(S.dataTransfer.dropEffect="move",ae(Q));},[]),fi=react.useCallback(()=>{ae(null);},[]),Kr=react.useCallback((S,Q)=>{if(S.preventDefault(),!K||K===Q||Q==="name")return;let pe=[...Fe],ke=pe.findIndex(te=>te.id===K),xe=pe.findIndex(te=>te.id===Q);if(ke===-1||xe===-1)return;let Xe=pe.splice(ke,1);Xe[0]&&(pe.splice(xe,0,Xe[0]),_r(pe),we(null),ae(null));},[K,Fe,_r]),Ds=react.useCallback(async S=>{if(r.onCreateCustomField){let Q={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(Q);}Y(false);},[r]),Ea=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ma=react.useMemo(()=>{let S=A0(e);if(bt.trim()){let Q=bt.toLowerCase();S=S.filter(pe=>pe.name.toLowerCase().includes(Q));}if(Ve!=="all"){let Q=new Set(S.filter(pe=>Ea(pe)===Ve).flatMap(pe=>pe.parentPath));S=S.filter(pe=>Q.has(pe.id));}if(dt){let Q=new Set(S.filter(pe=>Ea(pe)!=="completed").flatMap(pe=>pe.parentPath));S=S.filter(pe=>Q.has(pe.id));}return S.sort((Q,pe)=>{let ke,xe;switch(le){case "name":ke=Q.name.toLowerCase(),xe=pe.name.toLowerCase();break;case "startDate":ke=Q.startDate?.getTime()||0,xe=pe.startDate?.getTime()||0;break;case "endDate":ke=Q.endDate?.getTime()||0,xe=pe.endDate?.getTime()||0;break;case "progress":ke=Q.progress||0,xe=pe.progress||0;break;case "status":ke=Q.status||"todo",xe=pe.status||"todo";break;case "priority":let Xe={urgent:0,high:1,medium:2,low:3,none:4};ke=Xe[Q.priority]??4,xe=Xe[pe.priority]??4;break;case "position":return 0;default:return 0}return ke<xe?je==="asc"?-1:1:ke>xe?je==="asc"?1:-1:0}),S},[e,bt,Ve,dt,le,je,Ea]);Vr.current=Ma;let yn=react.useCallback((S,Q)=>{let pe=Xe=>{r.onTaskUpdate?.({...S,...Xe});},ke=Xe=>Xe?S.customFields?.find(Ee=>Ee.fieldId===Xe)?.value:void 0,xe=(Xe,te)=>{if(!Xe)return;let Je=[...S.customFields||[]],Re=Je.findIndex(Ut=>Ut.fieldId===Xe);Re>=0?Je[Re]={fieldId:Xe,value:te}:Je.push({fieldId:Xe,value:te}),pe({customFields:Je});};switch(Q.type){case "name":return null;case "status":return jsxRuntime.jsx(bg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:te=>{pe({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:z,locale:f,translations:I.status});case "priority":return jsxRuntime.jsx(yg,{value:S.priority,onChange:te=>pe({priority:te}),isDark:z,locale:f});case "assignees":{let te=S.hasChildren,Ee=S.assignees||[];if(te&&S.subtasks?.length){let Je=new Map,Re=Ut=>{(Ut||[]).forEach(ut=>{(ut.assignees||[]).forEach(pt=>{Je.has(pt.name)||Je.set(pt.name,pt);}),ut.subtasks?.length&&Re(ut.subtasks);});};Re(S.subtasks),Ee=Array.from(Je.values());}else te&&(Ee=[]);return jsxRuntime.jsx(hl,{value:Ee,availableUsers:l,onChange:Je=>pe({assignees:Je}),isDark:z,locale:f,disabled:te})}case "startDate":return jsxRuntime.jsx(xl,{value:S.startDate,onChange:te=>pe({startDate:te}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(xl,{value:S.endDate,onChange:te=>pe({endDate:te}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let te=!!(S.subtasks&&S.subtasks.length>0),Ee=te?F0(Wd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Sg,{value:Ee,onChange:te?void 0:Je=>{let Re=Je===100?"completed":Je>0?"in-progress":"todo";pe({progress:Je,status:Re});},isDark:z,disabled:te})}case "tags":return jsxRuntime.jsx(Gg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Pg,{value:ke(Q.customFieldId)||"",onChange:te=>xe(Q.customFieldId,te),isDark:z});case "number":return jsxRuntime.jsx(Ag,{value:ke(Q.customFieldId)||0,onChange:te=>xe(Q.customFieldId,te),isDark:z});case "date":let Xe=ke(Q.customFieldId);return jsxRuntime.jsx(xl,{value:Xe?new Date(Xe):void 0,onChange:te=>xe(Q.customFieldId,te),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(Ig,{value:ke(Q.customFieldId)||"",options:Q.options||[],onChange:te=>xe(Q.customFieldId,te),isDark:z});case "checkbox":return jsxRuntime.jsx(Bg,{value:ke(Q.customFieldId)||false,onChange:te=>xe(Q.customFieldId,te),isDark:z});case "multiselect":return jsxRuntime.jsx($g,{value:ke(Q.customFieldId)||[],options:Q.options||[],onChange:te=>xe(Q.customFieldId,te),isDark:z,maxSelectable:Q.maxSelectable});case "person":{let te=ke(Q.customFieldId)||[];return jsxRuntime.jsx(hl,{value:te.map(Ee=>({name:Ee.name,avatar:Ee.avatar,initials:Ee.initials||(Ee.name||"?").slice(0,2).toUpperCase(),color:Ee.color||"#00E5CC"})),availableUsers:l,onChange:Ee=>xe(Q.customFieldId,Ee),isDark:z,locale:f})}case "file":return jsxRuntime.jsx(Ug,{value:ke(Q.customFieldId),isDark:z,onOpen:te=>{te.url&&window.open(te.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let te=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.estimatedTime,onChange:Ee=>pe({estimatedTime:Ee}),isDark:z,locale:f,disabled:te,lens:$,hourlyRate:Oe(S)})}case "quotedTime":{let te=S.status==="completed"||S.progress===100,Ee=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsxRuntime.jsx(Ia,{value:S.quotedTime,onChange:Je=>pe({quotedTime:Je}),isDark:z,locale:f,disabled:te,isBlurred:Ee,lens:$,hourlyRate:Oe(S)})}case "elapsedTime":{let te=S.status==="completed"||S.progress===100,Ee=S.executedDollarsCanonical;return jsxRuntime.jsx(Ia,{value:S.elapsedTime,onChange:Je=>pe({elapsedTime:Je}),isDark:z,locale:f,disabled:te,lens:$,hourlyRate:Oe(S),financialOverride:Ee})}case "effortMinutes":{if(Le&&S.subtasks&&S.subtasks.length>0){let{allocated:Ut}=ks(S);if($==="financial"){let ut=We(S),pt=Math.round(ut.dollarAllocated),fr=Math.round(ut.dollarQuoted),cr=fr-pt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[pt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",pt.toLocaleString("es-CO")]}):null,cr!==0&&pt>0&&fr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",cr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[cr>0?"+":"",Math.abs(cr)>=1e3?`$${(cr/1e3).toFixed(1)}K`:`$${cr}`]})]})}return jsxRuntime.jsx(Ia,{value:Ut>0?Ut:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:ee})}let te=S.status==="completed"||S.progress===100,Ee=S.effortMinutes||0,Je=S.soldEffortMinutes||0,Re=Oe(S);if($==="financial"&&Re&&Ee>0&&Je>0){let Ut=Math.round(Ee/60*Re),pt=Math.round(Je/60*Re)-Ut;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ia,{value:Ee,onChange:fr=>pe({effortMinutes:fr}),isDark:z,locale:f,disabled:te,lens:$,hourlyRate:Oe(S)}),pt!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",pt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[pt>0?"+":"",Math.abs(pt)>=1e3?`$${(pt/1e3).toFixed(1)}K`:`$${pt}`]})]})}return jsxRuntime.jsx(Ia,{value:Ee,onChange:Ut=>pe({effortMinutes:Ut}),isDark:z,locale:f,disabled:te,lens:$,hourlyRate:Oe(S)})}case "timeLoggedMinutes":{let te=S.executedDollarsCanonical;if(Le&&S.subtasks&&S.subtasks.length>0){let{spent:Je}=ks(S);return jsxRuntime.jsx(Ia,{value:Je>0?Je:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S),financialOverride:te})}let Ee=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Je=>{r.onLogTime?.(S,Je);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Ee,lens:$,hourlyRate:Oe(S),financialOverride:te})}case "soldEffortMinutes":{if(Le&&S.subtasks&&S.subtasks.length>0){let{quoted:Je}=ks(S),Re=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:Je>0?Je:void 0,isDark:z,locale:f,disabled:true,isBlurred:Re,lens:$,hourlyRate:Oe(S)})}let te=S.status==="completed"||S.progress===100,Ee=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:S.soldEffortMinutes,onChange:Je=>pe({soldEffortMinutes:Je}),isDark:z,locale:f,disabled:te,isBlurred:Ee,lens:$,hourlyRate:Oe(S)})}case "scheduleVariance":{let te=S.effortMinutes||0,Ee=S.soldEffortMinutes||0,Je=S.timeLoggedMinutes||0,Re=te>0||Ee>0||Je>0;return jsxRuntime.jsx(Kg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:Re})}case "hoursBar":{if(Le&&S.hasChildren){let{spent:te,allocated:Ee,quoted:Je}=ks(S),Re=te>Ee&&Ee>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",Re?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ws(te)}),Ee>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ws(Ee)})]}),Je>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ws(Je)})]})]})}return jsxRuntime.jsx(Yg,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:$,hourlyRate:Oe(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(Jg,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(hl,{value:S.assignees||[],availableUsers:l,onChange:Ee=>{r.onTaskUpdate?.({...S,assignees:Ee});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(Zg,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let te=se.get(S.id);if(te!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",te>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:te>0?`${Number(te.toFixed(2))}%`:"\u2014"});let Ee=S.weight||0;return jsxRuntime.jsx(Q1,{value:Ee,onChange:Je=>pe({weight:Je}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Le,se]),bo=react.useCallback(S=>{let pe={name:I.columns.name,status:I.columns.status,priority:I.columns.priority,assignees:I.columns.assignees,startDate:I.columns.startDate,endDate:I.columns.endDate,progress:I.columns.progress,tags:I.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:I.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:I.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:I.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:I.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:I.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:I.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:I.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:I.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:I.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:I.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:I.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof pe=="string"?pe:String(pe||S.type)},[I,f]),Fn=react.useMemo(()=>{let pe=st.reduce((xe,Xe)=>xe+Xe.width,0)+(k?48:0),ke={};for(let xe of st)ke[xe.id]=`${xe.width/pe*100}%`;return ke},[st,k]);return a?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:me,className:g(z?"bg-[#0D0D0D]":"bg-white",Z&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ma.length," ",I.pagination.tasks]}),h&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:bt,onChange:S=>mt(S.target.value),placeholder:I.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&fe>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:ft,onClick:()=>ue(!ne),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?ne?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":ne?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),lr==="all"?f==="es"?"Todos":"All":`L${lr}`]}),ne&&jsxRuntime.jsx("div",{ref:_,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(fe,5)},(S,Q)=>({value:Q+1,label:`L${Q+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{Ba(S.value),ue(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?lr===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":lr===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),lr===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(C0,{value:Ve,hideCompleted:dt,onChange:Ie,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsxRuntime.jsx("button",{onClick:()=>Pe(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:I.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),st.map(S=>{let Q=S.id!=="name",pe=ot===S.id&&K!==S.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",Q&&"cursor-grab",S.type!=="name"&&"justify-center",K===S.id&&"opacity-50",pe&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Fn[S.id],minWidth:S.minWidth},draggable:Q,onDragStart:Q?ke=>Pn(ke,S.id):void 0,onDragEnd:Q?_n:void 0,onDragOver:Q?ke=>Go(ke,S.id):void 0,onDragLeave:Q?fi:void 0,onDrop:Q?ke=>Kr(ke,S.id):void 0,onContextMenu:ke=>ar(ke,void 0,S.id),children:[Q&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxRuntime.jsxs("button",{draggable:false,onClick:ke=>{let xe=ke.currentTarget.getBoundingClientRect();d(S.id,xe);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[bo(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),le===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>gr(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[bo(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",le===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[bo(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",Z===S.id&&"bg-[#00E5CC]"),onMouseDown:ke=>zo(ke,S.id)})]},S.id)}),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),X(Q=>!Q);},className:g("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",F&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(b0,{isOpen:F,onClose:()=>X(false),columns:Fe,customFields:c,mostrarColumnasDensas:w,onColumnsChange:_r,onCreateCustomField:()=>{X(false),Y(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ma.map((S,Q)=>{let pe=lt.has(S.id),ke=Math.min(Q*.01,.2),xe=S.hasChildren&&S.level===0,Xe=S.subtasks?.length||0;if(xe){let{spent:ut,allocated:pt,quoted:fr}=ks(S),cr=J1(S);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ke},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ze===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),st.map(ea=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",ea.type!=="name"&&"justify-center"),style:{width:Fn[ea.id],minWidth:ea.minWidth},children:ea.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Mt=>{Mt.stopPropagation(),Bt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Mt=>{Mt.stopPropagation(),Bt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",Xe," ",f==="es"?Xe===1?"Tarea":"Tareas":Xe===1?"Item":"Items",")"]}),cr!==null&&v&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",cr>=1?"text-[#32D74B] bg-[#32D74B]/10":cr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",cr.toFixed(2)]})]})]}):ea.type==="timeLoggedMinutes"?$==="financial"?(()=>{let Mt=S.executedDollarsCanonical,Kt=Mt!=null?Math.round(Mt):Math.round(We(S).dollarSpent);return Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:ut>0?ut:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):ea.type==="soldEffortMinutes"?$==="financial"?(()=>{let Mt=We(S),Kt=Math.round(Mt.dollarQuoted);return Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:fr>0?fr:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):ea.type==="effortMinutes"?$==="financial"?(()=>{let Mt=We(S),Kt=Math.round(Mt.dollarAllocated),Dt=Math.round(Mt.dollarQuoted),Pt=Dt-Kt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("es-CO")]}):null,Pt!==0&&Kt>0&&Dt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Pt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Pt>0?"+":"",Math.abs(Pt)>=1e3?`$${(Pt/1e3).toFixed(1)}K`:`$${Pt}`]})]})})():jsxRuntime.jsx(Ia,{value:pt>0?pt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):yn(S,ea)},ea.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let te=Be===S.id,Ee=Ue===S.id,Je=Ee&&Ye==="above",Re=Ee&&Ye==="below",Ut=Ee&&Ye==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ke},className:g("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ze===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:te?.4:1,backgroundColor:Ut?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Ut?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:ut=>ar(ut,S),onMouseEnter:()=>$t(S.id),onMouseLeave:()=>$t(ut=>ut===S.id?null:ut),children:[Je&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Re&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsxRuntime.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:ut=>wa(S.id,ut),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),st.map(ut=>{let pt=!!(S.subtasks&&S.subtasks.length>0),fr=Qt(ut.type),ea=!!fr&&!pt&&Hr===S.id&&!wr,Mt=!!wr&&!!fr&&wr.column===fr&&Zr(S.id);return jsxRuntime.jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",ut.type!=="name"&&"justify-center"),style:{width:Fn[ut.id],minWidth:ut.minWidth,position:"relative",backgroundColor:Mt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Mt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[ut.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.jsx("button",{onClick:Kt=>{Kt.stopPropagation(),Bt(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?z?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):yn(S,ut),ea&&fr&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Kt=>jr(Kt,S.id,fr,Q),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},ut.id)}),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),W&&Ma.length>0&&(()=>{let{spent:S,allocated:Q,quoted:pe}=De,ke=Q-S,xe=ke<0,Xe=xe?`+${ws(Math.abs(ke))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ws(ke)} ${f==="es"?"AHORRADO":"SAVED"}`,te=$==="financial"&&ee>0,Ee=Ce?.breakdown,Je=!!Ee&&((Ee.equipment??0)>0||(Ee.travel??0)>0),Re=Ee?.laborSpent!=null?Ee.laborSpent:Ce?.spent!=null?Ce.spent:De.dollarSpent,Ut=Ee?.laborAllocated!=null?Ee.laborAllocated:Ce?.allocated!=null?Ce.allocated:De.dollarAllocated,ut=Ce?.quoted!=null?Ce.quoted:De.dollarQuoted,pt=(Mt,Kt)=>{if(te){let Dt=Kt??Mt/60*ee;return `$${Math.round(Dt).toLocaleString("es-CO")}`}return ws(Mt)},fr=te?Math.abs(Ut-Re):0,cr=te?`+$${fr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${xe?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:Xe,ea=te&&Je?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),st.map(Mt=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Mt.type!=="name"&&"justify-center"),style:{width:Fn[Mt.id],minWidth:Mt.minWidth},children:Mt.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),ea&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),ea]})]}):Mt.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pt(S,te?Re:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:pt(Q,te?Ut:void 0)})]}),Q>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",xe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:te?cr:Xe})]}):Mt.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?pt(pe,te?ut:void 0):"\u2013"}):Mt.type==="effortMinutes"?(()=>{if(te&&pe>0&&Q>0){let Kt=Math.round(ut),Dt=Math.round(Ut),Pt=Kt-Dt,Zt=Kt>0?Math.round(Pt/Kt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pt(Q,Ut)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Pt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Pt>=0?"+":"",Math.abs(Pt)>=1e3?`$${(Pt/1e3).toFixed(1)}K`:`$${Pt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Zt,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?pt(Q,te?Ut:void 0):"\u2013"})})():Mt.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?pt(S,te?Re:void 0):"\u2013"}):Mt.type==="progress"?(()=>{let Kt=F0(Wd(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Kt,"%"]})})():Mt.type==="weight"?(()=>{let Kt=e||[],Dt=[],Pt=ua=>{for(let qr of ua)Dt.push(qr),qr.subtasks?.length&&Pt(qr.subtasks);};Pt(Kt);let ba=Dt.filter(ua=>!ua.subtasks?.length||ua.subtasks.length===0).reduce((ua,qr)=>ua+(qr.weight||0),0),ka=Math.abs(ba-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",ka?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ba.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Mt.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ma.length===0&&bt&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsxRuntime.jsx(N0,{data:He.data,isDark:z,locale:f,onClose:()=>Pe(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Q=document.querySelector(`[data-task-id="${S}"]`);Q&&(Q.scrollIntoView({behavior:"smooth",block:"center"}),Ze(S),setTimeout(()=>Ze(null),2e3));}})]}),jsxRuntime.jsx(s0,{state:de,onClose:$a,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Ur,onColumnSort:en,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),ye&&gt&&Be&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:gt.x+12,top:gt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Q=Te.flattenTasks(e).find(pe=>pe.id===Be);return Q?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:Q.name})]}):null})()}),document.body),jsxRuntime.jsx(x0,{isOpen:R,onClose:()=>Y(false),onSave:Ds,isDark:z,locale:f})]})}var R0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],B0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],$0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var zd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Gd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Vd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},El={dark:zd,light:Gd,neutral:Vd};function O0(e){return El[e]||El.dark}function Ml(e,t,r,a,n=5){let s=[],o=[],l=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of l){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let c={};for(let p=r;p<=a;p++)c[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)c[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function H0(e){return e==="es"?Z1:eC}function U0(e){return (e.getDay()+6)%7}function W0(e,t){let r=new Date(e,t,1),a=U0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},l=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},c=l(r),i=new Date(e,t+1,0),d=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:d}}function si(e,t){return U0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&r(o.subtasks,l,c);}};return r(e,"",""),t}function z0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function G0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Pl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),l=42,c=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=z0(d.startDate),f=z0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?G0(v):G0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?nC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=aC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(x,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function V0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var jd=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Fl({locale:e}){let t=H0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Ll({bar:e,ws:t,money:r,projColor:a,slotH:n=jd}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":e.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),l>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function Al({chip:e,ws:t,slotH:r=jd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:iC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Il({more:e,ws:t,slotH:r=jd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function j0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function _0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:uC.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function K0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=react.useState(false),x=react.useRef(null),h=d==="es";react.useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function q0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function X0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var Y0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function J0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=Y0[r]||Y0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function Z0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Q0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return Q0[e%Q0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var _d="\xA0";function Bo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function ef(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(Z0(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:vC(c),initials:xC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((c.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function tf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=Z0(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:m,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:p=>{!c||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!c||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${_d}/${_d}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Bo(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",_d,Bo(l.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function rf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Bo(s),"h asignadas / ",Bo(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Bo(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Bo(i.hours),"h / ",Bo(i.capacity),"h"]})]},i.name)})})]})}var Kd=28,CC=182;function nf({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=l==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),c&&c[x]?jsxRuntime.jsx(tf,{days:c[x].days,capByDay:c[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=react.useMemo(()=>Ml(a,n,t,r),[a,n,t,r]),m=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:p,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return si(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Ll,{bar:f,ws:t,money:s,projColor:o,slotH:Kd})},`b${x}`)),d.chips.map((f,x)=>jsxRuntime.jsx(Al,{chip:f,ws:t,slotH:Kd},`c${x}`)),d.more.map((f,x)=>jsxRuntime.jsx(Il,{more:f,ws:t,slotH:Kd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function of(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function sf(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?of(l):of(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function lf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(s.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function cf({onExpand:e}){return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ts(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function df({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Ts(r.oldProjectEnd,n)} \u2192 ${Ts(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Ts(r.oldStart,n)," \u2013 ",Ts(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Ts(r.newStart,n)," \u2013 ",Ts(r.newEnd,n)]})]})]}),d?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function uf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>l?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Rl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function qd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function pf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Rl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Rl(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=l(f);x>u&&(u=x);}let p=qd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function mf(e,t,r){let a=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Rl(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-qd(p)*864e5));}s.set(c.id,d===1/0?r:d);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Rl(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Bl(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=pf(n,new Map),i=mf(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=pf(d,new Map([[t,r.getTime()]])),u=mf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=qd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function gf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,$l=26,$C="#5B7FD4";function ff({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=react.useState("mes"),[k,M]=react.useState(()=>{let j=new Date,ye={y:j.getFullYear(),m:j.getMonth()},Ae=(e??[]).map(Ye=>Ye.startDate?new Date(Ye.startDate):null).filter(Ye=>!!Ye&&!isNaN(Ye.getTime()));if(Ae.length===0||(e??[]).some(Ye=>{let Nt=Ye.startDate?new Date(Ye.startDate):null,gt=Ye.endDate?new Date(Ye.endDate):Nt;if(!Nt||isNaN(Nt.getTime()))return false;let Jt=new Date(ye.y,ye.m,1),vr=new Date(ye.y,ye.m+1,0,23,59,59);return Nt<=vr&&(gt??Nt)>=Jt}))return ye;let kt=Ae.reduce((Ye,Nt)=>Ye<Nt?Ye:Nt);return {y:kt.getFullYear(),m:kt.getMonth()}}),[B,T]=react.useState(false),[C,P]=react.useState([]),[D,V]=react.useState("all"),[$,ee]=react.useState(null),[L,Le]=react.useState(null),[W,Ce]=react.useState(false),[I,z]=react.useState(null),[Oe,We]=react.useState(false),J=react.useMemo(()=>W0(k.y,k.m),[k.y,k.m]),De=a||$C,se=react.useMemo(()=>{let j=new Set;for(let ye of h){let Ae=new Date(`${ye}T12:00:00`),Ue=J.dateToSerial(Ae);Ue>=1&&Ue<=42&&j.add(Ue);}return j},[h,J]);react.useEffect(()=>{y?.({start:gf(J.serialToDate(1)),end:gf(J.serialToDate(42))});},[k.y,k.m]);let He=x.length,Se=react.useMemo(()=>{let j=b?.hoursPerDay;if(!j)return 8;let ye=[j.monday,j.tuesday,j.wednesday,j.thursday,j.friday].map(Ae=>Ae||0).filter(Ae=>Ae>0);return ye.length?Math.round(ye.reduce((Ae,Ue)=>Ae+Ue,0)/ye.length*10)/10:8},[b]),Pe=react.useMemo(()=>Pl({tasks:e,grid:J,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,J,De,o,r]),ze=react.useMemo(()=>{if(d===false)return [];let j=new Map;for(let ye of Pe.calTasks)ye.phaseId&&ye.phaseName&&j.set(ye.phaseId,ye.phaseName);return [...j.entries()].map(([ye,Ae])=>({id:ye,name:Ae})).sort((ye,Ae)=>ye.name.localeCompare(Ae.name))},[Pe.calTasks,d]),Ze=!C.includes("tareas"),le=!C.includes("cpm"),tt=react.useMemo(()=>{let j=Ze?Pe.calTasks:[];return D!=="all"&&(j=j.filter(ye=>ye.phaseId===D)),le||(j=j.map(ye=>ye.critical?{...ye,critical:false}:ye)),j},[Pe.calTasks,Ze,le,D]),je=react.useMemo(()=>{let j=new Set;return C.includes("hitos")&&(j.add("hito"),j.add("desembolso")),C.includes("ext")&&j.add("ext"),C.includes("aus")&&j.add("aus"),Pe.dayItems.filter(ye=>!j.has(ye.type))},[Pe.dayItems,C]),$e=!C.includes("festivos"),bt=new Date,mt=J.dateToSerial(new Date(bt.getFullYear(),bt.getMonth(),bt.getDate())),Ve=j=>P(ye=>ye.includes(j)?ye.filter(Ae=>Ae!==j):[...ye,j]),Ie=()=>M(j=>{let ye=new Date(j.y,j.m-1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),dt=()=>M(j=>{let ye=new Date(j.y,j.m+1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),zt=()=>{let j=new Date;M({y:j.getFullYear(),m:j.getMonth()});},Fe=(j,ye,Ae)=>{if(!p||ye===0)return;let Ue=Pe.calTasks.find(Jt=>Jt.uid===j);if(!Ue)return;let kt=ye*864e5,Ye=new Date(Ue.realStart.getTime()+kt),Nt=new Date(Ue.realEnd.getTime()+kt),gt=Bl(e,j,Ye,Nt);gt&&z({uid:j,taskId:Ue.id,taskName:Ue.name,sim:gt,anchor:Ae});},nt=async()=>{if(!I||!f)return;We(true);let j=[{id:I.uid,startDate:I.sim.newStart,endDate:I.sim.newEnd},...I.sim.movedSuccessors.map(Ae=>({id:Ae.id,startDate:Ae.newStart,endDate:Ae.newEnd}))],ye=await f(j);We(false),ye&&z(null);},F=V0(k.y,k.m,n),X=[{id:"",name:t,color:De}],R=react.useMemo(()=>sf(e,o),[e,o]),Y=react.useMemo(()=>{if(v==="lookahead"){let j=J.weeks.find(Ae=>mt>=Ae.ws&&mt<=Ae.we)??J.weeks[0],ye=J.weeks.indexOf(j);return J.weeks.slice(ye,ye+2)}return v==="semana"?[J.weeks.find(ye=>mt>=ye.ws&&mt<=ye.we)??J.weeks[0]]:[]},[v,J.weeks,mt]),de=react.useMemo(()=>{let j={};return Y.forEach((ye,Ae)=>{let Ue=[];for(let Ye=ye.ws;Ye<=ye.we;Ye++)Ue.push({serial:Ye,date:J.serialToDate(Ye),isWeekend:si(J,Ye),isHoliday:se.has(Ye)});let kt=ef(x,Ue,Se);j[Ae]={days:Ue,capByDay:kt};}),j},[Y,J,se,x,Se]),he=v==="semana"||v==="lookahead",Be=v==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx(_0,{view:v,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(K0,{monthLabel:F,onPrev:Ie,onNext:dt,onToday:zt,layersOpen:B,onToggleLayers:()=>T(j=>!j),layersOff:C,phases:ze,phaseFilter:D,onPhaseChange:V,locale:n,children:B?jsxRuntime.jsx(q0,{off:C,onToggle:Ve}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsxRuntime.jsx(uf,{grid:J,tasks:tt,items:je,money:l,projColor:De,todaySerial:mt,locale:n,onTaskOpen:i}):he?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fl,{locale:n}),jsxRuntime.jsx(nf,{grid:J,weeks:Y,tasks:tt,items:je,money:l,projColor:De,todaySerial:mt,locale:n,capRows:de,teamSize:He,onTaskOpen:i,onMore:(j,ye,Ae)=>ee({day:j,items:ye,tasks:Ae}),onCapDay:(j,ye,Ae)=>{for(let Ue of Object.keys(de)){let kt=de[+Ue].capByDay.get(j);if(kt){Le({dayLabel:ye,perPerson:kt.perPerson,anchor:Ae.getBoundingClientRect()});break}}}})]}):Pe.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(j=>jsxRuntime.jsx(bf,{grid:J,ws:j.ws,we:j.we,todaySerial:mt,showFestivos:$e,holidaySerials:se,locale:n,deadlineDays:new Set},j.ws))}),jsxRuntime.jsx(J0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fl,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(j=>jsxRuntime.jsx(OC,{grid:J,ws:j.ws,we:j.we,tasks:tt,items:je,money:l,projColor:De,todaySerial:mt,showFestivos:$e,holidaySerials:se,locale:n,onTaskOpen:i,onMore:(ye,Ae,Ue)=>ee({day:ye,items:Ae,tasks:Ue}),canReschedule:p,onDragReschedule:Fe,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsxRuntime.jsx(X0,{dayLabel:`${J.serialToDate($.day).getDate()}`,items:$.items,tasks:$.tasks.map(j=>({swatch:De,taskId:j.id,label:j.name,critical:j.critical,value:l==="$"?j.cost:`${j.hrs}h`})),onClose:()=>ee(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,L?jsxRuntime.jsx(rf,{dayLabel:L.dayLabel,perPerson:L.perPerson,onClose:()=>Le(null),style:{position:"fixed",top:`${L.anchor.top-8}px`,left:`${L.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,I?jsxRuntime.jsx(df,{taskName:I.taskName,taskId:I.sim.taskId,sim:I.sim,busy:Oe,locale:n,onConfirm:nt,onCancel:()=>z(null),style:{position:"fixed",top:`${I.anchor.top+12}px`,left:`${Math.min(I.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),W?jsxRuntime.jsx(lf,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsxRuntime.jsx(cf,{onExpand:()=>Ce(true)})]}),jsxRuntime.jsx(j0,{projects:X})]})}function bf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=r;c++)l.push(c);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,m=n&&s.has(c),u="cal-day";return si(e,c)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=react.useMemo(()=>Ml(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(BC,h.laneCount*$l+36),v=react.useRef(null),[w,k]=react.useState(null),M=(B,T)=>{if(!p||!f){m?.(T);return}B.preventDefault();let C=v.current;if(!C)return;let P=C.getBoundingClientRect().width/7,D=B.clientX,V=0,$=L=>{let Le=Math.round((L.clientX-D)/P);V=Le,k({id:T,days:Le});},ee=L=>{if(window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",ee),k(null),V===0){m?.(T);return}let Le=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Le);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",ee);};return jsxRuntime.jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(bf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=x?.uid===B.t.uid?x.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsxRuntime.jsx("div",{onPointerDown:ee=>M(ee,B.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Ll,{bar:$,ws:t,money:s,projColor:o,slotH:$l})},`b${T}`)}),h.chips.map((B,T)=>jsxRuntime.jsx(Al,{chip:B,ws:t,slotH:$l},`c${T}`)),h.more.map((B,T)=>jsxRuntime.jsx(Il,{more:B,ws:t,slotH:$l,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),d=react.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=react.useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var yf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function li(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 ci(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 xf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function vf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...yf,...o}),[o]),[i,d]=react.useState(new Set),m=react.useRef(null),u=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),B=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:B<7?`${B}d ago`:y.toLocaleDateString()},b=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[ci(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let k=i.has(v.id),M=s===v.id,B=xf(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ci(v.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:li(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(C.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(C)})]},T))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function kf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let d=[.5,1,1.5,2,3],m=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:m&&ci(m.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:m&&li(m)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>l(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:li(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(p=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Xd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Jd(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 Cf(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 Tf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=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(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Nf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[d,m]=react.useState([]),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=_C(e,t,r.width,r.height,r,150);m($);},[e,t,r]);let M=react.useCallback(($,ee)=>{r.enableDragging&&(ee.stopPropagation(),p($));},[r.enableDragging]),B=react.useCallback($=>{if(!u||!i.current)return;let L=i.current.getBoundingClientRect(),Le=($.clientX-L.left-w.x)/y,W=($.clientY-L.top-w.y)/y;m(Ce=>Ce.map(I=>I.id===u?{...I,x:Le,y:W,fx:Le,fy:W}:I));},[u,y,w]),T=react.useCallback(()=>{p(null);},[]),C=react.useCallback(($,ee)=>{ee.stopPropagation(),l?.({type:"node-click",node:$,position:{x:ee.clientX,y:ee.clientY}});},[l]),P=react.useCallback(($,ee)=>{ee.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:ee.clientX,y:ee.clientY}});},[l]),D=react.useCallback($=>{let ee=d.find(L=>L.id===$);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[d]),V=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=$.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Cf($)," ",Jd($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let ee=D(typeof $.source=="string"?$.source:$.source.id),L=D(typeof $.target=="string"?$.target:$.target.id),Le=Tf($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsxRuntime.jsx("line",{x1:ee.x,y1:ee.y,x2:L.x,y2:L.y,stroke:Xd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Le?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsxRuntime.jsx("text",{x:(ee.x+L.x)/2,y:(ee.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let ee=f===$.id,L=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",ee&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Le=>M($.id,Le),onMouseEnter:()=>x($.id),onMouseLeave:()=>x(null),onClick:Le=>C($,Le),children:[jsxRuntime.jsx("circle",{r:L?r.nodeSize*1.2:r.nodeSize,fill:V($),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ee?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ef({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,d]=react.useState(null),[m,u]=react.useState(null),p=react.useRef(null),f=l||n;react.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{m&&(r(m),x());};return e?jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((y,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((y,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},v)),m.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:p,value:s,onChange:y=>o(y.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-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,v)=>jsxRuntime.jsx("button",{onClick:()=>o(y),disabled:f,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:y},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:f,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"}),m?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Qd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function di(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(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(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),l=r.filter(m=>m.success),c=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,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],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(d=>d.timestamp>=o).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)}},Oo=new Zd;function Ff({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Oo.getStats()),[s,o]=react.useState(Oo.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Oo.getStats()),o(Oo.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),react.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=Oo.getRecentOperations(5);return jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:di(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,m=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:di(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:di(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function If({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[d,m]=react.useState(""),[u,p]=react.useState(false),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(null),w=react.useRef(null),k=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let P=D=>{D.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),m(""),x(null),b(null),v(null),t());},B=async()=>{if(!(!o.trim()||k)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(or,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",C,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:o,onChange:P=>l(P.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-[#00E5CC]/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:P=>i(P.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-[#00E5CC]/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,D)=>jsxRuntime.jsx("button",{onClick:()=>l(P),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:B,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Ul({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&wi(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,y)=>{a(v=>{let w=v.cards.find(P=>P.id===h);if(!w)return v;let k=w.columnId,M={...w,columnId:b,position:y},B=v.cards.map(P=>P.id===h?M:P),T=v.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(D=>D!==h)};if(P.id===b){let D=B.filter(V=>V.columnId===b).sort((V,$)=>V.position-$.position);return {...P,cardIds:D.map(V=>V.id)}}return P}),C={...v,cards:B,columns:T};return n(C),C});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:v};return n(w),w});},[n]),l=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,v],columns:w};return n(k),k});},[n]),c=react.useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let v=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(B=>B!==h)}:M),k={...b,cards:v,columns:w};return n(k),k});},[n]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=react.useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:v};return n(w),w});},[n]),m=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),v=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),p=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=react.useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:c,deleteColumn:m,clearBoard:f}}}function Bf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Ul({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(m=>m.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var ui={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Of={by:"none",order:"asc"};function Hf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...ui,...e}),[s,o]=react.useState({...Of,...t}),l=react.useCallback(x=>{n(h=>({...h,...x}));},[]),c=react.useCallback(x=>{o(h=>({...h,...x}));},[]),i=react.useCallback(()=>{n(ui),o(Of);},[]),d=react.useCallback(()=>{r&&n({...ui,assignees:[r]});},[r]),m=react.useCallback(()=>{n({...ui,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...ui,priorities:["HIGH","URGENT"]});},[]),p=react.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=react.useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${v}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let B=M.endDate||M.dueDate;if(!B)return false;let T;if(typeof B=="string")T=B.split("T")[0]||B;else {let C=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),D=String(B.getUTCDate()).padStart(2,"0");T=`${C}-${P}-${D}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let C=new Date(k+"T00:00:00"),P=new Date(T+"T00:00:00"),D=new Date(C);return D.setDate(D.getDate()+7),P>=C&&P<=D;case "custom":if(a.dateRange){let V=typeof B=="string"?new Date(B):B;return V>=a.dateRange.start&&V<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;v=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=M[b.priority||"LOW"],T=M[y.priority||"LOW"];v=B-T;break;case "dueDate":let C=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!C)return 1;if(!P)return -1;let D=typeof C=="string"?new Date(C).getTime():C.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();v=D-V;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,ee=y.estimatedTime||0;v=$-ee;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var Wf,zf;if(typeof window<"u")try{let e=yi("ai");Wf=e.generateObject,zf=e.generateText;}catch{}function Gf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(Wf&&zf&&e.apiKey),o=react.useCallback(async m=>{if(!s)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:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),l=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),c=react.useCallback(async m=>{if(!s)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(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function tu(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function Vf(e){let{cards:t}=e,[r,a]=tu(),n=react.useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=react.useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,k]=y<v?[y,v]:[v,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=react.useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=react.useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:d}}var jf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function _f(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...jf,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((x,h,b,y,v)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=react.useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=react.useCallback(async x=>{let h=t.filter(k=>k.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let v=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{v.has(M)||v.set(M,[]),v.get(M).push(k);});}),v.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${B} ${M} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let B=(await a.findSimilar(k,h)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(B.length>=n.minCardsPerStack-1){let T=[k.id,...B.map(P=>P.card.id)],C=B.reduce((P,D)=>P+D.similarity,0)/B.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:C});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var Kf=react.createContext(null);function qf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=yi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=yi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=yi("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Kf.Provider,{value:{store:n},children:e})}function Wl(){let e=react.useContext(Kf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function mi(){let e=Wl(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=react.useCallback(y=>{e.deleteColumn(y);},[e]),m=react.useCallback(y=>e.getColumn(y),[e]),u=react.useCallback(y=>{e.addCard(y);},[e]),p=react.useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),x=react.useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Xf(e){let{cards:t}=mi();return react.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)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 Jf(e="position",t="asc"){let{cards:r}=mi();return react.useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var zl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Bu.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 s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.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 s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new zl;function Zf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=c?c(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},h)})})})}function eb(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function rb({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let d=react.useRef(null),m=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:p,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=c?c(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function ab(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function nb(e,t=10){return e>t}var ou={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},su={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},iu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},du={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pu={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)"},mu={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)"},gu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fu={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}},bu={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}},Gl={spacing:ou,borderRadius:su,fontSize:iu,fontWeight:lu,lineHeight:cu,zIndex:du,duration:uu,easing:pu,shadows:mu,opacity:gu,kanban:fu,gantt:bu};function ob(e,t,r){return e[t]??r}function hu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?hu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yu(e="asakaa"){let t=hu(Gl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function dg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=dg(e),a=t.toLowerCase().trim(),n=r.find(l=>l.name.toLowerCase()===a);if(n)return n;let s=r.find(l=>l.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function fd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let p={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(p!==void 0){let f=new Date(a),x=f.getDay(),h=p-x;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let l=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),p=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,p,u)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function bd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function hd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function ug(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function pg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=fd(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=bd(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),m=Un(t,i),u=hd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),d=l[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function mg(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Vw(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 jw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ml(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>ml(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},l=o(e.startDate),c=o(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:Vw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function gg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.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:jw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function fg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>ml(a,e,t))}var yd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},xd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},gl={en:yd,es:xd};function vd(e){return gl[e]||gl.en}function fl(e,t){let r=vd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var wd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function bg(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function hg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let p=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=bg(e),i=wd[0],d=wd.find(p=>p.value===c)??i,m=d.icon,u=p=>{switch(bg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:wd.map(p=>{let f=p.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",p.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function xg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let d=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let c=kd.find(d=>d.value===e)??kd[4],i=a==="es"?"es":"en";return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(d=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function ri(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function yl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),react.useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),p=x=>e.some(h=>h.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ri(x.name),color:x.color||Cd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,h]);}l(false),i("");}};return s||!r?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&Cd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),l(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&Cd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:m,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(y=>y.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let h=p(x.name);return jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(b.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ri(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Ng({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,d]=react.useState(false),[m,u]=react.useState(n),[p,f]=react.useState(()=>{let D=n==="start"?e:t;if(D){let V=D instanceof Date?D:new Date(D);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,v]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=V=>{let $=V.target;x.current&&x.current.contains($)||b.current&&b.current.contains($)||d(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useLayoutEffect(()=>{if(!i){v(null);return}let D=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let $=520,Z=360,L=window.innerHeight-V.bottom,Ae=L<Z&&V.top>L,W=Ae?V.top-4:V.bottom+4,Ce=Math.min(Math.max(V.left,8),window.innerWidth-$-8);v({top:W,left:Ce,flipUp:Ae});};return D(),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}},[i]),react.useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let M=D=>D?D.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",B=react.useCallback(()=>{let D=p.getFullYear(),V=p.getMonth(),$=new Date(D,V,1),L=new Date(D,V+1,0).getDate(),Ae=$.getDay(),W=[],I=new Date(D,V,0).getDate();for(let Oe=Ae-1;Oe>=0;Oe--)W.push({date:new Date(D,V-1,I-Oe),isCurrentMonth:false});for(let Oe=1;Oe<=L;Oe++)W.push({date:new Date(D,V,Oe),isCurrentMonth:true});let z=42-W.length;for(let Oe=1;Oe<=z;Oe++)W.push({date:new Date(D,V+1,Oe),isCurrentMonth:false});return W},[p]),T=D=>{if(a)n==="start"?r(D,k||void 0):r(w||void 0,D),d(false);else if(m==="start"){let V=k&&D>k?D:k;r(D,V||void 0),u("end");}else {let V=w&&D<w?D:w;r(V||void 0,D),d(false);}},C=()=>{let D=new Date,V=new Date(D);V.setDate(D.getDate()+1);let $=new Date(D);$.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let Z=new Date(D);Z.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let L=new Date(D);L.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Ae=new Date(D);Ae.setDate(D.getDate()+14);let W=new Date(D);return W.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Z,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ae,display:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(D)})]})}let P=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,onClick:D=>{D.stopPropagation(),d(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&reactDom.createPortal(jsxRuntime.jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,V)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(D.date),children:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},V)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,k||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!a&&jsxRuntime.jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:B().map((D,V)=>{let $=D.date.toDateString()===new Date().toDateString(),Z=w?.toDateString()===D.date.toDateString(),L=k?.toDateString()===D.date.toDateString(),Ae=Z||L,W=!a&&w&&k&&D.date>=w&&D.date<=k;return jsxRuntime.jsx("button",{onClick:()=>T(new Date(D.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),$&&"ring-2 ring-[#00E5CC]",Z&&"bg-[#00E5CC] text-white",L&&!Z&&"bg-[#7C3AED] text-white",W&&!Ae&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ae&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},V)})})]})]}),document.body)]})}function vl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Ng,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function bs(e=600){let[t,r]=react.useState(false),a=react.useRef(null),n=react.useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return react.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function wl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),d=react.useRef([]);return react.useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;c(true);for(let x=1;x<=n;x++){let h=setTimeout(()=>{let b=x/n,y=1-Math.pow(1-b,3),v=Math.round(m+p*y);o(v),x===n&&(c(false),o(u));},f*x);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Dg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=react.useState(null),[o,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),d=react.useCallback(p=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(p),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,h=Math.min(x/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),l(0);},r);},[r,e]),m=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),a?.();},[a]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function Eg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),{isFlashing:m,triggerFlash:u}=bs(),{displayValue:p,isAnimating:f}=wl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,B=Math.round(M/k.width*100),T=Math.max(0,Math.min(100,B));T!==e&&(t(T),s&&u());},h=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);react.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=react.useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&u());}},[c,t,e,s,u]),y=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),v=p??e;return jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsxRuntime.jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),o?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:d,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Fg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let d=()=>{l!==e&&t?.(l),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(c(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:u=>c(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Ig({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,d]=react.useState(false),[m,u]=react.useState(e?.toString()||""),p=react.useRef(null),{isFlashing:f,triggerFlash:x}=bs(),{displayValue:h,isAnimating:b}=wl(e,{enabled:l&&!i});react.useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(m);if(!isNaN(w)){let k=w;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&x());}d(false);},v=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsxRuntime.jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsxRuntime.jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function Rg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),l(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function $g({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:d}=Dg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?l?d():i(!e):t(!e));},u=l?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&u&&"ring-green-500/50",l&&!u&&"ring-red-500/50",l&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Og({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&i(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let m=e.slice(0,l),u=e.length-m.length,p=e.length===0?n:m.join(", ")+(u>0?` +${u}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:p});let f=h=>{let b=e.includes(h),y=b?e.filter(v=>v!==h):[...e,h];!b&&o!=null&&e.length>=o||r(y);},x=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:h=>{h.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:p}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),c&&jsxRuntime.jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let b=e.includes(h),y=!b&&x;return jsxRuntime.jsxs("button",{disabled:y,onClick:v=>{v.stopPropagation(),f(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",y?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:h}),b&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Lk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function Wg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Lk(e);if(n.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return a?jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(s);},title:n.map(c=>c.name).join(`
414
+ `),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:l})]}):jsxRuntime.jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function Vg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxRuntime.jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let l=parseFloat(a[1]),c=a[2]?parseInt(a[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=react.useState(false),[p,f]=react.useState(""),x=react.useRef(null),{isFlashing:h,triggerFlash:b}=bs(),y=c==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);react.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),C=e%60;T>0&&C>0?f(`${T}h ${C}m`):T>0?f(`${T}h`):f(`${C}m`);}else f("");},[e,m]);let k=()=>{let T=Bk(p);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let B=y?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsxRuntime.jsx("input",{ref:x,type:"text",value:p,onChange:T=>f(T.target.value),onBlur:k,onKeyDown:M,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function qg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(r==null)return null;let c=n==="es";return r===0?s?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):r>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Xg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=r==="es",d=l==="financial"&&c>0,m=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,p]=react.useState(false),[f,x]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(v/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?v/w*100:0,C=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(x(false),b(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,h]);let D=W=>{if(W.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{x(false),b(W);},$=async(W,Ce)=>{h==="log"&&a&&W?a(e,W,Ce):h==="estimate"&&n?n(e,W):h==="quoted"&&s&&s(e,W),b(null);},Z=a||n||s||o,L=[{mode:"log",icon:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Ae=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&v===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&Z&&jsxRuntime.jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(W=>jsxRuntime.jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let W=v===0,I=(w>0?v/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(B)]}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:I?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:I?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(C)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Z&&jsxRuntime.jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(W=>jsxRuntime.jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Jg({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Qg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsxRuntime.jsx(Jg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?Vk(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Jg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function e0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function i0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?a0.es:a0.en,[v,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let C=b.current;if(!C)return;let P=C.getBoundingClientRect(),D=8,V=e.x,$=e.y;e.y+P.height>window.innerHeight-D&&($=Math.max(D,e.y-P.height)),e.x+P.width>window.innerWidth-D&&(V=Math.max(D,window.innerWidth-P.width-D)),(V!==e.x||$!==e.y)&&w({left:V,top:$});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let C=D=>{b.current&&!b.current.contains(D.target)&&t();},P=D=>{D.key==="Escape"&&t();};return document.addEventListener("mousedown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let C=[];return n&&C.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),C.push({id:"sep1",label:"",icon:null,separator:true}),l&&(C.push({id:"status",label:y.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),C.push({id:"priority",label:y.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),d.length>0&&C.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let D=e.task.assignees||[],$=D.some(Z=>Z.name===P.name)?D.filter(Z=>Z.name!==P.name):[...D,{name:P.name,initials:s1(P.name),color:P.color||i1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),m&&C.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&C.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&C.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),C},M=()=>{if(!e.columnId)return [];let C=[];return i&&(C.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(C.push({id:"sep-hide",label:"",icon:null,separator:true}),C.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:B.map(C=>C.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsxRuntime.jsx(l1,{item:C,isDark:r},C.id):jsxRuntime.jsxs("button",{onClick:C.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",C.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function l1({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxRuntime.jsxs("button",{onClick:l.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var a0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var f0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"}),multiselect:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),person:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),file:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function h0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=react.useState(""),[m,u]=react.useState(null),[p,f]=react.useState(null),x=react.useRef(null),h=c==="es"?b0.es:b0.en;react.useLayoutEffect(()=>{if(!e||!x.current)return;let C=()=>{if(!x.current)return;let P=x.current.parentElement;if(P){let Z=P.getBoundingClientRect();f({top:Z.bottom+4,right:window.innerWidth-Z.right});}let D=x.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),react.useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{x.current&&!x.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),x._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),x._cleanup&&x._cleanup();}},[e,t]);let b=react.useMemo(()=>{let C=new Set([...N1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&C.add(P.type);}),Array.from(C)},[r]);if(!e)return null;let y=C=>{let P=h.columns[C];if(P)return P;let D=r.find(V=>V.type===C);return D?.label?D.label:C},v=C=>{if(C==="name")return;let P=r.map(D=>D.id===C?{...D,visible:!D.visible}:D);n(P);},w=(C,P)=>{let D=r.find($=>$.type===C&&(!P||$.customFieldId===P));if(D){v(D.id);return}let V={id:P||C,type:C,label:P?a.find($=>$.id===P)?.name||C:y(C),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(C=>C!=="assignees"&&(o||!k.includes(C))&&y(C).toLowerCase().includes(i.toLowerCase())),B=a.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),T=l?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:x,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",C.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color=l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:i,onChange:C=>d(C.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:C=>{C&&C.style.setProperty("--focus-border",T);},onFocus:C=>{C.currentTarget.style.borderColor=T,C.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:C=>{C.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",C.currentTarget.style.background=l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:M.map(C=>{let P=r.find($=>$.type===C&&!$.customFieldId),D=P?.visible??false,V=C==="name";return jsxRuntime.jsxs("button",{onClick:()=>{V||(P?v(P.id):w(C));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(C),children:y(C)})]},C)})})]}),B.length>0&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(C.type,C.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:C.name})]},C.id)})})]})]})]})}var b0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var I1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function v0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,d]=react.useState([""]),m=n==="es"?x0.es:x0.en;react.useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var x0={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var C0={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function T0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),d=s==="es"?C0.es:C0.en;react.useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(p.value),a(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function N0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function D0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxRuntime.jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsxRuntime.jsx("button",{onClick:a,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=c-d,u=c>0?Math.round(m/c*100):0,p=c-i,f=c>0?Math.round(p/c*100):0,x=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=v>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=v>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsxRuntime.jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxRuntime.jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(c/i*100),100):0,p=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:N0(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:N0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsxRuntime.jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsxRuntime.jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxRuntime.jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,d=c<0,m=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let d=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var X1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function I0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...I0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ks(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ks(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ws(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function L0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,r+=c,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let d=i.effort_minutes||60;l+=(i.progress||0)*d,c+=d;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function zd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?zd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function R0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:B=true,showCreateTaskButton:T=false,onCreateTask:C,persistFilter:P=false,financialBlur:D,healthSidebar:V,lens:$="hours",hourlyRate:Z=0,rateMap:L,aggregateParentHours:Ae=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,I=fl(f,x),z=p==="dark",Oe=S=>{if(!L||!S.assignees||S.assignees.length===0)return Z;let X=0,pe=0;for(let ke of S.assignees){let We=ke.id?L[ke.id]:void 0;if(We==null||We<=0)continue;let re=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;re>0&&(X+=We*re,pe+=re);}if(pe>0)return X/pe;let ye=S.assignees.map(ke=>ke.id?L[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return ye.length===0?Z:ye.reduce((ke,We)=>ke+We,0)/ye.length},ze=S=>{let X=0,pe=0,ye=0,ke=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let Pe={s:X,a:pe,q:ye};if(ke(re.subtasks),X-Pe.s+(pe-Pe.a)+(ye-Pe.q)===0){let at=Oe(re);X+=(re.timeLoggedMinutes??0)/60*at,pe+=(re.effortMinutes??0)/60*at,ye+=(re.soldEffortMinutes??0)/60*at;}}else {let Pe=Oe(re);X+=(re.timeLoggedMinutes??0)/60*Pe,pe+=(re.effortMinutes??0)/60*Pe,ye+=(re.soldEffortMinutes??0)/60*Pe;}};return S.subtasks&&ke(S.subtasks),{dollarSpent:X,dollarAllocated:pe,dollarQuoted:ye}},Q=react.useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let X=JSON.parse(S);return {statusFilter:X.statusFilter||"all",hideCompleted:X.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),De=react.useMemo(()=>{function S(X){let pe=0,ye=0,ke=0,We=0,re=0,Pe=0;for(let Ee of X)if(Ee.subtasks&&Ee.subtasks.length>0){let at=S(Ee.subtasks);if(at.spent+at.allocated+at.quoted>0)pe+=at.spent,ye+=at.allocated,ke+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,Pe+=at.dollarQuoted;else {let lt=Ee.timeLoggedMinutes??0,gt=Ee.effortMinutes??0,rr=Ee.soldEffortMinutes??0;pe+=lt,ye+=gt,ke+=rr;let gr=Oe(Ee);We+=lt/60*gr,re+=gt/60*gr,Pe+=rr/60*gr;}}else {let at=Ee.timeLoggedMinutes??0,$t=Ee.effortMinutes??0,lt=Ee.soldEffortMinutes??0;pe+=at,ye+=$t,ke+=lt;let gt=Oe(Ee);We+=at/60*gt,re+=$t/60*gt,Pe+=lt/60*gt;}return {spent:pe,allocated:ye,quoted:ke,dollarSpent:We,dollarAllocated:re,dollarQuoted:Pe}}return S(e)},[e]),oe=react.useMemo(()=>{let S=new Map;function X(pe){let ye=0;for(let ke of pe)if(ke.subtasks&&ke.subtasks.length>0){let We=X(ke.subtasks);S.set(ke.id,We),ye+=We;}else ye+=ke.weight||0;return ye}return X(e),S},[e]),He=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Fe]=react.useState(true),[Ge,Qe]=react.useState(null),[se,Ze]=react.useState("position"),[_e,$e]=react.useState("asc"),[ft,pt]=react.useState(""),[je,Re]=react.useState(()=>Q().statusFilter),[dt,zt]=react.useState(()=>Q().hideCompleted),[Le,st]=react.useState(y||X1),[F,J]=react.useState(false),[R,Y]=react.useState(false),[ue,he]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=react.useState(null),[xe,Ie]=react.useState(false),[Ue,Ct]=react.useState(null),[Xe,Dt]=react.useState(null),[mt,Jt]=react.useState(null),xr=react.useRef(0),Er=react.useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,Bt]=react.useState(null),[vr,Gt]=react.useState(null),Qt=S=>{let X=S.type;return S.customFieldId?X==="file"?null:{kind:"customField",fieldId:S.customFieldId}:X==="assignees"||X==="teamLoad"?"assignees":X==="startDate"?"startDate":X==="endDate"?"endDate":null},Zr=(S,X)=>typeof S=="string"||typeof X=="string"?S===X:S.fieldId===X.fieldId,ba=react.useRef([]),et=react.useCallback((S,X)=>{Rt&&(X.preventDefault(),xr.current=X.clientY,j(S),Er.current=false,Ie(false),Jt({x:X.clientX,y:X.clientY}));},[Rt]),Ke=react.useCallback(S=>{if(!Be||(Math.abs(S.clientY-xr.current)>5&&!Er.current&&(Er.current=true,Ie(true)),Jt({x:S.clientX,y:S.clientY}),!Er.current))return;let pe=document.querySelectorAll("[data-listview-row]"),ye=null,ke=null;pe.forEach(We=>{let re=We.getBoundingClientRect(),Pe=We.getAttribute("data-listview-row");if(Pe&&Pe!==Be&&S.clientY>=re.top&&S.clientY<=re.bottom){ye=Pe;let Ee=S.clientY-re.top,at=re.height;ke=Ee<at*.25?"above":Ee>at*.75?"below":"child";}}),Ct(ye),Dt(ke);},[Be]),sa=react.useCallback(()=>{if(Er.current&&Be&&Ue&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Be,Ue);else if(Xe==="above"||Xe==="below"){let S=(ye,ke,We=null)=>{for(let re of ye){if(re.id===ke)return We;if(re.subtasks){let Pe=S(re.subtasks,ke,re.id);if(Pe!==void 0)return Pe}}},X=S(e,Be,null),pe=S(e,Ue,null);if(r.onTaskReparent){let ye=(at,$t)=>{if($t===null)return at;for(let lt of at){if(lt.id===$t)return lt.subtasks||[];if(lt.subtasks){let gt=ye(lt.subtasks,$t);if(gt.length>0||lt.subtasks.some(rr=>rr.id===$t))return gt}}return []},ke=ye(e,pe??null),We=ke.findIndex(at=>at.id===Ue),re=X===pe,Pe=re?ke.findIndex(at=>at.id===Be):-1,Ee=Xe==="below"?We+1:We;re&&Pe!==-1&&Pe<We&&(Ee-=1),r.onTaskReparent(Be,pe??null,Math.max(0,Ee));}}}j(null),Ct(null),Dt(null),Jt(null),Er.current=false,Ie(false);},[Be,Ue,Xe,e,r]),Vr=(S,X)=>typeof X!="string"?S.customFields?.find(ye=>ye.fieldId===X.fieldId)?.value:X==="assignees"?S.assignees:X==="startDate"?S.startDate:S.endDate,ea=(S,X,pe,ye)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ke=Array.from(document.querySelectorAll("[data-listview-row]")),We=ke.map(St=>St.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(X)),Pe=St=>We.slice(re,St+1);Gt({sourceTaskId:X,column:pe,sourceIndex:ye,targetIndex:ye,rangeIds:new Set([X])});let at=(St=>{let xt=St?.parentElement??null;for(;xt;){let Ca=window.getComputedStyle(xt).overflowY;if((Ca==="auto"||Ca==="scroll")&&xt.scrollHeight>xt.clientHeight)return xt;xt=xt.parentElement;}let Mr=document.scrollingElement;return Mr&&Mr.scrollHeight>Mr.clientHeight?Mr:null})(S.currentTarget),$t=St=>{let xt=re,Mr=false;ke.forEach((Ca,pa)=>{let qr=Ca.getBoundingClientRect();St>=qr.top&&St<=qr.bottom&&(xt=pa,Mr=true);});let ya=ke[ke.length-1];if(!Mr&&ya){let Ca=ya.getBoundingClientRect();St>Ca.bottom&&(xt=ke.length-1);}return xt<re&&(xt=re),xt},lt=S.clientY,gt=null,rr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},gr=()=>{let St=$t(lt),xt=new Set(Pe(St));Gt(Mr=>Mr&&{...Mr,targetIndex:St,rangeIds:xt});},Ur=()=>{if(rr(),!at)return;let St=at,Mr=St===document.scrollingElement?{top:0,bottom:window.innerHeight}:St.getBoundingClientRect(),ya=60,Ca=12,pa=lt-Mr.top,qr=Mr.bottom-lt,Fn=St.scrollHeight-St.clientHeight;if(qr<ya&&St.scrollTop<Fn){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,qr)/ya))),xo=()=>{St.scrollTop+=Ss,gr(),St.scrollTop<St.scrollHeight-St.clientHeight&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}else if(pa<ya&&St.scrollTop>0){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,pa)/ya))),xo=()=>{St.scrollTop-=Ss,gr(),St.scrollTop>0&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}},Ot=St=>{lt=St.clientY,gr(),Ur();},Kt=St=>{window.removeEventListener("mousemove",Ot),window.removeEventListener("mouseup",Kt),rr(),document.body.style.cursor="",document.body.style.userSelect="",Gt(null);let xt=$t(St.clientY),Mr=new Map(ba.current.map(qr=>[qr.id,qr])),ya=Mr.get(X);if(!ya)return;let Ca=Vr(ya,pe),pa=[];for(let qr of Pe(xt)){if(qr===X)continue;let Fn=Mr.get(qr);Fn&&(Fn.subtasks&&Fn.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,pe,Ca);};window.addEventListener("mousemove",Ot),window.addEventListener("mouseup",Kt);},jr=S=>vr?vr.rangeIds.has(S):false;react.useEffect(()=>{if(Be)return document.addEventListener("mousemove",Ke),document.addEventListener("mouseup",sa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ke),document.removeEventListener("mouseup",sa),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,Ke,sa]);let[_r,ce]=react.useState("all"),[de,ut]=react.useState(false),_=react.useRef(null),fe=react.useRef(null),ee=react.useMemo(()=>{let S=0;function X(pe,ye){for(let ke of pe)ye>S&&(S=ye),ke.subtasks?.length&&X(ke.subtasks,ye+1);}return X(e,1),S},[e]);react.useEffect(()=>{if(!de)return;let S=X=>{_.current?.contains(X.target)||fe.current?.contains(X.target)||ut(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),react.useEffect(()=>{if(_r==="all"){let pe=function(ye){for(let ke of ye)ke.subtasks?.length&&(ke.isExpanded===false&&r.onTaskToggleExpand?.(ke.id),pe(ke.subtasks));};pe(e);}else {let pe=function(ye,ke){for(let We of ye)if(We.subtasks?.length){let re=ke<_r,Pe=We.isExpanded!==false;re!==Pe&&r.onTaskToggleExpand?.(We.id),pe(We.subtasks,ke+1);}};pe(e,1);}},[_r]);let[O,te]=react.useState(null),[we,N]=react.useState(0),[H,me]=react.useState(0),K=react.useRef(null),[ve,nt]=react.useState(null),[ie,ot]=react.useState(null);react.useEffect(()=>{y&&st(S=>{if(S.length===y.length){let X=true;for(let pe=0;pe<S.length;pe++){let ye=S[pe],ke=y[pe];if(!ye||!ke||ye.id!==ke.id||ye.visible!==ke.visible||ye.width!==ke.width||ye.label!==ke.label){X=false;break}}if(X)return S}return y});},[y]),react.useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:je,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,je,dt]);let bt=react.useMemo(()=>{let S=new Set;function X(pe){for(let ye of pe)ye.subtasks?.length&&(ye.isExpanded!==false&&S.add(ye.id),X(ye.subtasks));}return X(e),S},[e]),Mt=react.useMemo(()=>Le.filter(S=>S.visible),[Le]),ir=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ha=react.useCallback(S=>{se===S?$e(X=>X==="asc"?"desc":"asc"):(Ze(S),$e("asc")),r.onSortChange?.({column:S,direction:_e==="asc"?"desc":"asc"});},[se,_e,r]),mr=react.useCallback(S=>{st(S),r.onColumnsChange?.(S);},[r]),tn=react.useCallback(S=>{let X=Le.map(pe=>pe.id===S?{...pe,visible:false}:pe);mr(X);},[Le,mr]),lr=react.useCallback((S,X)=>{Ze(S),$e(X);},[]),Ma=react.useCallback((S,X,pe)=>{B&&(S.preventDefault(),he({isOpen:true,x:S.clientX,y:S.clientY,type:X?"task":"header",task:X,columnId:pe}));},[B]),zo=react.useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Pn=react.useCallback((S,X)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let pe=Le.find(ye=>ye.id===X);pe&&(te(X),N(S.clientX),me(pe.width));},[Le,M]);react.useEffect(()=>{if(!O)return;let S=Le,X=ye=>{let ke=ye.clientX-we,We=Math.max(50,H+ke);S=S.map(re=>re.id===O?{...re,width:We}:re),st(S);},pe=()=>{r.onColumnsChange?.(S),te(null);};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",pe);}},[O,we,H,r]);let _n=react.useCallback((S,X)=>{if(X==="name"){S.preventDefault();return}nt(X),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",X),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Go=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),nt(null),ot(null);},[]),bi=react.useCallback((S,X)=>{S.preventDefault(),X!=="name"&&(S.dataTransfer.dropEffect="move",ot(X));},[]),Kr=react.useCallback(()=>{ot(null);},[]),Ds=react.useCallback((S,X)=>{if(S.preventDefault(),!ve||ve===X||X==="name")return;let pe=[...Le],ye=pe.findIndex(re=>re.id===ve),ke=pe.findIndex(re=>re.id===X);if(ye===-1||ke===-1)return;let We=pe.splice(ye,1);We[0]&&(pe.splice(ke,0,We[0]),mr(pe),nt(null),ot(null));},[ve,Le,mr]),Ga=react.useCallback(async S=>{if(r.onCreateCustomField){let X={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(X);}Y(false);},[r]),Va=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ba=react.useMemo(()=>{let S=I0(e);if(ft.trim()){let X=ft.toLowerCase();S=S.filter(pe=>pe.name.toLowerCase().includes(X));}if(je!=="all"){let X=new Set(S.filter(pe=>Va(pe)===je).flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}if(dt){let X=new Set(S.filter(pe=>Va(pe)!=="completed").flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}return S.sort((X,pe)=>{let ye,ke;switch(se){case "name":ye=X.name.toLowerCase(),ke=pe.name.toLowerCase();break;case "startDate":ye=X.startDate?.getTime()||0,ke=pe.startDate?.getTime()||0;break;case "endDate":ye=X.endDate?.getTime()||0,ke=pe.endDate?.getTime()||0;break;case "progress":ye=X.progress||0,ke=pe.progress||0;break;case "status":ye=X.status||"todo",ke=pe.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ye=We[X.priority]??4,ke=We[pe.priority]??4;break;case "position":return 0;default:return 0}return ye<ke?_e==="asc"?-1:1:ye>ke?_e==="asc"?1:-1:0}),S},[e,ft,je,dt,se,_e,Va]);ba.current=Ba;let ho=react.useCallback((S,X)=>{let pe=We=>{r.onTaskUpdate?.({...S,...We});},ye=We=>We?S.customFields?.find(Pe=>Pe.fieldId===We)?.value:void 0,ke=(We,re)=>{if(!We)return;let Ee=[...S.customFields||[]],at=Ee.findIndex($t=>$t.fieldId===We);at>=0?Ee[at]={fieldId:We,value:re}:Ee.push({fieldId:We,value:re}),pe({customFields:Ee});};switch(X.type){case "name":return null;case "status":return jsxRuntime.jsx(hg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{pe({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:z,locale:f,translations:I.status});case "priority":return jsxRuntime.jsx(xg,{value:S.priority,onChange:re=>pe({priority:re}),isDark:z,locale:f});case "assignees":{let re=S.hasChildren,Pe=S.assignees||[];if(re&&S.subtasks?.length){let Ee=new Map,at=$t=>{($t||[]).forEach(lt=>{(lt.assignees||[]).forEach(gt=>{Ee.has(gt.name)||Ee.set(gt.name,gt);}),lt.subtasks?.length&&at(lt.subtasks);});};at(S.subtasks),Pe=Array.from(Ee.values());}else re&&(Pe=[]);return jsxRuntime.jsx(yl,{value:Pe,availableUsers:l,onChange:Ee=>pe({assignees:Ee}),isDark:z,locale:f,disabled:re})}case "startDate":return jsxRuntime.jsx(vl,{value:S.startDate,onChange:re=>pe({startDate:re}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(vl,{value:S.endDate,onChange:re=>pe({endDate:re}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),Pe=re?L0(zd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Eg,{value:Pe,onChange:re?void 0:Ee=>{let at=Ee===100?"completed":Ee>0?"in-progress":"todo";pe({progress:Ee,status:at});},isDark:z,disabled:re})}case "tags":return jsxRuntime.jsx(Vg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Fg,{value:ye(X.customFieldId)||"",onChange:re=>ke(X.customFieldId,re),isDark:z});case "number":return jsxRuntime.jsx(Ig,{value:ye(X.customFieldId)||0,onChange:re=>ke(X.customFieldId,re),isDark:z});case "date":let We=ye(X.customFieldId);return jsxRuntime.jsx(vl,{value:We?new Date(We):void 0,onChange:re=>ke(X.customFieldId,re),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(Rg,{value:ye(X.customFieldId)||"",options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z});case "checkbox":return jsxRuntime.jsx($g,{value:ye(X.customFieldId)||false,onChange:re=>ke(X.customFieldId,re),isDark:z});case "multiselect":return jsxRuntime.jsx(Og,{value:ye(X.customFieldId)||[],options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z,maxSelectable:X.maxSelectable});case "person":{let re=ye(X.customFieldId)||[];return jsxRuntime.jsx(yl,{value:re.map(Pe=>({name:Pe.name,avatar:Pe.avatar,initials:Pe.initials||(Pe.name||"?").slice(0,2).toUpperCase(),color:Pe.color||"#00E5CC"})),availableUsers:l,onChange:Pe=>ke(X.customFieldId,Pe),isDark:z,locale:f})}case "file":return jsxRuntime.jsx(Wg,{value:ye(X.customFieldId),isDark:z,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.estimatedTime,onChange:Pe=>pe({estimatedTime:Pe}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsxRuntime.jsx(Ia,{value:S.quotedTime,onChange:Ee=>pe({quotedTime:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,Pe=S.executedDollarsCanonical;return jsxRuntime.jsx(Ia,{value:S.elapsedTime,onChange:Ee=>pe({elapsedTime:Ee}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S),financialOverride:Pe})}case "effortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{allocated:$t}=ks(S);if($==="financial"){let lt=ze(S),gt=Math.round(lt.dollarAllocated),rr=Math.round(lt.dollarQuoted),gr=rr-gt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[gt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",gt.toLocaleString("es-CO")]}):null,gr!==0&&gt>0&&rr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gr>0?"+":"",Math.abs(gr)>=1e3?`$${(gr/1e3).toFixed(1)}K`:`$${gr}`]})]})}return jsxRuntime.jsx(Ia,{value:$t>0?$t:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Z})}let re=S.status==="completed"||S.progress===100,Pe=S.effortMinutes||0,Ee=S.soldEffortMinutes||0,at=Oe(S);if($==="financial"&&at&&Pe>0&&Ee>0){let $t=Math.round(Pe/60*at),gt=Math.round(Ee/60*at)-$t;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ia,{value:Pe,onChange:rr=>pe({effortMinutes:rr}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)}),gt!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gt>0?"+":"",Math.abs(gt)>=1e3?`$${(gt/1e3).toFixed(1)}K`:`$${gt}`]})]})}return jsxRuntime.jsx(Ia,{value:Pe,onChange:$t=>pe({effortMinutes:$t}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(Ae&&S.subtasks&&S.subtasks.length>0){let{spent:Ee}=ks(S);return jsxRuntime.jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S),financialOverride:re})}let Pe=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Ee=>{r.onLogTime?.(S,Ee);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Pe,lens:$,hourlyRate:Oe(S),financialOverride:re})}case "soldEffortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{quoted:Ee}=ks(S),at=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,isBlurred:at,lens:$,hourlyRate:Oe(S)})}let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ia,{value:S.soldEffortMinutes,onChange:Ee=>pe({soldEffortMinutes:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,Pe=S.soldEffortMinutes||0,Ee=S.timeLoggedMinutes||0,at=re>0||Pe>0||Ee>0;return jsxRuntime.jsx(qg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(Ae&&S.hasChildren){let{spent:re,allocated:Pe,quoted:Ee}=ks(S),at=re>Pe&&Pe>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ws(re)}),Pe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ws(Pe)})]}),Ee>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ws(Ee)})]})]})}return jsxRuntime.jsx(Xg,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:$,hourlyRate:Oe(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(Qg,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(yl,{value:S.assignees||[],availableUsers:l,onChange:Pe=>{r.onTaskUpdate?.({...S,assignees:Pe});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(e0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let re=oe.get(S.id);if(re!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",re>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let Pe=S.weight||0;return jsxRuntime.jsx(Q1,{value:Pe,onChange:Ee=>pe({weight:Ee}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Ae,oe]),Kn=react.useCallback(S=>{let pe={name:I.columns.name,status:I.columns.status,priority:I.columns.priority,assignees:I.columns.assignees,startDate:I.columns.startDate,endDate:I.columns.endDate,progress:I.columns.progress,tags:I.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:I.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:I.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:I.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:I.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:I.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:I.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:I.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:I.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:I.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:I.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:I.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof pe=="string"?pe:String(pe||S.type)},[I,f]),yo=react.useMemo(()=>{let pe=Mt.reduce((ke,We)=>ke+We.width,0)+(k?48:0),ye={};for(let ke of Mt)ye[ke.id]=`${ke.width/pe*100}%`;return ye},[Mt,k]);return a?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:K,className:g(z?"bg-[#0D0D0D]":"bg-white",O&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ba.length," ",I.pagination.tasks]}),h&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:ft,onChange:S=>pt(S.target.value),placeholder:I.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&ee>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:_,onClick:()=>ut(!de),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?de?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":de?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),_r==="all"?f==="es"?"Todos":"All":`L${_r}`]}),de&&jsxRuntime.jsx("div",{ref:fe,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(ee,5)},(S,X)=>({value:X+1,label:`L${X+1}`}))].map(S=>jsxRuntime.jsxs("button",{onClick:()=>{ce(S.value),ut(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?_r===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":_r===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:S.label}),_r===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(T0,{value:je,hideCompleted:dt,onChange:Re,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsxRuntime.jsx("button",{onClick:()=>Fe(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:I.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(S=>{let X=S.id!=="name",pe=ie===S.id&&ve!==S.id;return jsxRuntime.jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",X&&"cursor-grab",S.type!=="name"&&"justify-center",ve===S.id&&"opacity-50",pe&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:yo[S.id],minWidth:S.minWidth},draggable:X,onDragStart:X?ye=>_n(ye,S.id):void 0,onDragEnd:X?Go:void 0,onDragOver:X?ye=>bi(ye,S.id):void 0,onDragLeave:X?Kr:void 0,onDrop:X?ye=>Ds(ye,S.id):void 0,onContextMenu:ye=>Ma(ye,void 0,S.id),children:[X&&jsxRuntime.jsx(lucideReact.GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxRuntime.jsxs("button",{draggable:false,onClick:ye=>{let ke=ye.currentTarget.getBoundingClientRect();d(S.id,ke);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),se===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ha(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",se===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Kn(S),m?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",O===S.id&&"bg-[#00E5CC]"),onMouseDown:ye=>Pn(ye,S.id)})]},S.id)}),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:S=>{S.stopPropagation(),J(X=>!X);},className:g("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",F&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(h0,{isOpen:F,onClose:()=>J(false),columns:Le,customFields:c,mostrarColumnasDensas:w,onColumnsChange:mr,onCreateCustomField:()=>{J(false),Y(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ba.map((S,X)=>{let pe=bt.has(S.id),ye=Math.min(X*.01,.2),ke=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(ke){let{spent:lt,allocated:gt,quoted:rr}=ks(S),gr=J1(S);return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ur=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Ur.type!=="name"&&"justify-center"),style:{width:yo[Ur.id],minWidth:Ur.minWidth},children:Ur.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),gr!==null&&v&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",gr>=1?"text-[#32D74B] bg-[#32D74B]/10":gr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",gr.toFixed(2)]})]})]}):Ur.type==="timeLoggedMinutes"?$==="financial"?(()=>{let Ot=S.executedDollarsCanonical,Kt=Ot!=null?Math.round(Ot):Math.round(ze(S).dollarSpent);return Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:lt>0?lt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="soldEffortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarQuoted);return Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ia,{value:rr>0?rr:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="effortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarAllocated),St=Math.round(Ot.dollarQuoted),xt=St-Kt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("es-CO")]}):null,xt!==0&&Kt>0&&St>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`]})]})})():jsxRuntime.jsx(Ia,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):ho(S,Ur)},Ur.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=Be===S.id,Pe=Ue===S.id,Ee=Pe&&Xe==="above",at=Pe&&Xe==="below",$t=Pe&&Xe==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:$t?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:lt=>Ma(lt,S),onMouseEnter:()=>Bt(S.id),onMouseLeave:()=>Bt(lt=>lt===S.id?null:lt),children:[Ee&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsxRuntime.jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:lt=>et(S.id,lt),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Mt.map(lt=>{let gt=!!(S.subtasks&&S.subtasks.length>0),rr=Qt(lt),Ur=!!rr&&!gt&&Hr===S.id&&!vr,Ot=!!vr&&!!rr&&Zr(vr.column,rr)&&jr(S.id);return jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",lt.type!=="name"&&"justify-center"),style:{width:yo[lt.id],minWidth:lt.minWidth,position:"relative",backgroundColor:Ot?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ot?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:lt.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.jsx("button",{onClick:Kt=>{Kt.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?z?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Ur&&rr?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[ho(S,lt),jsxRuntime.jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Kt=>ea(Kt,S.id,rr,X),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):ho(S,lt)},lt.id)}),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),W&&Ba.length>0&&(()=>{let{spent:S,allocated:X,quoted:pe}=De,ye=X-S,ke=ye<0,We=ke?`+${ws(Math.abs(ye))} ${f==="es"?"DE M\xC1S":"OVER"}`:`+${ws(ye)} ${f==="es"?"DE MARGEN":"REMAINING"}`,re=$==="financial"&&Z>0,Pe=Ce?.breakdown,Ee=!!Pe&&((Pe.equipment??0)>0||(Pe.travel??0)>0),at=Pe?.laborSpent!=null?Pe.laborSpent:Ce?.spent!=null?Ce.spent:De.dollarSpent,$t=Pe?.laborAllocated!=null?Pe.laborAllocated:Ce?.allocated!=null?Ce.allocated:De.dollarAllocated,lt=Ce?.quoted!=null?Ce.quoted:De.dollarQuoted,gt=(Ot,Kt)=>{if(re){let St=Kt??Ot/60*Z;return `$${Math.round(St).toLocaleString("es-CO")}`}return ws(Ot)},rr=re?Math.abs($t-at):0,gr=re?`+$${rr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,Ur=re&&Ee?f==="es"?"solo mano de obra":"labor only":void 0;return jsxRuntime.jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Rt&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ot=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:yo[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ur&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),Ur]})]}):Ot.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(S,re?at:void 0)}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,re?$t:void 0)})]}),X>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?gr:We})]}):Ot.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?gt(pe,re?lt:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(re&&pe>0&&X>0){let Kt=Math.round(lt),St=Math.round($t),xt=Kt-St,Mr=Kt>0?Math.round(xt/Kt*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,$t)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>=0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Mr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?gt(X,re?$t:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?gt(S,re?at:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let Kt=L0(zd(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Kt,"%"]})})():Ot.type==="weight"?(()=>{let Kt=e||[],St=[],xt=pa=>{for(let qr of pa)St.push(qr),qr.subtasks?.length&&xt(qr.subtasks);};xt(Kt);let ya=St.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),Ca=Math.abs(ya-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Ca?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ya.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ba.length===0&&ft&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsxRuntime.jsx(D0,{data:He.data,isDark:z,locale:f,onClose:()=>Fe(false),lens:t?.lens,onUnassignedTaskClick:S=>{let X=document.querySelector(`[data-task-id="${S}"]`);X&&(X.scrollIntoView({behavior:"smooth",block:"center"}),Qe(S),setTimeout(()=>Qe(null),2e3));}})]}),jsxRuntime.jsx(i0,{state:ue,onClose:zo,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:tn,onColumnSort:lr,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),xe&&mt&&Be&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let X=Te.flattenTasks(e).find(pe=>pe.id===Be);return X?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsxRuntime.jsx(v0,{isOpen:R,onClose:()=>Y(false),onSave:Ga,isDark:z,locale:f})]})}var B0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],$0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],O0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Gd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Vd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},jd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Ml={dark:Gd,light:Vd,neutral:jd};function H0(e){return Ml[e]||Ml.dark}function Pl(e,t,r,a,n=5){let s=[],o=[],l=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of l){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let c={};for(let p=r;p<=a;p++)c[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)c[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function U0(e){return e==="es"?Z1:eC}function W0(e){return (e.getDay()+6)%7}function z0(e,t){let r=new Date(e,t,1),a=W0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},l=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},c=l(r),i=new Date(e,t+1,0),d=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:d}}function ii(e,t){return W0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&r(o.subtasks,l,c);}};return r(e,"",""),t}function G0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function V0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Fl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),l=42,c=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=G0(d.startDate),f=G0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?V0(v):V0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?nC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=aC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(x,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function j0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var _d=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ll({locale:e}){let t=U0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Al({bar:e,ws:t,money:r,projColor:a,slotH:n=_d}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":e.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),l>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function Il({chip:e,ws:t,slotH:r=_d}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:iC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Rl({more:e,ws:t,slotH:r=_d,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function _0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function K0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:uC.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function q0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=react.useState(false),x=react.useRef(null),h=d==="es";react.useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsxRuntime.jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsxRuntime.jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function Y0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function J0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var X0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function Q0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=X0[r]||X0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function ef(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Z0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return Z0[e%Z0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var Kd="\xA0";function Bo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function tf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(ef(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:vC(c),initials:xC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((c.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function rf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=ef(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:m,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:p=>{!c||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!c||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${Kd}/${Kd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Bo(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",Kd,Bo(l.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function af({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Bo(s),"h asignadas / ",Bo(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Bo(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Bo(i.hours),"h / ",Bo(i.capacity),"h"]})]},i.name)})})]})}var qd=28,CC=182;function of({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=l==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),c&&c[x]?jsxRuntime.jsx(rf,{days:c[x].days,capByDay:c[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=react.useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),m=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:p,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ii(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Al,{bar:f,ws:t,money:s,projColor:o,slotH:qd})},`b${x}`)),d.chips.map((f,x)=>jsxRuntime.jsx(Il,{chip:f,ws:t,slotH:qd},`c${x}`)),d.more.map((f,x)=>jsxRuntime.jsx(Rl,{more:f,ws:t,slotH:qd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function sf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function lf(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?sf(l):sf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function cf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(s.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function df({onExpand:e}){return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ts(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function uf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Ts(r.oldProjectEnd,n)} \u2192 ${Ts(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Ts(r.oldStart,n)," \u2013 ",Ts(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Ts(r.newStart,n)," \u2013 ",Ts(r.newEnd,n)]})]})]}),d?jsxRuntime.jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function pf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>l?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Bl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Yd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function mf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Bl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Bl(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=l(f);x>u&&(u=x);}let p=Yd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function gf(e,t,r){let a=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Bl(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Yd(p)*864e5));}s.set(c.id,d===1/0?r:d);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Bl(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function $l(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=mf(n,new Map),i=gf(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=mf(d,new Map([[t,r.getTime()]])),u=gf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Yd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function ff(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Ol=26,$C="#5B7FD4";function bf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=react.useState("mes"),[k,M]=react.useState(()=>{let j=new Date,xe={y:j.getFullYear(),m:j.getMonth()},Ie=(e??[]).map(Xe=>Xe.startDate?new Date(Xe.startDate):null).filter(Xe=>!!Xe&&!isNaN(Xe.getTime()));if(Ie.length===0||(e??[]).some(Xe=>{let Dt=Xe.startDate?new Date(Xe.startDate):null,mt=Xe.endDate?new Date(Xe.endDate):Dt;if(!Dt||isNaN(Dt.getTime()))return false;let Jt=new Date(xe.y,xe.m,1),xr=new Date(xe.y,xe.m+1,0,23,59,59);return Dt<=xr&&(mt??Dt)>=Jt}))return xe;let Ct=Ie.reduce((Xe,Dt)=>Xe<Dt?Xe:Dt);return {y:Ct.getFullYear(),m:Ct.getMonth()}}),[B,T]=react.useState(false),[C,P]=react.useState([]),[D,V]=react.useState("all"),[$,Z]=react.useState(null),[L,Ae]=react.useState(null),[W,Ce]=react.useState(false),[I,z]=react.useState(null),[Oe,ze]=react.useState(false),Q=react.useMemo(()=>z0(k.y,k.m),[k.y,k.m]),De=a||$C,oe=react.useMemo(()=>{let j=new Set;for(let xe of h){let Ie=new Date(`${xe}T12:00:00`),Ue=Q.dateToSerial(Ie);Ue>=1&&Ue<=42&&j.add(Ue);}return j},[h,Q]);react.useEffect(()=>{y?.({start:ff(Q.serialToDate(1)),end:ff(Q.serialToDate(42))});},[k.y,k.m]);let He=x.length,Se=react.useMemo(()=>{let j=b?.hoursPerDay;if(!j)return 8;let xe=[j.monday,j.tuesday,j.wednesday,j.thursday,j.friday].map(Ie=>Ie||0).filter(Ie=>Ie>0);return xe.length?Math.round(xe.reduce((Ie,Ue)=>Ie+Ue,0)/xe.length*10)/10:8},[b]),Fe=react.useMemo(()=>Fl({tasks:e,grid:Q,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,Q,De,o,r]),Ge=react.useMemo(()=>{if(d===false)return [];let j=new Map;for(let xe of Fe.calTasks)xe.phaseId&&xe.phaseName&&j.set(xe.phaseId,xe.phaseName);return [...j.entries()].map(([xe,Ie])=>({id:xe,name:Ie})).sort((xe,Ie)=>xe.name.localeCompare(Ie.name))},[Fe.calTasks,d]),Qe=!C.includes("tareas"),se=!C.includes("cpm"),Ze=react.useMemo(()=>{let j=Qe?Fe.calTasks:[];return D!=="all"&&(j=j.filter(xe=>xe.phaseId===D)),se||(j=j.map(xe=>xe.critical?{...xe,critical:false}:xe)),j},[Fe.calTasks,Qe,se,D]),_e=react.useMemo(()=>{let j=new Set;return C.includes("hitos")&&(j.add("hito"),j.add("desembolso")),C.includes("ext")&&j.add("ext"),C.includes("aus")&&j.add("aus"),Fe.dayItems.filter(xe=>!j.has(xe.type))},[Fe.dayItems,C]),$e=!C.includes("festivos"),ft=new Date,pt=Q.dateToSerial(new Date(ft.getFullYear(),ft.getMonth(),ft.getDate())),je=j=>P(xe=>xe.includes(j)?xe.filter(Ie=>Ie!==j):[...xe,j]),Re=()=>M(j=>{let xe=new Date(j.y,j.m-1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),dt=()=>M(j=>{let xe=new Date(j.y,j.m+1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),zt=()=>{let j=new Date;M({y:j.getFullYear(),m:j.getMonth()});},Le=(j,xe,Ie)=>{if(!p||xe===0)return;let Ue=Fe.calTasks.find(Jt=>Jt.uid===j);if(!Ue)return;let Ct=xe*864e5,Xe=new Date(Ue.realStart.getTime()+Ct),Dt=new Date(Ue.realEnd.getTime()+Ct),mt=$l(e,j,Xe,Dt);mt&&z({uid:j,taskId:Ue.id,taskName:Ue.name,sim:mt,anchor:Ie});},st=async()=>{if(!I||!f)return;ze(true);let j=[{id:I.uid,startDate:I.sim.newStart,endDate:I.sim.newEnd},...I.sim.movedSuccessors.map(Ie=>({id:Ie.id,startDate:Ie.newStart,endDate:Ie.newEnd}))],xe=await f(j);ze(false),xe&&z(null);},F=j0(k.y,k.m,n),J=[{id:"",name:t,color:De}],R=react.useMemo(()=>lf(e,o),[e,o]),Y=react.useMemo(()=>{if(v==="lookahead"){let j=Q.weeks.find(Ie=>pt>=Ie.ws&&pt<=Ie.we)??Q.weeks[0],xe=Q.weeks.indexOf(j);return Q.weeks.slice(xe,xe+2)}return v==="semana"?[Q.weeks.find(xe=>pt>=xe.ws&&pt<=xe.we)??Q.weeks[0]]:[]},[v,Q.weeks,pt]),ue=react.useMemo(()=>{let j={};return Y.forEach((xe,Ie)=>{let Ue=[];for(let Xe=xe.ws;Xe<=xe.we;Xe++)Ue.push({serial:Xe,date:Q.serialToDate(Xe),isWeekend:ii(Q,Xe),isHoliday:oe.has(Xe)});let Ct=tf(x,Ue,Se);j[Ie]={days:Ue,capByDay:Ct};}),j},[Y,Q,oe,x,Se]),he=v==="semana"||v==="lookahead",Be=v==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx(K0,{view:v,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(q0,{monthLabel:F,onPrev:Re,onNext:dt,onToday:zt,layersOpen:B,onToggleLayers:()=>T(j=>!j),layersOff:C,phases:Ge,phaseFilter:D,onPhaseChange:V,locale:n,children:B?jsxRuntime.jsx(Y0,{off:C,onToggle:je}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsxRuntime.jsx(pf,{grid:Q,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ll,{locale:n}),jsxRuntime.jsx(of,{grid:Q,weeks:Y,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,capRows:ue,teamSize:He,onTaskOpen:i,onMore:(j,xe,Ie)=>Z({day:j,items:xe,tasks:Ie}),onCapDay:(j,xe,Ie)=>{for(let Ue of Object.keys(ue)){let Ct=ue[+Ue].capByDay.get(j);if(Ct){Ae({dayLabel:xe,perPerson:Ct.perPerson,anchor:Ie.getBoundingClientRect()});break}}}})]}):Fe.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ll,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(hf,{grid:Q,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsxRuntime.jsx(Q0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ll,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(OC,{grid:Q,ws:j.ws,we:j.we,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,onTaskOpen:i,onMore:(xe,Ie,Ue)=>Z({day:xe,items:Ie,tasks:Ue}),canReschedule:p,onDragReschedule:Le,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsxRuntime.jsx(J0,{dayLabel:`${Q.serialToDate($.day).getDate()}`,items:$.items,tasks:$.tasks.map(j=>({swatch:De,taskId:j.id,label:j.name,critical:j.critical,value:l==="$"?j.cost:`${j.hrs}h`})),onClose:()=>Z(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,L?jsxRuntime.jsx(af,{dayLabel:L.dayLabel,perPerson:L.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${L.anchor.top-8}px`,left:`${L.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,I?jsxRuntime.jsx(uf,{taskName:I.taskName,taskId:I.sim.taskId,sim:I.sim,busy:Oe,locale:n,onConfirm:st,onCancel:()=>z(null),style:{position:"fixed",top:`${I.anchor.top+12}px`,left:`${Math.min(I.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),W?jsxRuntime.jsx(cf,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsxRuntime.jsx(df,{onExpand:()=>Ce(true)})]}),jsxRuntime.jsx(_0,{projects:J})]})}function hf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=r;c++)l.push(c);return jsxRuntime.jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,m=n&&s.has(c),u="cal-day";return ii(e,c)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=react.useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(BC,h.laneCount*Ol+36),v=react.useRef(null),[w,k]=react.useState(null),M=(B,T)=>{if(!p||!f){m?.(T);return}B.preventDefault();let C=v.current;if(!C)return;let P=C.getBoundingClientRect().width/7,D=B.clientX,V=0,$=L=>{let Ae=Math.round((L.clientX-D)/P);V=Ae,k({id:T,days:Ae});},Z=L=>{if(window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",Z),k(null),V===0){m?.(T);return}let Ae=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Ae);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",Z);};return jsxRuntime.jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(hf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=x?.uid===B.t.uid?x.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsxRuntime.jsx("div",{onPointerDown:Z=>M(Z,B.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Al,{bar:$,ws:t,money:s,projColor:o,slotH:Ol})},`b${T}`)}),h.chips.map((B,T)=>jsxRuntime.jsx(Il,{chip:B,ws:t,slotH:Ol},`c${T}`)),h.more.map((B,T)=>jsxRuntime.jsx(Rl,{more:B,ws:t,slotH:Ol,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),d=react.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=react.useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var xf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ci(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 di(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 vf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function wf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...xf,...o}),[o]),[i,d]=react.useState(new Set),m=react.useRef(null),u=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),B=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:B<7?`${B}d ago`:y.toLocaleDateString()},b=react.useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return react.useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[di(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let k=i.has(v.id),M=s===v.id,B=vf(v.type);return jsxRuntime.jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(v),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:di(v.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&v.userAvatar&&jsxRuntime.jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ci(v)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(C.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(C)})]},T))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function Cf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let d=[.5,1,1.5,2,3],m=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:m&&di(m.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:m&&ci(m)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>l(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:ci(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(p=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Jd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Qd(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 Tf(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 Nf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=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(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Df({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[d,m]=react.useState([]),[u,p]=react.useState(null),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=_C(e,t,r.width,r.height,r,150);m($);},[e,t,r]);let M=react.useCallback(($,Z)=>{r.enableDragging&&(Z.stopPropagation(),p($));},[r.enableDragging]),B=react.useCallback($=>{if(!u||!i.current)return;let L=i.current.getBoundingClientRect(),Ae=($.clientX-L.left-w.x)/y,W=($.clientY-L.top-w.y)/y;m(Ce=>Ce.map(I=>I.id===u?{...I,x:Ae,y:W,fx:Ae,fy:W}:I));},[u,y,w]),T=react.useCallback(()=>{p(null);},[]),C=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),P=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),D=react.useCallback($=>{let Z=d.find(L=>L.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[d]),V=react.useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Z=$.card.priority;return Z==="URGENT"?"#ef4444":Z==="HIGH"?"#f59e0b":Z==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Tf($)," ",Qd($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Z=D(typeof $.source=="string"?$.source:$.source.id),L=D(typeof $.target=="string"?$.target:$.target.id),Ae=Nf($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsxRuntime.jsx("line",{x1:Z.x,y1:Z.y,x2:L.x,y2:L.y,stroke:Jd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsxRuntime.jsx("text",{x:(Z.x+L.x)/2,y:(Z.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let Z=f===$.id,L=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",Z&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>M($.id,Ae),onMouseEnter:()=>x($.id),onMouseLeave:()=>x(null),onClick:Ae=>C($,Ae),children:[jsxRuntime.jsx("circle",{r:L?r.nodeSize*1.2:r.nodeSize,fill:V($),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:Z?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Mf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,d]=react.useState(null),[m,u]=react.useState(null),p=react.useRef(null),f=l||n;react.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),react.useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{m&&(r(m),x());};return e?jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((y,v)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},v))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((y,v)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},v)),m.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:p,value:s,onChange:y=>o(y.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-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,v)=>jsxRuntime.jsx("button",{onClick:()=>o(y),disabled:f,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:y},v))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:f,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"}),m?jsxRuntime.jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Zd={"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Zd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ui(e){return `$${e.toFixed(4)}`}var eu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(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(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),l=r.filter(m=>m.success),c=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,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],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(d=>d.timestamp>=o).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)}},Oo=new eu;function Lf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Oo.getStats()),[s,o]=react.useState(Oo.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Oo.getStats()),o(Oo.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),react.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=Oo.getRecentOperations(5);return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ui(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,m=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ui(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:ui(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Rf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[d,m]=react.useState(""),[u,p]=react.useState(false),[f,x]=react.useState(null),[h,b]=react.useState(null),[y,v]=react.useState(null),w=react.useRef(null),k=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let P=D=>{D.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),m(""),x(null),b(null),v(null),t());},B=async()=>{if(!(!o.trim()||k)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",C,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:o,onChange:P=>l(P.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-[#00E5CC]/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:P=>i(P.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-[#00E5CC]/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,D)=>jsxRuntime.jsx("button",{onClick:()=>l(P),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:B,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&ki(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,y)=>{a(v=>{let w=v.cards.find(P=>P.id===h);if(!w)return v;let k=w.columnId,M={...w,columnId:b,position:y},B=v.cards.map(P=>P.id===h?M:P),T=v.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(D=>D!==h)};if(P.id===b){let D=B.filter(V=>V.columnId===b).sort((V,$)=>V.position-$.position);return {...P,cardIds:D.map(V=>V.id)}}return P}),C={...v,cards:B,columns:T};return n(C),C});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:v};return n(w),w});},[n]),l=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,v],columns:w};return n(k),k});},[n]),c=react.useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let v=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(B=>B!==h)}:M),k={...b,cards:v,columns:w};return n(k),k});},[n]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=react.useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:v};return n(w),w});},[n]),m=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),v=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),p=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=react.useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:c,deleteColumn:m,clearBoard:f}}}function $f({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Wl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(m=>m.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var pi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Hf={by:"none",order:"asc"};function Uf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...pi,...e}),[s,o]=react.useState({...Hf,...t}),l=react.useCallback(x=>{n(h=>({...h,...x}));},[]),c=react.useCallback(x=>{o(h=>({...h,...x}));},[]),i=react.useCallback(()=>{n(pi),o(Hf);},[]),d=react.useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),m=react.useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),p=react.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=react.useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${v}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let B=M.endDate||M.dueDate;if(!B)return false;let T;if(typeof B=="string")T=B.split("T")[0]||B;else {let C=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),D=String(B.getUTCDate()).padStart(2,"0");T=`${C}-${P}-${D}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let C=new Date(k+"T00:00:00"),P=new Date(T+"T00:00:00"),D=new Date(C);return D.setDate(D.getDate()+7),P>=C&&P<=D;case "custom":if(a.dateRange){let V=typeof B=="string"?new Date(B):B;return V>=a.dateRange.start&&V<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;v=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=M[b.priority||"LOW"],T=M[y.priority||"LOW"];v=B-T;break;case "dueDate":let C=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!C)return 1;if(!P)return -1;let D=typeof C=="string"?new Date(C).getTime():C.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();v=D-V;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,Z=y.estimatedTime||0;v=$-Z;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var zf,Gf;if(typeof window<"u")try{let e=xi("ai");zf=e.generateObject,Gf=e.generateText;}catch{}function Vf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(zf&&Gf&&e.apiKey),o=react.useCallback(async m=>{if(!s)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:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),l=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),c=react.useCallback(async m=>{if(!s)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(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=react.useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function ru(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function jf(e){let{cards:t}=e,[r,a]=ru(),n=react.useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=react.useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,k]=y<v?[y,v]:[v,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=react.useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=react.useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:d}}var _f={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Kf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({..._f,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((x,h,b,y,v)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=react.useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=react.useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=react.useCallback(async x=>{let h=t.filter(k=>k.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let v=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{v.has(M)||v.set(M,[]),v.get(M).push(k);});}),v.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${B} ${M} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let B=(await a.findSimilar(k,h)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(B.length>=n.minCardsPerStack-1){let T=[k.id,...B.map(P=>P.card.id)],C=B.reduce((P,D)=>P+D.similarity,0)/B.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:C});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var qf=react.createContext(null);function Yf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=xi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=xi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=xi("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(qf.Provider,{value:{store:n},children:e})}function zl(){let e=react.useContext(qf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=zl(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=react.useCallback(y=>{e.deleteColumn(y);},[e]),m=react.useCallback(y=>e.getColumn(y),[e]),u=react.useCallback(y=>{e.addCard(y);},[e]),p=react.useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),x=react.useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Jf(e){let{cards:t}=gi();return react.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)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 Qf(e="position",t="asc"){let{cards:r}=gi();return react.useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var Gl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=$u.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 s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.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 s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Gl;function eb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=c?c(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},h)})})})}function tb(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function ab({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let d=react.useRef(null),m=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:p,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=c?c(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function nb(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function ob(e,t=10){return e>t}var su={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},iu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},cu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},du={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mu={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)"},gu={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)"},fu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bu={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}},hu={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}},Vl={spacing:su,borderRadius:iu,fontSize:lu,fontWeight:cu,lineHeight:du,zIndex:uu,duration:pu,easing:mu,shadows:gu,opacity:fu,kanban:bu,gantt:hu};function sb(e,t,r){return e[t]??r}function yu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?yu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xu(e="asakaa"){let t=yu(Vl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
415
415
  ${r.join(`
416
416
  `)}
417
- }`}function gi(e,t="asakaa"){let r=[],a=hu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
417
+ }`}function fi(e,t="asakaa"){let r=[],a=yu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
418
418
  ${r.join(`
419
419
  `)}
420
- }`}var Vl={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:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},xu={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:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},vu={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:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function wu(e=Vl,t="asakaa"){let r=yu(t),a=gi(e,t);return `${r}
420
+ }`}var jl={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:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},vu={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:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},wu={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:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function ku(e=jl,t="asakaa"){let r=xu(t),a=fi(e,t);return `${r}
421
421
 
422
- ${a}`}function sb(){return `/**
422
+ ${a}`}function ib(){return `/**
423
423
  * ASAKAA Design Tokens
424
424
  * Auto-generated from design-tokens.ts
425
425
  * Do not edit this file directly
426
426
  */
427
427
 
428
- ${wu(Vl)}
428
+ ${ku(jl)}
429
429
 
430
430
  /* Light theme */
431
431
  [data-theme="light"] {
432
- ${gi(xu,"asakaa").split(`
432
+ ${fi(vu,"asakaa").split(`
433
433
  `).slice(1,-1).join(`
434
434
  `)}
435
435
  }
436
436
 
437
437
  /* Neutral theme */
438
438
  [data-theme="neutral"] {
439
- ${gi(vu,"asakaa").split(`
439
+ ${fi(wu,"asakaa").split(`
440
440
  `).slice(1,-1).join(`
441
441
  `)}
442
442
  }
443
- `}var h5=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function ib({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=as();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,l])=>{let c=o,i=c===a;return jsxRuntime.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:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(h5,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
444
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Ff;exports.AI_FEATURES=YC;exports.AI_MODELS=Qd;exports.AddCardButton=Dc;exports.AddColumnButton=wc;exports.AttachmentUploader=es;exports.BoardProvider=qf;exports.BulkOperationsToolbar=ji;exports.BurnDownChart=Ic;exports.CUSTOM_FIELD_TYPES=$0;exports.CalendarBoard=ff;exports.Card=An;exports.CardHistoryReplay=kf;exports.CardHistoryTimeline=vf;exports.CardRelationshipsGraph=Nf;exports.CardStack=UC;exports.CardTemplateSelector=Wc;exports.CircuitBreaker=ec;exports.Column=Yo;exports.ColumnManager=Ji;exports.CommandPalette=Mc;exports.ConfigMenu=jc;exports.ContextMenu=ls;exports.DEFAULT_SHORTCUTS=Gs;exports.DEFAULT_TABLE_COLUMNS=R0;exports.DEFAULT_TEMPLATES=Uc;exports.DateRangePicker=Ms;exports.DependenciesSelector=Fs;exports.DependencyLine=Xs;exports.DistributionCharts=Rc;exports.EditableColumnTitle=lc;exports.ErrorBoundary=Zo;exports.ExportDropdown=Sm;exports.ExportImportModal=Gc;exports.FilterBar=Vc;exports.GANTT_AI_SYSTEM_PROMPT=ig;exports.GanttAIAssistant=cl;exports.GanttBoard=ag;exports.GanttI18nContext=os;exports.GanttMilestone=ol;exports.GanttToolbar=Xi;exports.GenerateGanttTasksDialog=If;exports.GeneratePlanModal=Ef;exports.GroupBySelector=Oc;exports.HealthBar=gc;exports.KanbanBoard=Zn;exports.KanbanToolbar=xc;exports.KanbanViewAdapter=Ws;exports.KeyboardShortcutsHelp=Hc;exports.ListView=I0;exports.MenuIcons=rr;exports.PluginManager=zl;exports.PrioritySelector=ko;exports.ProfitabilityReport=fc;exports.QuickTaskCreate=Hs;exports.RATE_LIMITS=qC;exports.STANDARD_FIELDS=B0;exports.SwimlaneBoardView=Bc;exports.TagBadge=dc;exports.TagList=xp;exports.TagPicker=Xo;exports.TaskBar=el;exports.TaskDetailModal=So;exports.TaskFormModal=sg;exports.TaskGrid=Zi;exports.ThemeModal=Yc;exports.ThemeProvider=fm;exports.ThemeSwitcher=ib;exports.TimeInputPopover=wn;exports.TimePill=uc;exports.TimePopover=pc;exports.Timeline=sl;exports.UserAssignmentSelector=To;exports.VelocityChart=Ac;exports.VirtualGrid=rb;exports.VirtualList=Zf;exports.aiUsageTracker=Oo;exports.borderRadius=su;exports.buildCalendar=Pl;exports.calculatePosition=vi;exports.cardToGanttTask=pl;exports.cardsToGanttTasks=gg;exports.cn=g;exports.createKanbanView=Yp;exports.createRetryWrapper=Pb;exports.darkTheme=_c;exports.darkTokenTheme=Vl;exports.defaultTheme=Ki;exports.designTokens=Gl;exports.duration=uu;exports.easing=pu;exports.exportTokensToCSS=sb;exports.findTaskByName=Un;exports.fontSize=iu;exports.fontWeight=lu;exports.formatCost=di;exports.ganttEnTranslations=Yi;exports.ganttEsTranslations=hm;exports.ganttTaskToCardUpdate=mg;exports.ganttThemes=it;exports.ganttTokens=bu;exports.ganttTranslations=Xc;exports.ganttUtils=Te;exports.generateCSSVariables=yu;exports.generateCompleteCSS=wu;exports.generateInitialPositions=Db;exports.generateTasksContext=lg;exports.generateThemeVariables=gi;exports.getListViewTheme=O0;exports.getListViewTranslations=xd;exports.getToken=ob;exports.getTranslations=ym;exports.kanbanTokens=fu;exports.lightTheme=Kc;exports.lightTokenTheme=xu;exports.lineHeight=cu;exports.listViewDarkTheme=zd;exports.listViewEnTranslations=hd;exports.listViewEsTranslations=yd;exports.listViewLightTheme=Gd;exports.listViewNeutralTheme=Vd;exports.listViewThemes=El;exports.listViewTranslations=ml;exports.mergeListViewTranslations=gl;exports.mergeTranslations=Jc;exports.neutralTheme=qc;exports.neutralTokenTheme=vu;exports.opacity=gu;exports.parseLocalCommand=ug;exports.parseNaturalDate=gd;exports.parseNaturalDuration=fd;exports.parseProgress=bd;exports.parseStatus=dg;exports.pluginManager=m5;exports.retrySyncOperation=Mb;exports.retryWithBackoff=wi;exports.shadows=mu;exports.shouldVirtualizeGrid=nb;exports.simulateReschedule=Bl;exports.spacing=ou;exports.themes=Mo;exports.useAI=Gf;exports.useBoard=Bf;exports.useBoardCore=mi;exports.useBoardStore=Wl;exports.useCardStacking=_f;exports.useDragState=hc;exports.useFilteredCards=Xf;exports.useFilters=Hf;exports.useGanttI18n=Ka;exports.useKanbanState=Ul;exports.useKeyboardShortcuts=pm;exports.useMultiSelect=Vf;exports.useSelectionState=tu;exports.useSortedCards=Jf;exports.useTheme=as;exports.useVirtualGrid=ab;exports.useVirtualList=eb;exports.validateAIResponse=pg;exports.withErrorBoundary=Sc;exports.wouldCreateCircularDependency=Ti;exports.zIndex=du;//# sourceMappingURL=index.cjs.map
443
+ `}var h5=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function lb({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=as();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,l])=>{let c=o,i=c===a;return jsxRuntime.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:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(h5,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
444
+ Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Lf;exports.AI_FEATURES=YC;exports.AI_MODELS=Zd;exports.AddCardButton=Sc;exports.AddColumnButton=kc;exports.AttachmentUploader=es;exports.BoardProvider=Yf;exports.BulkOperationsToolbar=_i;exports.BurnDownChart=Rc;exports.CUSTOM_FIELD_TYPES=O0;exports.CalendarBoard=bf;exports.Card=An;exports.CardHistoryReplay=Cf;exports.CardHistoryTimeline=wf;exports.CardRelationshipsGraph=Df;exports.CardStack=UC;exports.CardTemplateSelector=zc;exports.CircuitBreaker=tc;exports.Column=Yo;exports.ColumnManager=Qi;exports.CommandPalette=Pc;exports.ConfigMenu=_c;exports.ContextMenu=ls;exports.DEFAULT_SHORTCUTS=Vs;exports.DEFAULT_TABLE_COLUMNS=B0;exports.DEFAULT_TEMPLATES=Wc;exports.DateRangePicker=Ps;exports.DependenciesSelector=Ls;exports.DependencyLine=Js;exports.DistributionCharts=Bc;exports.EditableColumnTitle=cc;exports.ErrorBoundary=Zo;exports.ExportDropdown=Em;exports.ExportImportModal=Vc;exports.FilterBar=jc;exports.GANTT_AI_SYSTEM_PROMPT=lg;exports.GanttAIAssistant=dl;exports.GanttBoard=ng;exports.GanttI18nContext=os;exports.GanttMilestone=sl;exports.GanttToolbar=Ji;exports.GenerateGanttTasksDialog=Rf;exports.GeneratePlanModal=Mf;exports.GroupBySelector=Hc;exports.HealthBar=fc;exports.KanbanBoard=eo;exports.KanbanToolbar=vc;exports.KanbanViewAdapter=zs;exports.KeyboardShortcutsHelp=Uc;exports.ListView=R0;exports.MenuIcons=tr;exports.PluginManager=Gl;exports.PrioritySelector=ko;exports.ProfitabilityReport=bc;exports.QuickTaskCreate=Us;exports.RATE_LIMITS=qC;exports.STANDARD_FIELDS=$0;exports.SwimlaneBoardView=$c;exports.TagBadge=uc;exports.TagList=vp;exports.TagPicker=Xo;exports.TaskBar=tl;exports.TaskDetailModal=So;exports.TaskFormModal=ig;exports.TaskGrid=el;exports.ThemeModal=Xc;exports.ThemeProvider=bm;exports.ThemeSwitcher=lb;exports.TimeInputPopover=wn;exports.TimePill=pc;exports.TimePopover=mc;exports.Timeline=il;exports.UserAssignmentSelector=To;exports.VelocityChart=Ic;exports.VirtualGrid=ab;exports.VirtualList=eb;exports.aiUsageTracker=Oo;exports.borderRadius=iu;exports.buildCalendar=Fl;exports.calculatePosition=wi;exports.cardToGanttTask=ml;exports.cardsToGanttTasks=fg;exports.cn=g;exports.createKanbanView=Xp;exports.createRetryWrapper=Pb;exports.darkTheme=Kc;exports.darkTokenTheme=jl;exports.defaultTheme=qi;exports.designTokens=Vl;exports.duration=pu;exports.easing=mu;exports.exportTokensToCSS=ib;exports.findTaskByName=Un;exports.fontSize=lu;exports.fontWeight=cu;exports.formatCost=ui;exports.ganttEnTranslations=Xi;exports.ganttEsTranslations=ym;exports.ganttTaskToCardUpdate=gg;exports.ganttThemes=it;exports.ganttTokens=hu;exports.ganttTranslations=Jc;exports.ganttUtils=Te;exports.generateCSSVariables=xu;exports.generateCompleteCSS=ku;exports.generateInitialPositions=Db;exports.generateTasksContext=cg;exports.generateThemeVariables=fi;exports.getListViewTheme=H0;exports.getListViewTranslations=vd;exports.getToken=sb;exports.getTranslations=xm;exports.kanbanTokens=bu;exports.lightTheme=qc;exports.lightTokenTheme=vu;exports.lineHeight=du;exports.listViewDarkTheme=Gd;exports.listViewEnTranslations=yd;exports.listViewEsTranslations=xd;exports.listViewLightTheme=Vd;exports.listViewNeutralTheme=jd;exports.listViewThemes=Ml;exports.listViewTranslations=gl;exports.mergeListViewTranslations=fl;exports.mergeTranslations=Qc;exports.neutralTheme=Yc;exports.neutralTokenTheme=wu;exports.opacity=fu;exports.parseLocalCommand=pg;exports.parseNaturalDate=fd;exports.parseNaturalDuration=bd;exports.parseProgress=hd;exports.parseStatus=ug;exports.pluginManager=m5;exports.retrySyncOperation=Mb;exports.retryWithBackoff=ki;exports.shadows=gu;exports.shouldVirtualizeGrid=ob;exports.simulateReschedule=$l;exports.spacing=su;exports.themes=Mo;exports.useAI=Vf;exports.useBoard=$f;exports.useBoardCore=gi;exports.useBoardStore=zl;exports.useCardStacking=Kf;exports.useDragState=yc;exports.useFilteredCards=Jf;exports.useFilters=Uf;exports.useGanttI18n=qa;exports.useKanbanState=Wl;exports.useKeyboardShortcuts=mm;exports.useMultiSelect=jf;exports.useSelectionState=ru;exports.useSortedCards=Qf;exports.useTheme=as;exports.useVirtualGrid=nb;exports.useVirtualList=tb;exports.validateAIResponse=mg;exports.withErrorBoundary=Ec;exports.wouldCreateCircularDependency=Ni;exports.zIndex=uu;//# sourceMappingURL=index.cjs.map
445
445
  //# sourceMappingURL=index.cjs.map