@libxai/board 1.9.34 → 1.9.35

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'),Bb=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 Bb__default=/*#__PURE__*/_interopDefault(Bb);var vi=(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 wi=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 [wi.Translate.toString(e),wi.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 ki(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 Fb(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function rc(e,t){return e.length===0?1e3:t===0?ki(null,e[0].position):t>=e.length?ki(e[e.length-1].position,null):ki(e[t-1].position,e[t].position)}function Wu(e,t=100){return e>t}var Lb=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 Ab(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 Ci(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Lb,onRetry:l}=t,c,i=0;for(let u=1;u<=r;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(p){if(c=p,u===r||!o(c,u))return {error:c,attempts:i,success:false};let m=Ab(u,a,n,s);if(l)try{l(c,u,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Ib(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 Rb(e,t={}){return async(...r)=>Ci(()=>e(...r),t)}var ac=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 zu=(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))(zu||{}),ko=class ko{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",...ko.globalOptions};}static configure(t){ko.globalOptions={...ko.globalOptions,...t};}child(t){return new ko({...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 Ti((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new Ti(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:zu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};ko.globalOptions={};var nc=ko,Ti=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}},Gu=new nc;function $b(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 Ob(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,oc(s.title),oc(s.description||""),oc(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 Hb(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 Bb__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,u=o.width/o.height,p=c-20,d=p/u;d>i-20&&(d=i-20,p=d*u);let m=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(l,"PNG",f,20,p,d),m}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 u=n.splitTextToSize(c.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function oc(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function ju(e,t,r,a){switch(t){case "json":return $b(e,a);case "csv":return Ob(e);case "pdf":return await Hb(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function _u(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${a}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let 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 Ub(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 Wb(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=Ku(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Ku(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((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.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(d),p.cardIds.push(d.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 Ku(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 qu(e,t){switch(t){case "json":return Ub(e);case "csv":return Wb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yu(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 sc=react.createContext(null);function Xu(){return react.useContext(sc)}var Ju=react.createContext(null);function Qu({children:e,themeName:t}){return jsxRuntime.jsx(Ju.Provider,{value:{themeName:t},children:e})}function Ni(){return react.useContext(Ju)}function sr({children:e,container:t}){let[r,a]=react.useState(false),n=Xu(),s=Ni();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 ap={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Yb="#BDC3C7",Xb=({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 Co({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 m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};react.useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),react.useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let u=m=>{t(m),n(false);},p=e?ap[e]:null,d=p?.color||Yb;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?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(sr,{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(ap).map(([m,f])=>jsxRuntime.jsxs("button",{onClick:()=>u(m),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:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Xb,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&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"})})]},m)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.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 Jb=[{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),d=(Ni()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,R=380,C=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let P=w-x.bottom,T=x.top,V;P>=R+C?V=x.bottom+C:T>=R+C?V=x.top-R-C:V=P>=T?x.bottom+C:Math.max(10,x.top-R-C),l({top:V,left:N}),s(true);};react.useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,k=N=>{let P=N.getFullYear(),T=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${P}-${T}-${V}`},M=k(w),R=new Date(w);R.setDate(R.getDate()+x);let C=k(R);r(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=R=>{if(R instanceof Date)return R;if(typeof R!="string"||!R.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=R.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let N=C[0],P=C[1],T=C[2];return N===void 0||P===void 0||T===void 0?null:new Date(N,P-1,T)},w=x(e),k=x(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 x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):m(),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?`${v()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsxRuntime.jsx(sr,{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:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:Jb.map(x=>jsxRuntime.jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:x=>r(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:x=>r(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function No({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[l,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),p=react.useRef(null),d=react.useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,R=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let N=x-y.bottom,P=y.top,T;N>=M+R?T=y.bottom+R:P>=M+R?T=y.top-M-R:T=N>=P?y.bottom+R:Math.max(10,y.top-M-R),u({top:T,left:C}),o(true);};react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);r(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=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:d,onClick:()=>s?o(false):m(),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(sr,{children:jsxRuntime.jsxs("div",{ref:p,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:v.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(y=>{let x=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:x?"#00E5CC":"transparent"},children:x?"\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 Di(e,t,r){let a=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.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 u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))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,u]=react.useState(""),[p,d]=react.useState(t.length>0),[m,f]=react.useState({top:0,left:0}),[v,h]=react.useState(null),b=react.useRef(null),y=react.useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,Y=C.right-T;Y<10&&(Y=C.left),Y+T>P-10&&(Y=P-T-10);let L=N-C.bottom,Re=C.top,U;L>=V+O?U=C.bottom+O:Re>=V+O?U=C.top-V-O:U=L>=Re?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:Y}),c(true);};react.useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,Y=C.right-T;Y<10&&(Y=C.left),Y+T>P-10&&(Y=P-T-10);let L=N-C.bottom,Re=C.top,U;L>=V+O?U=C.bottom+O:Re>=V+O?U=C.top-V-O:U=L>=Re?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:Y});},[p,l]),react.useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!y.current?.contains(N.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{let C=N=>{N.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let N=t.includes(C),P=r.find(T=>T.id===C);if(h(null),N){let T=t.filter(V=>V!==C);a(T),T.length===0&&d(false);}else {if(s&&Di(r,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}a([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||a([]);},M=r.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),R=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?c(false):x(),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:R,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:R},children:t.length})]}),l&&jsxRuntime.jsx(sr,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.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:[v&&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:v})]}),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:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&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"})]})}),p&&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:C=>u(C.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(C=>{let N=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>w(C.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:N?"#00E5CC":"transparent",borderColor:N?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:N&&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:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Bn=react.memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:wi.Transform.toString(d),transition:m};if(t)return jsxRuntime.jsx("div",{ref:p,style:v,...i,...u,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/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,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(Co,{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(No,{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)));Bn.displayName="Card";var Si={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"}},mp=({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 gp({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),u=[...Object.entries(Si).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Si).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=Si[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"}:{...Si.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let R=b-h.bottom,C=h.top,N;R>=w+k?N=h.bottom+k:C>=w+k?N=h.top-w-k:N=R>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:N,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 m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsxRuntime.jsx(mp,{icon:f.icon,color:v})}),n&&jsxRuntime.jsx(sr,{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:u.map(h=>jsxRuntime.jsxs("button",{onClick:()=>m(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(mp,{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 fp={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 bp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=fp[s]||fp.en,[l,c]=react.useState(false),[i,u]=react.useState(false),[p,d]=react.useState(e),[m,f]=react.useState({top:0,left:0}),v=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=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(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=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(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(sr,{children:jsxRuntime.jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.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:p,onChange:k=>d(k.target.value),onKeyDown:w,onBlur:x,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 Jo=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),M=react.useRef(null),R=u??Wu(t.length),C=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:R}),N=t.filter(Y=>!Y.metadata?.isContainer).length;if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let Y=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:Y}:Y>=80?{state:"warning",percentage:Y}:Y>=60?{state:"approaching",percentage:Y}:{state:"ok",percentage:Y}})(),V=T.state==="exceeded",O=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,N):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(O()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),T.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),T.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),T.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsxRuntime.jsx(bp,{columnTitle:e.title,onRename:Y=>f?.(e.id,Y),onDelete:v?()=>v(e.id):void 0,isDeletable:h,locale:x}),m&&jsxRuntime.jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsxRuntime.jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:R?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(Y=>Y.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"})}):R?jsxRuntime.jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(Y=>{let L=t[Y.index];return L?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Y.start}px)`},children:jsxRuntime.jsx(Bn,{card:L,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},L.id):null})}):t.map(Y=>jsxRuntime.jsx(Bn,{card:Y,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i},Y.id))})})]})});Jo.displayName="Column";function uc({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 u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.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 hh(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 kp(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,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function yh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function xh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var vh=["\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 Cp({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:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=react.useState(false),[x,w]=react.useState([]),[k,M]=react.useState(0),[R,C]=react.useState(null),[N,P]=react.useState(false),T=react.useRef(null),V=react.useRef(null),O=react.useRef(null),Y=react.useRef(null),L=react.useCallback((ce,Fe)=>{let X=hh(ce,Fe);if(C(X),X){let Pe=a.filter(Ne=>Ne.name.toLowerCase().includes(X.query)||Ne.email&&Ne.email.toLowerCase().includes(X.query)).slice(0,5);w(Pe),y(Pe.length>0),M(0);}else y(false),w([]);},[a]),Re=ce=>{let Fe=ce.target.value;if(t(Fe),L(Fe,ce.target.selectionStart||0),T.current){T.current.style.height="24px";let X=T.current.scrollHeight,Pe=280,Ne=Math.min(X,Pe);T.current.style.height=`${Ne}px`,T.current.style.overflowY=X>Pe?"auto":"hidden";}},U=()=>{T.current&&L(e,T.current.selectionStart||0);},Te=react.useCallback(ce=>{if(!R||!T.current)return;let Fe=e.slice(0,R.start),X=e.slice(R.end),Pe=`@${ce.name.replace(/\s+/g,"")} `,Ne=Fe+Pe+X;t(Ne),y(false),C(null),setTimeout(()=>{if(T.current){let Oe=R.start+Pe.length;T.current.selectionStart=Oe,T.current.selectionEnd=Oe,T.current.focus();}},0);},[R,e,t]),B=ce=>{if(b&&x.length>0)switch(ce.key){case "ArrowDown":ce.preventDefault(),M(Fe=>Fe<x.length-1?Fe+1:0);break;case "ArrowUp":ce.preventDefault(),M(Fe=>Fe>0?Fe-1:x.length-1);break;case "Enter":{ce.preventDefault();let Fe=x[k];Fe&&Te(Fe);break}case "Tab":{ce.preventDefault();let Fe=x[k];Fe&&Te(Fe);break}case "Escape":ce.preventDefault(),y(false);break}else ce.key==="Enter"&&!ce.shiftKey&&(ce.preventDefault(),r());};react.useEffect(()=>{let ce=Fe=>{V.current&&!V.current.contains(Fe.target)&&T.current&&!T.current.contains(Fe.target)&&y(false),Y.current&&!Y.current.contains(Fe.target)&&P(false);};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]);let z=react.useCallback(ce=>{if(!T.current)return;let Fe=T.current.selectionStart||e.length,X=e.slice(0,Fe)+ce+e.slice(Fe);t(X),P(false),setTimeout(()=>{if(T.current){let Pe=Fe+ce.length;T.current.selectionStart=Pe,T.current.selectionEnd=Pe,T.current.focus();}},0);},[e,t]),Me=react.useCallback(ce=>{if(!m||!ce.target.files)return;let Fe=Array.from(ce.target.files),X=v*1024*1024,Pe=Fe.filter(Ne=>Ne.size>X?(console.warn(`File ${Ne.name} exceeds max size of ${v}MB`),false):true);Pe.length>0&&m(Pe),ce.target.value="";},[m,v]),We=react.useCallback(ce=>ce.type.startsWith("image/")?lucideReact.Image:ce.type.includes("pdf")||ce.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&V.current){let ce=V.current.children[k];ce&&ce.scrollIntoView({block:"nearest"});}},[k,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(ce=>{let Fe=We(ce.file),X=ce.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:[X&&ce.preview?jsxRuntime.jsx("img",{src:ce.preview,alt:ce.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Fe,{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:ce.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:xh(ce.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(ce.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"})})]},ce.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:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!N),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:N&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,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:vh.map(ce=>jsxRuntime.jsx("button",{type:"button",onClick:()=>z(ce),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:ce},ce))})})})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.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:O,type:"file",multiple:true,onChange:Me,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:Re,onSelect:U,onKeyDown:B,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()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.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&&x.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:x.map((ce,Fe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Te(ce),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Fe===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:ce.color||"#8B5CF6"},children:yh(ce.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:ce.name}),ce.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:ce.email})]})]},ce.id))})})]})]})]})}function Tp({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 Li=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Qo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[p,d]=react.useState(false),[m,f]=react.useState(Li[10]||"#00E5CC"),[v,h]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),x=react.useRef(null),w=react.useRef(null),k=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),M=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let T=y.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[l]),react.useEffect(()=>{let T=V=>{let O=V.target,Y=b.current?.contains(O),L=x.current?.contains(O);!Y&&!L&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let R=T=>{let V=e.some(O=>O.id===T.id);r(V?e.filter(O=>O.id!==T.id):[...e,T]);},C=async()=>{if(!(!a||!i.trim())){d(true);try{let T=await a(i.trim(),m);T&&(r([...e,T]),u(""),f(Li[Math.floor(Math.random()*Li.length)]||"#00E5CC"));}finally{d(false);}}},N=(T,V)=>{V.stopPropagation(),r(e.filter(O=>O.id!==T));},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(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.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:x,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:v.top,left:v.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:T=>u(T.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:T=>{T.key==="Enter"&&i.trim()&&!M&&a&&C();}})}),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(T=>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:`${T.color}20`,color:T.color},onClick:V=>N(T.id,V),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(T=>{let V=e.some(O=>O.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.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:Li.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:m===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?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 mc({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 Dp({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(mc,{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 So=[{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 Sp(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){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 Ph({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 gc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Mh(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=Sp(e.loggedMinutes),i=e.estimateMinutes?Sp(e.estimateMinutes):null,u=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(Ph,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function Fh(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 Ii(e){let t=Fh(e);return t!==null?String(t):e}function Mp(e){let r=Ii(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 Ri(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 Ih(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 Rh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Bh({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 Pp({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 $h({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 fc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=react.useState(""),[f,v]=react.useState(t.estimateMinutes?Ri(t.estimateMinutes):""),[h,b]=react.useState(""),[y,x]=react.useState(false),[w,k]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{M.current?.focus();},[]);let R=async()=>{let P=Mp(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?Mp(f):null;await o(P),k(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),R()),P.key==="Escape"&&u?.();};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",p),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:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Pp,{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:Ih(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(Bh,{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(Pp,{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(Rh,{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($h,{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:d,onChange:P=>m(P.target.value),onKeyDown:N,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:R,disabled:y||!d.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:N,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:Ri(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=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,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?Ri(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:Ri(P.durationMinutes)})]},P.id))})]})]})}function zh(e){let r=Ii(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 Gh(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 Tn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[l,c]=react.useState(Gh(a)),[i,u]=react.useState(""),[p,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=zh(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.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:x=>x.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:m,type:"text",value:l,onChange:x=>c(x.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:x=>u(x.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:p||!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:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:p,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 Vh(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 jh(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 hc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Vh(e.health),s=jh(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 Zo(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 Kh(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 qh(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 Yh(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 Xh({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?"+":"",Zo(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:Zo(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:Zo(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 Jh({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?Zo(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(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,Zo(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",qh(e.status,r),Kh(e.status,r)),children:Yh(e.status,t)})})]})}function yc({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",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=react.useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",p,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",p,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",u),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",p),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(Xh,{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:d,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsxRuntime.jsx(Jh,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",p),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 es(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 uy(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 Up(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 py(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 Eo({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:R=0,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:T,onTimerStop:V,onTimerDiscard:O,blurFinancials:Y=false}){let L=s==="dark",Re={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)"},U=e&&"title"in e&&!("name"in e),Te=e,[B,z]=react.useState(e?Up(e,l):null),[Me,We]=react.useState(false),[ce,Fe]=react.useState(false),[X,Pe]=react.useState(false),[Ne,Oe]=react.useState(null),[ze,rt]=react.useState(new Date),[ne,Ke]=react.useState(false),[je,He]=react.useState(false),[gt,Mt]=react.useState(""),[Ge,Be]=react.useState(false),[st,Wt]=react.useState(false),[Ue,dt]=react.useState(false),[F,J]=react.useState(false),[I,q]=react.useState(""),pe=react.useRef(null),ve=react.useRef(null),[Ae,Ce]=react.useState(""),ft=react.useRef(null),[oe,fe]=react.useState(""),[et,Xe]=react.useState(false),[kt,tt]=react.useState([]),[St,mr]=react.useState(""),[cr,Rt]=react.useState(false),Lr=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 D=Up(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),z(D),q(D.description||""),Ce(D.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!I)return;let D=setTimeout(()=>{let H=ve.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,I]),react.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current),ft.current&&clearTimeout(ft.current);},[]),react.useEffect(()=>{t&&Lr.current&&f.length>0&&setTimeout(()=>{Lr.current&&(Lr.current.scrollTop=Lr.current.scrollHeight);},100);},[t,f.length]);let Ot=react.useCallback(D=>{z(D),U&&n&&Te?n(py(D,Te)):a&&a(D);},[U,Te,n,a]),kr=react.useCallback(()=>{We(false),Fe(false),Pe(false),Oe(null),He(false),Mt(""),Be(false);},[]),Vt=react.useCallback((D,H)=>{if(!B)return;let ue={...B,[D]:H};Ot(ue);},[B,Ot]),ar=react.useCallback(()=>{let D=ve.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ua=react.useCallback(D=>{q(D),setTimeout(ar,0),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>{if(B){let H={...B,description:D};Ot(H);}},800);},[B,Ot,ar]),Zr=react.useCallback(D=>{Ce(D),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{if(B&&D.trim()){let H={...B,name:D.trim()};Ot(H);}},800);},[B,Ot]),nt=react.useCallback(D=>{let H=D.map(ue=>{let ke={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ue};return ue.type.startsWith("image/")&&(ke.preview=URL.createObjectURL(ue)),ke});tt(ue=>[...ue,...H]);},[]),Je=react.useCallback(D=>{tt(H=>{let ue=H.find(ke=>ke.id===D);return ue?.preview&&URL.revokeObjectURL(ue.preview),H.filter(ke=>ke.id!==D)});},[]),Nr=react.useCallback(async()=>{if(!(!B||!oe.trim()&&kt.length===0||!v)){Xe(true);try{let D=kp(oe,b),H=[];if(kt.length>0&&y){let ue=kt.map(ke=>ke.file);H=await y(ue);}await v(B.id,oe.trim(),D.length>0?D:void 0,H.length>0?H:void 0),fe(""),kt.forEach(ue=>{ue.preview&&URL.revokeObjectURL(ue.preview);}),tt([]);}finally{Xe(false);}}},[B,oe,kt,v,b,y]),wa=react.useCallback(()=>{if(!B||!St.trim())return;let D=B.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:St.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},ue=[...D,H],ke={...B,subtasks:ue};Ot(ke),mr(""),Rt(false);},[B,St,Ot]),Dr=react.useCallback(D=>{if(!B?.subtasks)return;let H=B.subtasks.map(ke=>ke.id===D?{...ke,progress:ke.progress===100?0:100}:ke),ue={...B,subtasks:H};Ot(ue);},[B,Ot]),_r=react.useCallback(D=>{if(!B?.subtasks)return;let H=B.subtasks.filter(ke=>ke.id!==D),ue={...B,subtasks:H};Ot(ue);},[B,Ot]),Wr=react.useCallback(D=>{let H=typeof D=="string"?new Date(D):D,ke=new Date().getTime()-H.getTime(),me=Math.floor(ke/6e4),Se=Math.floor(ke/36e5),se=Math.floor(ke/864e5);return me<1?o==="es"?"Ahora":"Just now":me<60?o==="es"?`Hace ${me} min`:`${me}m ago`:Se<24?o==="es"?`Hace ${Se}h`:`${Se}h ago`:se<7?o==="es"?`Hace ${se}d`:`${se}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),le=react.useCallback(D=>{if(!B)return;let H=B.progress||0;D==="completed"?H=100:D==="in-progress"&&H===0?H=10:D==="todo"&&(H=0);let ue={...B,status:D,progress:H};Ot(ue),We(false);},[B,Ot]),de=react.useCallback((D,H)=>{if(!B)return;let ue={...B,startDate:D,endDate:H};Ot(ue);},[B,Ot]),pt=react.useCallback(()=>{let D=ze.getFullYear(),H=ze.getMonth(),ue=new Date(D,H,1),me=new Date(D,H+1,0).getDate(),Se=ue.getDay(),se=[],it=new Date(D,H,0).getDate();for(let Et=Se-1;Et>=0;Et--)se.push({date:new Date(D,H-1,it-Et),isCurrentMonth:false});for(let Et=1;Et<=me;Et++)se.push({date:new Date(D,H,Et),isCurrentMonth:true});let bt=42-se.length;for(let Et=1;Et<=bt;Et++)se.push({date:new Date(D,H+1,Et),isCurrentMonth:false});return se},[ze]),j=react.useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),dt(false),!B||!p)return;let H=Array.from(D.dataTransfer.files);if(H.length!==0){J(true);try{await p(B.id,H);}finally{J(false);}}},[B,p]),be=react.useCallback(async D=>{if(!B||!p||!D.target.files)return;let H=Array.from(D.target.files);if(H.length!==0){J(true);try{await p(B.id,H);}finally{J(false);}D.target.value="";}},[B,p]),te=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),dt(true);},[]),$=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),dt(false);},[]),ee=react.useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),we=react.useCallback(D=>D.startsWith("image/")?lucideReact.Image:D.includes("pdf")||D.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&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:B.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 D=B.progress===100?0:100,ue={...B,progress:D,status:D===100?"completed":"todo"};Ot(ue);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Ae,onChange:D=>Zr(D.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",B.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:()=>{kr(),We(!Me);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&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(D=>jsxRuntime.jsxs("button",{onClick:()=>le(D.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",B.status===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.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:()=>{kr(),Pe(!X);},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:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((D,H)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},H)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",B.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:X&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(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(D=>{let H=B.assignees?.some(ue=>ue.name===D.name);return jsxRuntime.jsxs("button",{onClick:()=>{let ue=B.assignees||[],ke;H?ke=ue.filter(me=>me.name!==D.name):ke=[...ue,D],Vt("assignees",ke);},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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:D.name}),H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},D.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:()=>{Oe(Ne?null:"start"),rt(B.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:[B.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"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(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:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,H=new Date(D);H.setDate(D.getDate()+1);let ue=new Date(D);ue.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let ke=new Date(D);ke.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let me=new Date(D);me.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Se=new Date(D);Se.setDate(D.getDate()+14);let se=new Date(D);return se.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: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:ue,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ke,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:me,display:me.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Se,display:Se.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:se,display:se.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Et)=>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(Ne==="start"){let nr=B.endDate&&bt.date>B.endDate?bt.date:B.endDate;de(bt.date,nr),Oe("end");}else {let nr=B.startDate&&bt.date<B.startDate?bt.date:B.startDate;de(nr,bt.date),Oe(null);}},children:[jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Et))})(),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),Oe(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:Ne==="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:()=>rt(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:()=>rt(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:()=>rt(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(D=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((D,H)=>{let ue=D.date.toDateString()===new Date().toDateString(),ke=B.startDate?.toDateString()===D.date.toDateString(),me=B.endDate?.toDateString()===D.date.toDateString(),Se=ke||me,se=B.startDate&&B.endDate&&D.date>=B.startDate&&D.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let it=new Date(D.date);if(Ne==="start"){let bt=B.endDate&&it>B.endDate?it:B.endDate;de(it,bt),Oe("end");}else {let bt=B.startDate&&it<B.startDate?it:B.startDate;de(bt,it),Oe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(L?"text-white":"text-gray-900"),ue&&"ring-2 ring-[#00E5CC]",ke&&"bg-[#00E5CC] text-white",me&&!ke&&"bg-[#7C3AED] text-white",se&&!Se&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Se&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:D.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:()=>{kr(),Fe(!ce);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(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(D=>jsxRuntime.jsxs("button",{onClick:()=>{Vt("priority",D.id),Fe(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",B.priority===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.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:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.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:[ne?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:D=>{let H=parseInt(D.target.value),ue=B.status;H===100?ue="completed":H>0?ue="in-progress":ue="todo";let ke={...B,progress:H,status:ue};Ot(ke);},onBlur:()=>Ke(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:()=>Ke(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",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),x&&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:B.status==="completed"||B.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?es(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Wt("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:es(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Wt("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:st==="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(Tn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async D=>{await N?.(B.id,D),Wt(false);},onClose:()=>Wt(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:Y?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"}):B.status==="completed"||B.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:B.quotedMinutes?es(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Wt("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:es(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Wt("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:st==="quoted"&&!Y&&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(Tn,{mode:"quoted",locale:o,isDark:L,currentValue:B.quotedMinutes||null,onSave:async D=>{P?(await P(B.id,D),z(H=>H?{...H,quotedMinutes:D}:null)):Vt("quotedMinutes",D),Wt(false);},onClose:()=>Wt(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:[B.status==="completed"||B.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?.(B.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"}),uy(R||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(B.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"})}),B.status==="completed"||B.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:()=>Wt("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:[es(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",es(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:st==="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(Tn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(D,H)=>{D&&await C?.(B.id,{durationMinutes:D,note:H,source:"manual"}),Wt(false);},onClose:()=>Wt(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(Qo,{selectedTags:B.tags||[],availableTags:c,onChange:D=>{Vt("tags",D);},onCreateTag:i,theme:Re})]}),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:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(D=>{let H=m.find(ue=>ue.id===D);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||D.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let ue=(B.dependencies||[]).filter(ke=>ke!==D);Vt("dependencies",ue);},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"})})]},D)})}),jsxRuntime.jsxs("button",{onClick:()=>{kr(),He(!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:()=>{He(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:gt,onChange:D=>Mt(D.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:m.length>0?m.filter(D=>D.id!==B.id).filter(D=>gt===""||D.name.toLowerCase().includes(gt.toLowerCase())).map(D=>{let H=B.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>{let ue=B.dependencies||[],ke;H?ke=ue.filter(me=>me!==D.id):ke=[...ue,D.id],Vt("dependencies",ke);},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:D.name}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.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:()=>{kr(),Be(!Ge);},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:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:So.find(D=>D.value===B.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:Ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(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:So.map(D=>{let H=B.color===D.value;return jsxRuntime.jsx("button",{onClick:()=>{Vt("color",D.value),Be(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:D.value,outlineColor:H?D.value:void 0},title:D.name,children:H&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},D.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:B.isMilestone||false,onChange:D=>Vt("isMilestone",D.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.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:ve,value:I,onChange:D=>ua(D.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",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(D=>D.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((D,H)=>(D.position??0)-(H.position??0)).map(D=>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:()=>Dr(D.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.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:D.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("button",{onClick:()=>_r(D.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"})})]},D.id))}),cr?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:St,onChange:D=>mr(D.target.value),onKeyDown:D=>{D.key==="Enter"&&St.trim()?wa():D.key==="Escape"&&(Rt(false),mr(""));},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:wa,disabled:!St.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",St.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),mr("");},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",u.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(D=>{let H=we(D.type),ue=D.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:[ue&&D.thumbnailUrl?jsxRuntime.jsx("img",{src:D.thumbnailUrl,alt:D.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:D.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ee(D.size)})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(D.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"})})]},D.id)})}),jsxRuntime.jsxs("div",{onDragOver:te,onDragLeave:$,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ue?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:be,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||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",Ue?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Ue?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"})]})}),!p&&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'),Ub=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 Ub__default=/*#__PURE__*/_interopDefault(Ub);var vi=(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 wi=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 [wi.Translate.toString(e),wi.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 ki(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 Rb(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function ac(e,t){return e.length===0?1e3:t===0?ki(null,e[0].position):t>=e.length?ki(e[e.length-1].position,null):ki(e[t-1].position,e[t].position)}function zu(e,t=100){return e>t}var Bb=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 $b(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 Ci(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Bb,onRetry:l}=t,c,i=0;for(let u=1;u<=r;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(p){if(c=p,u===r||!o(c,u))return {error:c,attempts:i,success:false};let m=$b(u,a,n,s);if(l)try{l(c,u,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Ob(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 Hb(e,t={}){return async(...r)=>Ci(()=>e(...r),t)}var nc=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 Gu=(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))(Gu||{}),Co=class Co{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",...Co.globalOptions};}static configure(t){Co.globalOptions={...Co.globalOptions,...t};}child(t){return new Co({...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 Ti((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new Ti(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Gu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};Co.globalOptions={};var oc=Co,Ti=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}},Vu=new oc;function Wb(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 zb(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,sc(s.title),sc(s.description||""),sc(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 Gb(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 Ub__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,u=o.width/o.height,p=c-20,d=p/u;d>i-20&&(d=i-20,p=d*u);let m=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(l,"PNG",f,20,p,d),m}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 u=n.splitTextToSize(c.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function sc(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function _u(e,t,r,a){switch(t){case "json":return Wb(e,a);case "csv":return zb(e);case "pdf":return await Gb(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Ku(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${a}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let 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 Vb(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 jb(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=qu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=qu(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((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.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(d),p.cardIds.push(d.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 qu(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 Yu(e,t){switch(t){case "json":return Vb(e);case "csv":return jb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xu(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 ic=react.createContext(null);function Ju(){return react.useContext(ic)}var Qu=react.createContext(null);function Zu({children:e,themeName:t}){return jsxRuntime.jsx(Qu.Provider,{value:{themeName:t},children:e})}function Ni(){return react.useContext(Qu)}function ir({children:e,container:t}){let[r,a]=react.useState(false),n=Ju(),s=Ni();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 np={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Zb="#BDC3C7",eh=({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 To({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 m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};react.useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),react.useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let u=m=>{t(m),n(false);},p=e?np[e]:null,d=p?.color||Zb;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?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),a&&jsxRuntime.jsx(ir,{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(np).map(([m,f])=>jsxRuntime.jsxs("button",{onClick:()=>u(m),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:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(eh,{color:f.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&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"})})]},m)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.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 th=[{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),d=(Ni()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,I=380,C=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let P=w-x.bottom,T=x.top,V;P>=I+C?V=x.bottom+C:T>=I+C?V=x.top-I-C:V=P>=T?x.bottom+C:Math.max(10,x.top-I-C),l({top:V,left:N}),s(true);};react.useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,k=N=>{let P=N.getFullYear(),T=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${P}-${T}-${V}`},M=k(w),I=new Date(w);I.setDate(I.getDate()+x);let C=k(I);r(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=I.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let N=C[0],P=C[1],T=C[2];return N===void 0||P===void 0||T===void 0?null:new Date(N,P-1,T)},w=x(e),k=x(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 x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>n?s(false):m(),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?`${v()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsxRuntime.jsx(ir,{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:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:th.map(x=>jsxRuntime.jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:x=>r(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:x=>r(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Do({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=react.useState(false),[l,c]=react.useState(""),[i,u]=react.useState({top:0,left:0}),p=react.useRef(null),d=react.useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,I=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let N=x-y.bottom,P=y.top,T;N>=M+I?T=y.bottom+I:P>=M+I?T=y.top-M-I:T=N>=P?y.bottom+I:Math.max(10,y.top-M-I),u({top:T,left:C}),o(true);};react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);r(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=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:d,onClick:()=>s?o(false):m(),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(ir,{children:jsxRuntime.jsxs("div",{ref:p,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:v.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(y=>{let x=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:x?"#00E5CC":"transparent"},children:x?"\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 Di(e,t,r){let a=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.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 u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))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,u]=react.useState(""),[p,d]=react.useState(t.length>0),[m,f]=react.useState({top:0,left:0}),[v,h]=react.useState(null),b=react.useRef(null),y=react.useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,X=C.right-T;X<10&&(X=C.left),X+T>P-10&&(X=P-T-10);let F=N-C.bottom,Fe=C.top,U;F>=V+O?U=C.bottom+O:Fe>=V+O?U=C.top-V-O:U=F>=Fe?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:X}),c(true);};react.useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,X=C.right-T;X<10&&(X=C.left),X+T>P-10&&(X=P-T-10);let F=N-C.bottom,Fe=C.top,U;F>=V+O?U=C.bottom+O:Fe>=V+O?U=C.top-V-O:U=F>=Fe?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:X});},[p,l]),react.useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!y.current?.contains(N.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),react.useEffect(()=>{let C=N=>{N.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let N=t.includes(C),P=r.find(T=>T.id===C);if(h(null),N){let T=t.filter(V=>V!==C);a(T),T.length===0&&d(false);}else {if(s&&Di(r,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}a([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||a([]);},M=r.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#00E5CC":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${n||""}`,children:[jsxRuntime.jsxs("button",{ref:y,onClick:()=>l?c(false):x(),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:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),l&&jsxRuntime.jsx(ir,{children:jsxRuntime.jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.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:[v&&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:v})]}),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:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&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"})]})}),p&&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:C=>u(C.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(C=>{let N=t.includes(C.id);return jsxRuntime.jsxs("button",{onClick:()=>w(C.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:N?"#00E5CC":"transparent",borderColor:N?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:N&&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:C.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var 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:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=sortable.useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:wi.Transform.toString(d),transition:m};if(t)return jsxRuntime.jsx("div",{ref:p,style:v,...i,...u,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/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,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(To,{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(Do,{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 Si={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"}},gp=({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 fp({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),u=[...Object.entries(Si).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Si).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=Si[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"}:{...Si.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let I=b-h.bottom,C=h.top,N;I>=w+k?N=h.bottom+k:C>=w+k?N=h.top-w-k:N=I>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:N,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 m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:i,onClick:()=>n?s(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsxRuntime.jsx(gp,{icon:f.icon,color:v})}),n&&jsxRuntime.jsx(ir,{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:u.map(h=>jsxRuntime.jsxs("button",{onClick:()=>m(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(gp,{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 bp={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 hp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=bp[s]||bp.en,[l,c]=react.useState(false),[i,u]=react.useState(false),[p,d]=react.useState(e),[m,f]=react.useState({top:0,left:0}),v=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=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(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=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(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(ir,{children:jsxRuntime.jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.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:p,onChange:k=>d(k.target.value),onKeyDown:w,onBlur:x,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 Qo=react.memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),M=react.useRef(null),I=u??zu(t.length),C=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:I}),N=t.filter(X=>!X.metadata?.isContainer).length;if(r)return jsxRuntime.jsx("div",{ref:w,className:b,children:r(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let X=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:X}:X>=80?{state:"warning",percentage:X}:X>=60?{state:"approaching",percentage:X}:{state:"ok",percentage:X}})(),V=T.state==="exceeded",O=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,N):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(O()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),T.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),T.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),T.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsxRuntime.jsx(hp,{columnTitle:e.title,onRename:X=>f?.(e.id,X),onDelete:v?()=>v(e.id):void 0,isDeletable:h,locale:x}),m&&jsxRuntime.jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsxRuntime.jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:I?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(X=>X.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"})}):I?jsxRuntime.jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(X=>{let F=t[X.index];return F?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${X.start}px)`},children:jsxRuntime.jsx(An,{card:F,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},F.id):null})}):t.map(X=>jsxRuntime.jsx(An,{card:X,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i},X.id))})})]})});Qo.displayName="Column";function pc({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 u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return a?jsxRuntime.jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.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 wh(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 Cp(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,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function kh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ch(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Th=["\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 Tp({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:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=react.useState(false),[x,w]=react.useState([]),[k,M]=react.useState(0),[I,C]=react.useState(null),[N,P]=react.useState(false),T=react.useRef(null),V=react.useRef(null),O=react.useRef(null),X=react.useRef(null),F=react.useCallback((ce,Le)=>{let J=wh(ce,Le);if(C(J),J){let Pe=a.filter(Ee=>Ee.name.toLowerCase().includes(J.query)||Ee.email&&Ee.email.toLowerCase().includes(J.query)).slice(0,5);w(Pe),y(Pe.length>0),M(0);}else y(false),w([]);},[a]),Fe=ce=>{let Le=ce.target.value;if(t(Le),F(Le,ce.target.selectionStart||0),T.current){T.current.style.height="24px";let J=T.current.scrollHeight,Pe=280,Ee=Math.min(J,Pe);T.current.style.height=`${Ee}px`,T.current.style.overflowY=J>Pe?"auto":"hidden";}},U=()=>{T.current&&F(e,T.current.selectionStart||0);},De=react.useCallback(ce=>{if(!I||!T.current)return;let Le=e.slice(0,I.start),J=e.slice(I.end),Pe=`@${ce.name.replace(/\s+/g,"")} `,Ee=Le+Pe+J;t(Ee),y(false),C(null),setTimeout(()=>{if(T.current){let $e=I.start+Pe.length;T.current.selectionStart=$e,T.current.selectionEnd=$e,T.current.focus();}},0);},[I,e,t]),B=ce=>{if(b&&x.length>0)switch(ce.key){case "ArrowDown":ce.preventDefault(),M(Le=>Le<x.length-1?Le+1:0);break;case "ArrowUp":ce.preventDefault(),M(Le=>Le>0?Le-1:x.length-1);break;case "Enter":{ce.preventDefault();let Le=x[k];Le&&De(Le);break}case "Tab":{ce.preventDefault();let Le=x[k];Le&&De(Le);break}case "Escape":ce.preventDefault(),y(false);break}else ce.key==="Enter"&&!ce.shiftKey&&(ce.preventDefault(),r());};react.useEffect(()=>{let ce=Le=>{V.current&&!V.current.contains(Le.target)&&T.current&&!T.current.contains(Le.target)&&y(false),X.current&&!X.current.contains(Le.target)&&P(false);};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]);let z=react.useCallback(ce=>{if(!T.current)return;let Le=T.current.selectionStart||e.length,J=e.slice(0,Le)+ce+e.slice(Le);t(J),P(false),setTimeout(()=>{if(T.current){let Pe=Le+ce.length;T.current.selectionStart=Pe,T.current.selectionEnd=Pe,T.current.focus();}},0);},[e,t]),Me=react.useCallback(ce=>{if(!m||!ce.target.files)return;let Le=Array.from(ce.target.files),J=v*1024*1024,Pe=Le.filter(Ee=>Ee.size>J?(console.warn(`File ${Ee.name} exceeds max size of ${v}MB`),false):true);Pe.length>0&&m(Pe),ce.target.value="";},[m,v]),Ue=react.useCallback(ce=>ce.type.startsWith("image/")?lucideReact.Image:ce.type.includes("pdf")||ce.type.includes("document")?lucideReact.FileText:lucideReact.File,[]);return react.useEffect(()=>{if(b&&V.current){let ce=V.current.children[k];ce&&ce.scrollIntoView({block:"nearest"});}},[k,b]),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(ce=>{let Le=Ue(ce.file),J=ce.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:[J&&ce.preview?jsxRuntime.jsx("img",{src:ce.preview,alt:ce.file.name,className:"w-6 h-6 rounded object-cover"}):jsxRuntime.jsx(Le,{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:ce.file.name}),jsxRuntime.jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Ch(ce.file.size)})]}),f&&jsxRuntime.jsx("button",{onClick:()=>f(ce.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"})})]},ce.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:[u&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>P(!N),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:N&&jsxRuntime.jsx(framerMotion.motion.div,{ref:X,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:Th.map(ce=>jsxRuntime.jsx("button",{type:"button",onClick:()=>z(ce),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:ce},ce))})})})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>O.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:O,type:"file",multiple:true,onChange:Me,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:Fe,onSelect:U,onKeyDown:B,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()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.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&&x.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:x.map((ce,Le)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>De(ce),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Le===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:ce.color||"#8B5CF6"},children:kh(ce.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:ce.name}),ce.email&&jsxRuntime.jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:ce.email})]})]},ce.id))})})]})]})]})}function Np({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 Li=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Zo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[l,c]=react.useState(false),[i,u]=react.useState(""),[p,d]=react.useState(false),[m,f]=react.useState(Li[10]||"#00E5CC"),[v,h]=react.useState({top:0,left:0}),b=react.useRef(null),y=react.useRef(null),x=react.useRef(null),w=react.useRef(null),k=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),M=t.some(T=>T.name.toLowerCase()===i.toLowerCase());react.useEffect(()=>{if(l&&y.current){let T=y.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[l]),react.useEffect(()=>{let T=V=>{let O=V.target,X=b.current?.contains(O),F=x.current?.contains(O);!X&&!F&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),react.useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let I=T=>{let V=e.some(O=>O.id===T.id);r(V?e.filter(O=>O.id!==T.id):[...e,T]);},C=async()=>{if(!(!a||!i.trim())){d(true);try{let T=await a(i.trim(),m);T&&(r([...e,T]),u(""),f(Li[Math.floor(Math.random()*Li.length)]||"#00E5CC"));}finally{d(false);}}},N=(T,V)=>{V.stopPropagation(),r(e.filter(O=>O.id!==T));},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(T=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.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:x,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:v.top,left:v.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:T=>u(T.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:T=>{T.key==="Enter"&&i.trim()&&!M&&a&&C();}})}),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(T=>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:`${T.color}20`,color:T.color},onClick:V=>N(T.id,V),children:[T.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},T.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(T=>{let V=e.some(O=>O.id===T.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>I(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:T.name}),V&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:T.color}})]},T.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:Li.map(T=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:m===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxRuntime.jsxs("button",{type:"button",onClick:C,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?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 gc({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 Sp({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(gc,{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 Eo=[{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 Ep(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 Ah(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 Ih({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 fc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Ah(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=Ep(e.loggedMinutes),i=e.estimateMinutes?Ep(e.estimateMinutes):null,u=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(Ih,{className:l[t]}),jsxRuntime.jsx("span",{children:u})]})}function Rh(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 Ii(e){let t=Rh(e);return t!==null?String(t):e}function Pp(e){let r=Ii(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 Ri(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 Oh(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 Hh({className:e}){return jsxRuntime.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{d:"M8 5v14l11-7z"})})}function Uh({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 Fp({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 Wh({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 bc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=react.useState(""),[f,v]=react.useState(t.estimateMinutes?Ri(t.estimateMinutes):""),[h,b]=react.useState(""),[y,x]=react.useState(false),[w,k]=react.useState(false),M=react.useRef(null);react.useEffect(()=>{M.current?.focus();},[]);let I=async()=>{let P=Pp(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?Pp(f):null;await o(P),k(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),I()),P.key==="Escape"&&u?.();};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",p),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:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsxRuntime.jsx(Fp,{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:Oh(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(Uh,{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(Fp,{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(Hh,{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(Wh,{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:d,onChange:P=>m(P.target.value),onKeyDown:N,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:I,disabled:y||!d.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:N,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:Ri(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=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,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?Ri(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:Ri(P.durationMinutes)})]},P.id))})]})]})}function _h(e){let r=Ii(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 Kh(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 Tn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[l,c]=react.useState(Kh(a)),[i,u]=react.useState(""),[p,d]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=_h(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.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:x=>x.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:m,type:"text",value:l,onChange:x=>c(x.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:x=>u(x.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:p||!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:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&e!=="log"&&jsxRuntime.jsx("button",{type:"button",onClick:v,disabled:p,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 qh(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 Yh(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 yc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=qh(e.health),s=Yh(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 es(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 Jh(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 Qh(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 Zh(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 ey({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?"+":"",es(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:es(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:es(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 ty({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?es(e.soldEffortMinutes):"-"}),jsxRuntime.jsx("td",{className:"px-4 py-3 text-sm text-center",children:es(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,es(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",Qh(e.status,r),Jh(e.status,r)),children:Zh(e.status,t)})})]})}function xc({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",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=react.useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsxRuntime.jsx("div",{className:g("p-8 text-center",p,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsxRuntime.jsx("div",{className:g("p-8 text-center",p,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",u),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsxRuntime.jsx("p",{className:g("text-sm mt-1",p),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsxRuntime.jsx(ey,{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:d,children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Tarea":"Task"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Ofertado":"Sold"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Trabajado":"Logged"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Variaci\xF3n":"Variance"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsxRuntime.jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Estado":"Status"})]})}),jsxRuntime.jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsxRuntime.jsx(ty,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsxRuntime.jsx("div",{className:g("text-xs text-center",p),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 ts(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 fy(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 Wp(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 by(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 Mo({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:I=0,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:T,onTimerStop:V,onTimerDiscard:O,blurFinancials:X=false}){let F=s==="dark",Fe={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},U=e&&"title"in e&&!("name"in e),De=e,[B,z]=react.useState(e?Wp(e,l):null),[Me,Ue]=react.useState(false),[ce,Le]=react.useState(false),[J,Pe]=react.useState(false),[Ee,$e]=react.useState(null),[He,et]=react.useState(new Date),[se,_e]=react.useState(false),[qe,Re]=react.useState(false),[ut,Et]=react.useState(""),[Ge,Ie]=react.useState(false),[dt,Mt]=react.useState(false),[Be,vt]=react.useState(false),[L,Q]=react.useState(false),[R,_]=react.useState(""),ue=react.useRef(null),ve=react.useRef(null),[Oe,ye]=react.useState(""),ft=react.useRef(null),[ie,ge]=react.useState(""),[Ze,Xe]=react.useState(false),[kt,Je]=react.useState([]),[At,Yt]=react.useState(""),[pr,It]=react.useState(false),Ur=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 D=Wp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),z(D),_(D.description||""),ye(D.name||"");}},[e?.id,e?.quotedMinutes,l,t]),react.useEffect(()=>{if(!t||!R)return;let D=setTimeout(()=>{let W=ve.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,R]),react.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),ft.current&&clearTimeout(ft.current);},[]),react.useEffect(()=>{t&&Ur.current&&f.length>0&&setTimeout(()=>{Ur.current&&(Ur.current.scrollTop=Ur.current.scrollHeight);},100);},[t,f.length]);let Ht=react.useCallback(D=>{z(D),U&&n&&De?n(by(D,De)):a&&a(D);},[U,De,n,a]),vr=react.useCallback(()=>{Ue(false),Le(false),Pe(false),$e(null),Re(false),Et(""),Ie(false);},[]),jt=react.useCallback((D,W)=>{if(!B)return;let pe={...B,[D]:W};Ht(pe);},[B,Ht]),or=react.useCallback(()=>{let D=ve.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ha=react.useCallback(D=>{_(D),setTimeout(or,0),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{if(B){let W={...B,description:D};Ht(W);}},800);},[B,Ht,or]),pa=react.useCallback(D=>{ye(D),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{if(B&&D.trim()){let W={...B,name:D.trim()};Ht(W);}},800);},[B,Ht]),tt=react.useCallback(D=>{let W=D.map(pe=>{let we={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(we.preview=URL.createObjectURL(pe)),we});Je(pe=>[...pe,...W]);},[]),Ye=react.useCallback(D=>{Je(W=>{let pe=W.find(we=>we.id===D);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(we=>we.id!==D)});},[]),ea=react.useCallback(async()=>{if(!(!B||!ie.trim()&&kt.length===0||!v)){Xe(true);try{let D=Cp(ie,b),W=[];if(kt.length>0&&y){let pe=kt.map(we=>we.file);W=await y(pe);}await v(B.id,ie.trim(),D.length>0?D:void 0,W.length>0?W:void 0),ge(""),kt.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),Je([]);}finally{Xe(false);}}},[B,ie,kt,v,b,y]),_r=react.useCallback(()=>{if(!B||!At.trim())return;let D=B.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},pe=[...D,W],we={...B,subtasks:pe};Ht(we),Yt(""),It(false);},[B,At,Ht]),sa=react.useCallback(D=>{if(!B?.subtasks)return;let W=B.subtasks.map(we=>we.id===D?{...we,progress:we.progress===100?0:100}:we),pe={...B,subtasks:W};Ht(pe);},[B,Ht]),wr=react.useCallback(D=>{if(!B?.subtasks)return;let W=B.subtasks.filter(we=>we.id!==D),pe={...B,subtasks:W};Ht(pe);},[B,Ht]),Wr=react.useCallback(D=>{let W=typeof D=="string"?new Date(D):D,we=new Date().getTime()-W.getTime(),rt=Math.floor(we/6e4),fe=Math.floor(we/36e5),q=Math.floor(we/864e5);return rt<1?o==="es"?"Ahora":"Just now":rt<60?o==="es"?`Hace ${rt} min`:`${rt}m ago`:fe<24?o==="es"?`Hace ${fe}h`:`${fe}h ago`:q<7?o==="es"?`Hace ${q}d`:`${q}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),le=react.useCallback(D=>{if(!B)return;let W=B.progress||0;D==="completed"?W=100:D==="in-progress"&&W===0?W=10:D==="todo"&&(W=0);let pe={...B,status:D,progress:W};Ht(pe),Ue(false);},[B,Ht]),de=react.useCallback((D,W)=>{if(!B)return;let pe={...B,startDate:D,endDate:W};Ht(pe);},[B,Ht]),pt=react.useCallback(()=>{let D=He.getFullYear(),W=He.getMonth(),pe=new Date(D,W,1),rt=new Date(D,W+1,0).getDate(),fe=pe.getDay(),q=[],it=new Date(D,W,0).getDate();for(let Pt=fe-1;Pt>=0;Pt--)q.push({date:new Date(D,W-1,it-Pt),isCurrentMonth:false});for(let Pt=1;Pt<=rt;Pt++)q.push({date:new Date(D,W,Pt),isCurrentMonth:true});let bt=42-q.length;for(let Pt=1;Pt<=bt;Pt++)q.push({date:new Date(D,W+1,Pt),isCurrentMonth:false});return q},[He]),j=react.useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),vt(false),!B||!p)return;let W=Array.from(D.dataTransfer.files);if(W.length!==0){Q(true);try{await p(B.id,W);}finally{Q(false);}}},[B,p]),be=react.useCallback(async D=>{if(!B||!p||!D.target.files)return;let W=Array.from(D.target.files);if(W.length!==0){Q(true);try{await p(B.id,W);}finally{Q(false);}D.target.value="";}},[B,p]),te=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),vt(true);},[]),$=react.useCallback(D=>{D.preventDefault(),D.stopPropagation(),vt(false);},[]),ee=react.useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),ke=react.useCallback(D=>D.startsWith("image/")?lucideReact.Image:D.includes("pdf")||D.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!B?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&B&&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",F?"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]",F?"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",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",F?"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",F?"text-[#6B7280]":"text-gray-400"),children:B.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 D=B.progress===100?0:100,pe={...B,progress:D,status:D===100?"completed":"todo"};Ht(pe);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("input",{type:"text",value:Oe,onChange:D=>pa(D.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",B.progress===100?"line-through text-[#6B7280]":F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{vr(),Ue(!Me);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(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]",F?"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(D=>jsxRuntime.jsxs("button",{onClick:()=>le(D.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.status===D.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),Pe(!J);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((D,W)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},W)),B.assignees.length>3&&jsxRuntime.jsxs("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:g("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:J&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(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",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let W=B.assignees?.some(pe=>pe.name===D.name);return jsxRuntime.jsxs("button",{onClick:()=>{let pe=B.assignees||[],we;W?we=pe.filter(rt=>rt.name!==D.name):we=[...pe,D],jt("assignees",we);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",W&&(F?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g("flex-1",F?"text-white":"text-gray-900"),children:D.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{$e(Ee?null:"start"),et(B.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:g("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(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",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,W=new Date(D);W.setDate(D.getDate()+1);let pe=new Date(D);pe.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let we=new Date(D);we.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let rt=new Date(D);rt.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let fe=new Date(D);fe.setDate(D.getDate()+14);let q=new Date(D);return q.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:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:we,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:rt,display:rt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:fe,display:fe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:q,display:q.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Pt)=>jsxRuntime.jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ee==="start"){let Zt=B.endDate&&bt.date>B.endDate?bt.date:B.endDate;de(bt.date,Zt),$e("end");}else {let Zt=B.startDate&&bt.date<B.startDate?bt.date:B.startDate;de(Zt,bt.date),$e(null);}},children:[jsxRuntime.jsx("span",{children:bt.label}),jsxRuntime.jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Pt))})(),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{de(void 0,void 0),$e(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"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",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ee==="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",F?"text-white":"text-gray-900"),children:He.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:()=>et(new Date),className:g("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()-1)),className:g("p-1 rounded",F?"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:()=>et(new Date(He.getFullYear(),He.getMonth()+1)),className:g("p-1 rounded",F?"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(D=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((D,W)=>{let pe=D.date.toDateString()===new Date().toDateString(),we=B.startDate?.toDateString()===D.date.toDateString(),rt=B.endDate?.toDateString()===D.date.toDateString(),fe=we||rt,q=B.startDate&&B.endDate&&D.date>=B.startDate&&D.date<=B.endDate;return jsxRuntime.jsx("button",{onClick:()=>{let it=new Date(D.date);if(Ee==="start"){let bt=B.endDate&&it>B.endDate?it:B.endDate;de(it,bt),$e("end");}else {let bt=B.startDate&&it<B.startDate?it:B.startDate;de(bt,it),$e(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(F?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",we&&"bg-[#00E5CC] text-white",rt&&!we&&"bg-[#7C3AED] text-white",q&&!fe&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!fe&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},W)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{vr(),Le(!ce);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(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]",F?"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(D=>jsxRuntime.jsxs("button",{onClick:()=>{jt("priority",D.id),Le(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.priority===D.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsxRuntime.jsx("span",{className:F?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:g("text-sm",F?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.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",F?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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:B.progress||0,onChange:D=>{let W=parseInt(D.target.value),pe=B.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let we={...B,progress:W,status:pe};Ht(we);},onBlur:()=>_e(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"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:()=>_e(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",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:g("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),x&&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",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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:B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ts(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(w.estimateMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm",F?"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(Tn,{mode:"estimate",locale:o,isDark:F,currentValue:w?.estimateMinutes||null,onSave:async D=>{await N?.(B.id,D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.FileText,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsxRuntime.jsx("div",{className:"flex items-center gap-2 flex-1",children:X?jsxRuntime.jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"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"}):B.status==="completed"||B.progress===100?jsxRuntime.jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?ts(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsxRuntime.jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(B.quotedMinutes)}):jsxRuntime.jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm",F?"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"&&!X&&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(Tn,{mode:"quoted",locale:o,isDark:F,currentValue:B.quotedMinutes||null,onSave:async D=>{P?(await P(B.id,D),z(W=>W?{...W,quotedMinutes:D}:null)):jt("quotedMinutes",D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsxRuntime.jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"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?.(B.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"}),fy(I||0)]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>T?.(B.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"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"})}),B.status==="completed"||B.progress===100?jsxRuntime.jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"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:()=>Mt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"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":F?"text-white":"text-gray-900"),children:[ts(w.loggedMinutes),w.estimateMinutes&&jsxRuntime.jsxs("span",{className:g("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",ts(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(Tn,{mode:"log",locale:o,isDark:F,currentValue:null,onSave:async(D,W)=>{D&&await C?.(B.id,{durationMinutes:D,note:W,source:"manual"}),Mt(false);},onClose:()=>Mt(false)})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(Zo,{selectedTags:B.tags||[],availableTags:c,onChange:D=>{jt("tags",D);},onCreateTag:i,theme:Fe})]}),jsxRuntime.jsxs("div",{className:"flex items-start gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Link2,{className:g("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(D=>{let W=m.find(pe=>pe.id===D);return jsxRuntime.jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||D.slice(0,8),jsxRuntime.jsx("button",{onClick:()=>{let pe=(B.dependencies||[]).filter(we=>we!==D);jt("dependencies",pe);},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"})})]},D)})}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),Re(!qe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:qe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Re(false),Et("");}}),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]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("div",{className:g("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",value:ut,onChange:D=>Et(D.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",F?"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:m.length>0?m.filter(D=>D.id!==B.id).filter(D=>ut===""||D.name.toLowerCase().includes(ut.toLowerCase())).map(D=>{let W=B.dependencies?.includes(D.id);return jsxRuntime.jsxs("button",{onClick:()=>{let pe=B.dependencies||[],we;W?we=pe.filter(rt=>rt!==D.id):we=[...pe,D.id],jt("dependencies",we);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",W&&(F?"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",W?"bg-[#00E5CC] border-[#00E5CC]":F?"border-white/30":"border-gray-300"),children:W&&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",F?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsxRuntime.jsx("div",{className:g("px-3 py-4 text-sm text-center",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxRuntime.jsxs("button",{onClick:()=>{vr(),Ie(!Ge);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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:B.color||"#6366F1"}}),jsxRuntime.jsx("span",{className:g("text-sm",F?"text-white":"text-gray-900"),children:Eo.find(D=>D.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ge&&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",F?"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:Eo.map(D=>{let W=B.color===D.value;return jsxRuntime.jsx("button",{onClick:()=>{jt("color",D.value),Ie(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:W?D.value:void 0},title:D.name,children:W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Diamond,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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:B.isMilestone||false,onChange:D=>jt("isMilestone",D.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":F?"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",F?"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",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:g("text-sm font-semibold",F?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{ref:ve,value:R,onChange:D=>ha(D.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",F?"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",F?"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",F?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(D=>D.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((D,W)=>(D.position??0)-(W.position??0)).map(D=>jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx("button",{onClick:()=>sa(D.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:g("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("button",{onClick:()=>wr(D.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"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"})})]},D.id))}),pr?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:At,onChange:D=>Yt(D.target.value),onKeyDown:D=>{D.key==="Enter"&&At.trim()?_r():D.key==="Escape"&&(It(false),Yt(""));},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",F?"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:_r,disabled:!At.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":F?"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:()=>{It(false),Yt("");},className:g("p-2 rounded-lg transition-colors",F?"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:()=>It(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"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",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(D=>{let W=ke(D.type),pe=D.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&D.thumbnailUrl?jsxRuntime.jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(W,{className:g("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:D.name}),jsxRuntime.jsx("p",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ee(D.size)})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(D.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"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"})})]},D.id)})}),jsxRuntime.jsxs("div",{onDragOver:te,onDragLeave:$,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?F?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",L&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:be,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||L}),L?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",F?"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",Be?"text-[#00E5CC]":F?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:g("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:Be?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"})]})}),!p&&jsxRuntime.jsx("p",{className:g("text-xs mt-1",F?"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",F?"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]",F?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:g("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxRuntime.jsxs("span",{className:g("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsxRuntime.jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",F?"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
  }
@@ -13,10 +13,10 @@
13
13
  border-radius: 4px !important;
14
14
  }
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
- background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsxRuntime.jsx("div",{ref:Lr,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((D,H)=>{let ue=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,ke=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return ue.getTime()-ke.getTime()}).map(D=>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:D.user?.color||"#8B5CF6"},children:D.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:D.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Wr(D.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Tp,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(H=>{let ue=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:[ue?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)})})]})]},D.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(Cp,{value:oe,onChange:fe,onSubmit:Nr,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:et,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:kt,onFilesSelect:nt,onRemoveFile:Je})})]})]})]})})}function vc(){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:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:R,timeEntries:C,timerState:N,onLogTime:P,onUpdateEstimate:T,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:Y,onDiscardTimer:L,blurFinancials:Re=false,sidePanel:U,renderColumnMetrics:Te,suppressDetailModal:B=false}){let[z,Me]=vc(),[We,ce]=react.useState(null),[Fe,X]=react.useState(false),Pe=react.useRef(null),Ne=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Oe=n?.theme||"dark",ze=Oe==="dark"||Oe==="neutral",rt=ze?"dark":"",ne=react.useCallback((F,J)=>{t.onCardUpdate?.(F,J);},[t]),Ke=react.useCallback((F,J)=>{t.onColumnUpdate?.(F,{title:J});},[t]),je=react.useCallback(F=>{t.onColumnDelete?.(F);},[t]),He=["todo","in-progress","completed"],gt=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(J=>{let I=J.cardIds.map(q=>e.cards.find(pe=>pe.id===q)).filter(q=>q!==void 0).sort((q,pe)=>q.position-pe.position);F.set(J.id,I);}),F},[e.cards,e.columns]);react.useEffect(()=>{let F=Pe.current;if(!F)return;let J=ve=>{let Ae=ve.target,Ce=ve.button===1,ft=Ae===F||Ae.classList.contains("asakaa-column")&&!Ae.closest(".asakaa-card");(Ce||ve.button===0&&ft&&!z.isDragging)&&(ve.preventDefault(),X(true),Ne.current={x:ve.clientX,y:ve.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},F.style.cursor="grabbing",F.style.userSelect="none");},I=ve=>{if(!Fe)return;let Ae=ve.clientX-Ne.current.x,Ce=ve.clientY-Ne.current.y;F.scrollLeft=Ne.current.scrollLeft-Ae,F.scrollTop=Ne.current.scrollTop-Ce;},q=()=>{Fe&&(X(false),F.style.cursor="",F.style.userSelect="");},pe=()=>{Fe&&(X(false),F.style.cursor="",F.style.userSelect="");};return F.addEventListener("mousedown",J),document.addEventListener("mousemove",I),document.addEventListener("mouseup",q),F.addEventListener("mouseleave",pe),()=>{F.removeEventListener("mousedown",J),document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",q),F.removeEventListener("mouseleave",pe);}},[Fe,z.isDragging]);let Ge=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]),Be=react.useCallback(F=>{let{active:J}=F,I=e.cards.find(q=>q.id===J.id);I&&Me({isDragging:true,draggedCardId:I.id,sourceColumnId:I.columnId,targetColumnId:I.columnId});},[e.cards,Me]),st=react.useCallback(F=>{let{active:J,over:I}=F;if(!I||!e.cards.find(ve=>ve.id===J.id))return;let pe=null;I.data.current?.type==="column"?pe=I.id:I.data.current?.type==="card"&&(pe=e.cards.find(Ae=>Ae.id===I.id)?.columnId||null),pe&&pe!==z.targetColumnId&&Me({...z,targetColumnId:pe});},[e.cards,z,Me]),Wt=react.useCallback(async F=>{let{active:J,over:I}=F;if(Me({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!I)return;let q=e.cards.find(Ce=>Ce.id===J.id);if(!q)return;let pe,ve;if(I.data.current?.type==="column"){pe=I.id;let Ce=Mt.get(pe)||[];ve=rc(Ce,0);}else {let Ce=e.cards.find(fe=>fe.id===I.id);if(!Ce)return;pe=Ce.columnId;let ft=Mt.get(pe)||[],oe=ft.findIndex(fe=>fe.id===I.id);ve=rc(ft,oe);}let Ae=e.columns.find(Ce=>Ce.id===pe);if(Ae&&Ae.wipLimit&&Ae.wipLimitType==="hard"){let Ce=Mt.get(pe)||[];if(q.columnId!==pe&&Ce.length>=Ae.wipLimit){t.onWipLimitExceeded?.(Ae,q);return}}(q.columnId!==pe||q.position!==ve)&&await t.onCardMove?.(q.id,pe,ve);},[e.cards,e.columns,Mt,t,Me]),Ue=react.useCallback(F=>{B||ce(F),r?.(F),w?.(F.id);},[r,w,B]),dt=react.useCallback(F=>{t.onCardUpdate?.(F.id,F),ce(F);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",rt,o),style:l,children:jsxRuntime.jsx(Ty,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",rt,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(Qu,{themeName:Oe,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",U?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:gt,collisionDetection:core$1.closestCorners,onDragStart:Be,onDragOver:st,onDragEnd:Wt,children:[jsxRuntime.jsxs("div",{ref:Pe,className:g("asakaa-board",U?"flex-1":"",rt,o),style:{...l,cursor:Fe?"grabbing":void 0},"data-theme":Oe,children:[e.columns.sort((F,J)=>F.position-J.position).map(F=>{let J=Mt.get(F.id)||[],I=!He.includes(F.id),q=a?.renderColumnFooter?.(F);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Jo,{column:F,cards:J,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:Te?(pe,ve)=>Te(pe,ve):void 0,onCardClick:Ue,onCardUpdate:ne,onColumnRename:t.onColumnUpdate?Ke:void 0,onColumnDelete:t.onColumnDelete?je:void 0,isDeletable:I,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),q]},F.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:z.draggedCardId?jsxRuntime.jsx(Bn,{card:e.cards.find(F=>F.id===z.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),U]}),!B&&jsxRuntime.jsx(Eo,{task:We,isOpen:!!We,onClose:()=>ce(null),onCardUpdate:dt,theme:ze?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:We?m?.get(We.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:Ge,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:R,timeEntries:C,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:T,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:Y,onTimerDiscard:L,blurFinancials:Re})]})}function Ty({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 My={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)"},Py={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)"},Fy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ly={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ay({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.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,u)=>i.position-u.position).map((i,u)=>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:u<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Iy({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 m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(r||a||n))return null;let p=[{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(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}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:p.map((m,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(m.id,m.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<p.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===m.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"})}):m.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:m.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Ry({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 kc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=a==="dark"?My:Py,m={...n==="es"?Fy:Ly,...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:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Iy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsxRuntime.jsx(Ay,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:r}):jsxRuntime.jsx(Ry,{onClick:()=>t(),label:r||m.newTask}))]})})}function Tc({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 d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=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:d=>c(d.target.value),onKeyDown:u,onBlur:p,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(""),[u,p]=react.useState(void 0),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(false),[y,x]=react.useState(false),[w,k]=react.useState(false),[M,R]=react.useState(s||new Date),C=react.useRef(null),N=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{C.current?.focus();},[]);let T=react.useCallback(()=>{b(false),x(false),k(false);},[]),V=react.useCallback(()=>{i(""),p(void 0),m(null),v(null),T(),t();},[t,T]),O=f||s||new Date,Y=react.useCallback(()=>{let U=c.trim();if(!U)return;let Te=r.find(z=>z.id===d),B=O;e({name:U,priority:u,assignee:Te||void 0,assigneeId:d,startDate:B,endDate:B}),i(""),p(void 0),m(null),v(null),T(),C.current?.focus();},[c,u,d,O,r,e,T]),L=react.useCallback(U=>{U.key==="Enter"&&c.trim()&&(U.preventDefault(),Y()),U.key==="Escape"&&V();},[Y,V,c]),Re=O;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>T(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:C,type:"text",value:c,onChange:U=>i(U.target.value),placeholder:N?"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:U=>{U.stopPropagation(),b(!h),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="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:U=>U.stopPropagation(),children:[{id:"urgent",label:N?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:N?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:N?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:N?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:N?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(U=>jsxRuntime.jsxs("button",{onClick:()=>{p(U.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",u===U.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",U.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),k(!w),b(false),x(false),R(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"}),Re.toLocaleDateString(N?"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:U=>U.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,Te=new Date(U);Te.setDate(U.getDate()+1);let B=new Date(U);B.setDate(U.getDate()+((6-U.getDay()+7)%7||7));let z=new Date(U);z.setDate(U.getDate()+((1-U.getDay()+7)%7||7));let Me=new Date(U);Me.setDate(U.getDate()+14);let We=new Date(U);We.setDate(U.getDate()+28);let ce=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:U,display:U.toLocaleDateString(ce,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:Te,display:Te.toLocaleDateString(ce,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:B,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:z,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:Me,display:Me.toLocaleDateString(ce,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(ce,{day:"numeric",month:"short"})}].map((X,Pe)=>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:()=>{v(X.date),k(false);},children:[jsxRuntime.jsx("span",{children:X.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:X.display})]},Pe))})()}),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(N?"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:()=>R(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:N?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>R(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:()=>R(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:(N?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(U=>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:U},U))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=M.getFullYear(),Te=M.getMonth(),B=new Date(U,Te,1).getDay(),z=new Date(U,Te+1,0).getDate(),Me=new Date(U,Te,0).getDate(),We=new Date().toDateString(),ce=[];for(let X=B-1;X>=0;X--)ce.push({dayNum:Me-X,isCurrent:false,date:new Date(U,Te-1,Me-X)});for(let X=1;X<=z;X++)ce.push({dayNum:X,isCurrent:true,date:new Date(U,Te,X)});let Fe=42-ce.length;for(let X=1;X<=Fe;X++)ce.push({dayNum:X,isCurrent:false,date:new Date(U,Te+1,X)});return ce.map((X,Pe)=>{let Ne=X.date.toDateString()===We,Oe=(f||s)?.toDateString()===X.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",!X.isCurrent&&(a?"text-white/20":"text-gray-300"),X.isCurrent&&(a?"text-white":"text-gray-900"),Ne&&"ring-1 ring-[#007FFF]",Oe&&"bg-[#007FFF] text-white",!Oe&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(X.date),k(false);},children:X.dayNum},Pe)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),x(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?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(U=>U.id===d)?.color||"#007FFF"},children:r.find(U=>U.id===d)?.initials||r.find(U=>U.id===d)?.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:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{m(null),x(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",!d&&(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:N?"Sin asignar":"Unassigned"})]}),r.map(U=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{m(U.id),x(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",d===U.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:U.color||"#007FFF"},children:U.initials||U.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:U.name})]},U.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:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:Y,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:N?"Guardar":"Save"})]})]})}function Mc({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),u=react.useRef(null),p=react.useRef(null),[d,m]=react.useState({}),[f,v]=react.useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{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;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=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:u,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:p,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:d,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:x,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(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 rm(e={}){return new zs(e)}var ts=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 Pc(e,t){let r=a=>jsxRuntime.jsx(ts,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Lc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=react.useState(false),[m,f]=react.useState(""),[v,h]=react.useState("home"),[b,y]=react.useState(""),[x,w]=react.useState("");react.useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(P=>!P)),N.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),react.useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=react.useCallback(()=>{d(false);},[]),M=react.useCallback(C=>{let[N,P]=C.split(":");switch(N){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?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,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;}},[m,x,t,r,a,n,s,o,l,c,k]),R=react.useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsxRuntime.jsx(sr,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,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:v==="create-card"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&R();}}),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."}),v==="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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.id))})]}),v==="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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),v==="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(C=>{let N=e.columns.find(P=>P.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.id)})})]}),v==="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 om(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:Ur,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsxRuntime.jsx("div",{className:"space-y-4",children:[...f].sort((D,W)=>{let pe=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,we=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-we.getTime()}).map(D=>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:D.user?.color||"#8B5CF6"},children:D.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",F?"text-white":"text-gray-900"),children:D.user?.name||(o==="es"?"Usuario":"User")}),jsxRuntime.jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Wr(D.createdAt)})]}),jsxRuntime.jsx("div",{className:g("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsxRuntime.jsx(Np,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxRuntime.jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsxRuntime.jsx(lucideReact.Image,{className:g("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsxRuntime.jsx(lucideReact.File,{className:g("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsx("span",{className:g("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},D.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",F?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:g("text-sm",F?"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",F?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx(Tp,{value:ie,onChange:ge,onSubmit:ea,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:Ze,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:kt,onFilesSelect:tt,onRemoveFile:Ye})})]})]})]})})}function wc(){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:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,timerState:N,onLogTime:P,onUpdateEstimate:T,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:X,onDiscardTimer:F,blurFinancials:Fe=false,sidePanel:U,renderColumnMetrics:De,suppressDetailModal:B=false}){let[z,Me]=wc(),[Ue,ce]=react.useState(null),[Le,J]=react.useState(false),Pe=react.useRef(null),Ee=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),$e=n?.theme||"dark",He=$e==="dark"||$e==="neutral",et=He?"dark":"",se=react.useCallback((L,Q)=>{t.onCardUpdate?.(L,Q);},[t]),_e=react.useCallback((L,Q)=>{t.onColumnUpdate?.(L,{title:Q});},[t]),qe=react.useCallback(L=>{t.onColumnDelete?.(L);},[t]),Re=["todo","in-progress","completed"],ut=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),Et=react.useMemo(()=>{let L=new Map;return e.columns.forEach(Q=>{let R=Q.cardIds.map(_=>e.cards.find(ue=>ue.id===_)).filter(_=>_!==void 0).sort((_,ue)=>_.position-ue.position);L.set(Q.id,R);}),L},[e.cards,e.columns]);react.useEffect(()=>{let L=Pe.current;if(!L)return;let Q=ve=>{let Oe=ve.target,ye=ve.button===1,ft=Oe===L||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(ye||ve.button===0&&ft&&!z.isDragging)&&(ve.preventDefault(),J(true),Ee.current={x:ve.clientX,y:ve.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},R=ve=>{if(!Le)return;let Oe=ve.clientX-Ee.current.x,ye=ve.clientY-Ee.current.y;L.scrollLeft=Ee.current.scrollLeft-Oe,L.scrollTop=Ee.current.scrollTop-ye;},_=()=>{Le&&(J(false),L.style.cursor="",L.style.userSelect="");},ue=()=>{Le&&(J(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",Q),document.addEventListener("mousemove",R),document.addEventListener("mouseup",_),L.addEventListener("mouseleave",ue),()=>{L.removeEventListener("mousedown",Q),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",_),L.removeEventListener("mouseleave",ue);}},[Le,z.isDragging]);let Ge=react.useMemo(()=>e.cards.map(L=>({id:L.id,name:L.title,startDate:L.startDate?new Date(L.startDate):void 0,endDate:L.endDate?new Date(L.endDate):void 0,progress:L.progress||0,status:L.columnId,priority:L.priority?.toLowerCase(),dependencies:Array.isArray(L.dependencies)?L.dependencies.map(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),Ie=react.useCallback(L=>{let{active:Q}=L,R=e.cards.find(_=>_.id===Q.id);R&&Me({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Me]),dt=react.useCallback(L=>{let{active:Q,over:R}=L;if(!R||!e.cards.find(ve=>ve.id===Q.id))return;let ue=null;R.data.current?.type==="column"?ue=R.id:R.data.current?.type==="card"&&(ue=e.cards.find(Oe=>Oe.id===R.id)?.columnId||null),ue&&ue!==z.targetColumnId&&Me({...z,targetColumnId:ue});},[e.cards,z,Me]),Mt=react.useCallback(async L=>{let{active:Q,over:R}=L;if(Me({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let _=e.cards.find(ye=>ye.id===Q.id);if(!_)return;let ue,ve;if(R.data.current?.type==="column"){ue=R.id;let ye=Et.get(ue)||[];ve=ac(ye,0);}else {let ye=e.cards.find(ge=>ge.id===R.id);if(!ye)return;ue=ye.columnId;let ft=Et.get(ue)||[],ie=ft.findIndex(ge=>ge.id===R.id);ve=ac(ft,ie);}let Oe=e.columns.find(ye=>ye.id===ue);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let ye=Et.get(ue)||[];if(_.columnId!==ue&&ye.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,_);return}}(_.columnId!==ue||_.position!==ve)&&await t.onCardMove?.(_.id,ue,ve);},[e.cards,e.columns,Et,t,Me]),Be=react.useCallback(L=>{B||ce(L),r?.(L),w?.(L.id);},[r,w,B]),vt=react.useCallback(L=>{t.onCardUpdate?.(L.id,L),ce(L);},[t]);return c?jsxRuntime.jsx("div",{className:g("asakaa-board",et,o),style:l,children:jsxRuntime.jsx(Ey,{columnCount:3})}):i?jsxRuntime.jsx("div",{className:g("asakaa-board",et,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(Zu,{themeName:$e,children:[jsxRuntime.jsxs("div",{className:g("flex h-full overflow-hidden",U?"flex-row":""),children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:ut,collisionDetection:core$1.closestCorners,onDragStart:Ie,onDragOver:dt,onDragEnd:Mt,children:[jsxRuntime.jsxs("div",{ref:Pe,className:g("asakaa-board",U?"flex-1":"",et,o),style:{...l,cursor:Le?"grabbing":void 0},"data-theme":$e,children:[e.columns.sort((L,Q)=>L.position-Q.position).map(L=>{let Q=Et.get(L.id)||[],R=!Re.includes(L.id),_=a?.renderColumnFooter?.(L);return jsxRuntime.jsxs("div",{className:"asakaa-column-wrapper",children:[jsxRuntime.jsx(Qo,{column:L,cards:Q,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:De?(ue,ve)=>De(ue,ve):void 0,onCardClick:Be,onCardUpdate:se,onColumnRename:t.onColumnUpdate?_e:void 0,onColumnDelete:t.onColumnDelete?qe:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),_]},L.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:z.draggedCardId?jsxRuntime.jsx(An,{card:e.cards.find(L=>L.id===z.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),U]}),!B&&jsxRuntime.jsx(Mo,{task:Ue,isOpen:!!Ue,onClose:()=>ce(null),onCardUpdate:vt,theme:He?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:Ue?m?.get(Ue.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:Ge,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:T,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:X,onTimerDiscard:F,blurFinancials:Fe})]})}function Ey({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 Ay={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)"},Iy={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)"},Ry={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},By={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function $y({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.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,u)=>i.position-u.position).map((i,u)=>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:u<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Oy({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 m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(r||a||n))return null;let p=[{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(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}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:p.map((m,f)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(m.id,m.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<p.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===m.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"})}):m.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:m.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Hy({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 Cc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=a==="dark"?Ay:Iy,m={...n==="es"?Ry:By,...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:d.bgGrid,borderColor:d.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Oy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsxRuntime.jsx($y,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:r}):jsxRuntime.jsx(Hy,{onClick:()=>t(),label:r||m.newTask}))]})})}function Nc({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 d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=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:d=>c(d.target.value),onKeyDown:u,onBlur:p,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(""),[u,p]=react.useState(void 0),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(false),[y,x]=react.useState(false),[w,k]=react.useState(false),[M,I]=react.useState(s||new Date),C=react.useRef(null),N=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";react.useEffect(()=>{C.current?.focus();},[]);let T=react.useCallback(()=>{b(false),x(false),k(false);},[]),V=react.useCallback(()=>{i(""),p(void 0),m(null),v(null),T(),t();},[t,T]),O=f||s||new Date,X=react.useCallback(()=>{let U=c.trim();if(!U)return;let De=r.find(z=>z.id===d),B=O;e({name:U,priority:u,assignee:De||void 0,assigneeId:d,startDate:B,endDate:B}),i(""),p(void 0),m(null),v(null),T(),C.current?.focus();},[c,u,d,O,r,e,T]),F=react.useCallback(U=>{U.key==="Enter"&&c.trim()&&(U.preventDefault(),X()),U.key==="Escape"&&V();},[X,V,c]),Fe=O;return jsxRuntime.jsxs("div",{className:g("quick-task-create",o),onClick:()=>T(),children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{ref:C,type:"text",value:c,onChange:U=>i(U.target.value),placeholder:N?"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:F})}),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:U=>{U.stopPropagation(),b(!h),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="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:U=>U.stopPropagation(),children:[{id:"urgent",label:N?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:N?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:N?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:N?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:N?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(U=>jsxRuntime.jsxs("button",{onClick:()=>{p(U.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",u===U.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full",U.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:U=>{U.stopPropagation(),k(!w),b(false),x(false),I(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"}),Fe.toLocaleDateString(N?"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:U=>U.stopPropagation(),children:[jsxRuntime.jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,De=new Date(U);De.setDate(U.getDate()+1);let B=new Date(U);B.setDate(U.getDate()+((6-U.getDay()+7)%7||7));let z=new Date(U);z.setDate(U.getDate()+((1-U.getDay()+7)%7||7));let Me=new Date(U);Me.setDate(U.getDate()+14);let Ue=new Date(U);Ue.setDate(U.getDate()+28);let ce=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:U,display:U.toLocaleDateString(ce,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:De,display:De.toLocaleDateString(ce,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:B,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:z,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:Me,display:Me.toLocaleDateString(ce,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(ce,{day:"numeric",month:"short"})}].map((J,Pe)=>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:()=>{v(J.date),k(false);},children:[jsxRuntime.jsx("span",{children:J.label}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:J.display})]},Pe))})()}),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(N?"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:()=>I(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:N?"Hoy":"Today"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>I(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:()=>I(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:(N?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(U=>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:U},U))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=M.getFullYear(),De=M.getMonth(),B=new Date(U,De,1).getDay(),z=new Date(U,De+1,0).getDate(),Me=new Date(U,De,0).getDate(),Ue=new Date().toDateString(),ce=[];for(let J=B-1;J>=0;J--)ce.push({dayNum:Me-J,isCurrent:false,date:new Date(U,De-1,Me-J)});for(let J=1;J<=z;J++)ce.push({dayNum:J,isCurrent:true,date:new Date(U,De,J)});let Le=42-ce.length;for(let J=1;J<=Le;J++)ce.push({dayNum:J,isCurrent:false,date:new Date(U,De+1,J)});return ce.map((J,Pe)=>{let Ee=J.date.toDateString()===Ue,$e=(f||s)?.toDateString()===J.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",!J.isCurrent&&(a?"text-white/20":"text-gray-300"),J.isCurrent&&(a?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",$e&&"bg-[#007FFF] text-white",!$e&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(J.date),k(false);},children:J.dayNum},Pe)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:U=>{U.stopPropagation(),x(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?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(U=>U.id===d)?.color||"#007FFF"},children:r.find(U=>U.id===d)?.initials||r.find(U=>U.id===d)?.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:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{m(null),x(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",!d&&(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:N?"Sin asignar":"Unassigned"})]}),r.map(U=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{m(U.id),x(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",d===U.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:U.color||"#007FFF"},children:U.initials||U.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:U.name})]},U.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:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:X,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:N?"Guardar":"Save"})]})]})}function Pc({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),u=react.useRef(null),p=react.useRef(null),[d,m]=react.useState({}),[f,v]=react.useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};react.useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{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;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=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:u,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:p,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:d,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:x,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 am(e={}){return new zs(e)}var rs=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 Fc(e,t){let r=a=>jsxRuntime.jsx(rs,{...t,children:jsxRuntime.jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Ac({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=react.useState(false),[m,f]=react.useState(""),[v,h]=react.useState("home"),[b,y]=react.useState(""),[x,w]=react.useState("");react.useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(P=>!P)),N.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),react.useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=react.useCallback(()=>{d(false);},[]),M=react.useCallback(C=>{let[N,P]=C.split(":");switch(N){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?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,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;}},[m,x,t,r,a,n,s,o,l,c,k]),I=react.useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsxRuntime.jsx(ir,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:k,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:m,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:v==="create-card"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&I();}}),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."}),v==="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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.id))})]}),v==="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(C=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${C.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:C.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),v==="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(C=>{let N=e.columns.find(P=>P.id===C.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:C.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.id)})})]}),v==="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 sm(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
- `,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=a<r.length-1?a+1:0;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Xy(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 Jy(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 Ic(e){return e.startsWith("image/")}function rs({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),[u,p]=react.useState(null),d=react.useRef(null),m=react.useRef(e);m.current=e;let f=react.useCallback((C,N)=>{N.preventDefault(),N.stopPropagation();let P=m.current.filter(O=>Ic(O.type)),T=P.findIndex(O=>O.id===C.id),V=O=>{let Y=m.current.filter(Re=>Ic(Re.type)),L=Y[O];L&&om(L.url,L.name,Y,O,V);};om(C.url,C.name,P,T,V);},[]),v=react.useCallback(C=>{let N=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(C.forEach(T=>{if(T.size/1048576>a){P.push(`${T.name} is too large (max ${a}MB)`);return}if(n&&!n.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}N.push(T);}),{valid:N,errors:P})},[e.length,s,a,n]),h=react.useCallback(async C=>{let{valid:N,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(N.length!==0){i(true),p(null);try{await t?.(N);}catch(T){p(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let N=Array.from(C.dataTransfer.files);h(N);},[h]),k=react.useCallback(C=>{let N=C.target.files?Array.from(C.target.files):[];h(N),d.current&&(d.current.value="");},[h]),M=react.useCallback(()=>{d.current?.click();},[]),R=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&r?.(C);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsxRuntime.jsx("input",{ref:d,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"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ic(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(C,N),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:Jy(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Xy(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>R(C.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"})})})]},C.id))})]})}function ox({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 Bc({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(ox,{})}),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 gx({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 $c({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(gx,{})}),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 Cx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},mm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Tx({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 gm({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 Oc({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||Cx[c.name]||mm[e.indexOf(c)%mm.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?Tx: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(gm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):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(gm,{})}),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 Ki=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),[u,p]=react.useState(false),[d,m]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{a.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(R=>{R.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{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:()=>v(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:()=>p(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&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:()=>m(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&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:x,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"})})]})]})})});Ki.displayName="BulkOperationsToolbar";function Mx(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 u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=r?.find(v=>v.id===m);o=`assignee-${m}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:l,groupValue:m,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 d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=d.title,c=d.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(m=>{o=`label-${m}`,l=m,c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:m,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 Hc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=react.useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),h=react.useMemo(()=>s||Mx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=react.useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),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(x=>{let w=f.has(x.id),k=e.cards.filter(R=>x.cardIds.includes(R.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:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.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(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.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})})]},x.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 Uc=[{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 Wc({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),l=Uc.find(i=>i.value===e)||Uc[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return 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:Uc.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 Lx(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 xm(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 u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Lx(i,p)){a&&i.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:o,unregisterShortcut:l,isEnabled:r}}function Ix(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Rx(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 Bx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Rx(e),a=t?Ix(t):"";return r?`${r} + ${a}`:a}function $x(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 zc({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=$x(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:Bx(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 Gc=[{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
+ `,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=a<r.length-1?a+1:0;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function ex(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 tx(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 Rc(e){return e.startsWith("image/")}function as({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),[u,p]=react.useState(null),d=react.useRef(null),m=react.useRef(e);m.current=e;let f=react.useCallback((C,N)=>{N.preventDefault(),N.stopPropagation();let P=m.current.filter(O=>Rc(O.type)),T=P.findIndex(O=>O.id===C.id),V=O=>{let X=m.current.filter(Fe=>Rc(Fe.type)),F=X[O];F&&sm(F.url,F.name,X,O,V);};sm(C.url,C.name,P,T,V);},[]),v=react.useCallback(C=>{let N=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(C.forEach(T=>{if(T.size/1048576>a){P.push(`${T.name} is too large (max ${a}MB)`);return}if(n&&!n.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}N.push(T);}),{valid:N,errors:P})},[e.length,s,a,n]),h=react.useCallback(async C=>{let{valid:N,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(N.length!==0){i(true),p(null);try{await t?.(N);}catch(T){p(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=react.useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=react.useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let N=Array.from(C.dataTransfer.files);h(N);},[h]),k=react.useCallback(C=>{let N=C.target.files?Array.from(C.target.files):[];h(N),d.current&&(d.current.value="");},[h]),M=react.useCallback(()=>{d.current?.click();},[]),I=react.useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&r?.(C);},[r]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsxRuntime.jsx("input",{ref:d,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"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(C=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Rc(C.type)&&C.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(C,N),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:tx(C.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:ex(C.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>I(C.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"})})})]},C.id))})]})}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.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 $c({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(cx,{})}),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 yx({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 Oc({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(yx,{})}),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 Sx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},gm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ex({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 fm({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 Hc({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||Sx[c.name]||gm[e.indexOf(c)%gm.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?Ex: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(fm,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):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(fm,{})}),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 Ki=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),[u,p]=react.useState(false),[d,m]=react.useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{a.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(I=>{I.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{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:()=>v(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:()=>p(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&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:()=>m(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&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:x,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"})})]})]})})});Ki.displayName="BulkOperationsToolbar";function Ax(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 u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=r?.find(v=>v.id===m);o=`assignee-${m}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:l,groupValue:m,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 d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=d.title,c=d.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(m=>{o=`label-${m}`,l=m,c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:m,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 Uc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=react.useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),h=react.useMemo(()=>s||Ax(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=react.useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),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(x=>{let w=f.has(x.id),k=e.cards.filter(I=>x.cardIds.includes(I.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:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.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(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.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})})]},x.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 Wc=[{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 zc({value:e,onChange:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null),l=Wc.find(i=>i.value===e)||Wc[0];react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return 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:Wc.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 Bx(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 vm(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 u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Bx(i,p)){a&&i.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),{registerShortcut:o,unregisterShortcut:l,isEnabled:r}}function Ox(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Hx(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 Ux(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Hx(e),a=t?Ox(t):"";return r?`${r} + ${a}`:a}function Wx(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 Gc({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=Wx(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:Ux(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 Vc=[{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,13 +122,13 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),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,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.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:p.name}),p.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.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 _c({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,l]=react.useState("export"),[c,i]=react.useState("json"),[u,p]=react.useState(null),d=react.useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await ju(e,c,v);_u(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await Yu(h),y=h.name.endsWith(".json")?"json":"csv",x=qu(b,y);p(x),x.success&&a&&a(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}d.current&&(d.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(v=>jsxRuntime.jsxs("button",{onClick:()=>i(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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:m,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:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var zx=["URGENT","HIGH","MEDIUM","LOW"],Gx=[{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"}],Vx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=react.useState(true),b=react.useCallback(M=>{r({search:M.target.value});},[r]),y=react.useCallback(M=>{r({dateFilter:M.target.value});},[r]),x=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 ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"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:v?"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)"]})]}),!v&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[p&&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 R=M.target.value;r({priorities:R==="all"?[]:[R]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),zx.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 R=M.target.value;r({assignees:R==="all"?[]:[R]});},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 R=M.target.value;r({labels:R==="all"?[]:[R]});},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:x,className:"filter-bar__select filter-bar__select--sm",children:Gx.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:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Vx.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 qc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:p,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.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:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 Yc={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"}},Xc={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"}},Jc={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"}},Po={dark:Yc,light:Xc,neutral:Jc},Yi="dark";var Xi=react.createContext(void 0),ev="asakaa-theme";function km({children:e,defaultTheme:t=Yi,storageKey:r=ev}){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=Po[a];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${tv(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&l.style.setProperty(p,d);}),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:Po};return jsxRuntime.jsx(Xi.Provider,{value:o,children:e})}function os(){let e=react.useContext(Xi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function tv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Qc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=os();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(Po).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 ct={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 Cm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var Ji={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"}},Tm={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"}},Zc={en:Ji,es:Tm};function Nm(e){return Zc[e]||Zc.en}function ed(e,t){let r=Nm(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 is=react.createContext(Ji);function qa(){return react.useContext(is)}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 Am({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=react.useState(false),[i,u]=react.useState(null),p=react.useRef(null),d=react.useRef(null),m=qa(),f=Ks(p,l,"right",176);if(react.useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.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,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:p,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:m.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:d,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,x)=>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:x<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:x*.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 td({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=react.useState(false),[c,i]=react.useState(null),[u,p]=react.useState(false),d=react.useRef(null),m=react.useRef(null),f=qa(),v=Ks(d,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 R=M.target;d.current&&!d.current.contains(R)&&m.current&&!m.current.contains(R)&&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),x=async(k,M)=>{if(M){i(k);try{await M();}catch(R){console.error(`Export ${k} failed:`,R);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,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:m,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:v.top,left:v.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:()=>x(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:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?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:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Cv({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 Tv({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 rd({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 d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],p=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"}: ${p}`,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:p})]}),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:u.map((d,m)=>{let f=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(d.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:m<u.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:m*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function ad({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(),u=Ks(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=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",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{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"}],d=t!=="all"||a,m=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(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#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"}),d&&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:u.top,left:u.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"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:m?"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:m?"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:p.map(f=>{let v=t===f.value&&!a,h=()=>f.value==="all"?v?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:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&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:m?"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?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"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":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"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 Sm({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 Nv({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,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=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:u,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:m}),v&&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 Em({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=react.useState(false),f=react.useRef(null),v=react.useRef(null),h=qa(),b=Ks(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!d)return;let M=R=>{let C=R.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"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:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,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,R)=>{let C=M.icon,N=M.disabled,P=M.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:R*.03},title:P,children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?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&&!N&&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,R)=>{let C=i===M.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(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+R)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Dv({theme:e,etiqueta:t,children:r}){let[a,n]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!a)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[a]),jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":a,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),a&&jsxRuntime.jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:r})]})}function Qi({enCabecera:e=false,theme:t,timeScale:r,onTimeScaleChange:a,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:R,projectForecast:C,hideForecastHud:N,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportCSV:O,onExportJSON:Y,onExportMSProject:L,showCriticalPath:Re=true,onShowCriticalPathChange:U,showDependencies:Te=true,onShowDependenciesChange:B,highlightWeekends:z=true,onHighlightWeekendsChange:Me,showBaseline:We=false,onShowBaselineChange:ce,onCopySnapshotLink:Fe,hasDependencies:X=true}){let Pe=qa(),Ne=P||T||V||O||Y||L,Oe=!!t.glassToolbar,ze=[{value:"day",label:Pe.toolbar.day},{value:"week",label:Pe.toolbar.week},{value:"month",label:Pe.toolbar.month}],rt=[{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"})}],ne=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Sm,{value:r,onChange:a,theme:t}),v&&jsxRuntime.jsx(ad,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsxRuntime.jsx(Em,{theme:t,showCriticalPath:Re,onShowCriticalPathChange:U,showBaseline:We,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:Te,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:X}),jsxRuntime.jsx(td,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),(R||w)&&jsxRuntime.jsxs(Dv,{theme:t,etiqueta:Pe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[R&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(Ke=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(Ke),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===Ke?ne?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[Ke==="execution"?Pe.toolbar.viewExecution:Pe.toolbar.viewOracle,M===Ke&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"})]},Ke))}),w&&jsxRuntime.jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsxRuntime.jsx(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if(Oe){let Ke=ne?"rgba(255,255,255,0.08)":t.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:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:R&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ne?"#000000":t.bgSecondary,border:`1px solid ${ne?"rgba(255,255,255,0.08)":t.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>R("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?ne?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Pe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>R("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?ne?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Pe.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Sm,{value:r,onChange:a,theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Ke}}),w&&jsxRuntime.jsx(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxRuntime.jsx(ad,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Ke}}),y]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:Ke}}),jsxRuntime.jsx(Em,{theme:t,showCriticalPath:Re,onShowCriticalPathChange:U,showBaseline:We,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:Te,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:X}),jsxRuntime.jsx(td,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ne?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ne?"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:d||Pe.toolbar.createTask})]})]})]}),C&&!N&&jsxRuntime.jsx(Nv,{theme:t,forecast:C})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Tv,{options:ze,value:r,onChange:Ke=>a(Ke),theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.borderLight}}),w&&jsxRuntime.jsx(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsx(ad,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[y,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,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:d||Pe.toolbar.createTask})]}),(Ne||u)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsxRuntime.jsx(td,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),u&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsxRuntime.jsx(Cv,{options:rt,value:o,onChange:Ke=>l(Ke),theme:t})]})]})}function Zi({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 u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(sr,{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(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.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 u=200,p=a.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,h=r;t+u+d>m&&(v=t-u,v<d&&(v=d)),r+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&n();},p=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var 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 Um({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=react.useRef(false),f=react.useCallback(x=>{m.current=x;},[]),v=react.useCallback(x=>{let w=[],k=M=>{for(let R of M)w.push(R),R.subtasks&&R.subtasks.length>0&&R.isExpanded&&k(R.subtasks);};return k(x),w},[]),h=react.useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=react.useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){r(k[0].id,false);return}let R=k.findIndex(P=>P.id===M.id);if(R===-1)return;let C=x==="up"?R-1:R+1;if(C<0||C>=k.length)return;let N=k[C];r(N.id,w);},[e,h,v,r]),y=react.useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let R=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),N=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(N&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!N.isExpanded||x.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!R){N&&(x.preventDefault(),a(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!R){N&&(x.preventDefault(),a(N.id,"above"));return}if(x.key==="Enter"&&R){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),i(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&R){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&R&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,a,n,s,o,l,c,i,u,p]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function zm(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=react.useCallback(d=>{r(new Set([d])),n(d);},[]),o=react.useCallback(d=>{r(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),l=react.useCallback((d,m)=>{if(!a){s(d);return}let f=m.indexOf(a),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);r(new Set(y)),n(d);},[a,s]),c=react.useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=react.useCallback((d,m)=>{m?r(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=react.useCallback(()=>{r(new Set),n(null);},[]),p=react.useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function ld(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?ld(t.subtasks):t.subtasks}))}function Io(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 id(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=id(r.subtasks,t);if(a)return a}return null}function cd(e,t){if(t.length===0)return e;let r=Io(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let s=r[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return ld(p)}function dd(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=id(r,a);if(!n)continue;let s=id(r,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(r,n.id,a);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(r,n.id,c));}return ld(r)}function ud(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(a,n,r),a}function pd(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((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(i+1,0,d),d},l=o(r);l&&a.push(l);}return {tasks:r,duplicatedTasks:a}}function Gm(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(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,o),true};return l(a),{tasks:a,newTask:o}}function md(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:md(a.subtasks,t,r)}:a)}function gd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:gd(r.subtasks,t)}:r)}function fd(e,t){let r=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=r(m.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=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},i=c(e),u={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},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function Vm(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 u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,r))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},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 u=i.subtasks||[],p=a!==void 0?a:u.length,d=[...u];d.splice(p,0,{...n,parentId:r});let m=d.map((f,v)=>({...f,position:v}));return {...i,subtasks:m,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 tl({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:R,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:T,allTasks:V,scrollContainerRef:O,showCriticalPath:Y=false}){let L=react.useContext(is),[Re,U]=react.useState(null),[Te,B]=react.useState(null),[z,Me]=react.useState(""),We=react.useRef(null),[ce,Fe]=react.useState(null),[X,Pe]=react.useState(0),[Ne,Oe]=react.useState(0),[ze,rt]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ne,Ke]=react.useState(null),[je,He]=react.useState(null),[gt,Mt]=react.useState(null),Ge=react.useRef(0),Be=5,st=react.useRef(false),[Wt,Ue]=react.useState(null),[dt,F]=react.useState(false),J=react.useRef(null),[I,q]=react.useState(null),[pe,ve]=react.useState(null),[Ae,Ce]=react.useState(false),ft=react.useRef(null);react.useEffect(()=>{function le(de){ft.current&&!ft.current.contains(de.target)&&Ce(false);}if(Ae)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[Ae]),react.useEffect(()=>{Te&&We.current&&(We.current.focus(),We.current.select());},[Te]),react.useEffect(()=>{if(!ce)return;let le=pt=>{let j=pt.clientX-X,be=Ne+j;f?.(ce,be);},de=()=>{Fe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",de),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",de),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,X,Ne,f]);let{selectedTaskIds:oe,handleTaskClick:fe,isTaskSelected:et}=zm(l),{setIsEditing:Xe}=Um({tasks:e,selectedTaskIds:oe,onTaskSelect:(le,de)=>{let j=Io(e).map(be=>be.id);fe(le,j,de||false,false),o?.(le);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:le=>{let de=Io(e).find(pt=>pt.id===le);de&&kr(de);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:le=>{let de=Io(e).find(pt=>pt.id===le);de&&N&&N(de);},enableKeyboard:true}),kt=(le,de=0,pt="")=>{let j=[],be=[...le].sort((te,$)=>(te.position??0)-($.position??0));for(let te=0;te<be.length;te++){let $=be[te],ee=te+1,we=pt?`${pt}.${ee}`:`${ee}.0`,D=$.wbsCode||we;if($.wbsCode=D,j.push({task:$,level:de}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let ue=$.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${ee}`:`${ee}`);j.push(...kt($.subtasks,de+1,ue));}}return j},tt=kt(e),St=48,mr=Math.max(tt.length*r,600-St),cr=(le,de)=>de==="assignees"?le.assignees:de==="startDate"?le.startDate:le.endDate,Rt=(le,de,pt,j)=>{le.preventDefault(),le.stopPropagation(),q({sourceTaskId:de,column:pt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let be=le.currentTarget.closest("[data-grid-body]"),te=me=>{let Se=be?.getBoundingClientRect().top??0,se=Math.floor((me-Se)/r);return se=Math.max(0,Math.min(tt.length-1,se)),se<j&&(se=j),se},$=le.clientY,ee=O?.current??null,we=()=>{J.current&&(cancelAnimationFrame(J.current),J.current=null);},D=()=>{let me=te($);q(Se=>Se&&{...Se,targetIndex:me});},H=()=>{if(we(),!ee)return;let me=ee.getBoundingClientRect(),Se=60,se=12,it=$-me.top,bt=me.bottom-$;if(bt<Se&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Et=Math.max(1,Math.round(se*(1-Math.max(0,bt)/Se))),nr=()=>{ee.scrollTop+=Et,D(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(J.current=requestAnimationFrame(nr));};J.current=requestAnimationFrame(nr);}else if(it<Se&&ee.scrollTop>0){let Et=Math.max(1,Math.round(se*(1-Math.max(0,it)/Se))),nr=()=>{ee.scrollTop-=Et,D(),ee.scrollTop>0&&(J.current=requestAnimationFrame(nr));};J.current=requestAnimationFrame(nr);}},ue=me=>{$=me.clientY,D(),H();},ke=me=>{window.removeEventListener("mousemove",ue),window.removeEventListener("mouseup",ke),we(),document.body.style.cursor="",document.body.style.userSelect="",q(null);let Se=te(me.clientY),se=tt.find(ka=>ka.task.id===de)?.task;if(!se)return;let it=cr(se,pt),bt=Math.min(j,Se),Et=Math.max(j,Se),nr=[];for(let ka=bt;ka<=Et;ka++){if(ka===j)continue;let zr=tt[ka]?.task;!zr||zr.subtasks&&zr.subtasks.length>0||nr.push(zr.id);}nr.length!==0&&h?.(nr,pt,it);};window.addEventListener("mousemove",ue),window.addEventListener("mouseup",ke);},Lr=le=>{if(!I)return false;let de=Math.min(I.sourceIndex,I.targetIndex),pt=Math.max(I.sourceIndex,I.targetIndex);return le>=de&&le<=pt},Ot=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,kr=le=>{B(le.id),Me(le.name),Xe(true);},Vt=le=>{z.trim()&&z!==e.find(de=>de.id===le)?.name&&R?.(le,z.trim()),B(null),Me(""),Xe(false);},ar=()=>{B(null),Me(""),Xe(false);},ua=(le,de)=>{de.stopPropagation(),C?.(le.id);},Zr=(le,de)=>{de.preventDefault(),Ge.current=de.clientY,Ke(le),st.current=false,F(false),Ue({x:de.clientX,y:de.clientY});},nt=le=>{if(!ne||(Math.abs(le.clientY-Ge.current)>Be&&!st.current&&(st.current=true,F(true)),Ue({x:le.clientX,y:le.clientY}),!st.current))return;if(O?.current){let te=O.current,$=te.getBoundingClientRect(),ee=60,we=12;J.current&&(cancelAnimationFrame(J.current),J.current=null);let D=le.clientY-$.top,H=$.bottom-le.clientY;if(D<ee&&te.scrollTop>0){let ue=Math.round(we*(1-D/ee)),ke=()=>{te.scrollTop-=ue,st.current&&te.scrollTop>0&&(J.current=requestAnimationFrame(ke));};J.current=requestAnimationFrame(ke);}else if(H<ee&&te.scrollTop<te.scrollHeight-te.clientHeight){let ue=Math.round(we*(1-H/ee)),ke=()=>{te.scrollTop+=ue,st.current&&te.scrollTop<te.scrollHeight-te.clientHeight&&(J.current=requestAnimationFrame(ke));};J.current=requestAnimationFrame(ke);}}let pt=document.querySelectorAll("[data-task-row]"),j=null,be=null;pt.forEach(te=>{let $=te.getBoundingClientRect(),ee=te.getAttribute("data-task-row");if(ee&&ee!==ne&&le.clientY>=$.top&&le.clientY<=$.bottom){j=ee;let we=le.clientY-$.top,D=$.height;we<D*.25?be="above":we>D*.75?be="below":be="child";}}),He(j),Mt(be);},Je=()=>{if(st.current&&ne&&je&&gt){if(gt==="child")T?.(ne,je);else if(gt==="above"||gt==="below"){let le=(te,$,ee=null)=>{for(let we of te){if(we.id===$)return ee;if(we.subtasks){let D=le(we.subtasks,$,we.id);if(D!==void 0)return D}}},de=V&&V.length>0?V:e,pt=le(de,ne,null),j=le(de,je,null),be=(te,$,ee,we)=>{let D=te.findIndex(ke=>ke.id===$),H=we?te.findIndex(ke=>ke.id===ee):-1,ue=gt==="below"?D+1:D;return we&&H!==-1&&H<D&&(ue-=1),Math.max(0,ue)};if(j===null){let $=be(de,je,ne,pt===null);T?.(ne,null,$);}else {let te=cs(de,j);if(te?.subtasks){let $=pt===j,ee=be(te.subtasks,je,ne,$);T?.(ne,j,ee);}}}}J.current&&(cancelAnimationFrame(J.current),J.current=null),Ke(null),He(null),Mt(null),Ue(null),st.current=false,F(false);};react.useEffect(()=>{if(ne)return document.addEventListener("mousemove",nt),document.addEventListener("mouseup",Je),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",nt),document.removeEventListener("mouseup",Je),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,je,gt]);let Nr=(le,de,pt)=>{let j=de.subtasks&&de.subtasks.length>0;switch(le.id){case "name":let be=Te===de.id,te=Re===de.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:te?1:.3},onMouseDown:se=>Zr(de.id,se),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:se=>{se.stopPropagation(),u?.(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"}),be?jsxRuntime.jsx("input",{ref:We,type:"text",value:z,onChange:se=>Me(se.target.value),onKeyDown:se=>{se.key==="Enter"?Vt(de.id):se.key==="Escape"&&ar();},onBlur:()=>Vt(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:se=>se.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),"%"]}),Y&&de.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),Y&&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"]})]}),te&&!be&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:se=>ua(de,se),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),kr(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 ee=le.id==="startDate"?"startDate":"endDate",we=de[ee],D=pe?.taskId===de.id&&pe?.field===ee,H=se=>se?(typeof se=="string"?new Date(se):se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:se=>{if(!j)if(D)ve(null);else {let it=se.currentTarget.getBoundingClientRect();ve({taskId:de.id,field:ee,month:we?typeof we=="string"?new Date(we):we:new Date,position:{top:it.bottom+4,left:it.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:H(we)}),j&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),D&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ve(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:pe?.position.top,left:pe?.position.left},onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,it=new Date(se);it.setDate(se.getDate()+1);let bt=new Date(se);bt.setDate(se.getDate()+7);let Et=new Date(se);return Et.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:it},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Et}].map((ka,zr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ca=>Ca.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ca=>Ca.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:ka.date}),ve(null);},children:ka.label},zr))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:void 0}),ve(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:()=>ve(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:pe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ve(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((se,it)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},it))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=pe?.month||new Date,it=se.getFullYear(),bt=se.getMonth(),Et=new Date(it,bt,1).getDay(),nr=new Date(it,bt+1,0).getDate(),ka=new Date,zr=[];for(let br=Et-1;br>=0;br--)zr.push({day:new Date(it,bt,-br).getDate(),date:new Date(it,bt-1,new Date(it,bt,-br).getDate()),isCurrentMonth:false});for(let br=1;br<=nr;br++)zr.push({day:br,date:new Date(it,bt,br),isCurrentMonth:true});let Ca=42-zr.length;for(let br=1;br<=Ca;br++)zr.push({day:br,date:new Date(it,bt+1,br),isCurrentMonth:false});return zr.map((br,An)=>{let Ha=br.date.toDateString()===ka.toDateString(),Va=(we?typeof we=="string"?new Date(we):we:null)?.toDateString()===br.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:br.isCurrentMonth?Va?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Va?"#00E5CC":"transparent",boxShadow:Ha&&!Va?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(de.id,{[ee]:br.date}),ve(null);},children:br.day},An)})})()})]})]})]}),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:Ot(de)})});case "assignees":if(j)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 ue=a.filter(se=>de.assignees?.some(it=>it.id?it.id===se.id:it.name===se.name||it.initials===se.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(No,{assignedUsers:ue,availableUsers:a,onChange:se=>{let it=se.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(de.id,{assignees:it});}})});case "status":if(j){let se=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:se})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(gp,{status:de.status||"todo",onChange:se=>{v?.(de.id,{status:se,progress:se==="completed"?100:de.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.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 ke={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},me={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Se=ke[de.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Co,{priority:Se,onChange:se=>{se&&v?.(de.id,{priority:me[se]||"medium"});}})});default:return null}},wa=le=>[{id:"hide",label:"Hide Column",icon:tr.Hide,onClick:()=>m(le),disabled:le==="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:()=>{}}],Dr=le=>{let de=le.subtasks&&le.subtasks.length>0,pt=Io(e),j=oe.size>1&&oe.has(le.id),be=j?pt.filter(D=>oe.has(D.id)):[le],te=be.map(D=>D.id),$=be.filter(D=>!(D.subtasks&&D.subtasks.length>0)),ee=j?` (${te.length})`:"",we=()=>{P?P(te,le.name):w?.(te);};return de?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:tr.Duplicate,onClick:()=>{k?.(te);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:tr.Delete,onClick:we}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{c?.(le);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:tr.MarkIncomplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(D=>D.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:tr.SetInProgress,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:$.length===0||$.every(D=>D.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+ee,icon:tr.MarkComplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:tr.Duplicate,onClick:()=>{k?.(te);}},{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")+ee,icon:tr.Delete,onClick:we}]},_r=d.filter(le=>le.visible),Wr=_r.reduce((le,de)=>le+de.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Wr},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${St}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:_r.map((le,de)=>{let pt=de===_r.length-1,j=le.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(j?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:j&&_r.length===1?1:0,flexGrow:j&&_r.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:be=>{be.preventDefault(),rt({isOpen:true,x:be.clientX,y:be.clientY,type:"header",columnId:le.id});},onMouseEnter:be=>{be.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:be=>{be.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:le.label,children:le.label}),le.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ce===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Fe(le.id),Pe(be.clientX),Oe(le.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:ce===le.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},le.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(Zi,{columns:d,onToggleColumn:m,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ce(!Ae),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"})}),Ae&&jsxRuntime.jsxs("div",{ref:ft,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:le=>le.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:()=>Ce(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:mr},children:tt.map(({task:le,level:de},pt)=>{let j=et(le.id),be=Lr(pt),te=je===le.id,$=te&&gt==="above",ee=te&&gt==="below",we=te&&gt==="child",D={};return we&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${ne===le.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:we?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:Y?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>U(le.id),onMouseLeave:()=>U(null),onClick:H=>{let ke=Io(e).map(se=>se.id),Se=navigator.platform.toUpperCase().indexOf("MAC")>=0?H.metaKey:H.ctrlKey;fe(le.id,ke,Se,H.shiftKey),o?.(le.id),!Se&&!H.shiftKey&&s?.(le);},onDoubleClick:H=>{H.stopPropagation(),c?.(le);},onContextMenu:H=>{H.preventDefault(),rt({isOpen:true,x:H.clientX,y:H.clientY,type:"task",task:le}),i?.(le,H);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),_r.map((H,ue)=>{let ke=ue===_r.length-1,me=H.id==="name",Se=!!(le.subtasks&&le.subtasks.length>0),se=H.id==="assignees"||H.id==="startDate"||H.id==="endDate"?H.id:null,bt=!!se&&!Se&&Re===le.id&&!I,Et=be&&!!I&&I.column===H.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${me?"justify-start":"justify-center"}`,style:{position:"relative",width:`${H.width}px`,minWidth:`${H.minWidth??(me?200:60)}px`,maxWidth:`${H.maxWidth??2e3}px`,flexShrink:me&&_r.length===1?1:0,flexGrow:me&&_r.length===1?1:0,borderRight:ke?"none":`1px solid ${Re===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Et?`${t.accent}22`:void 0,boxShadow:Et?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Nr(H,le,me?de:0),bt&&se&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:nr=>Rt(nr,le.id,se,pt),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}})]},`${le.id}-${H.id}`)})]},le.id)})}),jsxRuntime.jsx(ls,{isOpen:ze.isOpen,x:ze.x,y:ze.y,items:ze.type==="header"&&ze.columnId?wa(ze.columnId):ze.type==="task"&&ze.task?Dr(ze.task):[],onClose:()=>rt({...ze,isOpen:false}),theme:t}),dt&&Wt&&ne&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Wt.x+12,top:Wt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=tt.find(de=>de.task.id===ne)?.task;return le?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:le.name})}):null})()}),document.body)]})}function Ym(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,l]=react.useState(e),[c,i]=react.useState(t),[u,p]=react.useState(null),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(0),[w,k]=react.useState(0),[M,R]=react.useState(null),[C,N]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:R,isHovered:C,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(Y,L)=>{a("none"),p(null),m(null),l(Y),i(L),k(0),b(null),x(0);}}}function rl({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=Ym(t,a),M=react.useRef(null),R=react.useRef(false),C=react.useRef(null),N=react.useRef(null),{dragMode:P,setDragMode:T,dragOffset:V,setDragOffset:O,ghostX:Y,setGhostX:L,ghostWidth:Re,setGhostWidth:U,connectionLine:Te,setConnectionLine:B,hoveredTaskId:z,setHoveredTaskId:Me,activeZone:We,setActiveZone:ce,draggedSegmentIndex:Fe,setDraggedSegmentIndex:X,draggedSegmentStartX:Pe,setDraggedSegmentStartX:Ne,segmentDragOffsetX:Oe,setSegmentDragOffsetX:ze,hoveredSegmentIndex:rt,setHoveredSegmentIndex:ne,isHovered:Ke,setIsHovered:je,isDragging:He,isResizing:gt,isConnecting:Mt,resetDragState:Ge}=k,Be=18,st=!!n.executionBarBg,Wt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ue=st?3:6,dt=e.subtasks&&e.subtasks.length>0,F=react.useRef(null),[J,I]=(()=>{let j=react.useRef(null),[,be]=react.useState(0);return [j.current,te=>{j.current=te,be($=>$+1);}]})(),q=!!w&&!x&&!dt&&!e.segments&&!!e.startDate&&!!e.endDate,pe=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let be=new Date(e.endDate);return be.setHours(0,0,0,0),be<j})()&&e.progress<100,ve=y&&e.isCriticalPath,Ae=n.name==="neutral"||n.today==="#1C1917",Ce=e.status==="completed"||e.progress===100,ft={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},fe=y&&e.isCriticalPath||pe?"#EF4444":e.color?e.color:e.priority&&ft[e.priority]?ft[e.priority]:n.taskBarPrimary,et=x?"default":He?Mt?"crosshair":gt?"ew-resize":"grabbing":"grab",Xe=x?"default":"ew-resize",tt=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),St=a<50,mr=a<40;react.useEffect(()=>{v&&(!Ke||He||e.segments)&&v(null);},[Ke,He,e.segments,v]);let cr=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Rt=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Lr=j=>Math.round(j/s)*s,Ot=j=>{let be=Math.round(j/s),te=new Date(o);return te.setDate(te.getDate()+be),te},kr=(j,be)=>{for(let te of m){if(te.id===e.id)continue;let $=5;if(j>=te.x-$&&j<=te.x+te.width+$&&be>=te.y-$&&be<=te.y+te.height+$)return te.id}return null},Vt=react.useCallback((j,be,te)=>{if(x)return;j.preventDefault(),j.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let ee=$.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let we=ee.matrixTransform($.getScreenCTM()?.inverse()),D=te!==void 0?te:t,H=be;if(!H){let ue=we.x-D;j.shiftKey?(H="connect",B({x:t+a,y:r+Be/2})):j.ctrlKey||j.metaKey?H="move":j.altKey?H=ue<a/2?"resize-start":"resize-end":mr?ue<a/2?H="move":H="resize-end":St?ue<=tt/2?H="resize-start":ue>=a-tt/2?H="resize-end":H="move":ue<=tt?H="resize-start":ue>=a-tt?H="resize-end":H="move";}R.current=false,T(H),je(false),ce(null),H==="move"?O(we.x-D):H==="connect"?B({x:t+a,y:r+Be/2}):O(0),L(D),U(a);},[t,a,r,Be,x]),ar=react.useCallback(j=>{let be=M.current?.ownerSVGElement;if(!be)return;let te=be.closest(".gantt-timeline-scroll");if(!te)return;let $=te.getBoundingClientRect(),ee=60,we=15,D=0;if(j.clientX<$.left+ee){let H=$.left+ee-j.clientX;D=-Math.min(we,H/2);}else if(j.clientX>$.right-ee){let H=j.clientX-($.right-ee);D=Math.min(we,H/2);}return D!==0&&(te.scrollLeft+=D),D!==0},[]),ua=react.useCallback(j=>{if(P==="none")return;R.current=true,N.current=j;let be=M.current?.ownerSVGElement;if(!be)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=ar(j);ee&&!C.current?C.current=window.setInterval(()=>{N.current&&(ar(N.current),ua(N.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let te=be.createSVGPoint();te.x=j.clientX,te.y=j.clientY;let $=te.matrixTransform(be.getScreenCTM()?.inverse());if(P==="connect"){B({x:$.x,y:$.y});let ee=kr($.x,$.y);Me(ee);}else if(P==="move"){let ee=$.x-V,we=Lr(ee);L(we),U(a);let D=Math.round((we-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Fe!==null){let H=we-Pe;ze(H);}}else if(P==="resize-start"){let ee=$.x,we=Lr(ee),D=t+a-we;D>=s&&(L(we),U(D));}else if(P==="resize-end"){let ee=$.x,D=Lr(ee)-t;D>=s&&U(D);}},[P,t,a,s,V,e,Lr,Fe,Pe,kr,Me,B,L,U,ze,f,ar]),Zr=react.useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),N.current=null,P!=="none"){if(P==="connect")z&&d&&d(e,z),B(null),Me(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),be,te,$=true;if(P==="move"){if(be=Ot(Y),te=new Date(be.getTime()+j),e.segments&&e.segments.length>0&&Fe!==null){let ee=Math.round(Oe/s),we=e.segments.map((ke,me)=>{if(me===Fe){let Se=new Date(ke.startDate),se=new Date(ke.endDate);return Se.setDate(Se.getDate()+ee),se.setDate(se.getDate()+ee),{startDate:Se,endDate:se}}return ke}),D=we.flatMap(ke=>[ke.startDate,ke.endDate]),H=new Date(Math.min(...D.map(ke=>ke.getTime()))),ue=new Date(Math.max(...D.map(ke=>ke.getTime())));p?.({...e,segments:we},H,ue),Ge(t,a);return}}else P==="resize-start"?(be=Ot(Y),te=e.endDate,be>te&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(be=e.startDate,te=Ot(Y+Re),te.setDate(te.getDate()-1),te<be&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&be&&te&&(te.getTime()<be.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,be,te));}f?.(e.id,0,false),Ge(t,a);}},[P,Y,Re,e,p,z,d,t,a,s,Ot,Oe,Fe,Ge,f]);react.useEffect(()=>{if(P==="none")return;let j=te=>{ua(te);},be=()=>{Zr();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",be),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",be),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,ua,Zr]);let nt=He&&!Mt?Y:t,Je=He&&!Mt?Re:a,Nr=l.taskClass(e),wa=24,Dr=y?e.isCriticalPath?1:.25:1,_r=react.useCallback(j=>{if(!q)return;j.stopPropagation(),j.preventDefault();let te=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;F.current={barRect:te,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),I(e.progress||0);},[q,e.progress,I]),Wr=react.useCallback(j=>{let be=F.current;if(!be)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??be.barRect;if(!$||$.width<=0)return;let ee=(j.clientX-$.left)/$.width,we=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(we=Math.round(we/25)*25),I(we);},[I]),le=react.useCallback(j=>{let be=F.current;if(!be)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let te=J;F.current=null,I(null),te!=null&&te!==be.initialPct&&w&&w(e,te);},[J,w,e,I]),de=react.useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),pt=J??(e.progress||0);return jsxRuntime.jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:Dr,transition:"opacity 300ms ease"},onClick:()=>{!He&&!R.current&&c?.(e),R.current=false;},onDoubleClick:j=>{!He&&!R.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!He&&je(true),onMouseMove:j=>{v&&Ke&&!He&&!e.segments&&v({task:e,x:t,y:r,width:a,height:Be,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{He||(je(false),ce(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+wa,height:Be,fill:"transparent",style:{pointerEvents:"all"}}),Ke&&!He&&!St&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:tt,height:Be,fill:We==="resize-start"?n.accent:"transparent",opacity:We==="resize-start"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-start"),onMouseDown:j=>Vt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+tt,y:r,width:a-tt*2,height:Be,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>Vt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-tt,y:r,width:tt,height:Be,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>Vt(j,"resize-end")})]}),Ke&&!He&&mr&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Be,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>Vt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Be,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.2:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>Vt(j,"resize-end")}),Ke&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Be-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),He&&!Mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Y,y:r,width:Re,height:Be,rx:Ue,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&&!He&&(()=>{let j=e.baselineStartDate.getTime(),be=e.baselineEndDate.getTime(),te=o.getTime(),$=864e5,ee=(j-te)/$,we=(be-j)/$,D=ee*s,H=Math.max(we*s,s),ue=nt+Je,ke=D+H,me=e.endDate?.getTime()??0,Se=Math.ceil((me-be)/$),se=Se>0,it=Se<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:D,y:r,width:H,height:Be,rx:Ue,fill:"none",stroke:Wt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),se&&ue>ke&&jsxRuntime.jsx("rect",{x:ke,y:r,width:ue-ke,height:Be,rx:0,fill:"#EF4444",opacity:.2}),se&&jsxRuntime.jsxs("text",{x:Math.max(ue,ke)+6,y:r+Be/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Se,"d"]}),it&&jsxRuntime.jsxs("text",{x:ue+6,y:r+Be/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Se,"d"]})]})})(),!e.segments&&st&&dt&&(()=>{let be=r+(Be-8)/2,te=4,$=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let we=e.startDate&&ee>=e.startDate,D=e.endDate&&(()=>{let se=new Date(e.endDate);return se.setHours(0,0,0,0),ee>se})(),H=e.startDate&&ee<e.startDate,ue=1;if(we&&e.startDate&&e.endDate&&!H){let se=new Date(e.startDate);se.setHours(0,0,0,0);let it=new Date(e.endDate);it.setHours(0,0,0,0);let bt=Math.max(1,(it.getTime()-se.getTime())/(1e3*60*60*24)),nr=Math.min((ee.getTime()-se.getTime())/(1e3*60*60*24),bt)/bt*100;ue=nr>0?$/nr:1;}let ke;$>=100?ke="#00E5CC":H?ke="#4B5563":D&&$<100?ke="#EF4444":ue>=.95?ke="#22C55E":ue>=.8?ke="#F59E0B":ke="#EF4444";let me=Math.max($/100*Je,$>0?te*2:0),Se=Je>100&&$>0;return jsxRuntime.jsxs("g",{"data-task-class":Nr,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:nt,y:be,width:Je,height:8,rx:te,fill:"rgba(255,255,255,0.10)"}),$>0&&jsxRuntime.jsx("rect",{x:nt,y:be,width:me,height:8,rx:te,fill:ke}),Se&&jsxRuntime.jsxs("text",{x:nt+me+6,y:be+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($),"%"]})]})})(),!e.segments&&st&&!dt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:nt,y:r,width:Je,height:Be,rx:Ue,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Nr,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:He&&!Mt?.15:e.parentId?.6:1,scale:Ke&&!He?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Vt(j),style:{cursor:et,pointerEvents:"all"}}),!e.segments&&!st&&jsxRuntime.jsx(framerMotion.motion.rect,{x:nt,y:r,width:Je,height:Be,rx:Ue,fill:fe,"data-task-class":Nr,initial:{opacity:0,scale:.95},animate:{opacity:He&&!Mt?.15:e.parentId?.6:Ke?.9:.8,scale:Ke&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:dt?void 0:j=>Vt(j),style:{cursor:dt?"default":et,pointerEvents:"all"}}),st&&(pe||ve)&&!e.segments&&jsxRuntime.jsx("rect",{x:nt,y:r,width:Je,height:Be,rx:Ue,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&&pt>0&&!dt&&jsxRuntime.jsx("rect",{x:nt,y:r,width:Math.max(Je*(pt/100),Ue*2),height:Be,rx:Ue,fill:fe,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!dt&&e.progress<100&&(()=>{let j=e.progress>0?Je*(e.progress/100):0,be=nt+j,te=Je-j,$=e.progress===0?Ue:0,ee=e.progress===0?nt:be,we=e.progress===0?Je:te;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:ee,y:r,width:we,height:Be,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:ee,y:r,width:we,height:Be,rx:$,fill:"none",stroke:fe,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),st&&!e.segments&&e.progress>0&&e.progress<100&&!dt&&!He&&J===null&&(()=>{let j=nt+Je*(e.progress/100),be=8,te=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:j,cy:r+Be/2,r:be,fill:te?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:j,y:r+Be/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:te?.initials||te?.name?.charAt(0)?.toUpperCase()||""})]})})(),q&&!He&&Je>=40&&(J!==null||pt<88)&&(()=>{let j=nt+Je*(pt/100),be=r+Be/2,te=J!==null,$=te?7:Ke?6:5,ee=te||Ke?1:.35,we=nt+Je-j,D=Math.max(4,Math.min(12,we-10)),H=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-H,y:be-12,width:H+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:_r,onPointerMove:Wr,onPointerUp:le,onPointerCancel:le,onClick:de,onDoubleClick:de,onMouseDown:ue=>ue.stopPropagation()}),jsxRuntime.jsx("circle",{cx:j,cy:be,r:$,fill:"#FFFFFF",stroke:fe,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:te?`drop-shadow(0 0 4px ${fe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),te&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:j-20,y:be-28,width:40,height:18,rx:4,fill:Wt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:fe,strokeWidth:1}),jsxRuntime.jsxs("text",{x:j,y:be-16,textAnchor:"middle",dominantBaseline:"central",fill:Wt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((j,be)=>{let te=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-te+s,we=He&&P==="move"&&Fe===be,D=rt===be,H=we?te+Oe:te;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!He&&ne(be),onMouseLeave:()=>!He&&ne(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:H,y:r,width:ee,height:Be,rx:Ue,fill:fe,initial:{opacity:0,scale:.95},animate:{opacity:we||e.parentId?.6:D?.9:.8,scale:D&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ue=>{ue.stopPropagation(),X(be),Ne(te),Vt(ue,void 0,te);},style:{cursor:et,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:H,y:r,width:ee*(e.progress/100),height:Be,rx:Ue,fill:fe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${be}`)}),Ae&&(pe||ve)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ve&&!pe&&jsxRuntime.jsx("rect",{x:nt,y:r,width:Je,height:Be,rx:Ue,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),pe&&jsxRuntime.jsx("rect",{x:nt,y:r,width:Je,height:Be,rx:Ue,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Je>60&&!e.segments&&!(st&&dt)&&(()=>{let j=l.taskLabel(e),be=typeof j=="string"?j:e.name,te=be.length>Math.floor(Je/8)?`${be.substring(0,Math.floor(Je/8))}...`:be;return jsxRuntime.jsx("text",{x:nt+8,y:r+Be/2,dominantBaseline:"middle",fill:Ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ce?"line-through":"none"},children:te})})(),!He&&!e.segments&&!dt&&e.progress>0&&e.progress<100&&(st?jsxRuntime.jsxs("text",{x:nt+Je+6,y:r+Be/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Je>100?jsxRuntime.jsxs("text",{x:nt+Je-12,y:r+Be/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&&Je>80&&!He&&!e.segments&&!(st&&dt)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:nt+Je-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:nt+Je-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ke||gt)&&!Mt&&!e.segments&&!dt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:nt-2,y:r,width:16,height:Be,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-start"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),Vt(j,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:nt+4,y:r+8,width:3,height:Be-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:nt+Je-14,y:r,width:16,height:Be,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-end"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),Vt(j,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:nt+Je-7,y:r+8,width:3,height:Be-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:Ke&&!He&&!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+Be/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ce("connect"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),Vt(j,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+10,cy:r+Be/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&&Te&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Be/2,x2:Te.x,y2:Te.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:Te.x,cy:Te.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:Te.x+15,y:Te.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Te.x+10},animate:{opacity:1,x:Te.x+15},transition:{duration:.2},children:"Connect"})]}),(Ke||He)&&!Mt&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:nt-1,y:r-1,width:Je+2,height:Be+2,rx:Ue+1,fill:"none",stroke:He?n.accent:st?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:st?1:2,opacity:He||st?.6:.4,initial:{opacity:0},animate:{opacity:He||st?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),gt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:Y,y1:0,x2:Y,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:Y+Re,y1:0,x2:Y+Re,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ke&&!He&&!e.segments&&!v&&(()=>{let te=r<100,$=te?r+Be+13:r-82-13,ee=te?`M ${nt+Je/2-6} ${r+Be+3} L ${nt+Je/2} ${r+Be+13} L ${nt+Je/2+6} ${r+Be+3}`:`M ${nt+Je/2-6} ${r-13} L ${nt+Je/2} ${r-3} L ${nt+Je/2+6} ${r-13}`,we=$+22,D=$+40,H=$+55,ue=$+70,ke=te?$+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:te?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:te?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:nt+Je/2-120,y:$,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:nt+Je/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:nt+Je/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:nt+Je/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:cr(e.startDate)}),jsxRuntime.jsx("text",{x:nt+Je/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:nt+Je/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:cr(e.endDate)}),jsxRuntime.jsx("text",{x:nt+Je/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:nt+Je/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Rt()}),jsxRuntime.jsx("text",{x:nt+Je/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:nt+Je/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:nt+Je/2-110,y:ue,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:nt+Je/2-50,y:ue,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(me=>me.name).join(", ").substring(0,30),e.assignees.map(me=>me.name).join(", ").length>30?"...":""]})]}),!te&&jsxRuntime.jsx("text",{x:nt+Je/2,y:ke,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:mr?"Left: move \u2022 Right: resize":St?"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 bd=260,us=8,Qm=16,fw=-12;function Zm({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:x,mouseX:w,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,R=x.lastActivity!=null,C=(M?155:105)+(R?28:0),N=w+Qm,P=k+fw-C;N+bd>window.innerWidth-us&&(N=w-bd-Qm),N<us&&(N=us);let T=P<us;T&&(P=k+20),P+C>window.innerHeight-us&&(P=window.innerHeight-us-C),s({left:N,top:P,showBelow:T});},[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=x=>x.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{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 x=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,R=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;R.getTime()<=C.getTime();){let P=R.getDay();x[P]&&!w.has(k(R))&&M++,R.setDate(R.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=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:bd,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(al,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.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:d},children:[c.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(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:d,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:m},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 jc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=react.useState(false),s=react.useRef(null),o=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),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,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(p=>jsxRuntime.jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.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:p.name}),p.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.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 Kc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,l]=react.useState("export"),[c,i]=react.useState("json"),[u,p]=react.useState(null),d=react.useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await _u(e,c,v);Ku(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await Xu(h),y=h.name.endsWith(".json")?"json":"csv",x=Yu(b,y);p(x),x.success&&a&&a(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}d.current&&(d.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(v=>jsxRuntime.jsxs("button",{onClick:()=>i(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"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:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),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:m,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:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var _x=["URGENT","HIGH","MEDIUM","LOW"],Kx=[{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"}],qx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function qc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=react.useState(true),b=react.useCallback(M=>{r({search:M.target.value});},[r]),y=react.useCallback(M=>{r({dateFilter:M.target.value});},[r]),x=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 ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"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:v?"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)"]})]}),!v&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[p&&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 I=M.target.value;r({priorities:I==="all"?[]:[I]});},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 I=M.target.value;r({assignees:I==="all"?[]:[I]});},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 I=M.target.value;r({labels:I==="all"?[]:[I]});},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:x,className:"filter-bar__select filter-bar__select--sm",children:Kx.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:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qx.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 Yc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxRuntime.jsxs("div",{className:g("relative",a),ref:p,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.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:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>d(async()=>await 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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>d(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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 Xc={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"}},Jc={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"}},Fo={dark:Xc,light:Jc,neutral:Qc},Yi="dark";var Xi=react.createContext(void 0),nv="asakaa-theme";function Cm({children:e,defaultTheme:t=Yi,storageKey:r=nv}){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=Fo[a];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${ov(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&l.style.setProperty(p,d);}),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:Fo};return jsxRuntime.jsx(Xi.Provider,{value:o,children:e})}function ss(){let e=react.useContext(Xi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ov(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ss();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(Fo).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 ct={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 Tm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var Ji={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"}},Nm={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"}},ed={en:Ji,es:Nm};function Dm(e){return ed[e]||ed.en}function td(e,t){let r=Dm(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 ls=react.createContext(Ji);function _a(){return react.useContext(ls)}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 Im({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=react.useState(false),[i,u]=react.useState(null),p=react.useRef(null),d=react.useRef(null),m=_a(),f=Ks(p,l,"right",176);if(react.useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.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,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{ref:p,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:m.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:d,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,x)=>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:x<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:x*.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 rd({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=react.useState(false),[c,i]=react.useState(null),[u,p]=react.useState(false),d=react.useRef(null),m=react.useRef(null),f=_a(),v=Ks(d,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 I=M.target;d.current&&!d.current.contains(I)&&m.current&&!m.current.contains(I)&&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),x=async(k,M)=>{if(M){i(k);try{await M();}catch(I){console.error(`Export ${k} failed:`,I);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:d,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:m,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:v.top,left:v.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:()=>x(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:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?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:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Sv({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 Ev({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 ad({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=react.useState(false),o=react.useRef(null),l=react.useRef(null),c=_a(),i=Ks(o,n,"left");react.useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],p=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"}: ${p}`,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:p})]}),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:u.map((d,m)=>{let f=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{r(d.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:m<u.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:m*.03},children:[jsxRuntime.jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function nd({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=_a(),u=Ks(l,s,"left");react.useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=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",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{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"}],d=t!=="all"||a,m=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(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#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"}),d&&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:u.top,left:u.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"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:m?"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:m?"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:p.map(f=>{let v=t===f.value&&!a,h=()=>f.value==="all"?v?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:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&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:m?"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?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"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":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"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 Em({value:e,onChange:t,theme:r}){let a=_a(),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 Mv({theme:e,forecast:t}){let r=_a(),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,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=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:u,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:m}),v&&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 Mm({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=react.useState(false),f=react.useRef(null),v=react.useRef(null),h=_a(),b=Ks(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";react.useEffect(()=>{if(!d)return;let M=I=>{let C=I.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:lucideReact.Zap,active:t,onChange:r,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:lucideReact.Layers,active:a,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:lucideReact.CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"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:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:v,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,I)=>{let C=M.icon,N=M.disabled,P=M.tooltip;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:I*.03},title:P,children:[jsxRuntime.jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?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&&!N&&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,I)=>{let C=i===M.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>u(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+I)*.03},children:[jsxRuntime.jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Pv({theme:e,etiqueta:t,children:r}){let[a,n]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!a)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[a]),jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":a,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),a&&jsxRuntime.jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:r})]})}function Qi({enCabecera:e=false,theme:t,timeScale:r,onTimeScaleChange:a,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:I,projectForecast:C,hideForecastHud:N,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportCSV:O,onExportJSON:X,onExportMSProject:F,showCriticalPath:Fe=true,onShowCriticalPathChange:U,showDependencies:De=true,onShowDependenciesChange:B,highlightWeekends:z=true,onHighlightWeekendsChange:Me,showBaseline:Ue=false,onShowBaselineChange:ce,onCopySnapshotLink:Le,hasDependencies:J=true}){let Pe=_a(),Ee=P||T||V||O||X||F,$e=!!t.glassToolbar,He=[{value:"day",label:Pe.toolbar.day},{value:"week",label:Pe.toolbar.week},{value:"month",label:Pe.toolbar.month}],et=[{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"})}],se=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Em,{value:r,onChange:a,theme:t}),v&&jsxRuntime.jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsxRuntime.jsx(Mm,{theme:t,showCriticalPath:Fe,onShowCriticalPathChange:U,showBaseline:Ue,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:De,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:J}),jsxRuntime.jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),(I||w)&&jsxRuntime.jsxs(Pv,{theme:t,etiqueta:Pe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[I&&jsxRuntime.jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(_e=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>I(_e),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===_e?se?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[_e==="execution"?Pe.toolbar.viewExecution:Pe.toolbar.viewOracle,M===_e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5"})]},_e))}),w&&jsxRuntime.jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsxRuntime.jsx(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if($e){let _e=se?"rgba(255,255,255,0.08)":t.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:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-3",children:I&&jsxRuntime.jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:se?"#000000":t.bgSecondary,border:`1px solid ${se?"rgba(255,255,255,0.08)":t.border}`},children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>I("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?se?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Pe.toolbar.viewExecution}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>I("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?se?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Pe.toolbar.viewOracle})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Em,{value:r,onChange:a,theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),w&&jsxRuntime.jsx(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxRuntime.jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),y]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),jsxRuntime.jsx(Mm,{theme:t,showCriticalPath:Fe,onShowCriticalPathChange:U,showBaseline:Ue,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:De,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:J}),jsxRuntime.jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),p&&m&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${se?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${se?"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:d||Pe.toolbar.createTask})]})]})]}),C&&!N&&jsxRuntime.jsx(Mv,{theme:t,forecast:C})]})}return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Ev,{options:He,value:r,onChange:_e=>a(_e),theme:t}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.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:t.borderLight}}),w&&jsxRuntime.jsx(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxRuntime.jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[y,jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:m,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:d||Pe.toolbar.createTask})]}),(Ee||u)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsxRuntime.jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),u&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsxRuntime.jsx(Sv,{options:et,value:o,onChange:_e=>l(_e),theme:t})]})]})}function Zi({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 u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(ir,{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(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function cs({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 u=200,p=a.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,h=r;t+u+d>m&&(v=t-u,v<d&&(v=d)),r+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[e,t,r,a.length]),react.useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&n();},p=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref: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(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ar={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 Wm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=react.useRef(false),f=react.useCallback(x=>{m.current=x;},[]),v=react.useCallback(x=>{let w=[],k=M=>{for(let I of M)w.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&k(I.subtasks);};return k(x),w},[]),h=react.useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=react.useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){r(k[0].id,false);return}let I=k.findIndex(P=>P.id===M.id);if(I===-1)return;let C=x==="up"?I-1:I+1;if(C<0||C>=k.length)return;let N=k[C];r(N.id,w);},[e,h,v,r]),y=react.useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),N=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(N&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!N.isExpanded||x.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!I){N&&(x.preventDefault(),a(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!I){N&&(x.preventDefault(),a(N.id,"above"));return}if(x.key==="Enter"&&I){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),i(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&I){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&I&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,a,n,s,o,l,c,i,u,p]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function Gm(e){let[t,r]=react.useState(new Set),[a,n]=react.useState(null);react.useEffect(()=>{e&&(r(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=react.useCallback(d=>{r(new Set([d])),n(d);},[]),o=react.useCallback(d=>{r(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),l=react.useCallback((d,m)=>{if(!a){s(d);return}let f=m.indexOf(a),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);r(new Set(y)),n(d);},[a,s]),c=react.useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=react.useCallback((d,m)=>{m?r(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=react.useCallback(()=>{r(new Set),n(null);},[]),p=react.useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function cd(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?cd(t.subtasks):t.subtasks}))}function Ro(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 ds(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ds(r.subtasks,t);if(a)return a}}return null}function ld(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ld(r.subtasks,t);if(a)return a}return null}function dd(e,t){if(t.length===0)return e;let r=Ro(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let s=r[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return cd(p)}function ud(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ld(r,a);if(!n)continue;let s=ld(r,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(r,n.id,a);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(r,n.id,c));}return cd(r)}function pd(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(a,n,r),a}function md(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((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(i+1,0,d),d},l=o(r);l&&a.push(l);}return {tasks:r,duplicatedTasks:a}}function Vm(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(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,o),true};return l(a),{tasks:a,newTask:o}}function gd(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:gd(a.subtasks,t,r)}:a)}function fd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:fd(r.subtasks,t)}:r)}function bd(e,t){let r=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=r(m.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=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},i=c(e),u={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},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function jm(e,t,r,a){if(t===r)return e;let n=ds(e,t);if(!n)return e;if(r){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,r))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},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 u=i.subtasks||[],p=a!==void 0?a:u.length,d=[...u];d.splice(p,0,{...n,parentId:r});let m=d.map((f,v)=>({...f,position:v}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Ka(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ka(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 tl({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:I,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:T,allTasks:V,scrollContainerRef:O,showCriticalPath:X=false}){let F=react.useContext(ls),[Fe,U]=react.useState(null),[De,B]=react.useState(null),[z,Me]=react.useState(""),Ue=react.useRef(null),[ce,Le]=react.useState(null),[J,Pe]=react.useState(0),[Ee,$e]=react.useState(0),[He,et]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[se,_e]=react.useState(null),[qe,Re]=react.useState(null),[ut,Et]=react.useState(null),Ge=react.useRef(0),Ie=5,dt=react.useRef(false),[Mt,Be]=react.useState(null),[vt,L]=react.useState(false),Q=react.useRef(null),[R,_]=react.useState(null),[ue,ve]=react.useState(null),[Oe,ye]=react.useState(false),ft=react.useRef(null);react.useEffect(()=>{function le(de){ft.current&&!ft.current.contains(de.target)&&ye(false);}if(Oe)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[Oe]),react.useEffect(()=>{De&&Ue.current&&(Ue.current.focus(),Ue.current.select());},[De]),react.useEffect(()=>{if(!ce)return;let le=pt=>{let j=pt.clientX-J,be=Ee+j;f?.(ce,be);},de=()=>{Le(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",de),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",de),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,J,Ee,f]);let{selectedTaskIds:ie,handleTaskClick:ge,isTaskSelected:Ze}=Gm(l),{setIsEditing:Xe}=Wm({tasks:e,selectedTaskIds:ie,onTaskSelect:(le,de)=>{let j=Ro(e).map(be=>be.id);ge(le,j,de||false,false),o?.(le);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:le=>{let de=Ro(e).find(pt=>pt.id===le);de&&vr(de);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:le=>{let de=Ro(e).find(pt=>pt.id===le);de&&N&&N(de);},enableKeyboard:true}),kt=(le,de=0,pt="")=>{let j=[],be=[...le].sort((te,$)=>(te.position??0)-($.position??0));for(let te=0;te<be.length;te++){let $=be[te],ee=te+1,ke=pt?`${pt}.${ee}`:`${ee}.0`,D=$.wbsCode||ke;if($.wbsCode=D,j.push({task:$,level:de}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${ee}`:`${ee}`);j.push(...kt($.subtasks,de+1,pe));}}return j},Je=kt(e),At=48,Yt=Math.max(Je.length*r,600-At),pr=(le,de)=>de==="assignees"?le.assignees:de==="startDate"?le.startDate:le.endDate,It=(le,de,pt,j)=>{le.preventDefault(),le.stopPropagation(),_({sourceTaskId:de,column:pt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let be=le.currentTarget.closest("[data-grid-body]"),te=rt=>{let fe=be?.getBoundingClientRect().top??0,q=Math.floor((rt-fe)/r);return q=Math.max(0,Math.min(Je.length-1,q)),q<j&&(q=j),q},$=le.clientY,ee=O?.current??null,ke=()=>{Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);},D=()=>{let rt=te($);_(fe=>fe&&{...fe,targetIndex:rt});},W=()=>{if(ke(),!ee)return;let rt=ee.getBoundingClientRect(),fe=60,q=12,it=$-rt.top,bt=rt.bottom-$;if(bt<fe&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Pt=Math.max(1,Math.round(q*(1-Math.max(0,bt)/fe))),Zt=()=>{ee.scrollTop+=Pt,D(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(Q.current=requestAnimationFrame(Zt));};Q.current=requestAnimationFrame(Zt);}else if(it<fe&&ee.scrollTop>0){let Pt=Math.max(1,Math.round(q*(1-Math.max(0,it)/fe))),Zt=()=>{ee.scrollTop-=Pt,D(),ee.scrollTop>0&&(Q.current=requestAnimationFrame(Zt));};Q.current=requestAnimationFrame(Zt);}},pe=rt=>{$=rt.clientY,D(),W();},we=rt=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",we),ke(),document.body.style.cursor="",document.body.style.userSelect="",_(null);let fe=te(rt.clientY),q=Je.find(ya=>ya.task.id===de)?.task;if(!q)return;let it=pr(q,pt),bt=Math.min(j,fe),Pt=Math.max(j,fe),Zt=[];for(let ya=bt;ya<=Pt;ya++){if(ya===j)continue;let Kr=Je[ya]?.task;!Kr||Kr.subtasks&&Kr.subtasks.length>0||Zt.push(Kr.id);}Zt.length!==0&&h?.(Zt,pt,it);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",we);},Ur=le=>{if(!R)return false;let de=Math.min(R.sourceIndex,R.targetIndex),pt=Math.max(R.sourceIndex,R.targetIndex);return le>=de&&le<=pt},Ht=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,vr=le=>{B(le.id),Me(le.name),Xe(true);},jt=le=>{z.trim()&&z!==e.find(de=>de.id===le)?.name&&I?.(le,z.trim()),B(null),Me(""),Xe(false);},or=()=>{B(null),Me(""),Xe(false);},ha=(le,de)=>{de.stopPropagation(),C?.(le.id);},pa=(le,de)=>{de.preventDefault(),Ge.current=de.clientY,_e(le),dt.current=false,L(false),Be({x:de.clientX,y:de.clientY});},tt=le=>{if(!se||(Math.abs(le.clientY-Ge.current)>Ie&&!dt.current&&(dt.current=true,L(true)),Be({x:le.clientX,y:le.clientY}),!dt.current))return;if(O?.current){let te=O.current,$=te.getBoundingClientRect(),ee=60,ke=12;Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);let D=le.clientY-$.top,W=$.bottom-le.clientY;if(D<ee&&te.scrollTop>0){let pe=Math.round(ke*(1-D/ee)),we=()=>{te.scrollTop-=pe,dt.current&&te.scrollTop>0&&(Q.current=requestAnimationFrame(we));};Q.current=requestAnimationFrame(we);}else if(W<ee&&te.scrollTop<te.scrollHeight-te.clientHeight){let pe=Math.round(ke*(1-W/ee)),we=()=>{te.scrollTop+=pe,dt.current&&te.scrollTop<te.scrollHeight-te.clientHeight&&(Q.current=requestAnimationFrame(we));};Q.current=requestAnimationFrame(we);}}let pt=document.querySelectorAll("[data-task-row]"),j=null,be=null;pt.forEach(te=>{let $=te.getBoundingClientRect(),ee=te.getAttribute("data-task-row");if(ee&&ee!==se&&le.clientY>=$.top&&le.clientY<=$.bottom){j=ee;let ke=le.clientY-$.top,D=$.height;ke<D*.25?be="above":ke>D*.75?be="below":be="child";}}),Re(j),Et(be);},Ye=()=>{if(dt.current&&se&&qe&&ut){if(ut==="child")T?.(se,qe);else if(ut==="above"||ut==="below"){let le=(te,$,ee=null)=>{for(let ke of te){if(ke.id===$)return ee;if(ke.subtasks){let D=le(ke.subtasks,$,ke.id);if(D!==void 0)return D}}},de=V&&V.length>0?V:e,pt=le(de,se,null),j=le(de,qe,null),be=(te,$,ee,ke)=>{let D=te.findIndex(we=>we.id===$),W=ke?te.findIndex(we=>we.id===ee):-1,pe=ut==="below"?D+1:D;return ke&&W!==-1&&W<D&&(pe-=1),Math.max(0,pe)};if(j===null){let $=be(de,qe,se,pt===null);T?.(se,null,$);}else {let te=ds(de,j);if(te?.subtasks){let $=pt===j,ee=be(te.subtasks,qe,se,$);T?.(se,j,ee);}}}}Q.current&&(cancelAnimationFrame(Q.current),Q.current=null),_e(null),Re(null),Et(null),Be(null),dt.current=false,L(false);};react.useEffect(()=>{if(se)return document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Ye),document.body.style.cursor="",document.body.style.userSelect="";}},[se,qe,ut]);let ea=(le,de,pt)=>{let j=de.subtasks&&de.subtasks.length>0;switch(le.id){case "name":let be=De===de.id,te=Fe===de.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[T&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:te?1:.3},onMouseDown:q=>pa(de.id,q),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:q=>{q.stopPropagation(),u?.(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"}),be?jsxRuntime.jsx("input",{ref:Ue,type:"text",value:z,onChange:q=>Me(q.target.value),onKeyDown:q=>{q.key==="Enter"?jt(de.id):q.key==="Escape"&&or();},onBlur:()=>jt(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:q=>q.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),"%"]}),X&&de.isCriticalPath&&jsxRuntime.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),X&&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"]})]}),te&&!be&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>ha(de,q),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:q=>{q.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 ee=le.id==="startDate"?"startDate":"endDate",ke=de[ee],D=ue?.taskId===de.id&&ue?.field===ee,W=q=>q?(typeof q=="string"?new Date(q):q).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:q=>q.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:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:q=>{if(!j)if(D)ve(null);else {let it=q.currentTarget.getBoundingClientRect();ve({taskId:de.id,field:ee,month:ke?typeof ke=="string"?new Date(ke):ke:new Date,position:{top:it.bottom+4,left:it.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:W(ke)}),j&&jsxRuntime.jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),D&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ve(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:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,it=new Date(q);it.setDate(q.getDate()+1);let bt=new Date(q);bt.setDate(q.getDate()+7);let Pt=new Date(q);return Pt.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:it},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Pt}].map((ya,Kr)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Za=>Za.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Za=>Za.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:ya.date}),ve(null);},children:ya.label},Kr))})(),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:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:void 0}),ve(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:()=>ve(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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:()=>ve(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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((q,it)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},it))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=ue?.month||new Date,it=q.getFullYear(),bt=q.getMonth(),Pt=new Date(it,bt,1).getDay(),Zt=new Date(it,bt+1,0).getDate(),ya=new Date,Kr=[];for(let er=Pt-1;er>=0;er--)Kr.push({day:new Date(it,bt,-er).getDate(),date:new Date(it,bt-1,new Date(it,bt,-er).getDate()),isCurrentMonth:false});for(let er=1;er<=Zt;er++)Kr.push({day:er,date:new Date(it,bt,er),isCurrentMonth:true});let Za=42-Kr.length;for(let er=1;er<=Za;er++)Kr.push({day:er,date:new Date(it,bt+1,er),isCurrentMonth:false});return Kr.map((er,yo)=>{let Vn=er.date.toDateString()===ya.toDateString(),jn=(ke?typeof ke=="string"?new Date(ke):ke:null)?.toDateString()===er.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:er.isCurrentMonth?jn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:jn?"#00E5CC":"transparent",boxShadow:Vn&&!jn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(de.id,{[ee]:er.date}),ve(null);},children:er.day},yo)})})()})]})]})]}),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:Ht(de)})});case "assignees":if(j)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 pe=a.filter(q=>de.assignees?.some(it=>it.id?it.id===q.id:it.name===q.name||it.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Do,{assignedUsers:pe,availableUsers:a,onChange:q=>{let it=q.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(de.id,{assignees:it});}})});case "status":if(j){let q=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:q})})}return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(fp,{status:de.status||"todo",onChange:q=>{v?.(de.id,{status:q,progress:q==="completed"?100:de.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.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 we={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},rt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=we[de.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(To,{priority:fe,onChange:q=>{q&&v?.(de.id,{priority:rt[q]||"medium"});}})});default:return null}},_r=le=>[{id:"hide",label:"Hide Column",icon:ar.Hide,onClick:()=>m(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ar.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ar.SortDesc,onClick:()=>{}}],sa=le=>{let de=le.subtasks&&le.subtasks.length>0,pt=Ro(e),j=ie.size>1&&ie.has(le.id),be=j?pt.filter(D=>ie.has(D.id)):[le],te=be.map(D=>D.id),$=be.filter(D=>!(D.subtasks&&D.subtasks.length>0)),ee=j?` (${te.length})`:"",ke=()=>{P?P(te,le.name):w?.(te);};return de?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:(F?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ar.Duplicate,onClick:()=>{k?.(te);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(F?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ar.Delete,onClick:ke}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:ar.Pencil,onClick:()=>{c?.(le);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(F?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:ar.MarkIncomplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(D=>D.status==="todo")},{id:"setInProgress",label:(F?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:ar.SetInProgress,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:$.length===0||$.every(D=>D.status==="in-progress")},{id:"markComplete",label:(F?.contextMenu?.markComplete||"Mark Complete")+ee,icon:ar.MarkComplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(F?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ar.Duplicate,onClick:()=>{k?.(te);}},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:ar.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(F?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ar.Delete,onClick:ke}]},wr=d.filter(le=>le.visible),Wr=wr.reduce((le,de)=>le+de.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Wr},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${At}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:wr.map((le,de)=>{let pt=de===wr.length-1,j=le.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(j?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:j&&wr.length===1?1:0,flexGrow:j&&wr.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:be=>{be.preventDefault(),et({isOpen:true,x:be.clientX,y:be.clientY,type:"header",columnId:le.id});},onMouseEnter:be=>{be.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:be=>{be.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:le.label,children:le.label}),le.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ce===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Le(le.id),Pe(be.clientX),$e(le.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:ce===le.id?.8:void 0},children:jsxRuntime.jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},le.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(Zi,{columns:d,onToggleColumn:m,theme:t}),jsxRuntime.jsx("button",{onClick:()=>ye(!Oe),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"})}),Oe&&jsxRuntime.jsxs("div",{ref:ft,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:le=>le.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:()=>ye(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:Yt},children:Je.map(({task:le,level:de},pt)=>{let j=Ze(le.id),be=Ur(pt),te=qe===le.id,$=te&&ut==="above",ee=te&&ut==="below",ke=te&&ut==="child",D={};return ke&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${se===le.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:ke?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:X?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>U(le.id),onMouseLeave:()=>U(null),onClick:W=>{let we=Ro(e).map(q=>q.id),fe=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;ge(le.id,we,fe,W.shiftKey),o?.(le.id),!fe&&!W.shiftKey&&s?.(le);},onDoubleClick:W=>{W.stopPropagation(),c?.(le);},onContextMenu:W=>{W.preventDefault(),et({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:le}),i?.(le,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[$&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),wr.map((W,pe)=>{let we=pe===wr.length-1,rt=W.id==="name",fe=!!(le.subtasks&&le.subtasks.length>0),q=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!q&&!fe&&Fe===le.id&&!R,Pt=be&&!!R&&R.column===W.id;return jsxRuntime.jsxs("div",{className:`px-4 flex items-center ${rt?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(rt?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:rt&&wr.length===1?1:0,flexGrow:rt&&wr.length===1?1:0,borderRight:we?"none":`1px solid ${Fe===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Pt?`${t.accent}22`:void 0,boxShadow:Pt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ea(W,le,rt?de:0),bt&&q&&jsxRuntime.jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Zt=>It(Zt,le.id,q,pt),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}})]},`${le.id}-${W.id}`)})]},le.id)})}),jsxRuntime.jsx(cs,{isOpen:He.isOpen,x:He.x,y:He.y,items:He.type==="header"&&He.columnId?_r(He.columnId):He.type==="task"&&He.task?sa(He.task):[],onClose:()=>et({...He,isOpen:false}),theme:t}),vt&&Mt&&se&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Mt.x+12,top:Mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Je.find(de=>de.task.id===se)?.task;return le?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:le.name})}):null})()}),document.body)]})}function Xm(e,t){let[r,a]=react.useState("none"),[n,s]=react.useState(0),[o,l]=react.useState(e),[c,i]=react.useState(t),[u,p]=react.useState(null),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(0),[w,k]=react.useState(0),[M,I]=react.useState(null),[C,N]=react.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:C,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(X,F)=>{a("none"),p(null),m(null),l(X),i(F),k(0),b(null),x(0);}}}function rl({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=Xm(t,a),M=react.useRef(null),I=react.useRef(false),C=react.useRef(null),N=react.useRef(null),{dragMode:P,setDragMode:T,dragOffset:V,setDragOffset:O,ghostX:X,setGhostX:F,ghostWidth:Fe,setGhostWidth:U,connectionLine:De,setConnectionLine:B,hoveredTaskId:z,setHoveredTaskId:Me,activeZone:Ue,setActiveZone:ce,draggedSegmentIndex:Le,setDraggedSegmentIndex:J,draggedSegmentStartX:Pe,setDraggedSegmentStartX:Ee,segmentDragOffsetX:$e,setSegmentDragOffsetX:He,hoveredSegmentIndex:et,setHoveredSegmentIndex:se,isHovered:_e,setIsHovered:qe,isDragging:Re,isResizing:ut,isConnecting:Et,resetDragState:Ge}=k,Ie=18,dt=!!n.executionBarBg,Mt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Be=dt?3:6,vt=e.subtasks&&e.subtasks.length>0,L=react.useRef(null),[Q,R]=(()=>{let j=react.useRef(null),[,be]=react.useState(0);return [j.current,te=>{j.current=te,be($=>$+1);}]})(),_=!!w&&!x&&!vt&&!e.segments&&!!e.startDate&&!!e.endDate,ue=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let be=new Date(e.endDate);return be.setHours(0,0,0,0),be<j})()&&e.progress<100,ve=y&&e.isCriticalPath,Oe=n.name==="neutral"||n.today==="#1C1917",ye=e.status==="completed"||e.progress===100,ft={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ge=y&&e.isCriticalPath||ue?"#EF4444":e.color?e.color:e.priority&&ft[e.priority]?ft[e.priority]:n.taskBarPrimary,Ze=x?"default":Re?Et?"crosshair":ut?"ew-resize":"grabbing":"grab",Xe=x?"default":"ew-resize",Je=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),At=a<50,Yt=a<40;react.useEffect(()=>{v&&(!_e||Re||e.segments)&&v(null);},[_e,Re,e.segments,v]);let pr=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),It=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Ur=j=>Math.round(j/s)*s,Ht=j=>{let be=Math.round(j/s),te=new Date(o);return te.setDate(te.getDate()+be),te},vr=(j,be)=>{for(let te of m){if(te.id===e.id)continue;let $=5;if(j>=te.x-$&&j<=te.x+te.width+$&&be>=te.y-$&&be<=te.y+te.height+$)return te.id}return null},jt=react.useCallback((j,be,te)=>{if(x)return;j.preventDefault(),j.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let ee=$.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let ke=ee.matrixTransform($.getScreenCTM()?.inverse()),D=te!==void 0?te:t,W=be;if(!W){let pe=ke.x-D;j.shiftKey?(W="connect",B({x:t+a,y:r+Ie/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=pe<a/2?"resize-start":"resize-end":Yt?pe<a/2?W="move":W="resize-end":At?pe<=Je/2?W="resize-start":pe>=a-Je/2?W="resize-end":W="move":pe<=Je?W="resize-start":pe>=a-Je?W="resize-end":W="move";}I.current=false,T(W),qe(false),ce(null),W==="move"?O(ke.x-D):W==="connect"?B({x:t+a,y:r+Ie/2}):O(0),F(D),U(a);},[t,a,r,Ie,x]),or=react.useCallback(j=>{let be=M.current?.ownerSVGElement;if(!be)return;let te=be.closest(".gantt-timeline-scroll");if(!te)return;let $=te.getBoundingClientRect(),ee=60,ke=15,D=0;if(j.clientX<$.left+ee){let W=$.left+ee-j.clientX;D=-Math.min(ke,W/2);}else if(j.clientX>$.right-ee){let W=j.clientX-($.right-ee);D=Math.min(ke,W/2);}return D!==0&&(te.scrollLeft+=D),D!==0},[]),ha=react.useCallback(j=>{if(P==="none")return;I.current=true,N.current=j;let be=M.current?.ownerSVGElement;if(!be)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=or(j);ee&&!C.current?C.current=window.setInterval(()=>{N.current&&(or(N.current),ha(N.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let te=be.createSVGPoint();te.x=j.clientX,te.y=j.clientY;let $=te.matrixTransform(be.getScreenCTM()?.inverse());if(P==="connect"){B({x:$.x,y:$.y});let ee=vr($.x,$.y);Me(ee);}else if(P==="move"){let ee=$.x-V,ke=Ur(ee);F(ke),U(a);let D=Math.round((ke-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Le!==null){let W=ke-Pe;He(W);}}else if(P==="resize-start"){let ee=$.x,ke=Ur(ee),D=t+a-ke;D>=s&&(F(ke),U(D));}else if(P==="resize-end"){let ee=$.x,D=Ur(ee)-t;D>=s&&U(D);}},[P,t,a,s,V,e,Ur,Le,Pe,vr,Me,B,F,U,He,f,or]),pa=react.useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),N.current=null,P!=="none"){if(P==="connect")z&&d&&d(e,z),B(null),Me(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),be,te,$=true;if(P==="move"){if(be=Ht(X),te=new Date(be.getTime()+j),e.segments&&e.segments.length>0&&Le!==null){let ee=Math.round($e/s),ke=e.segments.map((we,rt)=>{if(rt===Le){let fe=new Date(we.startDate),q=new Date(we.endDate);return fe.setDate(fe.getDate()+ee),q.setDate(q.getDate()+ee),{startDate:fe,endDate:q}}return we}),D=ke.flatMap(we=>[we.startDate,we.endDate]),W=new Date(Math.min(...D.map(we=>we.getTime()))),pe=new Date(Math.max(...D.map(we=>we.getTime())));p?.({...e,segments:ke},W,pe),Ge(t,a);return}}else P==="resize-start"?(be=Ht(X),te=e.endDate,be>te&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(be=e.startDate,te=Ht(X+Fe),te.setDate(te.getDate()-1),te<be&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&be&&te&&(te.getTime()<be.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,be,te));}f?.(e.id,0,false),Ge(t,a);}},[P,X,Fe,e,p,z,d,t,a,s,Ht,$e,Le,Ge,f]);react.useEffect(()=>{if(P==="none")return;let j=te=>{ha(te);},be=()=>{pa();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",be),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",be),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,ha,pa]);let tt=Re&&!Et?X:t,Ye=Re&&!Et?Fe:a,ea=l.taskClass(e),_r=24,sa=y?e.isCriticalPath?1:.25:1,wr=react.useCallback(j=>{if(!_)return;j.stopPropagation(),j.preventDefault();let te=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:te,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),R(e.progress||0);},[_,e.progress,R]),Wr=react.useCallback(j=>{let be=L.current;if(!be)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??be.barRect;if(!$||$.width<=0)return;let ee=(j.clientX-$.left)/$.width,ke=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(ke=Math.round(ke/25)*25),R(ke);},[R]),le=react.useCallback(j=>{let be=L.current;if(!be)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let te=Q;L.current=null,R(null),te!=null&&te!==be.initialPct&&w&&w(e,te);},[Q,w,e,R]),de=react.useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),pt=Q??(e.progress||0);return jsxRuntime.jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:sa,transition:"opacity 300ms ease"},onClick:()=>{!Re&&!I.current&&c?.(e),I.current=false;},onDoubleClick:j=>{!Re&&!I.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!Re&&qe(true),onMouseMove:j=>{v&&_e&&!Re&&!e.segments&&v({task:e,x:t,y:r,width:a,height:Ie,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Re||(qe(false),ce(null));},children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a+_r,height:Ie,fill:"transparent",style:{pointerEvents:"all"}}),_e&&!Re&&!At&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:Je,height:Ie,fill:Ue==="resize-start"?n.accent:"transparent",opacity:Ue==="resize-start"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-start"),onMouseDown:j=>jt(j,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Je,y:r,width:a-Je*2,height:Ie,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>jt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a-Je,y:r,width:Je,height:Ie,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>jt(j,"resize-end")})]}),_e&&!Re&&Yt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:Ie,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>jt(j,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:Ie,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.2:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>jt(j,"resize-end")}),_e&&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"}})]}),Re&&!Et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:X,y:r,width:Fe,height:Ie,rx:Be,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&&!Re&&(()=>{let j=e.baselineStartDate.getTime(),be=e.baselineEndDate.getTime(),te=o.getTime(),$=864e5,ee=(j-te)/$,ke=(be-j)/$,D=ee*s,W=Math.max(ke*s,s),pe=tt+Ye,we=D+W,rt=e.endDate?.getTime()??0,fe=Math.ceil((rt-be)/$),q=fe>0,it=fe<-0;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:D,y:r,width:W,height:Ie,rx:Be,fill:"none",stroke:Mt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),q&&pe>we&&jsxRuntime.jsx("rect",{x:we,y:r,width:pe-we,height:Ie,rx:0,fill:"#EF4444",opacity:.2}),q&&jsxRuntime.jsxs("text",{x:Math.max(pe,we)+6,y:r+Ie/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",fe,"d"]}),it&&jsxRuntime.jsxs("text",{x:pe+6,y:r+Ie/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[fe,"d"]})]})})(),!e.segments&&dt&&vt&&(()=>{let be=r+(Ie-8)/2,te=4,$=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let ke=e.startDate&&ee>=e.startDate,D=e.endDate&&(()=>{let q=new Date(e.endDate);return q.setHours(0,0,0,0),ee>q})(),W=e.startDate&&ee<e.startDate,pe=1;if(ke&&e.startDate&&e.endDate&&!W){let q=new Date(e.startDate);q.setHours(0,0,0,0);let it=new Date(e.endDate);it.setHours(0,0,0,0);let bt=Math.max(1,(it.getTime()-q.getTime())/(1e3*60*60*24)),Zt=Math.min((ee.getTime()-q.getTime())/(1e3*60*60*24),bt)/bt*100;pe=Zt>0?$/Zt:1;}let we;$>=100?we="#00E5CC":W?we="#4B5563":D&&$<100?we="#EF4444":pe>=.95?we="#22C55E":pe>=.8?we="#F59E0B":we="#EF4444";let rt=Math.max($/100*Ye,$>0?te*2:0),fe=Ye>100&&$>0;return jsxRuntime.jsxs("g",{"data-task-class":ea,style:{cursor:"default",pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:tt,y:be,width:Ye,height:8,rx:te,fill:"rgba(255,255,255,0.10)"}),$>0&&jsxRuntime.jsx("rect",{x:tt,y:be,width:rt,height:8,rx:te,fill:we}),fe&&jsxRuntime.jsxs("text",{x:tt+rt+6,y:be+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($),"%"]})]})})(),!e.segments&&dt&&!vt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ea,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Et?.15:e.parentId?.6:1,scale:_e&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>jt(j),style:{cursor:Ze,pointerEvents:"all"}}),!e.segments&&!dt&&jsxRuntime.jsx(framerMotion.motion.rect,{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:ge,"data-task-class":ea,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Et?.15:e.parentId?.6:_e?.9:.8,scale:_e&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:vt?void 0:j=>jt(j),style:{cursor:vt?"default":Ze,pointerEvents:"all"}}),dt&&(ue||ve)&&!e.segments&&jsxRuntime.jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,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&&pt>0&&!vt&&jsxRuntime.jsx("rect",{x:tt,y:r,width:Math.max(Ye*(pt/100),Be*2),height:Ie,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!vt&&e.progress<100&&(()=>{let j=e.progress>0?Ye*(e.progress/100):0,be=tt+j,te=Ye-j,$=e.progress===0?Be:0,ee=e.progress===0?tt:be,ke=e.progress===0?Ye:te;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:ee,y:r,width:ke,height:Ie,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsxRuntime.jsx("rect",{x:ee,y:r,width:ke,height:Ie,rx:$,fill:"none",stroke:ge,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),dt&&!e.segments&&e.progress>0&&e.progress<100&&!vt&&!Re&&Q===null&&(()=>{let j=tt+Ye*(e.progress/100),be=8,te=e.assignees?.[0];return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("circle",{cx:j,cy:r+Ie/2,r:be,fill:te?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsxRuntime.jsx("text",{x:j,y:r+Ie/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:te?.initials||te?.name?.charAt(0)?.toUpperCase()||""})]})})(),_&&!Re&&Ye>=40&&(Q!==null||pt<88)&&(()=>{let j=tt+Ye*(pt/100),be=r+Ie/2,te=Q!==null,$=te?7:_e?6:5,ee=te||_e?1:.35,ke=tt+Ye-j,D=Math.max(4,Math.min(12,ke-10)),W=12;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-W,y:be-12,width:W+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:wr,onPointerMove:Wr,onPointerUp:le,onPointerCancel:le,onClick:de,onDoubleClick:de,onMouseDown:pe=>pe.stopPropagation()}),jsxRuntime.jsx("circle",{cx:j,cy:be,r:$,fill:"#FFFFFF",stroke:ge,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:te?`drop-shadow(0 0 4px ${ge})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),te&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:j-20,y:be-28,width:40,height:18,rx:4,fill:Mt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:ge,strokeWidth:1}),jsxRuntime.jsxs("text",{x:j,y:be-16,textAnchor:"middle",dominantBaseline:"central",fill:Mt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[Q,"%"]})]})]})})(),e.segments&&e.segments.map((j,be)=>{let te=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-te+s,ke=Re&&P==="move"&&Le===be,D=et===be,W=ke?te+$e:te;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!Re&&se(be),onMouseLeave:()=>!Re&&se(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:W,y:r,width:ee,height:Ie,rx:Be,fill:ge,initial:{opacity:0,scale:.95},animate:{opacity:ke||e.parentId?.6:D?.9:.8,scale:D&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),J(be),Ee(te),jt(pe,void 0,te);},style:{cursor:Ze,pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:W,y:r,width:ee*(e.progress/100),height:Ie,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}})]},`segment-${be}`)}),Oe&&(ue||ve)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ve&&!ue&&jsxRuntime.jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ue&&jsxRuntime.jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ye>60&&!e.segments&&!(dt&&vt)&&(()=>{let j=l.taskLabel(e),be=typeof j=="string"?j:e.name,te=be.length>Math.floor(Ye/8)?`${be.substring(0,Math.floor(Ye/8))}...`:be;return jsxRuntime.jsx("text",{x:tt+8,y:r+Ie/2,dominantBaseline:"middle",fill:ye?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ye?"line-through":"none"},children:te})})(),!Re&&!e.segments&&!vt&&e.progress>0&&e.progress<100&&(dt?jsxRuntime.jsxs("text",{x:tt+Ye+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,"%"]}):Ye>100?jsxRuntime.jsxs("text",{x:tt+Ye-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&&Ye>80&&!Re&&!e.segments&&!(dt&&vt)&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:tt+Ye-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:tt+Ye-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_e||ut)&&!Et&&!e.segments&&!vt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:tt-2,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-start"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt+4,y:r+8,width:3,height:Ie-16,rx:1.5,fill:Ue==="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:tt+Ye-14,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-end"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:tt+Ye-7,y:r+8,width:3,height:Ie-16,rx:1.5,fill:Ue==="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:_e&&!Re&&!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:()=>ce("connect"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"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:Ue==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Et&&De&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+Ie/2,x2:De.x,y2:De.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:De.x,cy:De.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:De.x+15,y:De.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:De.x+10},animate:{opacity:1,x:De.x+15},transition:{duration:.2},children:"Connect"})]}),(_e||Re)&&!Et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:tt-1,y:r-1,width:Ye+2,height:Ie+2,rx:Be+1,fill:"none",stroke:Re?n.accent:dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:dt?1:2,opacity:Re||dt?.6:.4,initial:{opacity:0},animate:{opacity:Re||dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ut&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:X,y1:0,x2:X,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:X+Fe,y1:0,x2:X+Fe,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:_e&&!Re&&!e.segments&&!v&&(()=>{let te=r<100,$=te?r+Ie+13:r-82-13,ee=te?`M ${tt+Ye/2-6} ${r+Ie+3} L ${tt+Ye/2} ${r+Ie+13} L ${tt+Ye/2+6} ${r+Ie+3}`:`M ${tt+Ye/2-6} ${r-13} L ${tt+Ye/2} ${r-3} L ${tt+Ye/2+6} ${r-13}`,ke=$+22,D=$+40,W=$+55,pe=$+70,we=te?$+82-5:r-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:te?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:te?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:tt+Ye/2-120,y:$,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:tt+Ye/2,y:ke,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:tt+Ye/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:tt+Ye/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pr(e.startDate)}),jsxRuntime.jsx("text",{x:tt+Ye/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:tt+Ye/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pr(e.endDate)}),jsxRuntime.jsx("text",{x:tt+Ye/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:tt+Ye/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It()}),jsxRuntime.jsx("text",{x:tt+Ye/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:tt+Ye/2+65,y:W,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:tt+Ye/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:tt+Ye/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(rt=>rt.name).join(", ").substring(0,30),e.assignees.map(rt=>rt.name).join(", ").length>30?"...":""]})]}),!te&&jsxRuntime.jsx("text",{x:tt+Ye/2,y:we,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":At?"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 hd=260,ps=8,Zm=16,xw=-12;function eg({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:x,mouseX:w,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,I=x.lastActivity!=null,C=(M?155:105)+(I?28:0),N=w+Zm,P=k+xw-C;N+hd>window.innerWidth-ps&&(N=w-hd-Zm),N<ps&&(N=ps);let T=P<ps;T&&(P=k+20),P+C>window.innerHeight-ps&&(P=window.innerHeight-ps-C),s({left:N,top:P,showBelow:T});},[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=x=>x.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{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 x=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,I=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;I.getTime()<=C.getTime();){let P=I.getDay();x[P]&&!w.has(k(I))&&M++,I.setDate(I.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=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:hd,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(al,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsxRuntime.jsx(al,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxRuntime.jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsxRuntime.jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxRuntime.jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsxRuntime.jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsxRuntime.jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.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:d},children:[c.estimated,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsxRuntime.jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsxRuntime.jsx("span",{style:{color:m,fontWeight:600},children:p(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:d,lineHeight:1.4},children:[jsxRuntime.jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsxRuntime.jsx("span",{style:{color:m},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 al({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:u,strokeWidthOverride:p,glowFilter:d}){let[,m]=react.useState(false),[f,v]=react.useState(null),h=a-t,b=h>0,y=Math.abs(h)<5,x=20,w=!y&&r<=e,k,M,R=r-e,C=e+R/2;M=C;let N=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${r} ${a}`;else if(w){let Ne=e+15,Oe=r-x,ze=b?t+20:t-20;M=Oe;let rt=b?1:-1;k=`M ${e} ${t} L ${Ne-N} ${t} Q ${Ne} ${t} ${Ne} ${t+rt*N} L ${Ne} ${ze-rt*N} Q ${Ne} ${ze} ${Ne-N} ${ze} L ${Oe+N} ${ze} Q ${Oe} ${ze} ${Oe} ${ze+rt*N} L ${Oe} ${a-rt*N} Q ${Oe} ${a} ${Oe+N} ${a} L ${r} ${a}`;}else {M=r-x;let Pe=b?1:-1;k=`M ${e} ${t} L ${M-N} ${t} Q ${M} ${t} ${M} ${t+Pe*N} L ${M} ${a-Pe*N} Q ${M} ${a} ${M+N} ${a} L ${r} ${a}`;}else k=`M ${e} ${t} C ${C} ${t}, ${C} ${a}, ${r} ${a}`;let P=6,T=5,V=`M ${r} ${a} L ${r-P} ${a-T/2} L ${r-P} ${a+T/2} Z`,O=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),Y=u||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=p||1,Re=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),U="#f87171",Te="rgba(248, 113, 113, 0.15)",B=M,z=(t+a)/2;if(f)if(o==="squared")if(y)B=Math.max(e+10,Math.min(r-10,f.x)),z=t;else if(w){let Pe=e+15,Ne=r-x,Oe=b?t+20:t-20,ze=[[e,t,Pe,t],[Pe,t,Pe,Oe],[Pe,Oe,Ne,Oe],[Ne,Oe,Ne,a],[Ne,a,r,a]],rt=1/0,ne={x:B,y:z};for(let Ke of ze){let je=Me(f.x,f.y,Ke[0],Ke[1],Ke[2],Ke[3]),He=Math.hypot(f.x-je.x,f.y-je.y);He<rt&&(rt=He,ne=je);}B=ne.x,z=ne.y;}else {let Pe=[[e,t,M,t],[M,t,M,a],[M,a,r,a]],Ne=1/0,Oe={x:B,y:z};for(let ze of Pe){let rt=Me(f.x,f.y,ze[0],ze[1],ze[2],ze[3]),ne=Math.hypot(f.x-rt.x,f.y-rt.y);ne<Ne&&(Ne=ne,Oe=rt);}B=Oe.x,z=Oe.y;}else {let Pe=C,Ne=t,Oe=C,ze=a,rt=1/0,ne=B,Ke=z;for(let je=0;je<=1;je+=.02){let He=1-je,gt=He*He*He*e+3*He*He*je*Pe+3*He*je*je*Oe+je*je*je*r,Mt=He*He*He*t+3*He*He*je*Ne+3*He*je*je*ze+je*je*je*a,Ge=Math.hypot(f.x-gt,f.y-Mt);Ge<rt&&(rt=Ge,ne=gt,Ke=Mt);}B=ne,z=Ke;}function Me(Pe,Ne,Oe,ze,rt,ne){let Ke=rt-Oe,je=ne-ze,He=Ke*Ke+je*je;if(He===0)return {x:Oe,y:ze};let gt=((Pe-Oe)*Ke+(Ne-ze)*je)/He;return gt=Math.max(0,Math.min(1,gt)),{x:Oe+gt*Ke,y:ze+gt*je}}let We=Pe=>{let Ne=Pe.currentTarget.ownerSVGElement;if(!Ne)return;let Oe=Ne.getScreenCTM();if(!Oe)return;let ze=Oe.inverse();v({x:ze.a*Pe.clientX+ze.c*Pe.clientY+ze.e,y:ze.b*Pe.clientX+ze.d*Pe.clientY+ze.f});},ce=()=>{m(false),v(null),c?.(false);},Fe=()=>{m(true),c?.(true);},X=Pe=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Pe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ne=>{Ne.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:z,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:z,r:9,fill:Te,stroke:U,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:z-3,x2:B+3,y2:z+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:z-3,x2:B-3,y2:z+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ce,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:Re,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Re,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Re,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Re,opacity:.9,style:{pointerEvents:"none"}}),X({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Fe,onMouseLeave:ce,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:Re,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Re,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Re,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Re,style:{pointerEvents:"none"}}),X({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:Fe,onMouseLeave:ce,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:Y,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:d||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:V,fill:Y,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:Y,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function il({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 De={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let 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 u=a.get(i)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(l.has(p))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=De.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=De.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=De.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=De.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
- `)},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=De.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=De.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)=>De.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=De.findTaskById(e,t);return !r||!r.dependencies?[]:De.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>De.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=De.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=>De.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=De.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?De.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?De.formatDate(c.startDate):"N/A",c.endDate?De.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=De.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,x)=>y+x,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(x.id,k),x.subtasks?.length&&i(x.subtasks,k);});};i(e);let u=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),p=n.map(h=>{let b=h.startDate&&h.endDate?De.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,x=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,R=typeof w=="number"?+(w/60).toFixed(1):0,C=h._costRate>0?h._costRate:l(h),N={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?De.formatDate(h.startDate):"","End Date":h.endDate?De.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(T=>T.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":R||""};u&&(N["$ Estimated"]=k>0&&C>0?Math.round(k*C):"",N["$ Executed"]=M>0&&C>0?Math.round(M*C):"",N["$ Quoted"]=R>0&&C>0?Math.round(R*C):"",N["Rate ($/h)"]=C>0?C:"");let P=h.weight;return N["Weight (%)"]=typeof P=="number"&&P>0?P:"",N["Is Milestone"]=h.isMilestone?"Yes":"No",N}),d=r?.projectName||"";if(d||p.length>0){let h=0,b=0,y=0,x=0,w=0,k=0,M=0,R=0,C=n.filter(T=>T.startDate).map(T=>T.startDate.getTime()),N=n.filter(T=>T.endDate).map(T=>T.endDate.getTime());for(let T of p)typeof T["Estimated (h)"]=="number"&&(h+=T["Estimated (h)"]),typeof T["Logged (h)"]=="number"&&(b+=T["Logged (h)"]),typeof T["Quoted (h)"]=="number"&&(y+=T["Quoted (h)"]),u&&(typeof T["$ Estimated"]=="number"&&(x+=T["$ Estimated"]),typeof T["$ Executed"]=="number"&&(w+=T["$ Executed"]),typeof T["$ Quoted"]=="number"&&(k+=T["$ Quoted"])),typeof T["Progress (%)"]=="number"&&(M+=T["Progress (%)"],R++);let P={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":C.length>0?De.formatDate(new Date(Math.min(...C))):"","End Date":N.length>0?De.formatDate(new Date(Math.max(...N))):"","Duration (days)":C.length>0&&N.length>0?De.calculateDuration(new Date(Math.min(...C)),new Date(Math.max(...N))):"","Progress (%)":R>0?Math.round(M/R):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};u&&(P["$ Estimated"]=x||"",P["$ Executed"]=w||"",P["$ Quoted"]=k||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",p.unshift(P);}let m=a.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=a.utils.book_new();if(a.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let h=new Date,b=x=>String(x).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}a.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=De.flattenTasks(e),n=new Map;a.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=De.getEarliestStartDate(e)||new Date,l=De.getLatestEndDate(e)||new Date,c=a.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?De.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(b=>n.has(b)).map(b=>`
130
+ `})]});return reactDom.createPortal(y,document.body)}function al({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:u,strokeWidthOverride:p,glowFilter:d}){let[,m]=react.useState(false),[f,v]=react.useState(null),h=a-t,b=h>0,y=Math.abs(h)<5,x=20,w=!y&&r<=e,k,M,I=r-e,C=e+I/2;M=C;let N=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${r} ${a}`;else if(w){let Ee=e+15,$e=r-x,He=b?t+20:t-20;M=$e;let et=b?1:-1;k=`M ${e} ${t} L ${Ee-N} ${t} Q ${Ee} ${t} ${Ee} ${t+et*N} L ${Ee} ${He-et*N} Q ${Ee} ${He} ${Ee-N} ${He} L ${$e+N} ${He} Q ${$e} ${He} ${$e} ${He+et*N} L ${$e} ${a-et*N} Q ${$e} ${a} ${$e+N} ${a} L ${r} ${a}`;}else {M=r-x;let Pe=b?1:-1;k=`M ${e} ${t} L ${M-N} ${t} Q ${M} ${t} ${M} ${t+Pe*N} L ${M} ${a-Pe*N} Q ${M} ${a} ${M+N} ${a} L ${r} ${a}`;}else k=`M ${e} ${t} C ${C} ${t}, ${C} ${a}, ${r} ${a}`;let P=6,T=5,V=`M ${r} ${a} L ${r-P} ${a-T/2} L ${r-P} ${a+T/2} Z`,O=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),X=u||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=p||1,Fe=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),U="#f87171",De="rgba(248, 113, 113, 0.15)",B=M,z=(t+a)/2;if(f)if(o==="squared")if(y)B=Math.max(e+10,Math.min(r-10,f.x)),z=t;else if(w){let Pe=e+15,Ee=r-x,$e=b?t+20:t-20,He=[[e,t,Pe,t],[Pe,t,Pe,$e],[Pe,$e,Ee,$e],[Ee,$e,Ee,a],[Ee,a,r,a]],et=1/0,se={x:B,y:z};for(let _e of He){let qe=Me(f.x,f.y,_e[0],_e[1],_e[2],_e[3]),Re=Math.hypot(f.x-qe.x,f.y-qe.y);Re<et&&(et=Re,se=qe);}B=se.x,z=se.y;}else {let Pe=[[e,t,M,t],[M,t,M,a],[M,a,r,a]],Ee=1/0,$e={x:B,y:z};for(let He of Pe){let et=Me(f.x,f.y,He[0],He[1],He[2],He[3]),se=Math.hypot(f.x-et.x,f.y-et.y);se<Ee&&(Ee=se,$e=et);}B=$e.x,z=$e.y;}else {let Pe=C,Ee=t,$e=C,He=a,et=1/0,se=B,_e=z;for(let qe=0;qe<=1;qe+=.02){let Re=1-qe,ut=Re*Re*Re*e+3*Re*Re*qe*Pe+3*Re*qe*qe*$e+qe*qe*qe*r,Et=Re*Re*Re*t+3*Re*Re*qe*Ee+3*Re*qe*qe*He+qe*qe*qe*a,Ge=Math.hypot(f.x-ut,f.y-Et);Ge<et&&(et=Ge,se=ut,_e=Et);}B=se,z=_e;}function Me(Pe,Ee,$e,He,et,se){let _e=et-$e,qe=se-He,Re=_e*_e+qe*qe;if(Re===0)return {x:$e,y:He};let ut=((Pe-$e)*_e+(Ee-He)*qe)/Re;return ut=Math.max(0,Math.min(1,ut)),{x:$e+ut*_e,y:He+ut*qe}}let Ue=Pe=>{let Ee=Pe.currentTarget.ownerSVGElement;if(!Ee)return;let $e=Ee.getScreenCTM();if(!$e)return;let He=$e.inverse();v({x:He.a*Pe.clientX+He.c*Pe.clientY+He.e,y:He.b*Pe.clientX+He.d*Pe.clientY+He.f});},ce=()=>{m(false),v(null),c?.(false);},Le=()=>{m(true),c?.(true);},J=Pe=>s?jsxRuntime.jsxs(framerMotion.motion.g,{initial:Pe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ee=>{Ee.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:B,cy:z,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:B,cy:z,r:9,fill:De,stroke:U,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B-3,y1:z-3,x2:B+3,y2:z+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:B+3,y1:z-3,x2:B-3,y2:z+3,stroke:U,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:ce,onMouseMove:Ue,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:Fe,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Fe,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Fe,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:4,fill:Fe,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxRuntime.jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Le,onMouseLeave:ce,onMouseMove:Ue,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:Fe,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:k,fill:"none",stroke:Fe,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:V,fill:Fe,stroke:"none",style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:r,cy:a,r:3.5,fill:Fe,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:Le,onMouseLeave:ce,onMouseMove:Ue,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:X,strokeWidth:F,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:d||"none"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:V,fill:X,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:X,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function il({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 Ne={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let 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 u=a.get(i)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(l.has(p))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=Ne.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Ne.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Ne.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=Ne.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
+ `)},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=Ne.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=Ne.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)=>Ne.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=Ne.findTaskById(e,t);return !r||!r.dependencies?[]:Ne.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ne.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>Ne.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=Ne.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=>Ne.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=Ne.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?Ne.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Ne.formatDate(c.startDate):"N/A",c.endDate?Ne.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=Ne.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,x)=>y+x,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(x.id,k),x.subtasks?.length&&i(x.subtasks,k);});};i(e);let u=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),p=n.map(h=>{let b=h.startDate&&h.endDate?Ne.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,x=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,I=typeof w=="number"?+(w/60).toFixed(1):0,C=h._costRate>0?h._costRate:l(h),N={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Ne.formatDate(h.startDate):"","End Date":h.endDate?Ne.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(T=>T.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":I||""};u&&(N["$ Estimated"]=k>0&&C>0?Math.round(k*C):"",N["$ Executed"]=M>0&&C>0?Math.round(M*C):"",N["$ Quoted"]=I>0&&C>0?Math.round(I*C):"",N["Rate ($/h)"]=C>0?C:"");let P=h.weight;return N["Weight (%)"]=typeof P=="number"&&P>0?P:"",N["Is Milestone"]=h.isMilestone?"Yes":"No",N}),d=r?.projectName||"";if(d||p.length>0){let h=0,b=0,y=0,x=0,w=0,k=0,M=0,I=0,C=n.filter(T=>T.startDate).map(T=>T.startDate.getTime()),N=n.filter(T=>T.endDate).map(T=>T.endDate.getTime());for(let T of p)typeof T["Estimated (h)"]=="number"&&(h+=T["Estimated (h)"]),typeof T["Logged (h)"]=="number"&&(b+=T["Logged (h)"]),typeof T["Quoted (h)"]=="number"&&(y+=T["Quoted (h)"]),u&&(typeof T["$ Estimated"]=="number"&&(x+=T["$ Estimated"]),typeof T["$ Executed"]=="number"&&(w+=T["$ Executed"]),typeof T["$ Quoted"]=="number"&&(k+=T["$ Quoted"])),typeof T["Progress (%)"]=="number"&&(M+=T["Progress (%)"],I++);let P={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":C.length>0?Ne.formatDate(new Date(Math.min(...C))):"","End Date":N.length>0?Ne.formatDate(new Date(Math.max(...N))):"","Duration (days)":C.length>0&&N.length>0?Ne.calculateDuration(new Date(Math.min(...C)),new Date(Math.max(...N))):"","Progress (%)":I>0?Math.round(M/I):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};u&&(P["$ Estimated"]=x||"",P["$ Executed"]=w||"",P["$ Quoted"]=k||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",p.unshift(P);}let m=a.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=a.utils.book_new();if(a.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let h=new Date,b=x=>String(x).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}a.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=Ne.flattenTasks(e),n=new Map;a.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=Ne.getEarliestStartDate(e)||new Date,l=Ne.getLatestEndDate(e)||new Date,c=a.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?Ne.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(b=>n.has(b)).map(b=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${n.get(b)}</PredecessorUID>
134
134
  <Type>1</Type>
@@ -358,14 +358,14 @@
358
358
  </Calendars>
359
359
  <Tasks>${c}
360
360
  </Tasks>
361
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=r,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=a.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;a.set(i.id,{es:p,ef:d});};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 u=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,a=De.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(a.length===0)return t;let n=new Map(a.map(d=>[d.id,d])),s=new Map;for(let d of a)s.has(d.id)||s.set(d.id,[]);for(let d of a)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of a)o.set(d.id,0);for(let d of a)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let l=new Map,c=[],i=[];for(let d of a)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=De.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];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 u=Math.max(...Array.from(l.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=De.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let r=De.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let n=De.getDependentTasks(e,t);if(n.length===0){let l=De.getLatestEndDate(e);if(!l)return null;let c=De.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=De.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>De.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=De.findTaskById(e,t);if(!s||!s.endDate)return e;let o=De.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=De.calculateDuration(c.startDate,c.endDate),u;if(r!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+r)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),r!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=De.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=De.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(),u=1e3*60*60*24,p=De.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=De.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(T=>T.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,R=(x-i)/u*s,C=R+f*s,N=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:R,previewX:C,width:N,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,r),c},splitTask:(e,t,r,a=3)=>{let n=De.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=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function ll({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,canEditTask:k,onTaskProgressDrag:M,workingDaysConfig:R}){let N=qa(),P=react.useRef(null),[T,V]=react.useState([]),[O,Y]=react.useState(null),[L,Re]=react.useState(null),[U,Te]=react.useState(null),B=react.useRef(false),[z,Me]=react.useState(new Set),[We,ce]=react.useState(null),Fe=react.useCallback(I=>{if(U&&!B.current){let q=I.target,pe=false;for(;q&&q!==I.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){pe=true;break}q=q.parentElement;}pe||Te(null);}},[U]),X=react.useCallback(I=>{Re(I);},[]),Pe=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Ne=a==="day"?60:a==="week"?20:8,Oe=Pe*Ne*o,ze=I=>{let q=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),pe=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-pe);let ve=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-ve.getTime())/864e5+1)/7)},rt=I=>{let q=I.getDay();return q===0||q===6},ne=react.useMemo(()=>{let I=R?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[R?.holidayDates]),Ke=I=>{if(!ne)return false;let q=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return ne.has(q)},je=react.useCallback(I=>{let q=Math.round(I/(Ne*o)),pe=new Date(n);return pe.setDate(pe.getDate()+q),pe},[n,Ne,o]),He=react.useCallback((I,q)=>{if(q.startDate&&q.endDate)return;let pe=I.currentTarget.ownerSVGElement;if(!pe)return;let ve=pe.createSVGPoint();ve.x=I.clientX,ve.y=I.clientY;let Ae=ve.matrixTransform(pe.getScreenCTM()?.inverse()),Ce=je(Ae.x),ft=new Date(Ce);ft.setDate(ft.getDate()+1),ce(null),f?.(q,Ce,ft);},[je,f]),gt=react.useCallback((I,q,pe)=>{let ve=I.currentTarget.ownerSVGElement;if(!ve)return;let Ae=ve.createSVGPoint();Ae.x=I.clientX,Ae.y=I.clientY;let Ce=Ae.matrixTransform(ve.getScreenCTM()?.inverse()),ft=je(Ce.x),fe=Math.round(Ce.x/(Ne*o))*Ne*o;ce({taskId:q.id,x:fe,y:pe*r+r/2,date:ft});},[je,Ne,o,r]),Mt=react.useCallback(()=>{ce(null);},[]),Ge=react.useMemo(()=>{let I=Ae=>Ae.map(Ce=>{if(Ce.subtasks&&Ce.subtasks.length>0){let ft=I(Ce.subtasks),oe=ft.filter(fe=>fe.startDate&&fe.endDate);if(oe.length>0){let fe=oe.map(tt=>tt.startDate.getTime()),et=oe.map(tt=>tt.endDate.getTime()),Xe=new Date(Math.min(...fe)),kt=new Date(Math.max(...et));return {...Ce,subtasks:ft,startDate:Xe,endDate:kt}}return {...Ce,subtasks:ft}}return Ce}),q=(Ae,Ce=[])=>{let ft=[...Ae].sort((oe,fe)=>(oe.position??0)-(fe.position??0));for(let oe of ft)Ce.push(oe),oe.subtasks&&oe.subtasks.length>0&&(oe.isExpanded===void 0||oe.isExpanded)&&q(oe.subtasks,Ce);return Ce},pe=I(e);return q(pe)},[e]),Be=react.useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let q=I.startDate.getTime(),pe=I.endDate.getTime(),ve=n.getTime(),Ae=(q-ve)/(1e3*60*60*24),Ce=(pe-q)/(1e3*60*60*24)+1,ft=Ae*Ne*o,oe=Math.max(Ne*o,40),fe=Math.max(Ce*Ne*o,oe);return {x:ft,width:fe}},[n,Ne,o]),st=react.useMemo(()=>Ge.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:q,width:pe}=Be(I),Ae=Ge.findIndex(Ce=>Ce.id===I.id)*r+(r-18)/2;return {id:I.id,x:q,y:Ae,width:pe,height:18}}),[Ge,Be]),Wt=react.useCallback((I,q,pe)=>{if(!pe){V([]),Y(null);return}if(Y({taskId:I,daysDelta:q}),q===0){V([]);return}let ve=De.calculateCascadePreview(e,I,q,Ge,n,Ne*o,r,48);V(ve);},[e,Ge,n,Ne,o,r,48]),Ue=react.useCallback((I,q)=>{if(!O)return q;let pe=Ne*o,ve=O.daysDelta*pe;if(I===O.taskId)return {x:q.x+ve,width:q.width};let Ae=T.find(Ce=>Ce.taskId===I);return Ae?{x:Ae.previewX,width:Ae.width}:q},[O,T,Ne,o]),dt=react.useMemo(()=>{let I=[],q=new Date(n);for(;q<=s;){let Ae=(q.getTime()-n.getTime())/864e5*Ne*o;if(a==="day")I.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ae}),q.setDate(q.getDate()+1);else if(a==="week"){let Ce=ze(q);I.push({date:new Date(q),label:`${N.labels.week} ${Ce}`,x:Ae}),q.setDate(q.getDate()+7);}else I.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ae}),q.setMonth(q.getMonth()+1);}return I},[n,s,a,Ne,o,l,N.labels.week]),F=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Ne*o,[n,Ne,o]),J=Math.max(Ge.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(Oe,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(Oe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),dt.map((I,q)=>jsxRuntime.jsxs("g",{children:[q>0&&jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:I.x+8,y:48/2,fill:a==="day"&&!rt(I.date)&&Ke(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${q}`)),F>=0&&F<=Oe&&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:N.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max(Oe,1e3),height:J,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Fe,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(Oe,1e3),height:J,fill:t.bgPrimary}),Ge.map((I,q)=>jsxRuntime.jsx("rect",{x:0,y:q*r,width:Math.max(Oe,1e3),height:r,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${I.id}`)),dt.map((I,q)=>q>0?jsxRuntime.jsx("line",{x1:I.x,y1:0,x2:I.x,y2:Ge.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),dt.map((I,q)=>{let pe=dt[q+1]?.x||Oe,ve=w&&rt(I.date),Ae=a==="day"&&!rt(I.date)&&Ke(I.date);return ve||Ae?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:I.x,y:0,width:pe-I.x,height:Ge.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:I.x,y:0,width:pe-I.x,height:Ge.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),Ge.map((I,q)=>{let pe=I.startDate&&I.endDate;return jsxRuntime.jsx("g",{children:!pe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:q*r,width:Oe,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ve=>He(ve,I),onMouseMove:ve=>gt(ve,I,q),onMouseLeave:()=>{Mt();}},`clickable-${I.id}`),We&&We.taskId===I.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:We.x,y1:q*r+4,x2:We.x,y2:q*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}, ${q*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!==I.id)&&jsxRuntime.jsx("text",{x:F>0?F:100,y:q*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:N.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),Ge.map((I,q)=>{if(!I.startDate||!I.endDate)return null;let{x:pe,width:ve}=Be(I),Ae=q*r+(r-18)/2,Ce=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone)return jsxRuntime.jsx(il,{task:I,x:pe+ve/2,y:Ae+12,theme:t,onClick:p},I.id);if(Ce){let ft=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),oe=8,fe=Ae+(r-18)/2+(18-oe)/2,et=4,Xe=I.progress||0,kt=new Date;kt.setHours(0,0,0,0);let tt=I.startDate&&kt>=I.startDate,St=I.endDate&&(()=>{let ar=new Date(I.endDate);return ar.setHours(0,0,0,0),kt>ar})(),mr=I.startDate&&kt<I.startDate,cr=1;if(tt&&I.startDate&&I.endDate&&!mr){let ar=new Date(I.startDate);ar.setHours(0,0,0,0);let ua=new Date(I.endDate);ua.setHours(0,0,0,0);let Zr=Math.max(1,(ua.getTime()-ar.getTime())/(1e3*60*60*24)),Je=Math.min((kt.getTime()-ar.getTime())/(1e3*60*60*24),Zr)/Zr*100;cr=Je>0?Xe/Je:1;}let Rt;Xe>=100?Rt="#00E5CC":mr?Rt="#4B5563":St&&Xe<100?Rt="#EF4444":cr>=.95?Rt="#22C55E":cr>=.8?Rt="#F59E0B":Rt="#EF4444";let Lr=Math.max(Xe/100*ve,Xe>0?et*2:0),Ot=ve>100&&Xe>0,kr=I.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>p?.(I),onContextMenu:ar=>{ar.preventDefault(),ar.stopPropagation(),m?.(I,ar);},onMouseMove:ar=>{X({task:I,x:pe,y:fe,width:ve,height:oe,showBelow:fe<100,mouseX:ar.clientX,mouseY:ar.clientY});},onMouseLeave:()=>X(null),style:{cursor:"default",opacity:y?kr?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:pe,y:Ae,width:ve,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:pe,y:fe,width:ve,height:oe,rx:et,fill:ft?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Xe>0&&jsxRuntime.jsx("rect",{x:pe,y:fe,width:Lr,height:oe,rx:et,fill:Rt}),y&&kr&&jsxRuntime.jsx("rect",{x:pe,y:fe,width:ve,height:oe,rx:et,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ot&&jsxRuntime.jsxs("text",{x:pe+Lr+6,y:fe+oe/2,dominantBaseline:"central",fill:ft?"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),"%"]})]},I.id)}return jsxRuntime.jsx(rl,{task:I,x:pe,y:Ae,width:ve,theme:t,dayWidth:Ne*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:st,onDragMove:Wt,onHoverChange:X,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:k?!k(I):false,onProgressChange:M},I.id)}),x&&Ge.map((I,q)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(pe=>{let ve=Ge.find(Rt=>Rt.id===pe);if(!ve||!ve.startDate||!ve.endDate)return null;let Ae=Ge.findIndex(Rt=>Rt.id===pe),Ce=Ue(ve.id,Be(ve)),ft=Ue(I.id,Be(I)),oe=Ce.x+Ce.width,fe=Ae*r+26,et=ft.x,Xe=q*r+26,kt=`dep-${pe}-${I.id}`;if(z.has(kt))return null;let tt=y&&I.isCriticalPath&&ve.isCriticalPath;return jsxRuntime.jsx(Js,{x1:oe,y1:fe,x2:et,y2:Xe,theme:t,lineStyle:i,colorOverride:y?tt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?tt?2:1:void 0,glowFilter:tt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(I.id,pe),onHoverChange:Rt=>{B.current=Rt,Rt&&Te({key:kt,fromId:pe,toId:I.id,exitX:oe,exitY:fe,enterX:et,enterY:Xe});}},kt)})),T.map(I=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:I.previewX,y:I.y-48,width:I.width,height:18,rx:6,fill:I.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(I.daysDelta)>0&&jsxRuntime.jsx("text",{x:I.previewX+I.width/2,y:I.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:I.daysDelta>0?`+${I.daysDelta}d`:`${I.daysDelta}d`})]},`cascade-preview-${I.taskId}`)),x&&U&&jsxRuntime.jsx(Js,{x1:U.exitX,y1:U.exitY,x2:U.enterX,y2:U.enterY,theme:t,lineStyle:i,onDelete:()=>{let I=U.key;Te(null),B.current=false,Me(q=>new Set(q).add(I)),h?.(U.toId,U.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{B.current=I,I||Te(null);}},`${U.key}-hover-overlay`),F>=0&&F<=Oe&&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(Zm,{tooltipData:L,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:R})]})}var xw=['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"'],rg=({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"})}),vw=()=>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"})}),ww=()=>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"})}),kw=()=>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"})}),Cw=()=>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 ul({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=react.useState(false),[p,d]=react.useState(false),[m,f]=react.useState([]),[v,h]=react.useState(""),[b,y]=react.useState(false),[x,w]=react.useState(true),[k,M]=react.useState(""),[R,C]=react.useState(-1),[N,P]=react.useState(false),[T,V]=react.useState(0),O=react.useRef(null),Y=react.useRef(null),L=react.useRef(null),Re=react.useRef(null),{enabled:U=true,placeholder:Te='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:z,suggestions:Me=xw,maxHistory:We=50,persistHistory:ce,mentionableUsers:Fe=[]}=r,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ne=X?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Oe=X?"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=X?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",rt=X?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ne=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ke=X?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",je=X?"rgba(0, 229, 204, 0.9)":"#00E5CC",He=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",gt=X?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Mt=X?"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)",Ge=X?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Be=X?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",st=X?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Wt=X?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ue=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",dt=X?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",F=X?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",I=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",q="rgba(0, 229, 204, 0.04)",pe=X?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ve=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ae=X?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",Ce=X?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ft=X?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",oe=X?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",fe=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",et=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xe="rgba(0, 229, 204, 0.06)",kt=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",tt=X?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",St=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",mr=X?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",cr=X?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Rt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Lr=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ot=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",kr=X?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Vt=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ar=X?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ua=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Zr=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",nt=X?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Je=X?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Nr=ce?.storageKey||"gantt-ai-history",wa=ce?.maxMessages??5,Dr=Fe.filter($=>{if(!k)return true;let ee=k.toLowerCase();return $.name.toLowerCase().includes(ee)||$.email&&$.email.toLowerCase().includes(ee)}).slice(0,5),_r=react.useCallback($=>{if(h($),Fe.length===0)return;let ee=O.current;if(!ee)return;let we=ee.selectionStart||$.length,D=$.slice(0,we),H=D.lastIndexOf("@");if(H>=0&&((H>0?D[H-1]:" ")===" "||H===0)){let ke=D.slice(H+1);if(ke.length<=40){M(ke),C(H),P(true),V(0);return}}P(false),M(""),C(-1);},[Fe.length]),Wr=react.useCallback($=>{let ee=v.slice(0,R),we=v.slice(R+1+k.length),D=`${ee}@${$.name} ${we}`;h(D),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,R,k]),le=react.useCallback($=>{if(!N||Dr.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),V(ee=>ee<Dr.length-1?ee+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),V(ee=>ee>0?ee-1:Dr.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let ee=Dr[T];return ee&&Wr(ee),true}return $.key==="Escape"?(P(false),true):false},[N,Dr,T,Wr]);react.useEffect(()=>{if(ce?.enabled)try{let $=localStorage.getItem(Nr);if($){let we=JSON.parse($).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(we.slice(-wa));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[ce?.enabled,Nr,wa]),react.useEffect(()=>{if(ce?.enabled&&m.length>0)try{let $=m.filter(ee=>!ee.isLoading).slice(-wa);localStorage.setItem(Nr,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[m,ce?.enabled,Nr,wa]),react.useEffect(()=>{Y.current&&Y.current.scrollIntoView({behavior:"smooth"});},[m]),react.useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let de=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&l?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&c?.($.taskId,$.dependencyFrom);break}},[n,s,o,l,c]),pt=react.useCallback(async $=>{if(!$.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(D=>[...D.slice(-(We-1)),ee]),h(""),w(false),y(true);let we={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,we]);try{if(z){let D=m.filter(ue=>!ue.isLoading&&ue.content).slice(-6).map(ue=>({role:ue.role,content:ue.content})),H=await z($,e,D);f(ue=>{let ke=ue.filter(Se=>!Se.isLoading),me={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...ke,me]}),de(H);}else f(D=>[...D.filter(ue=>!ue.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(D){f(H=>[...H.filter(ke=>!ke.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${D instanceof Error?D.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,We,z,e,de]),j=$=>{$.preventDefault(),pt(v);},be=$=>{h($),O.current?.focus();};if(react.useEffect(()=>{let $=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(we=>!we),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),react.useEffect(()=>{if(!i)return;let $=we=>{let D=we.target;L.current&&!L.current.contains(D)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",$);}},[i]),!U)return null;let te={"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(sr,{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 ${te[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ne}`,color:"#00E5CC",cursor:"pointer",boxShadow:Oe,overflow:"visible"},onClick:()=>u(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 ${rt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(rg,{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:ne,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ke}`},children:"AI \xB7 \u2318K"}),jsxRuntime.jsx("style",{children:`
361
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=r,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ne.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=a.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;a.set(i.id,{es:p,ef:d});};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 u=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,a=Ne.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(a.length===0)return t;let n=new Map(a.map(d=>[d.id,d])),s=new Map;for(let d of a)s.has(d.id)||s.set(d.id,[]);for(let d of a)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of a)o.set(d.id,0);for(let d of a)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let l=new Map,c=[],i=[];for(let d of a)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Ne.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];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 u=Math.max(...Array.from(l.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Ne.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let r=Ne.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Ne.calculateCriticalPath(e).includes(t))return 0;let n=Ne.getDependentTasks(e,t);if(n.length===0){let l=Ne.getLatestEndDate(e);if(!l)return null;let c=Ne.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=Ne.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ne.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=Ne.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ne.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=Ne.calculateDuration(c.startDate,c.endDate),u;if(r!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+r)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),r!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ne.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=Ne.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(),u=1e3*60*60*24,p=Ne.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=Ne.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(T=>T.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,I=(x-i)/u*s,C=I+f*s,N=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:I,previewX:C,width:N,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,r),c},splitTask:(e,t,r,a=3)=>{let n=Ne.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=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function ll({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,canEditTask:k,onTaskProgressDrag:M,workingDaysConfig:I}){let N=_a(),P=react.useRef(null),[T,V]=react.useState([]),[O,X]=react.useState(null),[F,Fe]=react.useState(null),[U,De]=react.useState(null),B=react.useRef(false),[z,Me]=react.useState(new Set),[Ue,ce]=react.useState(null),Le=react.useCallback(R=>{if(U&&!B.current){let _=R.target,ue=false;for(;_&&_!==R.currentTarget;){if(_.getAttribute?.("data-dependency-line")==="true"||_.getAttribute?.("data-dependency-hover-overlay")==="true"){ue=true;break}_=_.parentElement;}ue||De(null);}},[U]),J=react.useCallback(R=>{Fe(R);},[]),Pe=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Ee=a==="day"?60:a==="week"?20:8,$e=Pe*Ee*o,He=R=>{let _=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),ue=_.getUTCDay()||7;_.setUTCDate(_.getUTCDate()+4-ue);let ve=new Date(Date.UTC(_.getUTCFullYear(),0,1));return Math.ceil(((_.getTime()-ve.getTime())/864e5+1)/7)},et=R=>{let _=R.getDay();return _===0||_===6},se=react.useMemo(()=>{let R=I?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[I?.holidayDates]),_e=R=>{if(!se)return false;let _=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return se.has(_)},qe=react.useCallback(R=>{let _=Math.round(R/(Ee*o)),ue=new Date(n);return ue.setDate(ue.getDate()+_),ue},[n,Ee,o]),Re=react.useCallback((R,_)=>{if(_.startDate&&_.endDate)return;let ue=R.currentTarget.ownerSVGElement;if(!ue)return;let ve=ue.createSVGPoint();ve.x=R.clientX,ve.y=R.clientY;let Oe=ve.matrixTransform(ue.getScreenCTM()?.inverse()),ye=qe(Oe.x),ft=new Date(ye);ft.setDate(ft.getDate()+1),ce(null),f?.(_,ye,ft);},[qe,f]),ut=react.useCallback((R,_,ue)=>{let ve=R.currentTarget.ownerSVGElement;if(!ve)return;let Oe=ve.createSVGPoint();Oe.x=R.clientX,Oe.y=R.clientY;let ye=Oe.matrixTransform(ve.getScreenCTM()?.inverse()),ft=qe(ye.x),ge=Math.round(ye.x/(Ee*o))*Ee*o;ce({taskId:_.id,x:ge,y:ue*r+r/2,date:ft});},[qe,Ee,o,r]),Et=react.useCallback(()=>{ce(null);},[]),Ge=react.useMemo(()=>{let R=Oe=>Oe.map(ye=>{if(ye.subtasks&&ye.subtasks.length>0){let ft=R(ye.subtasks),ie=ft.filter(ge=>ge.startDate&&ge.endDate);if(ie.length>0){let ge=ie.map(Je=>Je.startDate.getTime()),Ze=ie.map(Je=>Je.endDate.getTime()),Xe=new Date(Math.min(...ge)),kt=new Date(Math.max(...Ze));return {...ye,subtasks:ft,startDate:Xe,endDate:kt}}return {...ye,subtasks:ft}}return ye}),_=(Oe,ye=[])=>{let ft=[...Oe].sort((ie,ge)=>(ie.position??0)-(ge.position??0));for(let ie of ft)ye.push(ie),ie.subtasks&&ie.subtasks.length>0&&(ie.isExpanded===void 0||ie.isExpanded)&&_(ie.subtasks,ye);return ye},ue=R(e);return _(ue)},[e]),Ie=react.useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let _=R.startDate.getTime(),ue=R.endDate.getTime(),ve=n.getTime(),Oe=(_-ve)/(1e3*60*60*24),ye=(ue-_)/(1e3*60*60*24)+1,ft=Oe*Ee*o,ie=Math.max(Ee*o,40),ge=Math.max(ye*Ee*o,ie);return {x:ft,width:ge}},[n,Ee,o]),dt=react.useMemo(()=>Ge.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:_,width:ue}=Ie(R),Oe=Ge.findIndex(ye=>ye.id===R.id)*r+(r-18)/2;return {id:R.id,x:_,y:Oe,width:ue,height:18}}),[Ge,Ie]),Mt=react.useCallback((R,_,ue)=>{if(!ue){V([]),X(null);return}if(X({taskId:R,daysDelta:_}),_===0){V([]);return}let ve=Ne.calculateCascadePreview(e,R,_,Ge,n,Ee*o,r,48);V(ve);},[e,Ge,n,Ee,o,r,48]),Be=react.useCallback((R,_)=>{if(!O)return _;let ue=Ee*o,ve=O.daysDelta*ue;if(R===O.taskId)return {x:_.x+ve,width:_.width};let Oe=T.find(ye=>ye.taskId===R);return Oe?{x:Oe.previewX,width:Oe.width}:_},[O,T,Ee,o]),vt=react.useMemo(()=>{let R=[],_=new Date(n);for(;_<=s;){let Oe=(_.getTime()-n.getTime())/864e5*Ee*o;if(a==="day")R.push({date:new Date(_),label:_.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Oe}),_.setDate(_.getDate()+1);else if(a==="week"){let ye=He(_);R.push({date:new Date(_),label:`${N.labels.week} ${ye}`,x:Oe}),_.setDate(_.getDate()+7);}else R.push({date:new Date(_),label:_.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Oe}),_.setMonth(_.getMonth()+1);}return R},[n,s,a,Ee,o,l,N.labels.week]),L=react.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Ee*o,[n,Ee,o]),Q=Math.max(Ge.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($e,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max($e,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),vt.map((R,_)=>jsxRuntime.jsxs("g",{children:[_>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"&&!et(R.date)&&_e(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${_}`)),L>=0&&L<=$e&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("circle",{cx:L,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsxRuntime.jsx("circle",{cx:L,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxRuntime.jsxs("g",{transform:`translate(${L-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:N.labels.today.toUpperCase()})]})]})]})}),jsxRuntime.jsxs("svg",{ref:P,width:Math.max($e,1e3),height:Q,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Le,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($e,1e3),height:Q,fill:t.bgPrimary}),Ge.map((R,_)=>jsxRuntime.jsx("rect",{x:0,y:_*r,width:Math.max($e,1e3),height:r,fill:_%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),vt.map((R,_)=>_>0?jsxRuntime.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Ge.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${_}`):null),vt.map((R,_)=>{let ue=vt[_+1]?.x||$e,ve=w&&et(R.date),Oe=a==="day"&&!et(R.date)&&_e(R.date);return ve||Oe?jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:R.x,y:0,width:ue-R.x,height:Ge.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:Ge.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${_}`):null}),Ge.map((R,_)=>{let ue=R.startDate&&R.endDate;return jsxRuntime.jsx("g",{children:!ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:_*r,width:$e,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ve=>Re(ve,R),onMouseMove:ve=>ut(ve,R,_),onMouseLeave:()=>{Et();}},`clickable-${R.id}`),Ue&&Ue.taskId===R.id&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("line",{x1:Ue.x,y1:_*r+4,x2:Ue.x,y2:_*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsxRuntime.jsx("circle",{cx:Ue.x,cy:Ue.y,r:8,fill:t.accent,opacity:.9}),jsxRuntime.jsx("circle",{cx:Ue.x,cy:Ue.y,r:4,fill:"white",opacity:.9}),jsxRuntime.jsxs("g",{transform:`translate(${Ue.x}, ${_*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:Ue.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Ue||Ue.taskId!==R.id)&&jsxRuntime.jsx("text",{x:L>0?L:100,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:N.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),Ge.map((R,_)=>{if(!R.startDate||!R.endDate)return null;let{x:ue,width:ve}=Ie(R),Oe=_*r+(r-18)/2,ye=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsxRuntime.jsx(il,{task:R,x:ue+ve/2,y:Oe+12,theme:t,onClick:p},R.id);if(ye){let ft=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ie=8,ge=Oe+(r-18)/2+(18-ie)/2,Ze=4,Xe=R.progress||0,kt=new Date;kt.setHours(0,0,0,0);let Je=R.startDate&&kt>=R.startDate,At=R.endDate&&(()=>{let or=new Date(R.endDate);return or.setHours(0,0,0,0),kt>or})(),Yt=R.startDate&&kt<R.startDate,pr=1;if(Je&&R.startDate&&R.endDate&&!Yt){let or=new Date(R.startDate);or.setHours(0,0,0,0);let ha=new Date(R.endDate);ha.setHours(0,0,0,0);let pa=Math.max(1,(ha.getTime()-or.getTime())/(1e3*60*60*24)),Ye=Math.min((kt.getTime()-or.getTime())/(1e3*60*60*24),pa)/pa*100;pr=Ye>0?Xe/Ye:1;}let It;Xe>=100?It="#00E5CC":Yt?It="#4B5563":At&&Xe<100?It="#EF4444":pr>=.95?It="#22C55E":pr>=.8?It="#F59E0B":It="#EF4444";let Ur=Math.max(Xe/100*ve,Xe>0?Ze*2:0),Ht=ve>100&&Xe>0,vr=R.isCriticalPath;return jsxRuntime.jsxs("g",{onClick:()=>p?.(R),onContextMenu:or=>{or.preventDefault(),or.stopPropagation(),m?.(R,or);},onMouseMove:or=>{J({task:R,x:ue,y:ge,width:ve,height:ie,showBelow:ge<100,mouseX:or.clientX,mouseY:or.clientY});},onMouseLeave:()=>J(null),style:{cursor:"default",opacity:y?vr?1:.25:1,transition:"opacity 300ms ease"},children:[jsxRuntime.jsx("rect",{x:ue,y:Oe,width:ve,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ue,y:ge,width:ve,height:ie,rx:Ze,fill:ft?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Xe>0&&jsxRuntime.jsx("rect",{x:ue,y:ge,width:Ur,height:ie,rx:Ze,fill:It}),y&&vr&&jsxRuntime.jsx("rect",{x:ue,y:ge,width:ve,height:ie,rx:Ze,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ht&&jsxRuntime.jsxs("text",{x:ue+Ur+6,y:ge+ie/2,dominantBaseline:"central",fill:ft?"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(rl,{task:R,x:ue,y:Oe,width:ve,theme:t,dayWidth:Ee*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:dt,onDragMove:Mt,onHoverChange:J,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:k?!k(R):false,onProgressChange:M},R.id)}),x&&Ge.map((R,_)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(ue=>{let ve=Ge.find(It=>It.id===ue);if(!ve||!ve.startDate||!ve.endDate)return null;let Oe=Ge.findIndex(It=>It.id===ue),ye=Be(ve.id,Ie(ve)),ft=Be(R.id,Ie(R)),ie=ye.x+ye.width,ge=Oe*r+26,Ze=ft.x,Xe=_*r+26,kt=`dep-${ue}-${R.id}`;if(z.has(kt))return null;let Je=y&&R.isCriticalPath&&ve.isCriticalPath;return jsxRuntime.jsx(Js,{x1:ie,y1:ge,x2:Ze,y2:Xe,theme:t,lineStyle:i,colorOverride:y?Je?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Je?2:1:void 0,glowFilter:Je?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,ue),onHoverChange:It=>{B.current=It,It&&De({key:kt,fromId:ue,toId:R.id,exitX:ie,exitY:ge,enterX:Ze,enterY:Xe});}},kt)})),T.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}`)),x&&U&&jsxRuntime.jsx(Js,{x1:U.exitX,y1:U.exitY,x2:U.enterX,y2:U.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=U.key;De(null),B.current=false,Me(_=>new Set(_).add(R)),h?.(U.toId,U.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||De(null);}},`${U.key}-hover-overlay`),L>=0&&L<=$e&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsxRuntime.jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:6,opacity:.15}),jsxRuntime.jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:1,opacity:1})]})]}),F&&jsxRuntime.jsx(eg,{tooltipData:F,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:I})]})}var Cw=['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"'],ag=({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"})}),Tw=()=>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"})}),Nw=()=>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"})}),Dw=()=>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"})}),Sw=()=>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 ul({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=react.useState(false),[p,d]=react.useState(false),[m,f]=react.useState([]),[v,h]=react.useState(""),[b,y]=react.useState(false),[x,w]=react.useState(true),[k,M]=react.useState(""),[I,C]=react.useState(-1),[N,P]=react.useState(false),[T,V]=react.useState(0),O=react.useRef(null),X=react.useRef(null),F=react.useRef(null),Fe=react.useRef(null),{enabled:U=true,placeholder:De='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:z,suggestions:Me=Cw,maxHistory:Ue=50,persistHistory:ce,mentionableUsers:Le=[]}=r,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ee=J?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",$e=J?"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)",He=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",et=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",se=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",_e=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",qe=J?"rgba(0, 229, 204, 0.9)":"#00E5CC",Re=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ut=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Et=J?"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)",Ge=J?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ie=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",dt=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Mt=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Be=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",vt=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Q=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",_="rgba(0, 229, 204, 0.04)",ue=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ve=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Oe=J?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ye=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ft=J?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ie=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ge=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Ze=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xe="rgba(0, 229, 204, 0.06)",kt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Je=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",At=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Yt=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",pr=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",It=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ur=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ht=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",vr=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",jt=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",or=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ha=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pa=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",tt=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ye=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ea=ce?.storageKey||"gantt-ai-history",_r=ce?.maxMessages??5,sa=Le.filter($=>{if(!k)return true;let ee=k.toLowerCase();return $.name.toLowerCase().includes(ee)||$.email&&$.email.toLowerCase().includes(ee)}).slice(0,5),wr=react.useCallback($=>{if(h($),Le.length===0)return;let ee=O.current;if(!ee)return;let ke=ee.selectionStart||$.length,D=$.slice(0,ke),W=D.lastIndexOf("@");if(W>=0&&((W>0?D[W-1]:" ")===" "||W===0)){let we=D.slice(W+1);if(we.length<=40){M(we),C(W),P(true),V(0);return}}P(false),M(""),C(-1);},[Le.length]),Wr=react.useCallback($=>{let ee=v.slice(0,I),ke=v.slice(I+1+k.length),D=`${ee}@${$.name} ${ke}`;h(D),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,I,k]),le=react.useCallback($=>{if(!N||sa.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),V(ee=>ee<sa.length-1?ee+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),V(ee=>ee>0?ee-1:sa.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let ee=sa[T];return ee&&Wr(ee),true}return $.key==="Escape"?(P(false),true):false},[N,sa,T,Wr]);react.useEffect(()=>{if(ce?.enabled)try{let $=localStorage.getItem(ea);if($){let ke=JSON.parse($).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(ke.slice(-_r));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[ce?.enabled,ea,_r]),react.useEffect(()=>{if(ce?.enabled&&m.length>0)try{let $=m.filter(ee=>!ee.isLoading).slice(-_r);localStorage.setItem(ea,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[m,ce?.enabled,ea,_r]),react.useEffect(()=>{X.current&&X.current.scrollIntoView({behavior:"smooth"});},[m]),react.useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let de=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&l?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&c?.($.taskId,$.dependencyFrom);break}},[n,s,o,l,c]),pt=react.useCallback(async $=>{if(!$.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(D=>[...D.slice(-(Ue-1)),ee]),h(""),w(false),y(true);let ke={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,ke]);try{if(z){let D=m.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await z($,e,D);f(pe=>{let we=pe.filter(fe=>!fe.isLoading),rt={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...we,rt]}),de(W);}else f(D=>[...D.filter(pe=>!pe.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(D){f(W=>[...W.filter(we=>!we.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${D instanceof Error?D.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,Ue,z,e,de]),j=$=>{$.preventDefault(),pt(v);},be=$=>{h($),O.current?.focus();};if(react.useEffect(()=>{let $=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(ke=>!ke),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),react.useEffect(()=>{if(!i)return;let $=ke=>{let D=ke.target;F.current&&!F.current.contains(D)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",$);}},[i]),!U)return null;let te={"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(ir,{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 ${te[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ee}`,color:"#00E5CC",cursor:"pointer",boxShadow:$e,overflow:"visible"},onClick:()=>u(true),children:[jsxRuntime.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsxRuntime.jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${et}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsxRuntime.jsx(ag,{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:qe,background:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${_e}`},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:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${te[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:He,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${gt}`,boxShadow:Mt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ge,borderBottom:`1px solid ${Be}`},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:st,border:`1px solid ${Wt}`,color:"#00E5CC"},children:jsxRuntime.jsx(rg,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ue},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:$=>{$.currentTarget.style.background=J,$.currentTarget.style.color=F;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=dt;},children:jsxRuntime.jsx(kw,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:$=>{$.currentTarget.style.background=J,$.currentTarget.style.color=F;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=dt;},children:jsxRuntime.jsx(ww,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!p&&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:[m.length===0&&x&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:I,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:Me.slice(0,4).map(($,ee)=>jsxRuntime.jsx("button",{onClick:()=>be($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:q,color:ve,border:`1px solid ${pe}`},onMouseEnter:we=>{we.currentTarget.style.borderColor=Ae,we.currentTarget.style.color="#00E5CC";},onMouseLeave:we=>{we.currentTarget.style.borderColor=pe,we.currentTarget.style.color=ve;},children:$.length>30?$.slice(0,30)+"...":$},ee))})]}),m.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?Ce:oe,color:$.role==="user"?"#00E5CC":et,border:$.role==="user"?`1px solid ${ft}`:`1px solid ${fe}`},children:[$.isLoading?jsxRuntime.jsx(Cw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:Y})]}),jsxRuntime.jsxs("form",{onSubmit:$=>{if(N&&Dr.length>0){$.preventDefault();return}j($);},className:"p-3 relative",style:{borderTop:`1px solid ${Xe}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&Dr.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Re,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:Ot,border:`1px solid ${kr}`,boxShadow:Vt,backdropFilter:"blur(12px)"},children:Dr.map(($,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Wr($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===T?ar:"transparent",color:ua},onMouseEnter:()=>V(ee),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:nt,border:`1px solid ${Je}`,color:"#00E5CC"},children:$.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:$.name}),$.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:Zr},children:$.email})]})]},$.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:kt,border:`1px solid ${tt}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:v,onChange:$=>_r($.target.value),onKeyDown:$=>{le($);},placeholder:Te,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:St,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?mr:"transparent",color:v.trim()?"#00E5CC":Rt,border:v.trim()?`1px solid ${cr}`:"1px solid transparent"},children:jsxRuntime.jsx(vw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Lr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function ag(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,u=true)=>{a(p=>{let d=typeof i=="function"?i(p.present):i;if(n.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),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 ng({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 Sw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let r=De.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=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function og(e){return {...Sw,...e}}var Bw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},cg=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:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:R,onCreateTask:C,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:T,toolbarContainer:V,showBaseline:O,viewMode:Y,onViewModeChange:L,projectForecast:Re,hideForecastHud:U,onThemeChange:Te,onTaskClick:B,onTaskSelectionChange:z,selectedTaskId:Me,onTaskDblClick:We,onTaskContextMenu:ce,onTaskUpdate:Fe,onDependentTasksScheduled:X,onProgressChange:Pe,onTaskEdit:Ne,onTaskAddSubtask:Oe,onTaskMarkIncomplete:ze,onTaskSetInProgress:rt,onDependencyCreate:ne,onDependencyDelete:Ke,onBeforeTaskAdd:je,onAfterTaskAdd:He,onBeforeTaskUpdate:gt,onAfterTaskUpdate:Mt,onBeforeTaskDelete:Ge,onAfterTaskDelete:Be,permissions:st,onCopySnapshotLink:Wt}=r,dt=react.useContext(Xi)?.theme,[F,J]=react.useState(dt||s||"dark"),[I,q]=react.useState(o),[pe,ve]=react.useState(l),[Ae,Ce]=react.useState(1),[ft,oe]=react.useState("all"),[fe,et]=react.useState(Y||"execution"),Xe=Y??fe,kt=react.useCallback(E=>{et(E),L?.(E);},[L]),tt=O??Xe==="oracle",[St,mr]=react.useState(r.showCriticalPath!==false),[cr,Rt]=react.useState(r.showDependencies!==false),[Lr,Ot]=react.useState(r.highlightWeekends!==false),kr=react.useCallback(E=>{mr(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),Vt=react.useCallback(E=>{Rt(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),ar=react.useCallback(E=>{Ot(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(I);},[I]),react.useEffect(()=>{r.onZoomChange?.(Ae);},[Ae]);let ua=react.useRef(r.onDateRangeChange);ua.current=r.onDateRangeChange;let Zr=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[nt,Je]=react.useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let W=JSON.parse(A);if(W.taskFilter)return W.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Nr=N??nt,wa=P??Je,[Dr,_r]=react.useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let W=JSON.parse(A);if(typeof W.hideCompleted=="boolean")return W.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:Nr,hideCompleted:Dr};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[Nr,Dr,Zr]);let Wr=react.useRef(y);react.useEffect(()=>{if(Wr.current!==y&&y!==void 0){Je("all"),_r(false);let E=Zr();if(E)try{localStorage.removeItem(E);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}Wr.current=y;},[y,Zr]);let[le,de]=react.useState(0),[pt,j]=react.useState(false),[be,te]=react.useState(null),[$,ee]=react.useState({isOpen:false,x:0,y:0,task:null}),[we,D]=react.useState(null),[H,ue]=react.useState(null);react.useEffect(()=>{dt&&dt!==F&&J(dt);},[dt]),react.useEffect(()=>{s&&s!==F&&J(s);},[s]);let ke=react.useCallback(E=>{J(E),Te?.(E);},[Te]),{state:me,setState:Se,undo:se,redo:it,canUndo:bt,canRedo:Et,clearHistory:nr}=ag(t,50),ka=react.useMemo(()=>{let E=(A,W=0)=>{let _=W;for(let ie of A)ie.subtasks?.length&&(_=Math.max(_,E(ie.subtasks,W+1)));return _};return E(me)+1},[me]),zr=react.useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),Ca=react.useRef(new Map),br=react.useRef(false);if(!br.current&&v){br.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let W=JSON.parse(A);Array.isArray(W)&&(Ca.current=new Map(W));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let An=react.useCallback(()=>{let E=zr();if(E)try{let A=Array.from(Ca.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[zr]),Ha=react.useRef(0),Ds=react.useRef(me);react.useEffect(()=>{Ds.current=me;},[me]);let Va=react.useRef(false),bi=react.useCallback(E=>{oe(E),Ha.current+=1,Se(A=>{let W=(ie,ge=0)=>ie.map(qe=>{let Ye=E==="all"||ge<E-1;return qe.subtasks?.length&&Ca.current.set(qe.id,Ye),{...qe,isExpanded:Ye,subtasks:qe.subtasks?W(qe.subtasks,ge+1):void 0}}),_=W(A);return An(),_});},[Se,An]);react.useEffect(()=>{if(Ha.current>0){Ha.current-=1;return}let E=W=>{let _=new Map;for(let ie of W){let ge=ie.id;_.get(ge)||_.set(ge,ie);}return Array.from(_.values())},A=W=>W.map(_=>{let ie=Ca.current.get(_.id),ge=ie!==void 0?{..._,isExpanded:ie}:_;if(ge.subtasks?.length){let qe=E(ge.subtasks);return {...ge,subtasks:A(qe)}}return ge});if(Ca.current.size>0)Se(Ya(A(t)));else {let W=_=>_.map(ie=>ie.subtasks?.length?{...ie,subtasks:E(W(ie.subtasks))}:ie);Se(Ya(W(t)));}},[t,Se]);let jo=react.useRef(t),hi=react.useRef(true);react.useEffect(()=>{if(hi.current){hi.current=false,jo.current=me;return}if(Va.current){Va.current=false,jo.current=me;return}if(!a)return;let E=JSON.stringify(jo.current),A=JSON.stringify(me);E!==A&&(jo.current=me,a(me));},[me,a]);let Kr=react.useMemo(()=>ed(w,k),[w,k]),Ss=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}],[]),La=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Ta,tn]=react.useState(()=>{let E=Ss(Kr);if(!b)return E;try{let A=typeof b=="string"?b:"gantt-columns-state",W=localStorage.getItem(A);if(!W)return E;let _=JSON.parse(W),ie=new Map(_.map(ge=>[ge.id,ge]));return E.map(ge=>{let qe=ie.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(La);react.useEffect(()=>{if(ho.current===La)return;ho.current=La;let E=Ss(Kr);if(!La){tn(E);return}try{let A=localStorage.getItem(La);if(!A){tn(E);return}let W=JSON.parse(A),_=new Map(W.map(ie=>[ie.id,ie]));tn(E.map(ie=>{let ge=_.get(ie.id);return ge?{...ie,visible:ge.visible??ie.visible,width:ge.width??ie.width}:ie}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),tn(E);}},[La,Ss,Kr]),react.useEffect(()=>{if(La&&ho.current===La)try{let E=Ta.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(La,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Ta,La]),react.useEffect(()=>{tn(E=>E.map(A=>({...A,label:Kr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Kr]);let In=react.useMemo(()=>Ta.filter(A=>A.visible).reduce((A,W)=>A+W.width,0),[Ta]),S=react.useRef(Ta.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=Ta.filter(_=>_.visible),A=E.map(_=>_.id).join(","),W=S.current;if(A!==W){let _=E.some(ge=>ge.id!=="name"),ie=W.includes(",");_?!ie&&_&&te(null):te(null),S.current=A;}},[Ta]);let K=60,re=.6,ye=react.useMemo(()=>{let A=In+K,W=typeof window<"u"?window.innerWidth*re:800,_=Math.max(A,W);return be!==null?Math.max(200,Math.min(be,_)):Math.max(200,A)},[be,In]),xe=react.useRef(null),_e=react.useRef(null),Z=react.useRef(null),Le=react.useRef(null),Qe=react.useRef(null),$e=react.useMemo(()=>Cm(F),[F]),zt=react.useMemo(()=>({theme:$e,themeName:F}),[$e,F]),ut=react.useMemo(()=>og(m),[m]),mt=react.useMemo(()=>{if(!f||!St)return me;let E=De.calculateCriticalPathFull(me),A=W=>W.map(_=>{let ie=E.get(_.id),ge=_.subtasks?A(_.subtasks):void 0,qe=ge?.some(Zt=>Zt.isCriticalPath||Zt.subtasks&&Zt.subtasks.some(Ht=>Ht.isCriticalPath))||false,Ye=ie?ie.isCritical:qe;return {..._,isCriticalPath:Ye,cpmData:ie||void 0,subtasks:ge}});return A(me)},[me,f,St]),hr=react.useMemo(()=>De.flattenTasks(me).some(A=>A.dependencies&&A.dependencies.length>0),[me]),dr=react.useMemo(()=>{let E=(A,W="")=>[...A].sort((ie,ge)=>(ie.position??0)-(ge.position??0)).map((ie,ge)=>{let qe=ge+1,Ye=W?`${W}.${qe}`:`${qe}.0`,Zt=W?`${W}.${qe}`:`${qe}`;return {...ie,wbsCode:Ye,subtasks:ie.subtasks?.length?E(ie.subtasks,Zt):ie.subtasks}});return E(mt)},[mt]),ea=react.useMemo(()=>{if(Nr==="all"&&!Dr)return dr;let E=A=>{let W=[];for(let _ of A){let ie=_.subtasks?.length?E(_.subtasks):void 0,ge=false;if(Dr)ge=_.progress<100;else switch(Nr){case "all":ge=true;break;case "incomplete":ge=_.progress<100;break;case "in_progress":ge=_.progress>0&&_.progress<100;break;case "completed":ge=_.progress===100;break}(ge||ie&&ie.length>0)&&W.push({..._,subtasks:ie});}return W};return E(dr)},[dr,Nr,Dr]),Ft=Bw(pe);ng({undo:se,redo:it,canUndo:bt,canRedo:Et,enabled:true}),react.useImperativeHandle(n,()=>({getTask:E=>De.findTaskById(me,E),addTask:(E,A)=>{Se(W=>{if(!A)return [...W,{...E,level:0}];let _=ie=>ie.map(ge=>ge.id===A?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:A,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:_(ge.subtasks)}:ge);return _(W)});},updateTask:(E,A)=>{Se(W=>{let _=ie=>ie.map(ge=>ge.id===E?{...ge,...A}:ge.subtasks?{...ge,subtasks:_(ge.subtasks)}:ge);return _(W)});},deleteTask:E=>{Se(A=>{let W=_=>_.filter(ie=>ie.id===E?false:(ie.subtasks&&(ie.subtasks=W(ie.subtasks)),true));return W(A)});},deleteTasks:E=>{Se(A=>pd(A,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let A=De.findTaskById(me,E);A&&r.onTaskDuplicate(A);}else Se(A=>Ys(A,[E]).tasks);},splitTask:(E,A,W=3)=>{Se(_=>De.splitTask(_,E,A,W));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(E,A)=>!De.validateDependencies(me,E,A),getAllTasks:()=>De.flattenTasks(me),getTasksByStatus:E=>De.flattenTasks(me).filter(A=>A.status===E),getTasksByParent:E=>E?De.findTaskById(me,E)?.subtasks||[]:me.filter(W=>!W.parentId),getCriticalPath:()=>De.flattenTasks(me).filter(E=>E.isCriticalPath),indentTask:E=>{Se(A=>Ya(cd(A,[E])));},outdentTask:E=>{Se(A=>Ya(dd(A,[E])));},moveTask:(E,A)=>{Se(W=>ud(W,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:W}=fd(me,E);if(je){let _=je({...W,parentId:E});if((_ instanceof Promise?await _:_)===false)return}Se(Ya(A)),He&&He({...W,parentId:E});},scrollToTask:E=>{let W=De.flattenTasks(me).findIndex(_=>_.id===E);if(W!==-1&&xe.current){let _=W*Ft;xe.current.scrollTo({top:_,behavior:"smooth"}),Z.current&&Z.current.scrollTo({top:_,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{Se(A=>{let W=_=>_.map(ie=>ie.id===E?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie);return W(A)});},collapseTask:E=>{Se(A=>{let W=_=>_.map(ie=>ie.id===E?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie);return W(A)});},expandAll:()=>{Se(E=>{let A=W=>W.map(_=>({..._,isExpanded:true,subtasks:_.subtasks?A(_.subtasks):void 0}));return A(E)});},collapseAll:()=>{Se(E=>{let A=W=>W.map(_=>({..._,isExpanded:false,subtasks:_.subtasks?A(_.subtasks):void 0}));return A(E)});},collapseToLevel:E=>{bi(E);},undo:se,redo:it,canUndo:()=>bt,canRedo:()=>Et,clearHistory:nr,exportToPNG:async()=>{if(!Le.current||!xe.current||!Z.current)throw new Error("Gantt container not found");let E=Le.current,A=xe.current,W=_e.current||A.querySelector(".gantt-grid-scroll"),_=Z.current,ie=W?.scrollTop||0,ge=_.scrollTop,qe=E.style.overflow,Ye=E.style.height,Zt=A.style.overflow;try{let Ht=W?.querySelector(".gantt-taskgrid-content"),or=_.querySelector("svg"),ma=Ht?.scrollHeight||W?.scrollHeight||600,Ua=or?.getBoundingClientRect().height||_.scrollHeight,wo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ma,Ua)+20;W&&(W.scrollTop=0),_.scrollTop=0,E.style.overflow="visible",E.style.height=`${wo}px`,A.style.overflow="visible",await new Promise(qo=>setTimeout(qo,100));let kn=await htmlToImage.toPng(E,{backgroundColor:$e.bgPrimary,pixelRatio:2,filter:qo=>{if(!(qo instanceof Element))return !0;let yi=window.getComputedStyle(qo),Ms=parseInt(yi.zIndex,10);return (isNaN(Ms)||Ms<50)&&yi.position!=="fixed"}});return await(await fetch(kn)).blob()}finally{E.style.overflow=qe,E.style.height=Ye,A.style.overflow=Zt,W&&(W.scrollTop=ie),_.scrollTop=ge;}},exportToPDF:async E=>{await De.exportToPDF(me,E);},exportToExcel:async E=>{await De.exportToExcel(me,E,Xl.current);},exportToJSON:()=>De.exportToJSON(me),exportToCSV:()=>De.exportToCSV(me),importFromJSON:E=>{let A=De.importFromJSON(E);Se(A);},getTasks:()=>me,refresh:()=>{Se(E=>[...E]);},clearAll:()=>{Se([]);},scrollToToday:()=>{let E=Z.current,A=Qe.current;if(!E||!A)return;let _=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),ie=A.timeScale==="day"?60:A.timeScale==="week"?20:8,ge=_*ie*A.zoom,qe=E.clientWidth,Ye=Math.max(0,ge-qe/2);E.scrollTo({left:Ye,behavior:"smooth"});}}),[me,se,it,bt,Et,nr,$e,Ft]);let qt=react.useCallback(E=>{tn(A=>A.map(W=>W.id===E?{...W,visible:!W.visible}:W));},[]),Nt=react.useCallback((E,A)=>{tn(W=>W.map(_=>{if(_.id!==E)return _;let ie=_.minWidth??100,ge=_.maxWidth??800,qe=Math.max(ie,Math.min(ge,A));return {..._,width:qe}}));},[]),Lt=react.useCallback(E=>{Se(A=>{let W=gd(A,E),_=ie=>{for(let ge of ie){if(ge.id===E){Ca.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&_(ge.subtasks);}};return _(W),An(),W}),r.onTaskToggleExpand?.(E);},[r,An]),Qt=react.useCallback((E,A)=>{if(gt&&gt(E,A)===false)return;let _=De.findTaskById(me,E)?.progress,ie=qe=>qe.map(Ye=>Ye.id===E?{...Ye,...A}:Ye.subtasks?{...Ye,subtasks:ie(Ye.subtasks)}:Ye);Se(qe=>ie(qe));let ge=De.findTaskById(ie(me),E);ge&&(Fe?.(ge),Mt?.(ge),A.progress!==void 0&&_!==void 0&&A.progress!==_&&Pe?.(E,_,A.progress));},[me,Fe,gt,Mt,Pe]),ba=react.useCallback((E,A,W)=>{if(E.length===0)return;let _=new Set(E),ie=ge=>ge.map(qe=>{let Ye=_.has(qe.id)?{...qe,[A]:W}:qe;return Ye.subtasks?{...Ye,subtasks:ie(Ye.subtasks)}:Ye});Se(ge=>{let qe=ie(ge);return r.onBulkFill?.(E,A,W,qe),qe});},[r]),Na=react.useCallback(E=>{E.length!==0&&(Ha.current+=1,Va.current=true,Se(A=>Ya(cd(A,E))),r.onTaskIndent?.(E[0]));},[r]),pa=react.useCallback(E=>{E.length!==0&&(Ha.current+=1,Va.current=true,Se(A=>Ya(dd(A,E))),r.onTaskOutdent?.(E[0]));},[r]),qr=react.useCallback((E,A,W)=>{Ha.current+=1,Va.current=true,Se(_=>Ya(Vm(_,E,A,W))),r.onTaskReparent?.(E,A,W);},[r]),yo=react.useCallback((E,A)=>{E.length!==0&&(Ha.current+=1,Va.current=true,Se(W=>ud(W,E,A)),r.onTaskMove?.(E[0],A));},[r]),xo=react.useCallback(async E=>{let A=[];for(let W of E)Ge&&await Promise.resolve(Ge(W))===false||A.push(W);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(Se(W=>Ya(pd(W,A))),A.forEach(W=>r.onTaskDelete?.(W))),Be&&A.forEach(W=>Be(W)));},[r,Ge,Be]),vo=react.useCallback(E=>{r.onTaskDuplicate?E.forEach(A=>{let W=De.findTaskById(me,A);W&&r.onTaskDuplicate(W);}):Se(A=>Ys(A,E).tasks);},[r,me]),mb=react.useCallback((E,A)=>{Se(W=>{let{tasks:_,newTask:ie}=Gm(W,E,A);return je&&je(ie)===false?W:(r.onTaskCreate?.(ie.parentId,ie.position||0),He?.(ie),_)});},[r,je,He]),gb=react.useCallback((E,A)=>{Se(W=>md(W,E,A)),r.onTaskRename?.(E,A);},[r]),ql=react.useCallback(E=>{let{onTaskAddSubtask:A}=r;if(A){let W=cs(me,E);if(W){A(W);return}}Se(W=>{let{tasks:_}=fd(W,E);return r.onTaskCreate?.(E,0),_});},[r,me]),fb=react.useCallback((E,A)=>{let W=Math.max(0,Math.min(100,Math.round(A))),_={progress:W};W===100?_.status="completed":W>0?_.status="in-progress":_.status="todo",Qt(E.id,_);},[Qt]),bb=react.useCallback((E,A,W)=>{let _=!E.startDate&&!E.endDate,ie=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Ht=>Ht.map(or=>or.id===E.id?{...or,startDate:A,endDate:W,...E.segments&&{segments:E.segments}}:or.subtasks?{...or,subtasks:ge(or.subtasks)}:or),qe=ge(me),Ye=qe;qe=De.autoScheduleDependents(qe,E.id,ie),qe=Ya(qe),Se(qe);let Zt={...E,startDate:A,endDate:W};if(_&&r?.onTaskDateChange?r.onTaskDateChange(E,A,W):Fe?.(Zt),X&&ie!==0){let Ht=De.flattenTasks(Ye),or=De.flattenTasks(qe),ma=[];for(let Ua of or){if(Ua.id===E.id)continue;let Kn=Ht.find(kn=>kn.id===Ua.id);if(!Kn)continue;let Ko=Ua.startDate?.getTime()!==Kn.startDate?.getTime(),wo=Ua.endDate?.getTime()!==Kn.endDate?.getTime();(Ko||wo)&&ma.push(Ua);}ma.length>0&&X(ma);}},[me,Fe,X,r]),hb=react.useCallback((E,A)=>{ce?.(E,A),ee({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[ce]),yb=react.useCallback((E,A)=>{let W=De.splitTask(me,E.id,A);Se(W),ee({isOpen:false,x:0,y:0,task:null});},[me]),Pu=react.useCallback(E=>{let A=De.findTaskById(me,E.id)||E;We?.(A),Ne||D(A);},[me,We,Ne]),Fu=react.useCallback((E,A,W)=>{let _=new Map,ie=Ht=>{Ht.forEach(or=>{or.dependencies&&_.set(or.id,or.dependencies),or.subtasks&&ie(or.subtasks);});};ie(W);let ge=_.get(A)||[];_.set(A,[...ge,E]);let qe=new Set,Ye=new Set,Zt=Ht=>{if(!qe.has(Ht)){qe.add(Ht),Ye.add(Ht);let or=_.get(Ht)||[];for(let ma of or){if(!qe.has(ma)&&Zt(ma))return true;if(Ye.has(ma))return true}}return Ye.delete(Ht),false};return Zt(A)},[]),Lu=react.useCallback((E,A)=>{if(Fu(E.id,A,Ds.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:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${te[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Re,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ut}`,boxShadow:Et},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ge,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 ${Mt}`,color:"#00E5CC"},children:jsxRuntime.jsx(ag,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Be},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:vt},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=vt;},children:jsxRuntime.jsx(Dw,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:vt},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=vt;},children:jsxRuntime.jsx(Nw,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!p&&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:[m.length===0&&x&&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:Me.slice(0,4).map(($,ee)=>jsxRuntime.jsx("button",{onClick:()=>be($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:_,color:ve,border:`1px solid ${ue}`},onMouseEnter:ke=>{ke.currentTarget.style.borderColor=Oe,ke.currentTarget.style.color="#00E5CC";},onMouseLeave:ke=>{ke.currentTarget.style.borderColor=ue,ke.currentTarget.style.color=ve;},children:$.length>30?$.slice(0,30)+"...":$},ee))})]}),m.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?ye:ie,color:$.role==="user"?"#00E5CC":Ze,border:$.role==="user"?`1px solid ${ft}`:`1px solid ${ge}`},children:[$.isLoading?jsxRuntime.jsx(Sw,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:X})]}),jsxRuntime.jsxs("form",{onSubmit:$=>{if(N&&sa.length>0){$.preventDefault();return}j($);},className:"p-3 relative",style:{borderTop:`1px solid ${Xe}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&sa.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Fe,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:Ht,border:`1px solid ${vr}`,boxShadow:jt,backdropFilter:"blur(12px)"},children:sa.map(($,ee)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>Wr($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===T?or:"transparent",color:ha},onMouseEnter:()=>V(ee),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:tt,border:`1px solid ${Ye}`,color:"#00E5CC"},children:$.name.split(" ").map(ke=>ke[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:$.name}),$.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:pa},children:$.email})]})]},$.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:kt,border:`1px solid ${Je}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:v,onChange:$=>wr($.target.value),onKeyDown:$=>{le($);},placeholder:De,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?Yt:"transparent",color:v.trim()?"#00E5CC":It,border:v.trim()?`1px solid ${pr}`:"1px solid transparent"},children:jsxRuntime.jsx(Tw,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ur,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function ng(e,t=50){let[r,a]=react.useState({past:[],present:e,future:[]}),n=react.useRef(false),s=react.useCallback((i,u=true)=>{a(p=>{let d=typeof i=="function"?i(p.present):i;if(n.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=react.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),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 og({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 Fw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ne.formatDate(e.startDate)} - ${Ne.formatDate(e.endDate)}`);let r=Ne.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=>Ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function sg(e){return {...Fw,...e}}var Hw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},ug=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:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:I,onCreateTask:C,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:T,toolbarContainer:V,hideWbsLevel:O,showBaseline:X,viewMode:F,onViewModeChange:Fe,projectForecast:U,hideForecastHud:De,onThemeChange:B,onTaskClick:z,onTaskSelectionChange:Me,selectedTaskId:Ue,onTaskDblClick:ce,onTaskContextMenu:Le,onTaskUpdate:J,onDependentTasksScheduled:Pe,onProgressChange:Ee,onTaskEdit:$e,onTaskAddSubtask:He,onTaskMarkIncomplete:et,onTaskSetInProgress:se,onDependencyCreate:_e,onDependencyDelete:qe,onBeforeTaskAdd:Re,onAfterTaskAdd:ut,onBeforeTaskUpdate:Et,onAfterTaskUpdate:Ge,onBeforeTaskDelete:Ie,onAfterTaskDelete:dt,permissions:Mt,onCopySnapshotLink:Be}=r,L=react.useContext(Xi)?.theme,[Q,R]=react.useState(L||s||"dark"),[_,ue]=react.useState(o),[ve,Oe]=react.useState(l),[ye,ft]=react.useState(1),[ie,ge]=react.useState("all"),[Ze,Xe]=react.useState(F||"execution"),kt=F??Ze,Je=react.useCallback(E=>{Xe(E),Fe?.(E);},[Fe]),At=X??kt==="oracle",[Yt,pr]=react.useState(r.showCriticalPath!==false),[It,Ur]=react.useState(r.showDependencies!==false),[Ht,vr]=react.useState(r.highlightWeekends!==false),jt=react.useCallback(E=>{pr(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),or=react.useCallback(E=>{Ur(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),ha=react.useCallback(E=>{vr(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);react.useEffect(()=>{r.onTimeScaleChange?.(_);},[_]),react.useEffect(()=>{r.onZoomChange?.(ye);},[ye]);let pa=react.useRef(r.onDateRangeChange);pa.current=r.onDateRangeChange;let tt=react.useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ye,ea]=react.useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let H=JSON.parse(A);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),_r=N??Ye,sa=P??ea,[wr,Wr]=react.useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let H=JSON.parse(A);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});react.useEffect(()=>{let E=tt();if(E)try{let A={taskFilter:_r,hideCompleted:wr};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[_r,wr,tt]);let le=react.useRef(y);react.useEffect(()=>{if(le.current!==y&&y!==void 0){ea("all"),Wr(false);let E=tt();if(E)try{localStorage.removeItem(E);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}le.current=y;},[y,tt]);let[de,pt]=react.useState(0),[j,be]=react.useState(false),[te,$]=react.useState(null),[ee,ke]=react.useState({isOpen:false,x:0,y:0,task:null}),[D,W]=react.useState(null),[pe,we]=react.useState(null);react.useEffect(()=>{L&&L!==Q&&R(L);},[L]),react.useEffect(()=>{s&&s!==Q&&R(s);},[s]);let rt=react.useCallback(E=>{R(E),B?.(E);},[B]),{state:fe,setState:q,undo:it,redo:bt,canUndo:Pt,canRedo:Zt,clearHistory:ya}=ng(t,50),Kr=react.useMemo(()=>{let E=(A,H=0)=>{let K=H;for(let ae of A)ae.subtasks?.length&&(K=Math.max(K,E(ae.subtasks,H+1)));return K};return E(fe)+1},[fe]),Za=react.useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),er=react.useRef(new Map),yo=react.useRef(false);if(!yo.current&&v){yo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let H=JSON.parse(A);Array.isArray(H)&&(er.current=new Map(H));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let Vn=react.useCallback(()=>{let E=Za();if(E)try{let A=Array.from(er.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[Za]),Wa=react.useRef(0),jn=react.useRef(fe);react.useEffect(()=>{jn.current=fe;},[fe]);let _n=react.useRef(false),bi=react.useCallback(E=>{ge(E),Wa.current+=1,q(A=>{let H=(ae,me=0)=>ae.map(Ve=>{let je=E==="all"||me<E-1;return Ve.subtasks?.length&&er.current.set(Ve.id,je),{...Ve,isExpanded:je,subtasks:Ve.subtasks?H(Ve.subtasks,me+1):void 0}}),K=H(A);return Vn(),K});},[q,Vn]);react.useEffect(()=>{if(Wa.current>0){Wa.current-=1;return}let E=H=>{let K=new Map;for(let ae of H){let me=ae.id;K.get(me)||K.set(me,ae);}return Array.from(K.values())},A=H=>H.map(K=>{let ae=er.current.get(K.id),me=ae!==void 0?{...K,isExpanded:ae}:K;if(me.subtasks?.length){let Ve=E(me.subtasks);return {...me,subtasks:A(Ve)}}return me});if(er.current.size>0)q(Ka(A(t)));else {let H=K=>K.map(ae=>ae.subtasks?.length?{...ae,subtasks:E(H(ae.subtasks))}:ae);q(Ka(H(t)));}},[t,q]);let _o=react.useRef(t),hi=react.useRef(true);react.useEffect(()=>{if(hi.current){hi.current=false,_o.current=fe;return}if(_n.current){_n.current=false,_o.current=fe;return}if(!a)return;let E=JSON.stringify(_o.current),A=JSON.stringify(fe);E!==A&&(_o.current=fe,a(fe));},[fe,a]);let qr=react.useMemo(()=>td(w,k),[w,k]),xo=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}],[]),ma=react.useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[za,en]=react.useState(()=>{let E=xo(qr);if(!b)return E;try{let A=typeof b=="string"?b:"gantt-columns-state",H=localStorage.getItem(A);if(!H)return E;let K=JSON.parse(H),ae=new Map(K.map(me=>[me.id,me]));return E.map(me=>{let Ve=ae.get(me.id);return Ve?{...me,visible:Ve.visible??me.visible,width:Ve.width??me.width}:me})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),E}}),Kn=react.useRef(ma);react.useEffect(()=>{if(Kn.current===ma)return;Kn.current=ma;let E=xo(qr);if(!ma){en(E);return}try{let A=localStorage.getItem(ma);if(!A){en(E);return}let H=JSON.parse(A),K=new Map(H.map(ae=>[ae.id,ae]));en(E.map(ae=>{let me=K.get(ae.id);return me?{...ae,visible:me.visible??ae.visible,width:me.width??ae.width}:ae}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),en(E);}},[ma,xo,qr]),react.useEffect(()=>{if(ma&&Kn.current===ma)try{let E=za.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(ma,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[za,ma]),react.useEffect(()=>{en(E=>E.map(A=>({...A,label:qr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[qr]);let S=react.useMemo(()=>za.filter(A=>A.visible).reduce((A,H)=>A+H.width,0),[za]),Y=react.useRef(za.filter(E=>E.visible).map(E=>E.id).join(","));react.useEffect(()=>{let E=za.filter(K=>K.visible),A=E.map(K=>K.id).join(","),H=Y.current;if(A!==H){let K=E.some(me=>me.id!=="name"),ae=H.includes(",");K?!ae&&K&&$(null):$(null),Y.current=A;}},[za]);let re=60,xe=.6,Ce=react.useMemo(()=>{let A=S+re,H=typeof window<"u"?window.innerWidth*xe:800,K=Math.max(A,H);return te!==null?Math.max(200,Math.min(te,K)):Math.max(200,A)},[te,S]),We=react.useRef(null),oe=react.useRef(null),Te=react.useRef(null),Ke=react.useRef(null),at=react.useRef(null),nt=react.useMemo(()=>Tm(Q),[Q]),mt=react.useMemo(()=>({theme:nt,themeName:Q}),[nt,Q]),gt=react.useMemo(()=>sg(m),[m]),mr=react.useMemo(()=>{if(!f||!Yt)return fe;let E=Ne.calculateCriticalPathFull(fe),A=H=>H.map(K=>{let ae=E.get(K.id),me=K.subtasks?A(K.subtasks):void 0,Ve=me?.some(tr=>tr.isCriticalPath||tr.subtasks&&tr.subtasks.some(Wt=>Wt.isCriticalPath))||false,je=ae?ae.isCritical:Ve;return {...K,isCriticalPath:je,cpmData:ae||void 0,subtasks:me}});return A(fe)},[fe,f,Yt]),kr=react.useMemo(()=>Ne.flattenTasks(fe).some(A=>A.dependencies&&A.dependencies.length>0),[fe]),zr=react.useMemo(()=>{let E=(A,H="")=>[...A].sort((ae,me)=>(ae.position??0)-(me.position??0)).map((ae,me)=>{let Ve=me+1,je=H?`${H}.${Ve}`:`${Ve}.0`,tr=H?`${H}.${Ve}`:`${Ve}`;return {...ae,wbsCode:je,subtasks:ae.subtasks?.length?E(ae.subtasks,tr):ae.subtasks}});return E(mr)},[mr]),Ut=react.useMemo(()=>{if(_r==="all"&&!wr)return zr;let E=A=>{let H=[];for(let K of A){let ae=K.subtasks?.length?E(K.subtasks):void 0,me=false;if(wr)me=K.progress<100;else switch(_r){case "all":me=true;break;case "incomplete":me=K.progress<100;break;case "in_progress":me=K.progress>0&&K.progress<100;break;case "completed":me=K.progress===100;break}(me||ae&&ae.length>0)&&H.push({...K,subtasks:ae});}return H};return E(zr)},[zr,_r,wr]),Gt=Hw(ve);og({undo:it,redo:bt,canUndo:Pt,canRedo:Zt,enabled:true});let yt=react.useRef(null),Ft=(E,A="start")=>{let H=Te.current,K=at.current;if(!H||!K)return;let ae=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),me=K.timeScale==="day"?60:K.timeScale==="week"?20:8,Ve=ae*me*K.zoom,je=A==="center"?Ve-H.clientWidth/2:Ve-me*K.zoom*2;H.scrollTo({left:Math.max(0,je),behavior:"auto"});};react.useImperativeHandle(n,()=>({getTask:E=>Ne.findTaskById(fe,E),addTask:(E,A)=>{q(H=>{if(!A)return [...H,{...E,level:0}];let K=ae=>ae.map(me=>me.id===A?{...me,subtasks:[...me.subtasks||[],{...E,parentId:A,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(H)});},updateTask:(E,A)=>{q(H=>{let K=ae=>ae.map(me=>me.id===E?{...me,...A}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(H)});},deleteTask:E=>{q(A=>{let H=K=>K.filter(ae=>ae.id===E?false:(ae.subtasks&&(ae.subtasks=H(ae.subtasks)),true));return H(A)});},deleteTasks:E=>{q(A=>md(A,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let A=Ne.findTaskById(fe,E);A&&r.onTaskDuplicate(A);}else q(A=>Ys(A,[E]).tasks);},splitTask:(E,A,H=3)=>{q(K=>Ne.splitTask(K,E,A,H));},calculateEndDate:Ne.calculateEndDate,calculateDuration:Ne.calculateDuration,validateDependency:(E,A)=>!Ne.validateDependencies(fe,E,A),getAllTasks:()=>Ne.flattenTasks(fe),getTasksByStatus:E=>Ne.flattenTasks(fe).filter(A=>A.status===E),getTasksByParent:E=>E?Ne.findTaskById(fe,E)?.subtasks||[]:fe.filter(H=>!H.parentId),getCriticalPath:()=>Ne.flattenTasks(fe).filter(E=>E.isCriticalPath),indentTask:E=>{q(A=>Ka(dd(A,[E])));},outdentTask:E=>{q(A=>Ka(ud(A,[E])));},moveTask:(E,A)=>{q(H=>pd(H,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:H}=bd(fe,E);if(Re){let K=Re({...H,parentId:E});if((K instanceof Promise?await K:K)===false)return}q(Ka(A)),ut&&ut({...H,parentId:E});},scrollToTask:E=>{let H=Ne.flattenTasks(fe).findIndex(K=>K.id===E);if(H!==-1&&We.current){let K=H*Gt;We.current.scrollTo({top:K,behavior:"smooth"}),Te.current&&Te.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{q(A=>{let H=K=>K.map(ae=>ae.id===E?{...ae,isExpanded:true}:ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae);return H(A)});},collapseTask:E=>{q(A=>{let H=K=>K.map(ae=>ae.id===E?{...ae,isExpanded:false}:ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae);return H(A)});},expandAll:()=>{q(E=>{let A=H=>H.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?A(K.subtasks):void 0}));return A(E)});},collapseAll:()=>{q(E=>{let A=H=>H.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?A(K.subtasks):void 0}));return A(E)});},collapseToLevel:E=>{bi(E);},undo:it,redo:bt,canUndo:()=>Pt,canRedo:()=>Zt,clearHistory:ya,exportToPNG:async()=>{if(!Ke.current||!We.current||!Te.current)throw new Error("Gantt container not found");let E=Ke.current,A=We.current,H=oe.current||A.querySelector(".gantt-grid-scroll"),K=Te.current,ae=H?.scrollTop||0,me=K.scrollTop,Ve=E.style.overflow,je=E.style.height,tr=A.style.overflow;try{let Wt=H?.querySelector(".gantt-taskgrid-content"),sr=K.querySelector("svg"),ga=Wt?.scrollHeight||H?.scrollHeight||600,$a=sr?.getBoundingClientRect().height||K.scrollHeight,ko=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ga,$a)+20;H&&(H.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${ko}px`,A.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let kn=await htmlToImage.toPng(E,{backgroundColor:nt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let yi=window.getComputedStyle(Yo),Ms=parseInt(yi.zIndex,10);return (isNaN(Ms)||Ms<50)&&yi.position!=="fixed"}});return await(await fetch(kn)).blob()}finally{E.style.overflow=Ve,E.style.height=je,A.style.overflow=tr,H&&(H.scrollTop=ae),K.scrollTop=me;}},exportToPDF:async E=>{await Ne.exportToPDF(fe,E);},exportToExcel:async E=>{await Ne.exportToExcel(fe,E,Jl.current);},exportToJSON:()=>Ne.exportToJSON(fe),exportToCSV:()=>Ne.exportToCSV(fe),importFromJSON:E=>{let A=Ne.importFromJSON(E);q(A);},getTasks:()=>fe,refresh:()=>{q(E=>[...E]);},clearAll:()=>{q([]);},scrollToDate:(E,A="start")=>Ft(E,A),fitToDates:(E,A)=>{let H=Math.max(1,(A.getTime()-E.getTime())/864e5),K=H<=21?"day":H<=122?"week":"month";yt.current=E,ue(K),K===at.current?.timeScale&&requestAnimationFrame(()=>{let ae=yt.current;yt.current=null,ae&&Ft(ae);});},scrollToToday:()=>{let E=Te.current,A=at.current;if(!E||!A)return;let K=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),ae=A.timeScale==="day"?60:A.timeScale==="week"?20:8,me=K*ae*A.zoom,Ve=E.clientWidth,je=Math.max(0,me-Ve/2);E.scrollTo({left:je,behavior:"smooth"});}}),[fe,it,bt,Pt,Zt,ya,nt,Gt]);let Lr=react.useCallback(E=>{en(A=>A.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),xa=react.useCallback((E,A)=>{en(H=>H.map(K=>{if(K.id!==E)return K;let ae=K.minWidth??100,me=K.maxWidth??800,Ve=Math.max(ae,Math.min(me,A));return {...K,width:Ve}}));},[]),Ta=react.useCallback(E=>{q(A=>{let H=fd(A,E),K=ae=>{for(let me of ae){if(me.id===E){er.current.set(E,me.isExpanded??true);return}me.subtasks?.length&&K(me.subtasks);}};return K(H),Vn(),H}),r.onTaskToggleExpand?.(E);},[r,Vn]),Cr=react.useCallback((E,A)=>{if(Et&&Et(E,A)===false)return;let K=Ne.findTaskById(fe,E)?.progress,ae=Ve=>Ve.map(je=>je.id===E?{...je,...A}:je.subtasks?{...je,subtasks:ae(je.subtasks)}:je);q(Ve=>ae(Ve));let me=Ne.findTaskById(ae(fe),E);me&&(J?.(me),Ge?.(me),A.progress!==void 0&&K!==void 0&&A.progress!==K&&Ee?.(E,K,A.progress));},[fe,J,Et,Ge,Ee]),Yr=react.useCallback((E,A,H)=>{if(E.length===0)return;let K=new Set(E),ae=me=>me.map(Ve=>{let je=K.has(Ve.id)?{...Ve,[A]:H}:Ve;return je.subtasks?{...je,subtasks:ae(je.subtasks)}:je});q(me=>{let Ve=ae(me);return r.onBulkFill?.(E,A,H,Ve),Ve});},[r]),vo=react.useCallback(E=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(A=>Ka(dd(A,E))),r.onTaskIndent?.(E[0]));},[r]),Ss=react.useCallback(E=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(A=>Ka(ud(A,E))),r.onTaskOutdent?.(E[0]));},[r]),wo=react.useCallback((E,A,H)=>{Wa.current+=1,_n.current=true,q(K=>Ka(jm(K,E,A,H))),r.onTaskReparent?.(E,A,H);},[r]),fb=react.useCallback((E,A)=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(H=>pd(H,E,A)),r.onTaskMove?.(E[0],A));},[r]),ql=react.useCallback(async E=>{let A=[];for(let H of E)Ie&&await Promise.resolve(Ie(H))===false||A.push(H);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(q(H=>Ka(md(H,A))),A.forEach(H=>r.onTaskDelete?.(H))),dt&&A.forEach(H=>dt(H)));},[r,Ie,dt]),bb=react.useCallback(E=>{r.onTaskDuplicate?E.forEach(A=>{let H=Ne.findTaskById(fe,A);H&&r.onTaskDuplicate(H);}):q(A=>Ys(A,E).tasks);},[r,fe]),hb=react.useCallback((E,A)=>{q(H=>{let{tasks:K,newTask:ae}=Vm(H,E,A);return Re&&Re(ae)===false?H:(r.onTaskCreate?.(ae.parentId,ae.position||0),ut?.(ae),K)});},[r,Re,ut]),yb=react.useCallback((E,A)=>{q(H=>gd(H,E,A)),r.onTaskRename?.(E,A);},[r]),Yl=react.useCallback(E=>{let{onTaskAddSubtask:A}=r;if(A){let H=ds(fe,E);if(H){A(H);return}}q(H=>{let{tasks:K}=bd(H,E);return r.onTaskCreate?.(E,0),K});},[r,fe]),xb=react.useCallback((E,A)=>{let H=Math.max(0,Math.min(100,Math.round(A))),K={progress:H};H===100?K.status="completed":H>0?K.status="in-progress":K.status="todo",Cr(E.id,K);},[Cr]),vb=react.useCallback((E,A,H)=>{let K=!E.startDate&&!E.endDate,ae=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,me=Wt=>Wt.map(sr=>sr.id===E.id?{...sr,startDate:A,endDate:H,...E.segments&&{segments:E.segments}}:sr.subtasks?{...sr,subtasks:me(sr.subtasks)}:sr),Ve=me(fe),je=Ve;Ve=Ne.autoScheduleDependents(Ve,E.id,ae),Ve=Ka(Ve),q(Ve);let tr={...E,startDate:A,endDate:H};if(K&&r?.onTaskDateChange?r.onTaskDateChange(E,A,H):J?.(tr),Pe&&ae!==0){let Wt=Ne.flattenTasks(je),sr=Ne.flattenTasks(Ve),ga=[];for(let $a of sr){if($a.id===E.id)continue;let qn=Wt.find(kn=>kn.id===$a.id);if(!qn)continue;let qo=$a.startDate?.getTime()!==qn.startDate?.getTime(),ko=$a.endDate?.getTime()!==qn.endDate?.getTime();(qo||ko)&&ga.push($a);}ga.length>0&&Pe(ga);}},[fe,J,Pe,r]),wb=react.useCallback((E,A)=>{Le?.(E,A),ke({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[Le]),kb=react.useCallback((E,A)=>{let H=Ne.splitTask(fe,E.id,A);q(H),ke({isOpen:false,x:0,y:0,task:null});},[fe]),Fu=react.useCallback(E=>{let A=Ne.findTaskById(fe,E.id)||E;ce?.(A),$e||W(A);},[fe,ce,$e]),Lu=react.useCallback((E,A,H)=>{let K=new Map,ae=Wt=>{Wt.forEach(sr=>{sr.dependencies&&K.set(sr.id,sr.dependencies),sr.subtasks&&ae(sr.subtasks);});};ae(H);let me=K.get(A)||[];K.set(A,[...me,E]);let Ve=new Set,je=new Set,tr=Wt=>{if(!Ve.has(Wt)){Ve.add(Wt),je.add(Wt);let sr=K.get(Wt)||[];for(let ga of sr){if(!Ve.has(ga)&&tr(ga))return true;if(je.has(ga))return true}}return je.delete(Wt),false};return tr(A)},[]),Au=react.useCallback((E,A)=>{if(Lu(E.id,A,jn.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 W=_=>_.map(ie=>{if(ie.id===A){let ge=ie.dependencies||[];if(!ge.includes(E.id))return {...ie,dependencies:[...ge,E.id]}}return ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie});Ha.current+=1,Se(_=>W(_)),ne?.(E.id,A);},[ne,Fu]),Au=react.useCallback((E,A)=>{let W=_=>_.map(ie=>{if(ie.id===E&&ie.dependencies){let ge=ie.dependencies.filter(qe=>qe!==A);return {...ie,dependencies:ge}}return ie.subtasks?{...ie,subtasks:W(ie.subtasks)}:ie});Ha.current+=1,Se(_=>W(_)),Ke?.(E,A);},[Ke]),{startDate:Rn,endDate:Yl}=react.useMemo(()=>{let E=me.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),W=new Date(Math.min(...A.map(ge=>ge.getTime()))),_=new Date(Math.max(...A.map(ge=>ge.getTime()))),ie=I==="day"?7:I==="week"?14:30;return W.setDate(W.getDate()-ie),_.setDate(_.getDate()+ie),{startDate:W,endDate:_}},[me,I]);react.useEffect(()=>{ua.current?.(Rn,Yl);},[Rn,Yl]);let xb=react.useCallback(async()=>{if(!Le.current||!xe.current||!Z.current)return;await new Promise(wo=>setTimeout(wo,200));let E=Le.current,A=xe.current,W=_e.current||A.querySelector(".gantt-grid-scroll"),_=Z.current,ie=W?.scrollTop||0,ge=W?.scrollLeft||0,qe=_.scrollTop,Ye=_.scrollLeft,Zt=E.style.overflow,Ht=E.style.height,or=W?.style.overflow||"",ma=_.style.overflow,Ua=A.style.overflow,Kn=E.style.width,Ko=_.style.width;try{let wo=W?.querySelector(".gantt-taskgrid-content"),kn=_.querySelector("svg"),Zl=kn?.getAttribute("height")?parseInt(kn.getAttribute("height"),10):kn?.getBoundingClientRect().height||0,qo=wo?.scrollHeight||W?.scrollHeight||600,yi=Math.max(Zl,_.scrollHeight),Ms=kn?.getAttribute("width")?parseInt(kn.getAttribute("width"),10):kn?.getBoundingClientRect().width||_.scrollWidth,Sb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,ec=Math.max(qo,yi,Zl),$u=Sb+ec+50,Ou=(W?.offsetWidth||A.offsetWidth||300)+Ms+10;W&&(W.scrollTop=0,W.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,E.style.overflow="visible",E.style.height=`${$u}px`,E.style.width=`${Ou}px`,A.style.overflow="visible",W&&(W.style.overflow="visible",W.style.height=`${ec+50}px`),_.style.overflow="visible",_.style.height=`${ec+50}px`,_.style.width=`${Ms+10}px`,await new Promise(xi=>setTimeout(xi,150));let Eb=await htmlToImage.toPng(E,{backgroundColor:$e.bgPrimary,pixelRatio:2,width:Ou,height:$u,skipFonts:!1,filter:xi=>{if(!(xi instanceof Element))return !0;let Hu=window.getComputedStyle(xi),Uu=parseInt(Hu.zIndex,10);return !(!isNaN(Uu)&&Uu>=50||Hu.position==="fixed")}}),tc=document.createElement("a");tc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,tc.href=Eb,tc.click();}finally{E.style.overflow=Zt,E.style.height=Ht,E.style.width=Kn,A.style.overflow=Ua,W&&(W.style.overflow=or,W.style.height="",W.scrollTop=ie,W.scrollLeft=ge),_.style.overflow=ma,_.style.height="",_.style.width=Ko,_.scrollTop=qe,_.scrollLeft=Ye;}u?.("png");},[$e,u]),vb=react.useCallback(async()=>{await De.exportToPDF(me),u?.("pdf");},[me,u]),Xl=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p});Xl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p};let wb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),u?.("excel");return}let E=new Date,A=ie=>String(ie).padStart(2,"0"),W=`${E.getFullYear()}-${A(E.getMonth()+1)}-${A(E.getDate())}_${A(E.getHours())}${A(E.getMinutes())}`,_=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(me,`${_}_${W}.xlsx`,Xl.current),u?.("excel");},[me,p,u,r.onExportExcel]),kb=react.useCallback(()=>{let E=De.exportToCSV(me),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(A),W.download="gantt-chart.csv",W.click(),URL.revokeObjectURL(W.href),u?.("csv");},[me,u]),Cb=react.useCallback(()=>{let E=De.exportToJSON(me),A=new Blob([E],{type:"application/json;charset=utf-8;"}),W=document.createElement("a");W.href=URL.createObjectURL(A),W.download="gantt-chart.json",W.click(),URL.revokeObjectURL(W.href),u?.("json");},[me,u]),Tb=react.useCallback(()=>{De.exportToMSProject(me,"Gantt Project","project.xml"),u?.("msproject");},[me,u]),Nb=E=>{E.preventDefault(),j(true);},_o=react.useRef(false),[Jl,Iu]=react.useState(false),Es=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Z.current,A=xe.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let W=()=>{if(_o.current)return;_o.current=true;let Ye=E.scrollTop;de(Ye),A.scrollTop=Ye,requestAnimationFrame(()=>{_o.current=false;});},_=()=>{if(_o.current)return;_o.current=true;let Ye=A.scrollTop;de(Ye),E.scrollTop=Ye,requestAnimationFrame(()=>{_o.current=false;});},ie=Ye=>{if(pt&&A){let Ht=A.parentElement?.getBoundingClientRect()?.left||0,or=Ye.clientX-Ht,ma=200,Ua=In+K,Kn=window.innerWidth*re,Ko=Math.max(Ua,Kn);or>=ma&&or<=Ko&&te(or);}if(Jl&&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=()=>{j(false),Iu(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"||(Iu(true),Es.current={x:Ye.clientX,y:Ye.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},Ye.preventDefault());};return E.addEventListener("scroll",W),A.addEventListener("scroll",_),E.addEventListener("mousedown",qe),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",W),A.removeEventListener("scroll",_),E.removeEventListener("mousedown",qe),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge);}},[pt,Jl,In]),Qe.current={startDate:Rn,timeScale:I,zoom:Ae};let Ql=r.onTodayVisibilityChange,Ru=react.useRef(null);react.useEffect(()=>{if(!Ql)return;let E=Z.current;if(!E)return;let A=I==="day"?60:I==="week"?20:8,W=()=>{let ge=(new Date().getTime()-Rn.getTime())/(1e3*60*60*24)*A*Ae,qe=E.scrollLeft,Ye=qe+E.clientWidth,Zt=ge>=qe&&ge<=Ye;Ru.current!==Zt&&(Ru.current=Zt,Ql(Zt));};return W(),E.addEventListener("scroll",W,{passive:true}),window.addEventListener("resize",W),()=>{E.removeEventListener("scroll",W),window.removeEventListener("resize",W);}},[Ql,Rn,I,Ae]);let Bu=react.useRef(false),Db=react.useRef(null);return react.useLayoutEffect(()=>{if(Bu.current||me.length===0||!Z.current)return;Bu.current=true,Db.current=Rn;let E=Z.current,A=new Date,W=I==="day"?60:I==="week"?20:8,_=(A.getTime()-Rn.getTime())/(1e3*60*60*24),ie=E.clientWidth,qe=_*W*Ae-ie/2;_>=0&&ie>0&&(E.scrollLeft=Math.max(0,qe));},[me.length,Rn,I,Ae]),jsxRuntime.jsx(is.Provider,{value:Kr,children:jsxRuntime.jsx(sc.Provider,{value:zt,children:jsxRuntime.jsxs("div",{ref:Le,className:"flex flex-col h-full w-full",style:{backgroundColor:$e.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...$e.dotGrid&&{backgroundImage:`radial-gradient(circle, ${$e.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsxRuntime.jsx(Qi,{enCabecera:!!V,theme:$e,timeScale:I,onTimeScaleChange:q,zoom:Ae,onZoomChange:Ce,currentTheme:F,onThemeChange:ke,rowDensity:pe,onRowDensityChange:ve,showThemeSelector:c,showCreateTaskButton:M&&st?.canCreateTask!==false&&!st?.canCreateSubtaskOnly,createTaskLabel:R,onCreateTask:C,taskFilter:Nr,onTaskFilterChange:wa,hideCompleted:Dr,onHideCompletedChange:_r,toolbarRightContent:T,wbsLevel:ft,onWbsLevelChange:bi,maxWbsDepth:ka,viewMode:Xe,onViewModeChange:kt,projectForecast:Re,hideForecastHud:U,onExportPNG:i?xb:void 0,onExportPDF:i?vb:void 0,onExportExcel:i?wb:void 0,onExportCSV:i?kb:void 0,onExportJSON:i?Cb:void 0,onExportMSProject:i?Tb:void 0,showCriticalPath:St,onShowCriticalPathChange:kr,showDependencies:cr,onShowDependenciesChange:Vt,highlightWeekends:Lr,onHighlightWeekendsChange:ar,showBaseline:tt,onShowBaselineChange:A=>{A&&Xe!=="oracle"&&kt("oracle"),!A&&Xe==="oracle"&&kt("execution");},onCopySnapshotLink:Wt,hasDependencies:hr});return V?reactDom.createPortal(E,V):jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),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:_e,className:"gantt-grid-scroll flex-shrink-0",style:{width:ye,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(tl,{tasks:ea,allTasks:dr,theme:$e,rowHeight:Ft,availableUsers:d,templates:ut,showCriticalPath:St,onTaskClick:B,onTaskSelectionChange:z,selectedTaskId:Me,onTaskDblClick:Pu,onTaskContextMenu:ce,onTaskToggle:Lt,scrollTop:le,columns:Ta,onToggleColumn:qt,onColumnResize:Nt,onTaskUpdate:Qt,onBulkFill:ba,onTaskIndent:Na,onTaskOutdent:pa,onTaskMove:yo,onMultiTaskDelete:xo,onTaskDuplicate:vo,onTaskCreate:mb,onTaskRename:gb,onCreateSubtask:ql,onOpenTaskModal:B?E=>B(E):void 0,onDeleteRequest:(E,A)=>ue({taskIds:E,taskName:A}),onTaskReparent:qr,scrollContainerRef:_e})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:$e.border,zIndex:15},onMouseDown:Nb}),jsxRuntime.jsx("div",{ref:Z,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Jl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(ll,{tasks:ea,theme:$e,rowHeight:Ft,timeScale:I,startDate:Rn,endDate:Yl,zoom:Ae,locale:w,templates:ut,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:B,onTaskDblClick:Pu,onTaskContextMenu:hb,onTaskDateChange:bb,onTaskProgressDrag:fb,onDependencyCreate:Lu,onDependencyDelete:Au,showBaseline:tt,showCriticalPath:St,showDependencies:cr,highlightWeekends:Lr,canEditTask:st?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),$.task&&jsxRuntime.jsx(ls,{isOpen:$.isOpen,x:$.x,y:$.y,theme:$e,onClose:()=>ee({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=$.task;if(!E)return [];let A=De.findTaskById(me,E.id)||E,W=A.subtasks&&A.subtasks.length>0,_=st?.canCreateTask!==false,ie=st?.canDeleteTask!==false;if(W){let Ht=[],or=st?.canDuplicateTask!==false;return _&&Ht.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Oe?Oe(A):ql(A.id);}}),or&&Ht.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:tr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):Se(ma=>Ys(ma,[A.id]).tasks),ee({isOpen:false,x:0,y:0,task:null});}}),ie&&(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:()=>{ue({taskIds:[A.id],taskName:A.name});}})),Ht}let ge=st?.canUpdateTask!==false,qe=st?.canDuplicateTask!==false,Ye=[];return ge&&Ye.push({id:"edit",label:Kr.contextMenu?.editTask||"Edit Task",icon:tr.Pencil,onClick:()=>{Ne?Ne(A):D(A);}}),_&&Ye.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:tr.Add,onClick:()=>{Oe?Oe(A):ql(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:()=>{ze?ze(A):Qt(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:()=>{rt?rt(A):Qt(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),Ye.push({id:"markComplete",label:Kr.contextMenu?.markComplete||"Mark Complete",icon:tr.MarkComplete,onClick:()=>{Qt(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):Se(Ht=>Ys(Ht,[A.id]).tasks),ee({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(),or=A.endDate.getTime(),ma=Ht+(or-Ht)/2,Ua=new Date(ma);yb(A,Ua);}}),ie&&(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:()=>{ue({taskIds:[A.id],taskName:A.name});}})),Ye})()}),jsxRuntime.jsx(Eo,{task:we,isOpen:!!we,onClose:()=>D(null),onTaskUpdate:E=>{we&&(Qt(we.id,E),D(null));},theme:F==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:H&&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:()=>ue(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:$e.bgSecondary,border:`1px solid ${$e.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${$e.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:$e.textPrimary,fontFamily:"Inter, sans-serif"},children:[Kr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:$e.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:$e.textSecondary,fontFamily:"Inter, sans-serif"},children:H.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:$e.textPrimary},children:[H.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:$e.textPrimary},children:['"',H.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:$e.bgPrimary,borderTop:`1px solid ${$e.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ue(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:$e.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=$e.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{xo(H.taskIds),ue(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"]})]})]})})}),x?.enabled&&jsxRuntime.jsx(ul,{tasks:me,theme:$e,config:x,onTasksUpdate:Se,onTaskUpdate:Qt,onTaskCreate:E=>{Se(A=>[...A,E]);},onTaskDelete:E=>{xo([E]);},onDependencyCreate:(E,A)=>{let W=De.findTaskById(me,E);W&&Lu(W,A);},onDependencyDelete:Au})]})})})});function Kw(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 qw(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 yd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],xd=[{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 pg({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:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...yd,...i.filter(F=>!yd.some(J=>J.id===F.id))],b=ct[c]||ct.dark,[y,x]=react.useState(false),[w,k]=react.useState(false),[M,R]=react.useState(false),[C,N]=react.useState(false),[P,T]=react.useState({top:0,left:0}),[V,O]=react.useState(null),[Y,L]=react.useState(new Date),[Re,U]=react.useState({top:0,left:0}),[Te,B]=react.useState(false),[z,Me]=react.useState([]),[We,ce]=react.useState(false),[Fe,X]=react.useState(""),Pe=react.useRef(null),Ne=react.useRef(null),Oe=react.useRef(null),ze=react.useRef(null),rt=react.useRef(null),[ne,Ke]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[je,He]=react.useState({});react.useEffect(()=>{r?(Ke({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)&&B(true)):(Ke({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),Me([]));},[r,e,v]),react.useEffect(()=>{let F=J=>{Pe.current&&!Pe.current.contains(J.target)&&x(false),Ne.current&&!Ne.current.contains(J.target)&&k(false),Oe.current&&!Oe.current.contains(J.target)&&R(false),ze.current&&!ze.current.contains(J.target)&&N(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let gt=()=>{let F={};return ne.name.trim()||(F.name="El nombre es requerido"),ne.startDate&&ne.endDate&&ne.startDate>ne.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),He(F),Object.keys(F).length===0},Mt=async F=>{if(F.preventDefault(),!!gt())try{let J=l==="create"&&z.length>0?{...ne,pendingFiles:z}:ne;await s(J),Me([]),t();}catch(J){console.error("Error submitting task:",J);}},Ge=(F,J)=>{Ke(I=>{let q={...I,[F]:J};if(F==="status"){let pe=J;pe==="todo"?q.progress=0:pe==="in-progress"?(I.progress===0||I.progress===100)&&(q.progress=50):pe==="completed"||pe==="closed"?q.progress=100:(pe==="in-review"||pe==="review")&&(q.progress=75);}if(F==="progress"){let pe=typeof J=="number"?J:parseInt(J,10);pe===100&&I.status!=="completed"?q.status="completed":pe>0&&pe<100&&I.status==="todo"?q.status="in-progress":pe===0&&I.status!=="todo"&&(q.status="todo");}return q}),je[F]&&He(I=>{let q={...I};return delete q[F],q});},Be=h.find(F=>F.id===ne.status)??yd[0],st=xd.find(F=>F.id===ne.priority)??xd[1],Wt=So.find(F=>F.value===ne.color)??So[0],Ue=c==="dark",dt={backgroundColor:Ue?"#1d1f27":b.bgSecondary,border:`1px solid ${Ue?"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:Ue?"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:Ue?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ue?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Ue?"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:ne.name,onChange:F=>Ge("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:ne.description||"",onChange:F=>Ge("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:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...dt,borderColor:Be.color,backgroundColor:`${Be.color}15`},disabled:o,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Be.color}}),jsxRuntime.jsx("span",{style:{color:Be.color},children:Be.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Be.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ue?"#0a0a0a":b.bgPrimary,backdropFilter:Ue?"blur(16px)":void 0,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"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:()=>{Ge("status",F.id),x(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,ne.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:Ne,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:dt,disabled:o,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:st.color}}),jsxRuntime.jsx("span",{children:st.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:Ue?"#0a0a0a":b.bgPrimary,backdropFilter:Ue?"blur(16px)":void 0,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:xd.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:()=>{Ge("priority",F.id),k(false);},children:[jsxRuntime.jsx("span",{children:F.icon}),F.label,ne.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:Oe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&R(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[ne.assignees&&ne.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ne.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))}),ne.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",ne.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:Ue?"#0a0a0a":b.bgPrimary,backdropFilter:Ue?"blur(16px)":void 0,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(F=>{let J=ne.assignees?.some(I=>I.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:I=>I.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{let I=J?(ne.assignees||[]).filter(q=>q.name!==F.name):[...ne.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(q=>q[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ge("assignees",I);},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:ze,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)N(false);else {if(ze.current){let F=ze.current.getBoundingClientRect(),J=window.innerHeight,I=120,pe=J-F.bottom<I?F.top-I-8:F.bottom+8;T({top:pe,left:F.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ne.color}}),jsxRuntime.jsx("span",{children:Wt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(sr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Ue?"#0a0a0a":b.bgPrimary,backdropFilter:Ue?"blur(16px)":void 0,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"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:So.slice(0,18).map(F=>{let J=ne.color===F.value;return jsxRuntime.jsx("button",{type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),Ge("color",F.value),N(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)})})})})]})})]}),u.length>0||p?jsxRuntime.jsx(Qo,{selectedTags:ne.tags||[],availableTags:u,onChange:F=>Ge("tags",F),onCreateTag:p,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:Ue?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Ue?"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:rt,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!ne.isMilestone)if(V==="start")O(null);else {if(rt.current){let F=rt.current.getBoundingClientRect();U({top:F.bottom+8,left:Math.max(16,F.left-40)});}O("start"),L(ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:o||ne.isMilestone,children:ne.startDate?ne.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&&!ne.isMilestone)if(V==="end")O(null);else {if(rt.current){let F=rt.current.getBoundingClientRect();U({top:F.bottom+8,left:Math.max(16,F.left-40)});}O("end"),L(ne.endDate||ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:o||ne.isMilestone,children:ne.endDate?ne.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&jsxRuntime.jsxs(sr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(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:`${Re.top}px`,left:`${Re.left}px`,zIndex:99999,backgroundColor:Ue?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"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 ${Ue?"#262626":b.border}`},children:[(()=>{let F=new Date,J=new Date(F);J.setDate(F.getDate()+1);let I=new Date(F);I.setDate(F.getDate()+7);let q=new Date(F);return q.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:I},{label:"2 semanas",date:q}].map((ve,Ae)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(Ge("startDate",ve.date),(!ne.endDate||ve.date>ne.endDate)&&Ge("endDate",ve.date),O("end")):(Ge("endDate",ve.date),(!ne.startDate||ve.date<ne.startDate)&&Ge("startDate",ve.date),O(null));},children:ve.label},Ae))})(),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:()=>{Ge("startDate",void 0),Ge("endDate",void 0),O(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(Y.getFullYear(),Y.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:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>L(new Date(Y.getFullYear(),Y.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=Y.getFullYear(),J=Y.getMonth(),I=new Date(F,J,1).getDay(),q=new Date(F,J+1,0).getDate(),pe=new Date,ve=[];for(let Ce=I-1;Ce>=0;Ce--)ve.push({day:new Date(F,J,-Ce).getDate(),date:new Date(F,J-1,new Date(F,J,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=q;Ce++)ve.push({day:Ce,date:new Date(F,J,Ce),isCurrentMonth:true});let Ae=42-ve.length;for(let Ce=1;Ce<=Ae;Ce++)ve.push({day:Ce,date:new Date(F,J+1,Ce),isCurrentMonth:false});return ve.map((Ce,ft)=>{let oe=Ce.date.toDateString()===pe.toDateString(),fe=ne.startDate?.toDateString()===Ce.date.toDateString(),et=ne.endDate?.toDateString()===Ce.date.toDateString(),Xe=ne.startDate&&ne.endDate&&Ce.date>=ne.startDate&&Ce.date<=ne.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:Ce.isCurrentMonth?fe||et?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:fe?b.accent:et?"#7C3AED":Xe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:oe&&!fe&&!et?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(Ge("startDate",Ce.date),ne.endDate&&Ce.date>ne.endDate&&Ge("endDate",Ce.date),O("end")):(Ge("endDate",Ce.date),ne.startDate&&Ce.date<ne.startDate&&Ge("startDate",Ce.date),O(null));},children:Ce.day},ft)})})()})]})]})]})})]}),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:[ne.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ue?"#33343c":"#E5E7EB"},onClick:F=>{if(o)return;let J=F.currentTarget.getBoundingClientRect(),I=Math.round((F.clientX-J.left)/J.width*100/5)*5;Ge("progress",Math.max(0,Math.min(100,I)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ne.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${Ue?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!Te),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 ${Te?"":"-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:Te&&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:ne.effortMinutes?Kw(ne.effortMinutes):"",onChange:F=>{let J=qw(F.target.value);Ge("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:ne.parentId||"",onChange:F=>Ge("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:ne.location||"",onChange:F=>Ge("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:ne.equipment||"",onChange:F=>Ge("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})]})]}),(m||d.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})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsxRuntime.jsx(rs,{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=>Me(J=>[...J,...F]),onDelete:F=>{let J=parseInt(F.replace("pending-",""),10);Me(I=>I.filter((q,pe)=>pe!==J));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(rs,{cardId:r?.id||"new",attachments:d,onUpload:m&&r?.id?F=>m(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:ne.isMilestone,onChange:F=>Ge("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"]}),ne.dependencies&&ne.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ne.dependencies.map(F=>{let J=a.find(I=>I.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 I=(ne.dependencies||[]).filter(q=>q!==F);Ge("dependencies",I);},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:()=>{ce(!We),X("");},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:()=>{ce(false),X("");}}),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:Ue?"#0a0a0a":b.bgPrimary,backdropFilter:Ue?"blur(16px)":void 0,border:`1px solid ${Ue?"#262626":b.border}`,boxShadow:Ue?"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:Fe,onChange:F=>X(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=>Fe===""||F.name.toLowerCase().includes(Fe.toLowerCase())).map(F=>{let J=ne.dependencies?.includes(F.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let I=ne.dependencies||[],q;J?q=I.filter(pe=>pe!==F.id):q=[...I,F.id],Ge("dependencies",q);},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:I=>{J||(I.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:I=>{I.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 ${Ue?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Ue?"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 mg=`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 H=K=>K.map(ae=>{if(ae.id===A){let me=ae.dependencies||[];if(!me.includes(E.id))return {...ae,dependencies:[...me,E.id]}}return ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae});Wa.current+=1,q(K=>H(K)),_e?.(E.id,A);},[_e,Lu]),Iu=react.useCallback((E,A)=>{let H=K=>K.map(ae=>{if(ae.id===E&&ae.dependencies){let me=ae.dependencies.filter(Ve=>Ve!==A);return {...ae,dependencies:me}}return ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae});Wa.current+=1,q(K=>H(K)),qe?.(E,A);},[qe]),{startDate:wn,endDate:Xl}=react.useMemo(()=>{let E=fe.filter(me=>me.startDate&&me.endDate);if(E.length===0){let me=new Date,Ve=new Date(me);Ve.setDate(Ve.getDate()-30);let je=new Date(me);return je.setDate(je.getDate()+60),{startDate:Ve,endDate:je}}let A=E.flatMap(me=>[me.startDate,me.endDate]).filter(me=>me!==void 0),H=new Date(Math.min(...A.map(me=>me.getTime()))),K=new Date(Math.max(...A.map(me=>me.getTime()))),ae=_==="day"?7:_==="week"?14:30;return H.setDate(H.getDate()-ae),K.setDate(K.getDate()+ae),{startDate:H,endDate:K}},[fe,_]);react.useEffect(()=>{pa.current?.(wn,Xl);},[wn,Xl]);let Cb=react.useCallback(async()=>{if(!Ke.current||!We.current||!Te.current)return;await new Promise(ko=>setTimeout(ko,200));let E=Ke.current,A=We.current,H=oe.current||A.querySelector(".gantt-grid-scroll"),K=Te.current,ae=H?.scrollTop||0,me=H?.scrollLeft||0,Ve=K.scrollTop,je=K.scrollLeft,tr=E.style.overflow,Wt=E.style.height,sr=H?.style.overflow||"",ga=K.style.overflow,$a=A.style.overflow,qn=E.style.width,qo=K.style.width;try{let ko=H?.querySelector(".gantt-taskgrid-content"),kn=K.querySelector("svg"),ec=kn?.getAttribute("height")?parseInt(kn.getAttribute("height"),10):kn?.getBoundingClientRect().height||0,Yo=ko?.scrollHeight||H?.scrollHeight||600,yi=Math.max(ec,K.scrollHeight),Ms=kn?.getAttribute("width")?parseInt(kn.getAttribute("width"),10):kn?.getBoundingClientRect().width||K.scrollWidth,Fb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,tc=Math.max(Yo,yi,ec),Ou=Fb+tc+50,Hu=(H?.offsetWidth||A.offsetWidth||300)+Ms+10;H&&(H.scrollTop=0,H.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ou}px`,E.style.width=`${Hu}px`,A.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${tc+50}px`),K.style.overflow="visible",K.style.height=`${tc+50}px`,K.style.width=`${Ms+10}px`,await new Promise(xi=>setTimeout(xi,150));let Lb=await htmlToImage.toPng(E,{backgroundColor:nt.bgPrimary,pixelRatio:2,width:Hu,height:Ou,skipFonts:!1,filter:xi=>{if(!(xi instanceof Element))return !0;let Uu=window.getComputedStyle(xi),Wu=parseInt(Uu.zIndex,10);return !(!isNaN(Wu)&&Wu>=50||Uu.position==="fixed")}}),rc=document.createElement("a");rc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rc.href=Lb,rc.click();}finally{E.style.overflow=tr,E.style.height=Wt,E.style.width=qn,A.style.overflow=$a,H&&(H.style.overflow=sr,H.style.height="",H.scrollTop=ae,H.scrollLeft=me),K.style.overflow=ga,K.style.height="",K.style.width=qo,K.scrollTop=Ve,K.scrollLeft=je;}u?.("png");},[nt,u]),Tb=react.useCallback(async()=>{await Ne.exportToPDF(fe),u?.("pdf");},[fe,u]),Jl=react.useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p});Jl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p};let Nb=react.useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),u?.("excel");return}let E=new Date,A=ae=>String(ae).padStart(2,"0"),H=`${E.getFullYear()}-${A(E.getMonth()+1)}-${A(E.getDate())}_${A(E.getHours())}${A(E.getMinutes())}`,K=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ne.exportToExcel(fe,`${K}_${H}.xlsx`,Jl.current),u?.("excel");},[fe,p,u,r.onExportExcel]),Db=react.useCallback(()=>{let E=Ne.exportToCSV(fe),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(A),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[fe,u]),Sb=react.useCallback(()=>{let E=Ne.exportToJSON(fe),A=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(A),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[fe,u]),Eb=react.useCallback(()=>{Ne.exportToMSProject(fe,"Gantt Project","project.xml"),u?.("msproject");},[fe,u]),Mb=E=>{E.preventDefault(),be(true);},Ko=react.useRef(false),[Ql,Ru]=react.useState(false),Es=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let E=Te.current,A=We.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let H=()=>{if(Ko.current)return;Ko.current=true;let je=E.scrollTop;pt(je),A.scrollTop=je,requestAnimationFrame(()=>{Ko.current=false;});},K=()=>{if(Ko.current)return;Ko.current=true;let je=A.scrollTop;pt(je),E.scrollTop=je,requestAnimationFrame(()=>{Ko.current=false;});},ae=je=>{if(j&&A){let Wt=A.parentElement?.getBoundingClientRect()?.left||0,sr=je.clientX-Wt,ga=200,$a=S+re,qn=window.innerWidth*xe,qo=Math.max($a,qn);sr>=ga&&sr<=qo&&$(sr);}if(Ql&&E){let tr=je.clientX-Es.current.x,Wt=je.clientY-Es.current.y;E.scrollLeft=Es.current.scrollLeft-tr,E.scrollTop=Es.current.scrollTop-Wt;}},me=()=>{be(false),Ru(false);},Ve=je=>{if(je.button!==0)return;let tr=je.target;tr.closest("[data-task-bar]")||tr.closest("[data-dependency-line]")||tr.closest("button")||tr.closest('[role="button"]')||tr.tagName==="rect"&&tr.getAttribute("data-clickable")==="true"||(Ru(true),Es.current={x:je.clientX,y:je.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},je.preventDefault());};return E.addEventListener("scroll",H),A.addEventListener("scroll",K),E.addEventListener("mousedown",Ve),document.addEventListener("mousemove",ae),document.addEventListener("mouseup",me),()=>{E.removeEventListener("scroll",H),A.removeEventListener("scroll",K),E.removeEventListener("mousedown",Ve),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",me);}},[j,Ql,S]),at.current={startDate:wn,timeScale:_,zoom:ye};let Zl=r.onTodayVisibilityChange,Bu=react.useRef(null);react.useEffect(()=>{if(!Zl)return;let E=Te.current;if(!E)return;let A=_==="day"?60:_==="week"?20:8,H=()=>{let me=(new Date().getTime()-wn.getTime())/(1e3*60*60*24)*A*ye,Ve=E.scrollLeft,je=Ve+E.clientWidth,tr=me>=Ve&&me<=je;Bu.current!==tr&&(Bu.current=tr,Zl(tr));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[Zl,wn,_,ye]);let $u=react.useRef(false),Pb=react.useRef(null);return react.useLayoutEffect(()=>{if($u.current||fe.length===0||!Te.current)return;$u.current=true,Pb.current=wn;let E=Te.current,A=new Date,H=_==="day"?60:_==="week"?20:8,K=(A.getTime()-wn.getTime())/(1e3*60*60*24),ae=E.clientWidth,Ve=K*H*ye-ae/2;K>=0&&ae>0&&(E.scrollLeft=Math.max(0,Ve));},[fe.length,wn,_,ye]),react.useLayoutEffect(()=>{let E=yt.current;!E||at.current?.timeScale!==_||(yt.current=null,Ft(E));},[_,wn,ye]),jsxRuntime.jsx(ls.Provider,{value:qr,children:jsxRuntime.jsx(ic.Provider,{value:mt,children:jsxRuntime.jsxs("div",{ref:Ke,className:"flex flex-col h-full w-full",style:{backgroundColor:nt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...nt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${nt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsxRuntime.jsx(Qi,{enCabecera:!!V,theme:nt,timeScale:_,onTimeScaleChange:ue,zoom:ye,onZoomChange:ft,currentTheme:Q,onThemeChange:rt,rowDensity:ve,onRowDensityChange:Oe,showThemeSelector:c,showCreateTaskButton:M&&Mt?.canCreateTask!==false&&!Mt?.canCreateSubtaskOnly,createTaskLabel:I,onCreateTask:C,taskFilter:_r,onTaskFilterChange:sa,hideCompleted:wr,onHideCompletedChange:Wr,toolbarRightContent:T,wbsLevel:ie,onWbsLevelChange:O?void 0:bi,maxWbsDepth:Kr,viewMode:kt,onViewModeChange:Fe?Je:void 0,projectForecast:U,hideForecastHud:De,onExportPNG:i?Cb:void 0,onExportPDF:i?Tb:void 0,onExportExcel:i?Nb:void 0,onExportCSV:i?Db:void 0,onExportJSON:i?Sb:void 0,onExportMSProject:i?Eb:void 0,showCriticalPath:Yt,onShowCriticalPathChange:jt,showDependencies:It,onShowDependenciesChange:or,highlightWeekends:Ht,onHighlightWeekendsChange:ha,showBaseline:At,onShowBaselineChange:A=>{A&&kt!=="oracle"&&Je("oracle"),!A&&kt==="oracle"&&Je("execution");},onCopySnapshotLink:Be,hasDependencies:kr});return V?reactDom.createPortal(E,V):jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxRuntime.jsxs("div",{ref:We,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:oe,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ce,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(tl,{tasks:Ut,allTasks:zr,theme:nt,rowHeight:Gt,availableUsers:d,templates:gt,showCriticalPath:Yt,onTaskClick:z,onTaskSelectionChange:Me,selectedTaskId:Ue,onTaskDblClick:Fu,onTaskContextMenu:Le,onTaskToggle:Ta,scrollTop:de,columns:za,onToggleColumn:Lr,onColumnResize:xa,onTaskUpdate:Cr,onBulkFill:Yr,onTaskIndent:vo,onTaskOutdent:Ss,onTaskMove:fb,onMultiTaskDelete:ql,onTaskDuplicate:bb,onTaskCreate:hb,onTaskRename:yb,onCreateSubtask:Yl,onOpenTaskModal:z?E=>z(E):void 0,onDeleteRequest:(E,A)=>we({taskIds:E,taskName:A}),onTaskReparent:wo,scrollContainerRef:oe})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:nt.border,zIndex:15},onMouseDown:Mb}),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(ll,{tasks:Ut,theme:nt,rowHeight:Gt,timeScale:_,startDate:wn,endDate:Xl,zoom:ye,locale:w,templates:gt,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:z,onTaskDblClick:Fu,onTaskContextMenu:wb,onTaskDateChange:vb,onTaskProgressDrag:xb,onDependencyCreate:Au,onDependencyDelete:Iu,showBaseline:At,showCriticalPath:Yt,showDependencies:It,highlightWeekends:Ht,canEditTask:Mt?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),ee.task&&jsxRuntime.jsx(cs,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:nt,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let A=Ne.findTaskById(fe,E.id)||E,H=A.subtasks&&A.subtasks.length>0,K=Mt?.canCreateTask!==false,ae=Mt?.canDeleteTask!==false;if(H){let Wt=[],sr=Mt?.canDuplicateTask!==false;return K&&Wt.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{He?He(A):Yl(A.id);}}),sr&&Wt.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:ar.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):q(ga=>Ys(ga,[A.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),ae&&(Wt.length>0&&Wt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Wt.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:ar.Delete,onClick:()=>{we({taskIds:[A.id],taskName:A.name});}})),Wt}let me=Mt?.canUpdateTask!==false,Ve=Mt?.canDuplicateTask!==false,je=[];return me&&je.push({id:"edit",label:qr.contextMenu?.editTask||"Edit Task",icon:ar.Pencil,onClick:()=>{$e?$e(A):W(A);}}),K&&je.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{He?He(A):Yl(A.id);}}),je.length>0&&me&&je.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(je.push({id:"markIncomplete",label:qr.contextMenu?.markIncomplete||"Mark Incomplete",icon:ar.MarkIncomplete,onClick:()=>{et?et(A):Cr(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),je.push({id:"setInProgress",label:qr.contextMenu?.setInProgress||"Set In Progress",icon:ar.SetInProgress,onClick:()=>{se?se(A):Cr(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),je.push({id:"markComplete",label:qr.contextMenu?.markComplete||"Mark Complete",icon:ar.MarkComplete,onClick:()=>{Cr(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(Ve||me&&A.startDate&&A.endDate)&&je.length>0&&je.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ve&&je.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:ar.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):q(Wt=>Ys(Wt,[A.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),me&&A.startDate&&A.endDate&&je.push({id:"split",label:qr.contextMenu?.splitTask||"Split Task",icon:ar.Split,onClick:()=>{let Wt=A.startDate.getTime(),sr=A.endDate.getTime(),ga=Wt+(sr-Wt)/2,$a=new Date(ga);kb(A,$a);}}),ae&&(je.length>0&&je.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),je.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:ar.Delete,onClick:()=>{we({taskIds:[A.id],taskName:A.name});}})),je})()}),jsxRuntime.jsx(Mo,{task:D,isOpen:!!D,onClose:()=>W(null),onTaskUpdate:E=>{D&&(Cr(D.id,E),W(null));},theme:Q==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:pe&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>we(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:nt.bgSecondary,border:`1px solid ${nt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${nt.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:nt.textPrimary,fontFamily:"Inter, sans-serif"},children:[qr.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:nt.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:nt.textSecondary,fontFamily:"Inter, sans-serif"},children:pe.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:nt.textPrimary},children:[pe.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:nt.textPrimary},children:['"',pe.taskName,'"']}),"."]})})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:nt.bgPrimary,borderTop:`1px solid ${nt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>we(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:nt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=nt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ql(pe.taskIds),we(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsxRuntime.jsx(ul,{tasks:fe,theme:nt,config:x,onTasksUpdate:q,onTaskUpdate:Cr,onTaskCreate:E=>{q(A=>[...A,E]);},onTaskDelete:E=>{ql([E]);},onDependencyCreate:(E,A)=>{let H=Ne.findTaskById(fe,E);H&&Au(H,A);},onDependencyDelete:Iu})]})})})});function Xw(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 Jw(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 xd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vd=[{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 gg({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:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...xd,...i.filter(L=>!xd.some(Q=>Q.id===L.id))],b=ct[c]||ct.dark,[y,x]=react.useState(false),[w,k]=react.useState(false),[M,I]=react.useState(false),[C,N]=react.useState(false),[P,T]=react.useState({top:0,left:0}),[V,O]=react.useState(null),[X,F]=react.useState(new Date),[Fe,U]=react.useState({top:0,left:0}),[De,B]=react.useState(false),[z,Me]=react.useState([]),[Ue,ce]=react.useState(false),[Le,J]=react.useState(""),Pe=react.useRef(null),Ee=react.useRef(null),$e=react.useRef(null),He=react.useRef(null),et=react.useRef(null),[se,_e]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[qe,Re]=react.useState({});react.useEffect(()=>{r?(_e({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)&&B(true)):(_e({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),Me([]));},[r,e,v]),react.useEffect(()=>{let L=Q=>{Pe.current&&!Pe.current.contains(Q.target)&&x(false),Ee.current&&!Ee.current.contains(Q.target)&&k(false),$e.current&&!$e.current.contains(Q.target)&&I(false),He.current&&!He.current.contains(Q.target)&&N(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let ut=()=>{let L={};return se.name.trim()||(L.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Re(L),Object.keys(L).length===0},Et=async L=>{if(L.preventDefault(),!!ut())try{let Q=l==="create"&&z.length>0?{...se,pendingFiles:z}:se;await s(Q),Me([]),t();}catch(Q){console.error("Error submitting task:",Q);}},Ge=(L,Q)=>{_e(R=>{let _={...R,[L]:Q};if(L==="status"){let ue=Q;ue==="todo"?_.progress=0:ue==="in-progress"?(R.progress===0||R.progress===100)&&(_.progress=50):ue==="completed"||ue==="closed"?_.progress=100:(ue==="in-review"||ue==="review")&&(_.progress=75);}if(L==="progress"){let ue=typeof Q=="number"?Q:parseInt(Q,10);ue===100&&R.status!=="completed"?_.status="completed":ue>0&&ue<100&&R.status==="todo"?_.status="in-progress":ue===0&&R.status!=="todo"&&(_.status="todo");}return _}),qe[L]&&Re(R=>{let _={...R};return delete _[L],_});},Ie=h.find(L=>L.id===se.status)??xd[0],dt=vd.find(L=>L.id===se.priority)??vd[1],Mt=Eo.find(L=>L.value===se.color)??Eo[0],Be=c==="dark",vt={backgroundColor:Be?"#1d1f27":b.bgSecondary,border:`1px solid ${Be?"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:Be?"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:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Be?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:L=>L.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:Et,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:L=>Ge("name",L.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}),qe.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"}),qe.name]}),jsxRuntime.jsx("textarea",{value:se.description||"",onChange:L=>Ge("description",L.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:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...vt,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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(L=>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:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("status",L.id),x(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,se.status===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),jsxRuntime.jsxs("div",{ref:Ee,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:vt,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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:vd.map(L=>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:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("priority",L.id),k(false);},children:[jsxRuntime.jsx("span",{children:L.icon}),L.label,se.priority===L.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),n.length>0&&jsxRuntime.jsxs("div",{ref:$e,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!o&&I(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:vt,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((L,Q)=>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:L.color||b.accent,borderColor:b.bgSecondary},children:L.initials},Q))}),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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let Q=se.assignees?.some(R=>R.name===L.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=Q?(se.assignees||[]).filter(_=>_.name!==L.name):[...se.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(_=>_[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ge("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:L.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},L.id)})})})]}),jsxRuntime.jsxs("div",{ref:He,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)N(false);else {if(He.current){let L=He.current.getBoundingClientRect(),Q=window.innerHeight,R=120,ue=Q-L.bottom<R?L.top-R-8:L.bottom+8;T({top:ue,left:L.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:vt,disabled:o,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsxRuntime.jsx("span",{children:Mt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(ir,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Eo.slice(0,18).map(L=>{let Q=se.color===L.value;return jsxRuntime.jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),Ge("color",L.value),N(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:Q?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),u.length>0||p?jsxRuntime.jsx(Zo,{selectedTags:se.tags||[],availableTags:u,onChange:L=>Ge("tags",L),onCreateTag:p,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:Be?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Be?"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:et,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="start")O(null);else {if(et.current){let L=et.current.getBoundingClientRect();U({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("start"),F(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...vt,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")O(null);else {if(et.current){let L=et.current.getBoundingClientRect();U({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("end"),F(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...vt,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(ir,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(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:`${Fe.top}px`,left:`${Fe.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Be?"#262626":b.border}`},children:[(()=>{let L=new Date,Q=new Date(L);Q.setDate(L.getDate()+1);let R=new Date(L);R.setDate(L.getDate()+7);let _=new Date(L);return _.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:Q},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:_}].map((ve,Oe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(Ge("startDate",ve.date),(!se.endDate||ve.date>se.endDate)&&Ge("endDate",ve.date),O("end")):(Ge("endDate",ve.date),(!se.startDate||ve.date<se.startDate)&&Ge("startDate",ve.date),O(null));},children:ve.label},Oe))})(),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:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("startDate",void 0),Ge("endDate",void 0),O(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:()=>F(new Date(X.getFullYear(),X.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.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:X.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(X.getFullYear(),X.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.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((L,Q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:L},Q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=X.getFullYear(),Q=X.getMonth(),R=new Date(L,Q,1).getDay(),_=new Date(L,Q+1,0).getDate(),ue=new Date,ve=[];for(let ye=R-1;ye>=0;ye--)ve.push({day:new Date(L,Q,-ye).getDate(),date:new Date(L,Q-1,new Date(L,Q,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=_;ye++)ve.push({day:ye,date:new Date(L,Q,ye),isCurrentMonth:true});let Oe=42-ve.length;for(let ye=1;ye<=Oe;ye++)ve.push({day:ye,date:new Date(L,Q+1,ye),isCurrentMonth:false});return ve.map((ye,ft)=>{let ie=ye.date.toDateString()===ue.toDateString(),ge=se.startDate?.toDateString()===ye.date.toDateString(),Ze=se.endDate?.toDateString()===ye.date.toDateString(),Xe=se.startDate&&se.endDate&&ye.date>=se.startDate&&ye.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:ye.isCurrentMonth?ge||Ze?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:ge?b.accent:Ze?"#7C3AED":Xe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ie&&!ge&&!Ze?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(Ge("startDate",ye.date),se.endDate&&ye.date>se.endDate&&Ge("endDate",ye.date),O("end")):(Ge("endDate",ye.date),se.startDate&&ye.date<se.startDate&&Ge("startDate",ye.date),O(null));},children:ye.day},ft)})})()})]})]})]})})]}),qe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:qe.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:Be?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let Q=L.currentTarget.getBoundingClientRect(),R=Math.round((L.clientX-Q.left)/Q.width*100/5)*5;Ge("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 ${Be?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>B(!De),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 ${De?"":"-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:De&&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?Xw(se.effortMinutes):"",onChange:L=>{let Q=Jw(L.target.value);Ge("effortMinutes",Q);},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:L=>Ge("parentId",L.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(L=>L.id!==r?.id).map(L=>jsxRuntime.jsx("option",{value:L.id,children:L.name},L.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:L=>Ge("location",L.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:L=>Ge("equipment",L.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})]})]}),(m||d.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})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsxRuntime.jsx(as,{cardId:"pending",attachments:z.map((L,Q)=>({id:`pending-${Q}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Me(Q=>[...Q,...L]),onDelete:L=>{let Q=parseInt(L.replace("pending-",""),10);Me(R=>R.filter((_,ue)=>ue!==Q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(as,{cardId:r?.id||"new",attachments:d,onUpload:m&&r?.id?L=>m(r.id,L):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:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:L=>Ge("isMilestone",L.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(L=>{let Q=a.find(R=>R.id===L);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:[Q?.name||L.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let R=(se.dependencies||[]).filter(_=>_!==L);Ge("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"})})]},L)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{ce(!Ue),J("");},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:Ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ce(false),J("");}}),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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"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:Le,onChange:L=>J(L.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(L=>L.id!==r?.id).filter(L=>Le===""||L.name.toLowerCase().includes(Le.toLowerCase())).map(L=>{let Q=se.dependencies?.includes(L.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let R=se.dependencies||[],_;Q?_=R.filter(ue=>ue!==L.id):_=[...R,L.id],Ge("dependencies",_);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Q?`${b.accent}10`:"transparent"},onMouseEnter:R=>{Q||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=Q?`${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:Q?b.accent:"transparent",borderColor:Q?b.accent:b.borderLight},children:Q&&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:L.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),a.filter(L=>L.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 ${Be?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Be?"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:L=>L.currentTarget.style.color=b.textPrimary,onMouseLeave:L=>L.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:L=>!o&&(L.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:L=>!o&&(L.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 fg=`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 gg(e){return `CURRENT TASKS:
410
- ${fg(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 bg(e){return `CURRENT TASKS:
410
+ ${hg(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 fg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function zn(e,t){let r=fg(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 vd(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 d=new Date(a);return d.setDate(d.getDate()+1),d}if(r==="yesterday"||r==="ayer"){let d=new Date(a);return d.setDate(d.getDate()-1),d}if(r==="next week"||r==="la pr\xF3xima semana"){let d=new Date(a);return d.setDate(d.getDate()+7),d}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 m={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(m!==void 0){let f=new Date(a),v=f.getDay(),h=m-v;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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),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 d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},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 d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):a.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function wd(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 kd(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 bg(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 hg(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(),u=a[2].trim(),p=zn(t,i),d=vd(u);if(!p)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(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.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(),u=n[2].trim(),p=zn(t,i),d=wd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.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(),u=s[2].trim(),p=zn(t,i),d=kd(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,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(),u=o[2].trim(),p=zn(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,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(),u=l[2].trim(),p=zn(t,i),d=zn(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName: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(),u=zn(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 yg(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 Yw(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 Xw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function gl(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let p=r.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>gl(u,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},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:Yw(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 xg(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:Xw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function vg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>gl(a,e,t))}var Cd={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"}},Td={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"}},fl={en:Cd,es:Td};function Nd(e){return fl[e]||fl.en}function bl(e,t){let r=Nd(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 Dd=[{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 wg(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 kg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=wg(e),i=Dd[0],u=Dd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(wg(m)){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(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:d(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:Dd.map(m=>{let f=m.icon;return jsxRuntime.jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.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===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function co(e,t,r=320){let[a,n]=react.useState(false);return react.useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+r+o<=window.innerHeight,c=s.top-r-o>=0;n(!l&&c);},[t,r,e]),a}var Sd=[{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 Tg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null),c=co(l,s,180);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Sd.find(p=>p.value===e)??Sd[4],u=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",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]})]}):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(lucideReact.Flag,{className:g("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]}),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 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Sd.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.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",e===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function ri(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ed(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 xl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),p=react.useRef(null),d=co(u,o);react.useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(r){if(f(h.name))r(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ri(h.name),color:h.color||Ed(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};r([...e,b]);}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((h,b)=>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",!h.avatar&&Ed(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),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:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.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((h,b)=>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",!h.avatar&&Ed(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),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:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),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:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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((h,b)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),r(e.filter(x=>x.name!==h.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}})})]},`${h.name}-${b}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.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"}):m.map(h=>{let b=f(h.name);return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?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:y=>{b||(y.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(y.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:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ri(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function Pg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=react.useState(false),[p,d]=react.useState(n),[m,f]=react.useState(()=>{let T=n==="start"?e:t;if(T){let V=T instanceof Date?T:new Date(T);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,x]=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 T=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useLayoutEffect(()=>{if(!i){x(null);return}let T=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,Y=360,L=window.innerHeight-V.bottom,Re=L<Y&&V.top>L,U=Re?V.top-4:V.bottom+4,Te=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:U,left:Te,flipUp:Re});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[i]),react.useEffect(()=>{i&&d(a?n:"start");},[i,a,n]);let M=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",R=react.useCallback(()=>{let T=m.getFullYear(),V=m.getMonth(),O=new Date(T,V,1),L=new Date(T,V+1,0).getDate(),Re=O.getDay(),U=[],B=new Date(T,V,0).getDate();for(let Me=Re-1;Me>=0;Me--)U.push({date:new Date(T,V-1,B-Me),isCurrentMonth:false});for(let Me=1;Me<=L;Me++)U.push({date:new Date(T,V,Me),isCurrentMonth:true});let z=42-U.length;for(let Me=1;Me<=z;Me++)U.push({date:new Date(T,V+1,Me),isCurrentMonth:false});return U},[m]),C=T=>{if(a)n==="start"?r(T,k||void 0):r(w||void 0,T),u(false);else if(p==="start"){let V=k&&T>k?T:k;r(T,V||void 0),d("end");}else {let V=w&&T<w?T:w;r(V||void 0,T),u(false);}},N=()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Y=new Date(T);Y.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let L=new Date(T);L.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Re=new Date(T);Re.setDate(T.getDate()+14);let U=new Date(T);return U.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.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:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Y,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:Re,display:Re.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:U,display:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=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(T)})]})}let P=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,onClick:T=>{T.stopPropagation(),u(!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:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((T,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:()=>C(T.date),children:[jsxRuntime.jsx("span",{children:T.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:T.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),u(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:p==="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:m.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(m.getFullYear(),m.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(m.getFullYear(),m.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(T=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:R().map((T,V)=>{let O=T.date.toDateString()===new Date().toDateString(),Y=w?.toDateString()===T.date.toDateString(),L=k?.toDateString()===T.date.toDateString(),Re=Y||L,U=!a&&w&&k&&T.date>=w&&T.date<=k;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(T.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",Y&&"bg-[#00E5CC] text-white",L&&!Y&&"bg-[#7C3AED] text-white",U&&!Re&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Re&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]}),document.body)]})}function wl({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(Pg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},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 kl(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),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=a/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Fg(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),u=react.useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},r);},[r,e]),p=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:u,cancelChange:p}}function Ag({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(""),u=react.useRef(null),{isFlashing:p,triggerFlash:d}=bs(),{displayValue:m,isAnimating:f}=kl(e,{enabled:n,duration:300,steps:6}),v=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,R=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,R));C!==e&&(t(C),s&&d());},h=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);react.useEffect(()=>{o&&u.current&&(u.current.focus(),u.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&&d());}},[c,t,e,s,d]),y=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=m??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",p&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsxRuntime.jsx("div",{onClick:v,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]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):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:u,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",x===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:[x,"%"]})]})}function Bg({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 u=()=>{l!==e&&t?.(l),o(false);},p=d=>{d.key==="Enter"?u():d.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:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.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:d=>{d.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 Hg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[p,d]=react.useState(e?.toString()||""),m=react.useRef(null),{isFlashing:f,triggerFlash:v}=bs(),{displayValue:h,isAnimating:b}=kl(e,{enabled:l&&!i});react.useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),react.useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);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&&v());}u(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),u(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:m,type:"number",value:p,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,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(),u(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 Ug({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=react.useState(false),c=react.useRef(null),i=co(c,o,220);return react.useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[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:u=>{u.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 left-0 "+(i?"bottom-full mb-1 ":"top-full 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(u=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),r(u),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===u&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u}),e===u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function zg({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:u}=Fg(t,{delay:s}),p=m=>{m.stopPropagation(),!a&&t&&(n?l?u():i(!e):t(!e));},d=l?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:p,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]",d?"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&&d&&"ring-green-500/50",l&&!d&&"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:d?"#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"}):d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),u();},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 Gg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=react.useState(false),u=react.useRef(null),p=co(u,c,220);react.useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||r(x);},h=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.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:f}),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 left-0 "+(p?"bottom-full mb-1 ":"top-full 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(b=>{let y=e.includes(b),x=!y&&h;return jsxRuntime.jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:b}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function Hk(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 _g({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Hk(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 Yg({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 zk(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 Gk(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 $a({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:u}){let[p,d]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:h,triggerFlash:b}=bs(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:zk(e,a);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),N=e%60;C>0&&N>0?f(`${C}h ${N}m`):C>0?f(`${C}h`):f(`${N}m`);}else f("");},[e,p]);let k=()=>{let C=Gk(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(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 R=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(R,{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})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.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:C=>{C.stopPropagation(),d(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(R,{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 Zg({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 t0({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",u=l==="financial"&&c>0,p=U=>u?`$${Math.round(U*c).toLocaleString("en-US")}`:`${U}h`,[d,m]=react.useState(false),[f,v]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,R=Math.round(w/60*10)/10,C=w>0?x/w*100:0,N=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let U=Te=>{y.current&&!y.current.contains(Te.target)&&(v(false),b(null));};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[f,h]);let T=U=>{if(U.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){v(Te=>!Te),b(null);return}o&&o(e);},V=U=>{v(false),b(U);},O=async(U,Te)=>{h==="log"&&a&&U?a(e,U,Te):h==="estimate"&&n?n(e,U):h==="quoted"&&s&&s(e,U),b(null);},Y=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(U=>U.show),Re=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:U=>U.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&Y&&jsxRuntime.jsx("button",{onClick:T,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:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.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(U=>jsxRuntime.jsxs("button",{onClick:Te=>{Te.stopPropagation(),V(U.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:Te=>{Te.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Te=>{Te.target.style.background="transparent";},children:[jsxRuntime.jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.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(Tn,{mode:h,locale:r,isDark:t,currentValue:Re||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:U=>U.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(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 U=x===0,B=(w>0?x/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:U?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(R)]}),N>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(N)," ",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(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Y&&jsxRuntime.jsx("button",{onClick:T,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.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(U=>jsxRuntime.jsxs("button",{onClick:Te=>{Te.stopPropagation(),V(U.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:Te=>{Te.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Te=>{Te.target.style.background="transparent";},children:[jsxRuntime.jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.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(Tn,{mode:h,locale:r,isDark:t,currentValue:Re||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Xk(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 Jk(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 r0({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 a0({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=Xk(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsxRuntime.jsx(r0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}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?Jk(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(r0,{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 Qk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function o0({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",Qk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(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 p0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?l0.es:l0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),T=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-T&&(O=Math.max(T,e.y-P.height)),e.x+P.width>window.innerWidth-T&&(V=Math.max(T,window.innerWidth-P.width-T)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let N=T=>{b.current&&!b.current.contains(T.target)&&t();},P=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),l&&(N.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();}}]}),N.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();}}]}),u.length>0&&N.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.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 T=e.task.assignees||[],O=T.some(Y=>Y.name===P.name)?T.filter(Y=>Y.name!==P.name):[...T,{name:P.name,initials:m1(P.name),color:P.color||g1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&N.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&N.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&&N.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return i&&(N.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.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"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},R=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:R.map(N=>N.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsxRuntime.jsx(f1,{item:N,isDark:r},N.id):jsxRuntime.jsxs("button",{onClick:N.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",N.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(N.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function f1({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 l0={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 v0={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"})},L1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function k0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=react.useState(""),[p,d]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),h=c==="es"?w0.es:w0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let Y=P.getBoundingClientRect();f({top:Y.bottom+4,right:window.innerWidth-Y.right});}let T=v.current.getBoundingClientRect(),O=window.innerHeight-T.top-20;d(Math.max(300,O));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),react.useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},T=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let b=react.useMemo(()=>{let N=new Set([...L1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&N.add(P.type);}),Array.from(N)},[r]);if(!e)return null;let y=N=>{let P=h.columns[N];if(P)return P;let T=r.find(V=>V.type===N);return T?.label?T.label:N},x=N=>{if(N==="name")return;let P=r.map(T=>T.id===N?{...T,visible:!T.visible}:T);n(P);},w=(N,P)=>{let T=r.find(O=>O.type===N&&(!P||O.customFieldId===P));if(T){x(T.id);return}let V={id:P||N,type:N,label:P?a.find(O=>O.id===P)?.name||N:y(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&y(N).toLowerCase().includes(i.toLowerCase())),R=a.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.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:N=>{N.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.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:N=>u(N.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:N=>{N&&N.style.setProperty("--focus-border",C);},onFocus:N=>{N.currentTarget.style.borderColor=C,N.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.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:N=>N.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(N=>{let P=r.find(O=>O.type===N&&!O.customFieldId),T=P?.visible??false,V=N==="name";return jsxRuntime.jsxs("button",{onClick:()=>{V||(P?x(P.id):w(N));},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:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:v0[N]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?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(N),children:y(N)})]},N)})})]}),R.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:R.map(N=>{let T=r.find(V=>V.customFieldId===N.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(N.type,N.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:v0[N.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:N.name})]},N.id)})})]})]})]})}var w0={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 W1=[{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 N0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,u]=react.useState([""]),p=n==="es"?T0.es:T0.en;react.useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(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:p.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:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.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:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:W1.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:p.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:p.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:`${p.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:()=>v(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:m,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"}),p.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:p.cancel}),jsxRuntime.jsx("button",{onClick:d,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:p.create})]})]})]}):null}var T0={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 E0={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 M0({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),u=s==="es"?E0.es:E0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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",d&&(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"}),u.filters,d&&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:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.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"}):m.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(m.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?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.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 m=!t;a(m),m&&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:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function P0(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 F0({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,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>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,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(R,C)=>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:R}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(C)})]});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),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(R,C)=>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:R}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(C)})]});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(u)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),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(v,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=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:[m>=0?"+":"",go(m),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=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:[p>=0?`+${go(p)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=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:P0(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:P0(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:`${u}%`,backgroundColor:m}})})]})]})})(),(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,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${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]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),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 u=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:u}})})]},`${c.name}-${i}`)})})]})]})}var rC=[{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 H0(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(...H0(n.subtasks,t+1,s));}return a}function aC(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 u=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;a+=p,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 nC({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 O0(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 u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}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 Kd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Kd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function U0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:R=true,showCreateTaskButton:C=false,onCreateTask:N,persistFilter:P=false,financialBlur:T,healthSidebar:V,lens:O="hours",hourlyRate:Y=0,rateMap:L,aggregateParentHours:Re=false,showProjectTotals:U=false,totalsDollarOverride:Te}=t,B=bl(f,v),z=m==="dark",Me=S=>{if(!L||!S.assignees||S.assignees.length===0)return Y;let K=0,re=0;for(let xe of S.assignees){let _e=xe.id?L[xe.id]:void 0;if(_e==null||_e<=0)continue;let Z=typeof xe.estimatedMinutes=="number"?xe.estimatedMinutes:0;Z>0&&(K+=_e*Z,re+=Z);}if(re>0)return K/re;let ye=S.assignees.map(xe=>xe.id?L[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return ye.length===0?Y:ye.reduce((xe,_e)=>xe+_e,0)/ye.length},We=S=>{let K=0,re=0,ye=0,xe=_e=>{for(let Z of _e)if(Z.subtasks&&Z.subtasks.length>0){let Le={s:K,a:re,q:ye};if(xe(Z.subtasks),K-Le.s+(re-Le.a)+(ye-Le.q)===0){let $e=Me(Z);K+=(Z.timeLoggedMinutes??0)/60*$e,re+=(Z.effortMinutes??0)/60*$e,ye+=(Z.soldEffortMinutes??0)/60*$e;}}else {let Le=Me(Z);K+=(Z.timeLoggedMinutes??0)/60*Le,re+=(Z.effortMinutes??0)/60*Le,ye+=(Z.soldEffortMinutes??0)/60*Le;}};return S.subtasks&&xe(S.subtasks),{dollarSpent:K,dollarAllocated:re,dollarQuoted:ye}},ce=react.useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let K=JSON.parse(S);return {statusFilter:K.statusFilter||"all",hideCompleted:K.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),Fe=react.useMemo(()=>{function S(K){let re=0,ye=0,xe=0,_e=0,Z=0,Le=0;for(let Qe of K)if(Qe.subtasks&&Qe.subtasks.length>0){let $e=S(Qe.subtasks);if($e.spent+$e.allocated+$e.quoted>0)re+=$e.spent,ye+=$e.allocated,xe+=$e.quoted,_e+=$e.dollarSpent,Z+=$e.dollarAllocated,Le+=$e.dollarQuoted;else {let ut=Qe.timeLoggedMinutes??0,mt=Qe.effortMinutes??0,hr=Qe.soldEffortMinutes??0;re+=ut,ye+=mt,xe+=hr;let dr=Me(Qe);_e+=ut/60*dr,Z+=mt/60*dr,Le+=hr/60*dr;}}else {let $e=Qe.timeLoggedMinutes??0,zt=Qe.effortMinutes??0,ut=Qe.soldEffortMinutes??0;re+=$e,ye+=zt,xe+=ut;let mt=Me(Qe);_e+=$e/60*mt,Z+=zt/60*mt,Le+=ut/60*mt;}return {spent:re,allocated:ye,quoted:xe,dollarSpent:_e,dollarAllocated:Z,dollarQuoted:Le}}return S(e)},[e]),X=react.useMemo(()=>{let S=new Map;function K(re){let ye=0;for(let xe of re)if(xe.subtasks&&xe.subtasks.length>0){let _e=K(xe.subtasks);S.set(xe.id,_e),ye+=_e;}else ye+=xe.weight||0;return ye}return K(e),S},[e]),Pe=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Fe.spent,totalHoursAllocatedMinutes:Fe.allocated}},[V,Fe]),[Ne,Oe]=react.useState(true),[ze,rt]=react.useState(null),[ne,Ke]=react.useState("position"),[je,He]=react.useState("asc"),[gt,Mt]=react.useState(""),[Ge,Be]=react.useState(()=>ce().statusFilter),[st,Wt]=react.useState(()=>ce().hideCompleted),[Ue,dt]=react.useState(y||rC),[F,J]=react.useState(false),[I,q]=react.useState(false),[pe,ve]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Ae,Ce]=react.useState(null),[ft,oe]=react.useState(false),[fe,et]=react.useState(null),[Xe,kt]=react.useState(null),[tt,St]=react.useState(null),mr=react.useRef(0),cr=react.useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Lr,Ot]=react.useState(null),[kr,Vt]=react.useState(null),ar=S=>{let K=S.type;return S.customFieldId?K==="file"?null:{kind:"customField",fieldId:S.customFieldId}:K==="assignees"||K==="teamLoad"?"assignees":K==="startDate"?"startDate":K==="endDate"?"endDate":null},ua=(S,K)=>typeof S=="string"||typeof K=="string"?S===K:S.fieldId===K.fieldId,Zr=react.useRef([]),nt=react.useCallback((S,K)=>{Rt&&(K.preventDefault(),mr.current=K.clientY,Ce(S),cr.current=false,oe(false),St({x:K.clientX,y:K.clientY}));},[Rt]),Je=react.useCallback(S=>{if(!Ae||(Math.abs(S.clientY-mr.current)>5&&!cr.current&&(cr.current=true,oe(true)),St({x:S.clientX,y:S.clientY}),!cr.current))return;let re=document.querySelectorAll("[data-listview-row]"),ye=null,xe=null;re.forEach(_e=>{let Z=_e.getBoundingClientRect(),Le=_e.getAttribute("data-listview-row");if(Le&&Le!==Ae&&S.clientY>=Z.top&&S.clientY<=Z.bottom){ye=Le;let Qe=S.clientY-Z.top,$e=Z.height;xe=Qe<$e*.25?"above":Qe>$e*.75?"below":"child";}}),et(ye),kt(xe);},[Ae]),Nr=react.useCallback(()=>{if(cr.current&&Ae&&fe&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Ae,fe);else if(Xe==="above"||Xe==="below"){let S=(ye,xe,_e=null)=>{for(let Z of ye){if(Z.id===xe)return _e;if(Z.subtasks){let Le=S(Z.subtasks,xe,Z.id);if(Le!==void 0)return Le}}},K=S(e,Ae,null),re=S(e,fe,null);if(r.onTaskReparent){let ye=($e,zt)=>{if(zt===null)return $e;for(let ut of $e){if(ut.id===zt)return ut.subtasks||[];if(ut.subtasks){let mt=ye(ut.subtasks,zt);if(mt.length>0||ut.subtasks.some(hr=>hr.id===zt))return mt}}return []},xe=ye(e,re??null),_e=xe.findIndex($e=>$e.id===fe),Z=K===re,Le=Z?xe.findIndex($e=>$e.id===Ae):-1,Qe=Xe==="below"?_e+1:_e;Z&&Le!==-1&&Le<_e&&(Qe-=1),r.onTaskReparent(Ae,re??null,Math.max(0,Qe));}}}Ce(null),et(null),kt(null),St(null),cr.current=false,oe(false);},[Ae,fe,Xe,e,r]),wa=(S,K)=>typeof K!="string"?S.customFields?.find(ye=>ye.fieldId===K.fieldId)?.value:K==="assignees"?S.assignees:K==="startDate"?S.startDate:S.endDate,Dr=(S,K,re,ye)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let xe=Array.from(document.querySelectorAll("[data-listview-row]")),_e=xe.map(Nt=>Nt.getAttribute("data-listview-row")||""),Z=Math.max(0,_e.indexOf(K)),Le=Nt=>_e.slice(Z,Nt+1);Vt({sourceTaskId:K,column:re,sourceIndex:ye,targetIndex:ye,rangeIds:new Set([K])});let $e=(Nt=>{let Lt=Nt?.parentElement??null;for(;Lt;){let Na=window.getComputedStyle(Lt).overflowY;if((Na==="auto"||Na==="scroll")&&Lt.scrollHeight>Lt.clientHeight)return Lt;Lt=Lt.parentElement;}let Qt=document.scrollingElement;return Qt&&Qt.scrollHeight>Qt.clientHeight?Qt:null})(S.currentTarget),zt=Nt=>{let Lt=Z,Qt=false;xe.forEach((Na,pa)=>{let qr=Na.getBoundingClientRect();Nt>=qr.top&&Nt<=qr.bottom&&(Lt=pa,Qt=true);});let ba=xe[xe.length-1];if(!Qt&&ba){let Na=ba.getBoundingClientRect();Nt>Na.bottom&&(Lt=xe.length-1);}return Lt<Z&&(Lt=Z),Lt},ut=S.clientY,mt=null,hr=()=>{mt!==null&&(cancelAnimationFrame(mt),mt=null);},dr=()=>{let Nt=zt(ut),Lt=new Set(Le(Nt));Vt(Qt=>Qt&&{...Qt,targetIndex:Nt,rangeIds:Lt});},ea=()=>{if(hr(),!$e)return;let Nt=$e,Qt=Nt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Nt.getBoundingClientRect(),ba=60,Na=12,pa=ut-Qt.top,qr=Qt.bottom-ut,yo=Nt.scrollHeight-Nt.clientHeight;if(qr<ba&&Nt.scrollTop<yo){let xo=Math.max(1,Math.round(Na*(1-Math.max(0,qr)/ba))),vo=()=>{Nt.scrollTop+=xo,dr(),Nt.scrollTop<Nt.scrollHeight-Nt.clientHeight&&(mt=requestAnimationFrame(vo));};mt=requestAnimationFrame(vo);}else if(pa<ba&&Nt.scrollTop>0){let xo=Math.max(1,Math.round(Na*(1-Math.max(0,pa)/ba))),vo=()=>{Nt.scrollTop-=xo,dr(),Nt.scrollTop>0&&(mt=requestAnimationFrame(vo));};mt=requestAnimationFrame(vo);}},Ft=Nt=>{ut=Nt.clientY,dr(),ea();},qt=Nt=>{window.removeEventListener("mousemove",Ft),window.removeEventListener("mouseup",qt),hr(),document.body.style.cursor="",document.body.style.userSelect="",Vt(null);let Lt=zt(Nt.clientY),Qt=new Map(Zr.current.map(qr=>[qr.id,qr])),ba=Qt.get(K);if(!ba)return;let Na=wa(ba,re),pa=[];for(let qr of Le(Lt)){if(qr===K)continue;let yo=Qt.get(qr);yo&&(yo.subtasks&&yo.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,re,Na);};window.addEventListener("mousemove",Ft),window.addEventListener("mouseup",qt);},_r=S=>kr?kr.rangeIds.has(S):false;react.useEffect(()=>{if(Ae)return document.addEventListener("mousemove",Je),document.addEventListener("mouseup",Nr),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Je),document.removeEventListener("mouseup",Nr),document.body.style.cursor="",document.body.style.userSelect="";}},[Ae,Je,Nr]);let[Wr,le]=react.useState("all"),[de,pt]=react.useState(false),j=react.useRef(null),be=react.useRef(null),te=react.useMemo(()=>{let S=0;function K(re,ye){for(let xe of re)ye>S&&(S=ye),xe.subtasks?.length&&K(xe.subtasks,ye+1);}return K(e,1),S},[e]);react.useEffect(()=>{if(!de)return;let S=K=>{j.current?.contains(K.target)||be.current?.contains(K.target)||pt(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),react.useEffect(()=>{if(Wr==="all"){let re=function(ye){for(let xe of ye)xe.subtasks?.length&&(xe.isExpanded===false&&r.onTaskToggleExpand?.(xe.id),re(xe.subtasks));};re(e);}else {let re=function(ye,xe){for(let _e of ye)if(_e.subtasks?.length){let Z=xe<Wr,Le=_e.isExpanded!==false;Z!==Le&&r.onTaskToggleExpand?.(_e.id),re(_e.subtasks,xe+1);}};re(e,1);}},[Wr]);let[$,ee]=react.useState(null),[we,D]=react.useState(0),[H,ue]=react.useState(0),ke=react.useRef(null),[me,Se]=react.useState(null),[se,it]=react.useState(null);react.useEffect(()=>{y&&dt(S=>{if(S.length===y.length){let K=true;for(let re=0;re<S.length;re++){let ye=S[re],xe=y[re];if(!ye||!xe||ye.id!==xe.id||ye.visible!==xe.visible||ye.width!==xe.width||ye.label!==xe.label){K=false;break}}if(K)return S}return y});},[y]),react.useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Ge,hideCompleted:st}));}catch(S){console.error("Error persisting filter state:",S);}},[P,Ge,st]);let bt=react.useMemo(()=>{let S=new Set;function K(re){for(let ye of re)ye.subtasks?.length&&(ye.isExpanded!==false&&S.add(ye.id),K(ye.subtasks));}return K(e),S},[e]),Et=react.useMemo(()=>Ue.filter(S=>S.visible),[Ue]),nr=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ka=react.useCallback(S=>{ne===S?He(K=>K==="asc"?"desc":"asc"):(Ke(S),He("asc")),r.onSortChange?.({column:S,direction:je==="asc"?"desc":"asc"});},[ne,je,r]),zr=react.useCallback(S=>{dt(S),r.onColumnsChange?.(S);},[r]),Ca=react.useCallback(S=>{let K=Ue.map(re=>re.id===S?{...re,visible:false}:re);zr(K);},[Ue,zr]),br=react.useCallback((S,K)=>{Ke(S),He(K);},[]),An=react.useCallback((S,K,re)=>{R&&(S.preventDefault(),ve({isOpen:true,x:S.clientX,y:S.clientY,type:K?"task":"header",task:K,columnId:re}));},[R]),Ha=react.useCallback(()=>{ve(S=>({...S,isOpen:false}));},[]),Ds=react.useCallback((S,K)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let re=Ue.find(ye=>ye.id===K);re&&(ee(K),D(S.clientX),ue(re.width));},[Ue,M]);react.useEffect(()=>{if(!$)return;let S=Ue,K=ye=>{let xe=ye.clientX-we,_e=Math.max(50,H+xe);S=S.map(Z=>Z.id===$?{...Z,width:_e}:Z),dt(S);},re=()=>{r.onColumnsChange?.(S),ee(null);};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",re);}},[$,we,H,r]);let Va=react.useCallback((S,K)=>{if(K==="name"){S.preventDefault();return}Se(K),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",K),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),bi=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),Se(null),it(null);},[]),jo=react.useCallback((S,K)=>{S.preventDefault(),K!=="name"&&(S.dataTransfer.dropEffect="move",it(K));},[]),hi=react.useCallback(()=>{it(null);},[]),Kr=react.useCallback((S,K)=>{if(S.preventDefault(),!me||me===K||K==="name")return;let re=[...Ue],ye=re.findIndex(Z=>Z.id===me),xe=re.findIndex(Z=>Z.id===K);if(ye===-1||xe===-1)return;let _e=re.splice(ye,1);_e[0]&&(re.splice(xe,0,_e[0]),zr(re),Se(null),it(null));},[me,Ue,zr]),Ss=react.useCallback(async S=>{if(r.onCreateCustomField){let K={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(K);}q(false);},[r]),La=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ta=react.useMemo(()=>{let S=H0(e);if(gt.trim()){let K=gt.toLowerCase();S=S.filter(re=>re.name.toLowerCase().includes(K));}if(Ge!=="all"){let K=new Set(S.filter(re=>La(re)===Ge).flatMap(re=>re.parentPath));S=S.filter(re=>K.has(re.id));}if(st){let K=new Set(S.filter(re=>La(re)!=="completed").flatMap(re=>re.parentPath));S=S.filter(re=>K.has(re.id));}return S.sort((K,re)=>{let ye,xe;switch(ne){case "name":ye=K.name.toLowerCase(),xe=re.name.toLowerCase();break;case "startDate":ye=K.startDate?.getTime()||0,xe=re.startDate?.getTime()||0;break;case "endDate":ye=K.endDate?.getTime()||0,xe=re.endDate?.getTime()||0;break;case "progress":ye=K.progress||0,xe=re.progress||0;break;case "status":ye=K.status||"todo",xe=re.status||"todo";break;case "priority":let _e={urgent:0,high:1,medium:2,low:3,none:4};ye=_e[K.priority]??4,xe=_e[re.priority]??4;break;case "position":return 0;default:return 0}return ye<xe?je==="asc"?-1:1:ye>xe?je==="asc"?1:-1:0}),S},[e,gt,Ge,st,ne,je,La]);Zr.current=Ta;let tn=react.useCallback((S,K)=>{let re=_e=>{r.onTaskUpdate?.({...S,..._e});},ye=_e=>_e?S.customFields?.find(Le=>Le.fieldId===_e)?.value:void 0,xe=(_e,Z)=>{if(!_e)return;let Qe=[...S.customFields||[]],$e=Qe.findIndex(zt=>zt.fieldId===_e);$e>=0?Qe[$e]={fieldId:_e,value:Z}:Qe.push({fieldId:_e,value:Z}),re({customFields:Qe});};switch(K.type){case "name":return null;case "status":return jsxRuntime.jsx(kg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:Z=>{re({status:Z,progress:Z==="completed"?100:Z==="in-progress"?50:0});},isDark:z,locale:f,translations:B.status});case "priority":return jsxRuntime.jsx(Tg,{value:S.priority,onChange:Z=>re({priority:Z}),isDark:z,locale:f});case "assignees":{let Z=S.hasChildren,Le=S.assignees||[];if(Z&&S.subtasks?.length){let Qe=new Map,$e=zt=>{(zt||[]).forEach(ut=>{(ut.assignees||[]).forEach(mt=>{Qe.has(mt.name)||Qe.set(mt.name,mt);}),ut.subtasks?.length&&$e(ut.subtasks);});};$e(S.subtasks),Le=Array.from(Qe.values());}else Z&&(Le=[]);return jsxRuntime.jsx(xl,{value:Le,availableUsers:l,onChange:Qe=>re({assignees:Qe}),isDark:z,locale:f,disabled:Z})}case "startDate":return jsxRuntime.jsx(wl,{value:S.startDate,onChange:Z=>re({startDate:Z}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(wl,{value:S.endDate,onChange:Z=>re({endDate:Z}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let Z=!!(S.subtasks&&S.subtasks.length>0),Le=Z?O0(Kd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Ag,{value:Le,onChange:Z?void 0:Qe=>{let $e=Qe===100?"completed":Qe>0?"in-progress":"todo";re({progress:Qe,status:$e});},isDark:z,disabled:Z})}case "tags":return jsxRuntime.jsx(Yg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Bg,{value:ye(K.customFieldId)||"",onChange:Z=>xe(K.customFieldId,Z),isDark:z});case "number":return jsxRuntime.jsx(Hg,{value:ye(K.customFieldId)||0,onChange:Z=>xe(K.customFieldId,Z),isDark:z});case "date":let _e=ye(K.customFieldId);return jsxRuntime.jsx(wl,{value:_e?new Date(_e):void 0,onChange:Z=>xe(K.customFieldId,Z),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(Ug,{value:ye(K.customFieldId)||"",options:K.options||[],onChange:Z=>xe(K.customFieldId,Z),isDark:z});case "checkbox":return jsxRuntime.jsx(zg,{value:ye(K.customFieldId)||false,onChange:Z=>xe(K.customFieldId,Z),isDark:z});case "multiselect":return jsxRuntime.jsx(Gg,{value:ye(K.customFieldId)||[],options:K.options||[],onChange:Z=>xe(K.customFieldId,Z),isDark:z,maxSelectable:K.maxSelectable});case "person":{let Z=ye(K.customFieldId)||[];return jsxRuntime.jsx(xl,{value:Z.map(Le=>({name:Le.name,avatar:Le.avatar,initials:Le.initials||(Le.name||"?").slice(0,2).toUpperCase(),color:Le.color||"#00E5CC"})),availableUsers:l,onChange:Le=>xe(K.customFieldId,Le),isDark:z,locale:f})}case "file":return jsxRuntime.jsx(_g,{value:ye(K.customFieldId),isDark:z,onOpen:Z=>{Z.url&&window.open(Z.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let Z=S.status==="completed"||S.progress===100;return jsxRuntime.jsx($a,{value:S.estimatedTime,onChange:Le=>re({estimatedTime:Le}),isDark:z,locale:f,disabled:Z,lens:O,hourlyRate:Me(S)})}case "quotedTime":{let Z=S.status==="completed"||S.progress===100,Le=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx($a,{value:S.quotedTime,onChange:Qe=>re({quotedTime:Qe}),isDark:z,locale:f,disabled:Z,isBlurred:Le,lens:O,hourlyRate:Me(S)})}case "elapsedTime":{let Z=S.status==="completed"||S.progress===100,Le=S.executedDollarsCanonical;return jsxRuntime.jsx($a,{value:S.elapsedTime,onChange:Qe=>re({elapsedTime:Qe}),isDark:z,locale:f,disabled:Z,lens:O,hourlyRate:Me(S),financialOverride:Le})}case "effortMinutes":{if(Re&&S.subtasks&&S.subtasks.length>0){let{allocated:zt}=ks(S);if(O==="financial"){let ut=We(S),mt=Math.round(ut.dollarAllocated),hr=Math.round(ut.dollarQuoted),dr=hr-mt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[mt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",mt.toLocaleString("es-CO")]}):null,dr!==0&&mt>0&&hr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",dr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[dr>0?"+":"",Math.abs(dr)>=1e3?`$${(dr/1e3).toFixed(1)}K`:`$${dr}`]})]})}return jsxRuntime.jsx($a,{value:zt>0?zt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Y})}let Z=S.status==="completed"||S.progress===100,Le=S.effortMinutes||0,Qe=S.soldEffortMinutes||0,$e=Me(S);if(O==="financial"&&$e&&Le>0&&Qe>0){let zt=Math.round(Le/60*$e),mt=Math.round(Qe/60*$e)-zt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx($a,{value:Le,onChange:hr=>re({effortMinutes:hr}),isDark:z,locale:f,disabled:Z,lens:O,hourlyRate:Me(S)}),mt!==0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mt>0?"+":"",Math.abs(mt)>=1e3?`$${(mt/1e3).toFixed(1)}K`:`$${mt}`]})]})}return jsxRuntime.jsx($a,{value:Le,onChange:zt=>re({effortMinutes:zt}),isDark:z,locale:f,disabled:Z,lens:O,hourlyRate:Me(S)})}case "timeLoggedMinutes":{let Z=S.executedDollarsCanonical;if(Re&&S.subtasks&&S.subtasks.length>0){let{spent:Qe}=ks(S);return jsxRuntime.jsx($a,{value:Qe>0?Qe:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S),financialOverride:Z})}let Le=S.status==="completed"||S.progress===100;return jsxRuntime.jsx($a,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Qe=>{r.onLogTime?.(S,Qe);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Le,lens:O,hourlyRate:Me(S),financialOverride:Z})}case "soldEffortMinutes":{if(Re&&S.subtasks&&S.subtasks.length>0){let{quoted:Qe}=ks(S),$e=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx($a,{value:Qe>0?Qe:void 0,isDark:z,locale:f,disabled:true,isBlurred:$e,lens:O,hourlyRate:Me(S)})}let Z=S.status==="completed"||S.progress===100,Le=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx($a,{value:S.soldEffortMinutes,onChange:Qe=>re({soldEffortMinutes:Qe}),isDark:z,locale:f,disabled:Z,isBlurred:Le,lens:O,hourlyRate:Me(S)})}case "scheduleVariance":{let Z=S.effortMinutes||0,Le=S.soldEffortMinutes||0,Qe=S.timeLoggedMinutes||0,$e=Z>0||Le>0||Qe>0;return jsxRuntime.jsx(Zg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:$e})}case "hoursBar":{if(Re&&S.hasChildren){let{spent:Z,allocated:Le,quoted:Qe}=ks(S),$e=Z>Le&&Le>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",$e?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ws(Z)}),Le>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ws(Le)})]}),Qe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ws(Qe)})]})]})}return jsxRuntime.jsx(t0,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:O,hourlyRate:Me(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(a0,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Le=>{r.onTaskUpdate?.({...S,assignees:Le});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(o0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let Z=X.get(S.id);if(Z!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",Z>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:Z>0?`${Number(Z.toFixed(2))}%`:"\u2014"});let Le=S.weight||0;return jsxRuntime.jsx(nC,{value:Le,onChange:Qe=>re({weight:Qe}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,B,Re,X]),ho=react.useCallback(S=>{let re={name:B.columns.name,status:B.columns.status,priority:B.columns.priority,assignees:B.columns.assignees,startDate:B.columns.startDate,endDate:B.columns.endDate,progress:B.columns.progress,tags:B.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:B.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:B.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:B.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:B.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:B.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:B.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:B.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:B.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:B.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:B.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:B.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof re=="string"?re:String(re||S.type)},[B,f]),In=react.useMemo(()=>{let re=Et.reduce((xe,_e)=>xe+_e.width,0)+(k?48:0),ye={};for(let xe of Et)ye[xe.id]=`${xe.width/re*100}%`;return ye},[Et,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:[B.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:B.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:B.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:ke,className:g(z?"bg-[#0D0D0D]":"bg-white",$&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let S=!!t.toolbarContainer,K=jsxRuntime.jsx("div",{className:S?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:S?"flex items-center gap-2":"flex items-center gap-4",children:[jsxRuntime.jsx("div",{className:g("text-sm whitespace-nowrap",z?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let re=Ta.filter(_e=>(_e.subtasks?.length??0)>0).length,ye=Ta.length-re,xe=f==="es";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ye," ",B.pagination.tasks,re>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" \xB7 ",re," ",xe?re===1?"tarea padre":"tareas padre":re===1?"parent task":"parent tasks"]})]})})()}),h&&!S&&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:gt,onChange:re=>Mt(re.target.value),placeholder:B.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")})]}),!S&&jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&te>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:j,onClick:()=>pt(!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"}),Wr==="all"?f==="es"?"Todos":"All":`L${Wr}`]}),de&&jsxRuntime.jsx("div",{ref:be,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(te,5)},(re,ye)=>({value:ye+1,label:`L${ye+1}`}))].map(re=>jsxRuntime.jsxs("button",{onClick:()=>{le(re.value),pt(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?Wr===re.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Wr===re.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:re.label}),Wr===re.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(re.value)))})]}),jsxRuntime.jsx(M0,{value:Ge,hideCompleted:st,onChange:Be,onHideCompletedChange:Wt,isDark:z,locale:f}),Pe?.enabled&&Pe.data&&!Ne&&jsxRuntime.jsx("button",{onClick:()=>Oe(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,C&&N&&!S&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:N,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:B.toolbar.newTask})]})]})});return S?reactDom.createPortal(K,t.toolbarContainer):K})(),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"}),Et.map(S=>{let K=S.id!=="name",re=se===S.id&&me!==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",K&&"cursor-grab",S.type!=="name"&&"justify-center",me===S.id&&"opacity-50",re&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:In[S.id],minWidth:S.minWidth},draggable:K,onDragStart:K?ye=>Va(ye,S.id):void 0,onDragEnd:K?bi:void 0,onDragOver:K?ye=>jo(ye,S.id):void 0,onDragLeave:K?hi:void 0,onDrop:K?ye=>Kr(ye,S.id):void 0,onContextMenu:ye=>An(ye,void 0,S.id),children:[K&&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")}),u?jsxRuntime.jsxs("button",{draggable:false,onClick:ye=>{let xe=ye.currentTarget.getBoundingClientRect();u(S.id,xe);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[ho(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),ne===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ka(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[ho(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",ne===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[ho(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:ye=>Ds(ye,S.id),children:jsxRuntime.jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",$===S.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},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(K=>!K);},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(k0,{isOpen:F,onClose:()=>J(false),columns:Ue,customFields:c,mostrarColumnasDensas:w,onColumnsChange:zr,onCreateCustomField:()=>{J(false),q(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ta.map((S,K)=>{let re=bt.has(S.id),ye=Math.min(K*.01,.2),xe=S.hasChildren&&S.level===0,_e=S.subtasks?.length||0;if(xe){let{spent:ut,allocated:mt,quoted:hr}=ks(S),dr=aC(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",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"}),Et.map(ea=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",ea.type!=="name"&&"justify-center"),style:{width:In[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:Ft=>{Ft.stopPropagation(),nr(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:re?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:Ft=>{Ft.stopPropagation(),nr(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:re?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:["(",_e," ",f==="es"?_e===1?"Tarea":"Tareas":_e===1?"Item":"Items",")"]}),dr!==null&&x&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",dr>=1?"text-[#32D74B] bg-[#32D74B]/10":dr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",dr.toFixed(2)]})]})]}):ea.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Ft=S.executedDollarsCanonical,qt=Ft!=null?Math.round(Ft):Math.round(We(S).dollarSpent);return qt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",qt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx($a,{value:ut>0?ut:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):ea.type==="soldEffortMinutes"?O==="financial"?(()=>{let Ft=We(S),qt=Math.round(Ft.dollarQuoted);return qt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",qt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx($a,{value:hr>0?hr:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):ea.type==="effortMinutes"?O==="financial"?(()=>{let Ft=We(S),qt=Math.round(Ft.dollarAllocated),Nt=Math.round(Ft.dollarQuoted),Lt=Nt-qt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[qt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",qt.toLocaleString("es-CO")]}):null,Lt!==0&&qt>0&&Nt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`]})]})})():jsxRuntime.jsx($a,{value:mt>0?mt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):tn(S,ea)},ea.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let Z=Ae===S.id,Le=fe===S.id,Qe=Le&&Xe==="above",$e=Le&&Xe==="below",zt=Le&&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",ze===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:Z?.4:1,backgroundColor:zt?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:zt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:ut=>An(ut,S),onMouseEnter:()=>Ot(S.id),onMouseLeave:()=>Ot(ut=>ut===S.id?null:ut),children:[Qe&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),$e&&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=>nt(S.id,ut),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Et.map(ut=>{let mt=!!(S.subtasks&&S.subtasks.length>0),hr=ar(ut),ea=!!hr&&!mt&&Lr===S.id&&!kr,Ft=!!kr&&!!hr&&ua(kr.column,hr)&&_r(S.id);return jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",ut.type!=="name"&&"justify-center"),style:{width:In[ut.id],minWidth:ut.minWidth,position:"relative",backgroundColor:Ft?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ft?"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:qt=>{qt.stopPropagation(),nr(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:re?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})]})]}):ea&&hr?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[tn(S,ut),jsxRuntime.jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:qt=>Dr(qt,S.id,hr,K),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}})]}):tn(S,ut)},ut.id)}),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),U&&Ta.length>0&&(()=>{let{spent:S,allocated:K,quoted:re}=Fe,ye=K-S,xe=ye<0,_e=xe?`+${ws(Math.abs(ye))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ws(ye)} ${f==="es"?"AHORRADO":"SAVED"}`,Z=O==="financial"&&Y>0,Le=Te?.breakdown,Qe=!!Le&&((Le.equipment??0)>0||(Le.travel??0)>0),$e=Le?.laborSpent!=null?Le.laborSpent:Te?.spent!=null?Te.spent:Fe.dollarSpent,zt=Le?.laborAllocated!=null?Le.laborAllocated:Te?.allocated!=null?Te.allocated:Fe.dollarAllocated,ut=Te?.quoted!=null?Te.quoted:Fe.dollarQuoted,mt=(Ft,qt)=>{if(Z){let Nt=qt??Ft/60*Y;return `$${Math.round(Nt).toLocaleString("es-CO")}`}return ws(Ft)},hr=Z?Math.abs(zt-$e):0,dr=Z?`+$${hr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${xe?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:_e,ea=Z&&Qe?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"}),Et.map(Ft=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Ft.type!=="name"&&"justify-center"),style:{width:In[Ft.id],minWidth:Ft.minWidth},children:Ft.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]})]}):Ft.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:mt(S,Z?$e: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:mt(K,Z?zt:void 0)})]}),K>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:Z?dr:_e})]}):Ft.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?mt(re,Z?ut:void 0):"\u2013"}):Ft.type==="effortMinutes"?(()=>{if(Z&&re>0&&K>0){let qt=Math.round(ut),Nt=Math.round(zt),Lt=qt-Nt,Qt=qt>0?Math.round(Lt/qt*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:mt(K,zt)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>=0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Qt,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:K>0?mt(K,Z?zt:void 0):"\u2013"})})():Ft.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?mt(S,Z?$e:void 0):"\u2013"}):Ft.type==="progress"?(()=>{let qt=O0(Kd(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[qt,"%"]})})():Ft.type==="weight"?(()=>{let qt=e||[],Nt=[],Lt=pa=>{for(let qr of pa)Nt.push(qr),qr.subtasks?.length&&Lt(qr.subtasks);};Lt(qt);let ba=Nt.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),Na=Math.abs(ba-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Na?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"})},Ft.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ta.length===0&&gt&&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:B.empty.noResults})]})})]})}),Pe?.enabled&&Pe.data&&Ne&&jsxRuntime.jsx(F0,{data:Pe.data,isDark:z,locale:f,onClose:()=>Oe(false),lens:t?.lens,onUnassignedTaskClick:S=>{let K=document.querySelector(`[data-task-id="${S}"]`);K&&(K.scrollIntoView({behavior:"smooth",block:"center"}),rt(S),setTimeout(()=>rt(null),2e3));}})]}),jsxRuntime.jsx(p0,{state:pe,onClose:Ha,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Ca,onColumnSort:br,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),ft&&tt&&Ae&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:tt.x+12,top:tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let K=De.flattenTasks(e).find(re=>re.id===Ae);return K?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:K.name})]}):null})()}),document.body),jsxRuntime.jsx(N0,{isOpen:I,onClose:()=>q(false),onSave:Ss,isDark:z,locale:f})]})}var W0=[{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}],z0=[{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"}],G0=[{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 qd={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"},Yd={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"},Xd={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"},Fl={dark:qd,light:Yd,neutral:Xd};function V0(e){return Fl[e]||Fl.dark}function Ll(e,t,r,a,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,r),v=Math.min(m.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<r,contR:m.endSerial>a});}let c={};for(let m=r;m<=a;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],u=[],p={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var oC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],sC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function j0(e){return e==="es"?oC:sC}function _0(e){return (e.getDay()+6)%7}function K0(e,t){let r=new Date(e,t,1),a=_0(r),n=new Date(e,t,1-a),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(n);return d.setDate(n.getDate()+(p-1)),d},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(r),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function ii(e,t){return _0(e.serialToDate(t))>=5}function iC(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 q0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function Y0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Al(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=iC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=q0(u.startDate),f=q0(u.endDate);if(!m||!f)continue;let v=r.dateToSerial(m),h=r.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?Y0(x):Y0(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?dC(k.name):void 0),R=u.displayId||u.wbsCode||"",C=cC(R||u.id)?"":R||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var lC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function cC(e){return lC.test(e)||/^task-\d+/.test(e)}function dC(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 uC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],pC=["January","February","March","April","May","June","July","August","September","October","November","December"];function X0(e,t,r){return `${(r==="es"?uC:pC)[t]} ${e}`}var Jd=26,mC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Il({locale:e}){let t=j0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Rl({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`,u={"--proj":e.color??s.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:u,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 Bl({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:mC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function $l({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,locale:t="es"}){let r=t==="en";return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(a=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:a.color}}),a.id?`${a.id} `:"",a.name]},a.id||a.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",r?"Critical path":"Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",r?"Milestone":"Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",r?"Due date":"Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",r?"External event":"Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",r?"Absence":"Ausencia"]})]})}var hC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function Qd({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=hC.filter(p=>!c.includes(p.id));return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"cal-seg",children:u.map(p=>jsxRuntime.jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${i?p.en:p.es} (${p.key})`,children:i?p.en:p.es},p.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:"$"})]})]}):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:u.map(p=>jsxRuntime.jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[i?p.en:p.es,jsxRuntime.jsx("span",{className:"key",children:p.key})]},p.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:u="es",children:p}){let d=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),h=u==="es";react.useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);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:v,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"]}),m?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,p,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-d,"/6"]})]})})]})}var yC=[{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 Z0({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:yC.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 kC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},CC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function tf({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s,locale:o="es"}){let l=o==="en",c=react.useRef(null);react.useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let i=r.length+t.length,p=a||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"Absence":"Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${i} ${l?"items":"elementos"}`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===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:CC[d.type]},children:kC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var ef={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 rf({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=ef[r]||ef.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 nf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function DC(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 af=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function SC(e){return af[e%af.length]}function EC(e){return e>1?"over":e>=.9?"warn":"ok"}var Zd="\xA0";function Ho(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function of(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(nf(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:SC(c),initials:DC(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(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:r}}),u=i.reduce((p,d)=>p+d.hours,0);a.set(l,{assigned:Math.round(u*100)/100,capacity:r*e.length,perPerson:i});}return a}function sf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=nf(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,p="cal-cap-cell "+(o?"off":EC(i))+(r===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:p,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:d,onClick:m=>{!c||!a||a(s,d,m.currentTarget);},onKeyDown:m=>{!c||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,d,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${Zd}/${Zd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Ho(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",Zd,Ho(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 lf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=p=>{p.key==="Escape"&&r();},u=p=>{n.current&&!n.current.contains(p.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[r]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.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:[Ho(s),"h asignadas / ",Ho(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Ho(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 u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:u?"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/p*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Ho(i.hours),"h / ",Ho(i.capacity),"h"]})]},i.name)})})]})}var eu=28,PC=182;function df({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=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,v)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(FC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),c&&c[v]?jsxRuntime.jsx(sf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function FC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=react.useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),p=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=r;f++)d.push(f);let m={height:`${PC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:m,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=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"),p.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Rl,{bar:f,ws:t,money:s,projColor:o,slotH:eu})},`b${v}`)),u.chips.map((f,v)=>jsxRuntime.jsx(Bl,{chip:f,ws:t,slotH:eu},`c${v}`)),u.more.map((f,v)=>jsxRuntime.jsx($l,{more:f,ws:t,slotH:eu,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var LC=/^[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 LC.test(e)||/^task-\d+/.test(e)}function IC(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 uf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function RC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function pf(e,t){let r=RC(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?uf(l):uf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?IC(i.name):void 0),p=n.displayId||n.wbsCode||"",d=AC(p||n.id)?"":p||n.id;a.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return a}function mf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n,locale:s="es"}){let o=s==="en";return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:o?"Drag onto the calendar":"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(l=>{let c=a==="$"?l.cost:`${l.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[l.id?jsxRuntime.jsx("span",{className:"tk",children:l.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:l.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:c}),l.who?jsxRuntime.jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function gf({onExpand:e,locale:t="es"}){let r=t==="en";return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e());},title:r?"Expand backlog":"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",r?"Status":"Estado"]})]})}function Ts(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function ff({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=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=r.wasCritical,p=r.projectEndDeltaDays,d=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===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`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===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)]})]})]}),u?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:p>0?"v bad":"v good",children:d})]}),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:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var HC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function bf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.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 u=p=>p.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(p=>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:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>l?.(d.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:d.color??n,flex:"none"}}),d.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,d.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?d.cost:`${d.hrs}h`})]},d.uid)),p.items.map((d,m)=>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:HC[d.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function UC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Ol(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function tu(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 hf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let u of Ol(i))a.has(u)||a.set(u,[]),a.get(u).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 u=r.get(i);if(!u)return o.delete(i),0;let p=Ol(u).filter(f=>r.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=tu(u)*864e5;return n.set(i,d),s.set(i,d+m),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 yf(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 Ol(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 u=1/0;for(let p of i){let d=s.get(p),m=a.get(p);d!=null&&m&&(u=Math.min(u,d-tu(m)*864e5));}s.set(c.id,u===1/0?r:u);}}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&&Ol(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Hl(e,t,r,a){let n=UC(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=hf(n,new Map),i=yf(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),p=hf(u,new Map([[t,r.getTime()]])),d=yf(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=tu(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.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:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function xf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var VC=132,Ul=26,jC="#5B7FD4";function vf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=react.useState("mes"),[R,C]=react.useState(()=>{let oe=new Date,fe={y:oe.getFullYear(),m:oe.getMonth()},et=(e??[]).map(tt=>tt.startDate?new Date(tt.startDate):null).filter(tt=>!!tt&&!isNaN(tt.getTime()));if(et.length===0||(e??[]).some(tt=>{let St=tt.startDate?new Date(tt.startDate):null,mr=tt.endDate?new Date(tt.endDate):St;if(!St||isNaN(St.getTime()))return false;let cr=new Date(fe.y,fe.m,1),Rt=new Date(fe.y,fe.m+1,0,23,59,59);return St<=Rt&&(mr??St)>=cr}))return fe;let kt=et.reduce((tt,St)=>tt<St?tt:St);return {y:kt.getFullYear(),m:kt.getMonth()}}),[N,P]=react.useState(false),[T,V]=react.useState([]),[O,Y]=react.useState("all"),[L,Re]=react.useState(null),[U,Te]=react.useState(null),[B,z]=react.useState(false),[Me,We]=react.useState(null),[ce,Fe]=react.useState(false),X=react.useMemo(()=>K0(R.y,R.m),[R.y,R.m]),Pe=a||jC,Ne=react.useMemo(()=>{let oe=new Set;for(let fe of y){let et=new Date(`${fe}T12:00:00`),Xe=X.dateToSerial(et);Xe>=1&&Xe<=42&&oe.add(Xe);}return oe},[y,X]);react.useEffect(()=>{w?.({start:xf(X.serialToDate(1)),end:xf(X.serialToDate(42))});},[R.y,R.m]);let Oe=b.length,ze=react.useMemo(()=>{let oe=x?.hoursPerDay;if(!oe)return 8;let fe=[oe.monday,oe.tuesday,oe.wednesday,oe.thursday,oe.friday].map(et=>et||0).filter(et=>et>0);return fe.length?Math.round(fe.reduce((et,Xe)=>et+Xe,0)/fe.length*10)/10:8},[x]),rt=react.useMemo(()=>Al({tasks:e,grid:X,projectColor:()=>Pe,hourlyRate:o,projectId:r}),[e,X,Pe,o,r]),ne=react.useMemo(()=>{if(d===false)return [];let oe=new Map;for(let fe of rt.calTasks)fe.phaseId&&fe.phaseName&&oe.set(fe.phaseId,fe.phaseName);return [...oe.entries()].map(([fe,et])=>({id:fe,name:et})).sort((fe,et)=>fe.name.localeCompare(et.name))},[rt.calTasks,d]),Ke=!T.includes("tareas"),je=!T.includes("cpm"),He=react.useMemo(()=>{let oe=Ke?rt.calTasks:[];return O!=="all"&&(oe=oe.filter(fe=>fe.phaseId===O)),je||(oe=oe.map(fe=>fe.critical?{...fe,critical:false}:fe)),oe},[rt.calTasks,Ke,je,O]),gt=react.useMemo(()=>{let oe=new Set;return T.includes("hitos")&&(oe.add("hito"),oe.add("desembolso")),T.includes("ext")&&oe.add("ext"),T.includes("aus")&&oe.add("aus"),rt.dayItems.filter(fe=>!oe.has(fe.type))},[rt.dayItems,T]),Mt=!T.includes("festivos"),Ge=new Date,Be=X.dateToSerial(new Date(Ge.getFullYear(),Ge.getMonth(),Ge.getDate())),st=oe=>V(fe=>fe.includes(oe)?fe.filter(et=>et!==oe):[...fe,oe]),Wt=()=>C(oe=>{let fe=new Date(oe.y,oe.m-1,1);return {y:fe.getFullYear(),m:fe.getMonth()}}),Ue=()=>C(oe=>{let fe=new Date(oe.y,oe.m+1,1);return {y:fe.getFullYear(),m:fe.getMonth()}}),dt=()=>{let oe=new Date;C({y:oe.getFullYear(),m:oe.getMonth()});},F=(oe,fe,et)=>{if(!v||fe===0)return;let Xe=rt.calTasks.find(cr=>cr.uid===oe);if(!Xe)return;let kt=fe*864e5,tt=new Date(Xe.realStart.getTime()+kt),St=new Date(Xe.realEnd.getTime()+kt),mr=Hl(e,oe,tt,St);mr&&We({uid:oe,taskId:Xe.id,taskName:Xe.name,sim:mr,anchor:et});},J=async()=>{if(!Me||!h)return;Fe(true);let oe=[{id:Me.uid,startDate:Me.sim.newStart,endDate:Me.sim.newEnd},...Me.sim.movedSuccessors.map(et=>({id:et.id,startDate:et.newStart,endDate:et.newEnd}))],fe=await h(oe);Fe(false),fe&&We(null);},I=X0(R.y,R.m,n),q=[{id:"",name:t,color:Pe}],pe=react.useMemo(()=>pf(e,o),[e,o]),ve=react.useMemo(()=>{if(k==="lookahead"){let oe=X.weeks.find(et=>Be>=et.ws&&Be<=et.we)??X.weeks[0],fe=X.weeks.indexOf(oe);return X.weeks.slice(fe,fe+2)}return k==="semana"?[X.weeks.find(fe=>Be>=fe.ws&&Be<=fe.we)??X.weeks[0]]:[]},[k,X.weeks,Be]),Ae=react.useMemo(()=>{let oe={};return ve.forEach((fe,et)=>{let Xe=[];for(let tt=fe.ws;tt<=fe.we;tt++)Xe.push({serial:tt,date:X.serialToDate(tt),isWeekend:ii(X,tt),isHoliday:Ne.has(tt)});let kt=of(b,Xe,ze);oe[et]={days:Xe,capByDay:kt};}),oe},[ve,X,Ne,b,ze]),Ce=k==="semana"||k==="lookahead",ft=k==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?reactDom.createPortal(jsxRuntime.jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsxRuntime.jsx(Qd,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:oe=>c(oe==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsxRuntime.jsx(Qd,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:oe=>c(oe==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsxRuntime.jsx(Q0,{monthLabel:I,onPrev:Wt,onNext:Ue,onToday:dt,layersOpen:N,onToggleLayers:()=>P(oe=>!oe),layersOff:T,phases:ne,phaseFilter:O,onPhaseChange:Y,locale:n,children:N?jsxRuntime.jsx(Z0,{off:T,onToggle:st}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:ft?"hidden":void 0},children:[ft?jsxRuntime.jsx(bf,{grid:X,tasks:He,items:gt,money:l,projColor:Pe,todaySerial:Be,locale:n,onTaskOpen:i}):Ce?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx(df,{grid:X,weeks:ve,tasks:He,items:gt,money:l,projColor:Pe,todaySerial:Be,locale:n,capRows:Ae,teamSize:Oe,onTaskOpen:i,onMore:(oe,fe,et)=>Re({day:oe,items:fe,tasks:et}),onCapDay:(oe,fe,et)=>{for(let Xe of Object.keys(Ae)){let kt=Ae[+Xe].capByDay.get(oe);if(kt){Te({dayLabel:fe,perPerson:kt.perPerson,anchor:et.getBoundingClientRect()});break}}}})]}):rt.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:X.weeks.map(oe=>jsxRuntime.jsx(wf,{grid:X,ws:oe.ws,we:oe.we,todaySerial:Be,showFestivos:Mt,holidaySerials:Ne,locale:n,deadlineDays:new Set},oe.ws))}),jsxRuntime.jsx(rf,{monthLabel:I,locale:n,onCreateTask:f})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:X.weeks.map(oe=>jsxRuntime.jsx(_C,{grid:X,ws:oe.ws,we:oe.we,tasks:He,items:gt,money:l,projColor:Pe,todaySerial:Be,showFestivos:Mt,holidaySerials:Ne,locale:n,onTaskOpen:i,onMore:(fe,et,Xe)=>Re({day:fe,items:et,tasks:Xe}),canReschedule:v,onDragReschedule:F,pendingGhost:Me?{uid:Me.uid,days:Math.round((Me.sim.newStart.getTime()-Me.sim.oldStart.getTime())/864e5)}:null},oe.ws))})]}),L?jsxRuntime.jsx(tf,{dayLabel:`${X.serialToDate(L.day).getDate()}`,items:L.items,tasks:L.tasks.map(oe=>({swatch:Pe,taskId:oe.id,label:oe.name,critical:oe.critical,value:l==="$"?oe.cost:`${oe.hrs}h`})),onClose:()=>Re(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,U?jsxRuntime.jsx(lf,{dayLabel:U.dayLabel,perPerson:U.perPerson,onClose:()=>Te(null),style:{position:"fixed",top:`${U.anchor.top-8}px`,left:`${U.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Me?jsxRuntime.jsx(ff,{taskName:Me.taskName,taskId:Me.sim.taskId,sim:Me.sim,busy:ce,locale:n,onConfirm:J,onCancel:()=>We(null),style:{position:"fixed",top:`${Me.anchor.top+12}px`,left:`${Math.min(Me.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),B?jsxRuntime.jsx(mf,{items:pe,money:l,projColor:Pe,onItemClick:oe=>i?.(oe),onCollapse:()=>z(false),locale:n==="en"?"en":"es"}):jsxRuntime.jsx(gf,{onExpand:()=>z(true),locale:n==="en"?"en":"es"})]}),jsxRuntime.jsx(J0,{projects:q,locale:n==="en"?"en":"es"})]})}function wf({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),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return ii(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===a&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxRuntime.jsxs("div",{className:d,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function _C({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=react.useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(R=>R.type==="deadline").map(R=>R.serial)),[n]),y=Math.max(VC,h.laneCount*Ul+36),x=react.useRef(null),[w,k]=react.useState(null),M=(R,C)=>{if(!m||!f){p?.(C);return}R.preventDefault();let N=x.current;if(!N)return;let P=N.getBoundingClientRect().width/7,T=R.clientX,V=0,O=L=>{let Re=Math.round((L.clientX-T)/P);V=Re,k({id:C,days:Re});},Y=L=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",Y),k(null),V===0){p?.(C);return}let Re=new DOMRect(L.clientX,L.clientY,0,0);f(C,V,Re);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",Y);};return jsxRuntime.jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(wf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((R,C)=>{let N=w?.id===R.t.uid?w.days:null,P=v?.uid===R.t.uid?v.days:null,T=N??P??0,V=N==null&&P!=null,O=T!==0?{...R,s:R.s+T,e:R.e+T}:R;return jsxRuntime.jsx("div",{onPointerDown:Y=>M(Y,R.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Rl,{bar:O,ws:t,money:s,projColor:o,slotH:Ul})},`b${C}`)}),h.chips.map((R,C)=>jsxRuntime.jsx(Bl,{chip:R,ws:t,slotH:Ul},`c${C}`)),h.more.map((R,C)=>jsxRuntime.jsx($l,{more:R,ws:t,slotH:Ul,onClick:()=>d(R.day,R.items,a.filter(N=>N.startSerial<=R.day&&N.endSerial>=R.day))},`m${C}`))]})]})}function qC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=react.useMemo(()=>{let m=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{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:d,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className: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:p.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:m=>{m.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:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var Cf={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 Tf(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 Nf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...Cf,...o}),[o]),[i,u]=react.useState(new Set),p=react.useRef(null),d=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{u(x=>{let w=new Set(x);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),R=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:R<7?`${R}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&&p.current){let y=p.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 x=y.target.value;r({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[di(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.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:p,children:d.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((x,w)=>{let k=i.has(x.id),M=s===x.id,R=Tf(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:R},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:di(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:R}})]}),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&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ci(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},C)),x.metadata&&Object.keys(x.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(x.metadata).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Sf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],p=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className: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:p&&di(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&ci(p)}),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:p&&p.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:m=>l(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,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(m)},m.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:u.map(m=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),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:p&&p.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(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):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 au(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 nu(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 Ef(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 Mf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function e5(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(u=>{let p=r/2,d=a/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function Pf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[u,p]=react.useState([]),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=e5(e,t,r.width,r.height,r,150);p(O);},[e,t,r]);let M=react.useCallback((O,Y)=>{r.enableDragging&&(Y.stopPropagation(),m(O));},[r.enableDragging]),R=react.useCallback(O=>{if(!d||!i.current)return;let L=i.current.getBoundingClientRect(),Re=(O.clientX-L.left-w.x)/y,U=(O.clientY-L.top-w.y)/y;p(Te=>Te.map(B=>B.id===d?{...B,x:Re,y:U,fx:Re,fy:U}:B));},[d,y,w]),C=react.useCallback(()=>{m(null);},[]),N=react.useCallback((O,Y)=>{Y.stopPropagation(),l?.({type:"node-click",node:O,position:{x:Y.clientX,y:Y.clientY}});},[l]),P=react.useCallback((O,Y)=>{Y.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:Y.clientX,y:Y.clientY}});},[l]),T=react.useCallback(O=>{let Y=u.find(L=>L.id===O);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[u]),V=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Y=O.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.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:()=>x(O=>Math.min(O+.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:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:au(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Ef(O)," ",nu(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:R,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let Y=T(typeof O.source=="string"?O.source:O.source.id),L=T(typeof O.target=="string"?O.target:O.target.id),Re=Mf(O.type),U=h===O.id,Te=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",U&&"hovered",Te&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:B=>P(O,B),children:[jsxRuntime.jsx("line",{x1:Y.x,y1:Y.y,x2:L.x,y2:L.y,stroke:au(O.type),strokeWidth:Te?r.edgeWidth*2:r.edgeWidth,strokeOpacity:U?1:.6,markerEnd:Re?"url(#arrowhead)":void 0}),r.showEdgeLabels&&U&&jsxRuntime.jsx("text",{x:(Y.x+L.x)/2,y:(Y.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:nu(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let Y=f===O.id,L=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",Y&&"hovered",L&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Re=>M(O.id,Re),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Re=>N(O,Re),children:[jsxRuntime.jsx("circle",{r:L?r.nodeSize*1.2:r.nodeSize,fill:V(O),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:Y?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.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 Af({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,u]=react.useState(null),[p,d]=react.useState(null),m=react.useRef(null),f=l||n;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await a(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(r(p),v());};return e?jsxRuntime.jsxs(sr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:v,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:p?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!"})]}),p.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:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>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},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>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})]})},x)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,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,x)=>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},x))})]})]})}),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:v,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"}),p?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 ou={"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 r5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},a5={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 n5(e,t,r){let a=ou[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 su=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=n5(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let a=r.length,n=r.reduce((p,d)=>p+d.cost,0),s=r.reduce((p,d)=>p+d.inputTokens,0),o=r.reduce((p,d)=>p+d.outputTokens,0),l=r.filter(p=>p.success),c=r.reduce((p,d)=>p+d.duration,0),i={},u={};return r.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.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)}},Wo=new su;function Bf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Wo.getStats()),[s,o]=react.useState(Wo.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Wo.getStats()),o(Wo.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=Wo.getRecentOperations(5);return jsxRuntime.jsxs(sr,{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 u=a.costsByFeature[c]||0,p=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(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},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 Hf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[u,p]=react.useState(""),[d,m]=react.useState(false),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),k=d||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let P=T=>{T.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},R=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({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){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(r(h),M());};if(!e)return null;let N=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(sr,{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 (",N,"% 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,T)=>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:["#",T+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:u,onChange:P=>p(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,T)=>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},T))})]})]})}),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:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:R,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 Gl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}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(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},R=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===b){let T=R.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:T.map(V=>V.id)}}return P}),N={...x,cards:R,columns:C};return n(N),N});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};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 x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],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 x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(R=>R!==h)}:M),k={...b,cards:x,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 x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=react.useCallback(async(h,b)=>{a(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=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:u,onColumnDelete:p},setBoard:a,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Wf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Gl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+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:""},Gf={by:"none",order:"asc"};function Vf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...pi,...e}),[s,o]=react.useState({...Gf,...t}),l=react.useCallback(v=>{n(h=>({...h,...v}));},[]),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),i=react.useCallback(()=>{n(pi),o(Gf);},[]),u=react.useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),p=react.useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),m=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(v=>{let h=[...v];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(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let R=M.endDate||M.dueDate;if(!R)return false;let C;if(typeof R=="string")C=R.split("T")[0]||R;else {let N=R.getUTCFullYear(),P=String(R.getUTCMonth()+1).padStart(2,"0"),T=String(R.getUTCDate()).padStart(2,"0");C=`${N}-${P}-${T}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let N=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),T=new Date(N);return T.setDate(T.getDate()+7),P>=N&&P<=T;case "custom":if(a.dateRange){let V=typeof R=="string"?new Date(R):R;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(x=>a.assignees.includes(x)))),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 x=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;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},R=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=R-C;break;case "dueDate":let N=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!N)return 1;if(!P)return -1;let T=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,Y=y.estimatedTime||0;x=O-Y;break;default:x=0;}return s.order==="asc"?x:-x}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var _f,Kf;if(typeof window<"u")try{let e=vi("ai");_f=e.generateObject,Kf=e.generateText;}catch{}function qf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(_f&&Kf&&e.apiKey),o=react.useCallback(async p=>{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:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),l=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),c=react.useCallback(async p=>{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(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),u=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:a}}function lu(){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 Yf(e){let{cards:t}=e,[r,a]=lu(),n=react.useCallback(p=>r.selectedCardIds.includes(p),[r.selectedCardIds]),s=react.useCallback((p,d)=>{if(!d){a({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)r.selectedCardIds.includes(p)?a({selectedCardIds:r.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});else if(f&&r.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===r.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,N)=>C.position-N.position),y=b.findIndex(C=>C.id===r.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),R=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:R,lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});},[t,r,a]),o=react.useCallback(p=>{a({selectedCardIds:r.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(p=>{r.selectedCardIds.includes(p)?o(p):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});},[r,o,a]),u=react.useCallback(()=>t.filter(p=>r.selectedCardIds.includes(p.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Xf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Jf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Xf,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((v,h,b,y,x)=>{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:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=react.useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=react.useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=react.useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=react.useCallback(async v=>{let h=t.filter(k=>k.columnId===v);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(R=>R.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(R=>R.id),columnId:v,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 R={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${R} ${M} Priority`,cardIds:k.map(C=>C.id),columnId:v,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 R=(await a.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(R.length>=n.minCardsPerStack-1){let C=[k.id,...R.map(P=>P.card.id)],N=R.reduce((P,T)=>P+T.similarity,0)/R.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${R.length+1} similar tasks`,confidence:N});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var Qf=react.createContext(null);function Zf({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}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@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 Vl(){let e=react.useContext(Qf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=Vl(),[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,x)=>{e.updateColumn(y,x);},[e]),u=react.useCallback(y=>{e.deleteColumn(y);},[e]),p=react.useCallback(y=>e.getColumn(y),[e]),d=react.useCallback(y=>{e.addCard(y);},[e]),m=react.useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),v=react.useCallback((y,x,w)=>{e.moveCard(y,x,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:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function tb(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 rb(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 jl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Gu.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);}},w5=new jl;function nb({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),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:d,className:n,children:jsxRuntime.jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,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(v,f.index)},h)})})})}function ob(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 ib({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 u=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:o,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:m,className:s,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function lb(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 cb(e,t=10){return e>t}var pu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},mu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},gu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},fu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},bu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},hu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},yu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},xu={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)"},vu={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)"},wu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ku={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}},Cu={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}},_l={spacing:pu,borderRadius:mu,fontSize:gu,fontWeight:fu,lineHeight:bu,zIndex:hu,duration:yu,easing:xu,shadows:vu,opacity:wu,kanban:ku,gantt:Cu};function db(e,t,r){return e[t]??r}function Tu(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)?Tu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function T5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Nu(e="asakaa"){let t=Tu(_l),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=T5(n);r.push(` ${s}: ${o};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function hg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Hn(e,t){let r=hg(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 wd(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 d=new Date(a);return d.setDate(d.getDate()+1),d}if(r==="yesterday"||r==="ayer"){let d=new Date(a);return d.setDate(d.getDate()-1),d}if(r==="next week"||r==="la pr\xF3xima semana"){let d=new Date(a);return d.setDate(d.getDate()+7),d}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 m={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(m!==void 0){let f=new Date(a),v=f.getDay(),h=m-v;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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),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 d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},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 d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):a.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function kd(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 Cd(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 yg(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 xg(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(),u=a[2].trim(),p=Hn(t,i),d=wd(u);if(!p)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(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.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(),u=n[2].trim(),p=Hn(t,i),d=kd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.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(),u=s[2].trim(),p=Hn(t,i),d=Cd(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,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(),u=o[2].trim(),p=Hn(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,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(),u=l[2].trim(),p=Hn(t,i),d=Hn(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName: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(),u=Hn(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 vg(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 Qw(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 Zw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function gl(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let p=r.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>gl(u,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},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:Qw(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 wg(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:Zw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function kg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>gl(a,e,t))}var Td={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"}},Nd={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"}},fl={en:Td,es:Nd};function Dd(e){return fl[e]||fl.en}function bl(e,t){let r=Dd(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 Sd=[{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 Cg(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 Tg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Cg(e),i=Sd[0],u=Sd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(Cg(m)){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(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:d(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:Sd.map(m=>{let f=m.icon;return jsxRuntime.jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.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===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function uo(e,t,r=320){let[a,n]=react.useState(false);return react.useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+r+o<=window.innerHeight,c=s.top-r-o>=0;n(!l&&c);},[t,r,e]),a}var Ed=[{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 Dg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null),c=uo(l,s,180);react.useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Ed.find(p=>p.value===e)??Ed[4],u=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",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]})]}):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(lucideReact.Flag,{className:g("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]}),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 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ed.map(p=>jsxRuntime.jsxs("button",{onClick:d=>{d.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",e===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function ri(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Md(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 xl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=react.useState(false),[c,i]=react.useState(""),u=react.useRef(null),p=react.useRef(null),d=uo(u,o);react.useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(r){if(f(h.name))r(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ri(h.name),color:h.color||Md(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};r([...e,b]);}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((h,b)=>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",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),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:u,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.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((h,b)=>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",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),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:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),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:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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((h,b)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),r(e.filter(x=>x.name!==h.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}})})]},`${h.name}-${b}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.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"}):m.map(h=>{let b=f(h.name);return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?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:y=>{b||(y.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(y.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:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ri(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function Lg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=react.useState(false),[p,d]=react.useState(n),[m,f]=react.useState(()=>{let T=n==="start"?e:t;if(T){let V=T instanceof Date?T:new Date(T);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,x]=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 T=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),react.useLayoutEffect(()=>{if(!i){x(null);return}let T=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,X=360,F=window.innerHeight-V.bottom,Fe=F<X&&V.top>F,U=Fe?V.top-4:V.bottom+4,De=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:U,left:De,flipUp:Fe});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[i]),react.useEffect(()=>{i&&d(a?n:"start");},[i,a,n]);let M=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",I=react.useCallback(()=>{let T=m.getFullYear(),V=m.getMonth(),O=new Date(T,V,1),F=new Date(T,V+1,0).getDate(),Fe=O.getDay(),U=[],B=new Date(T,V,0).getDate();for(let Me=Fe-1;Me>=0;Me--)U.push({date:new Date(T,V-1,B-Me),isCurrentMonth:false});for(let Me=1;Me<=F;Me++)U.push({date:new Date(T,V,Me),isCurrentMonth:true});let z=42-U.length;for(let Me=1;Me<=z;Me++)U.push({date:new Date(T,V+1,Me),isCurrentMonth:false});return U},[m]),C=T=>{if(a)n==="start"?r(T,k||void 0):r(w||void 0,T),u(false);else if(p==="start"){let V=k&&T>k?T:k;r(T,V||void 0),d("end");}else {let V=w&&T<w?T:w;r(V||void 0,T),u(false);}},N=()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let X=new Date(T);X.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let F=new Date(T);F.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Fe=new Date(T);Fe.setDate(T.getDate()+14);let U=new Date(T);return U.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.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:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:X,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:F,display:F.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Fe,display:Fe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:U,display:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=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(T)})]})}let P=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.jsxs("button",{ref:h,onClick:T=>{T.stopPropagation(),u(!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:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((T,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:()=>C(T.date),children:[jsxRuntime.jsx("span",{children:T.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:T.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),u(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:p==="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:m.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(m.getFullYear(),m.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(m.getFullYear(),m.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(T=>jsxRuntime.jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:T},T))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:I().map((T,V)=>{let O=T.date.toDateString()===new Date().toDateString(),X=w?.toDateString()===T.date.toDateString(),F=k?.toDateString()===T.date.toDateString(),Fe=X||F,U=!a&&w&&k&&T.date>=w&&T.date<=k;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(T.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",X&&"bg-[#00E5CC] text-white",F&&!X&&"bg-[#7C3AED] text-white",U&&!Fe&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Fe&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]}),document.body)]})}function wl({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(Lg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function hs(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 kl(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),u=react.useRef([]);return react.useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=a/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Ag(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),u=react.useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},r);},[r,e]),p=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:u,cancelChange:p}}function Rg({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(""),u=react.useRef(null),{isFlashing:p,triggerFlash:d}=hs(),{displayValue:m,isAnimating:f}=kl(e,{enabled:n,duration:300,steps:6}),v=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,I=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,I));C!==e&&(t(C),s&&d());},h=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);react.useEffect(()=>{o&&u.current&&(u.current.focus(),u.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&&d());}},[c,t,e,s,d]),y=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=m??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",p&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsxRuntime.jsx("div",{onClick:v,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]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):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:u,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",x===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:[x,"%"]})]})}function Og({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 u=()=>{l!==e&&t?.(l),o(false);},p=d=>{d.key==="Enter"?u():d.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:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.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:d=>{d.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 Wg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=react.useState(false),[p,d]=react.useState(e?.toString()||""),m=react.useRef(null),{isFlashing:f,triggerFlash:v}=hs(),{displayValue:h,isAnimating:b}=kl(e,{enabled:l&&!i});react.useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),react.useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);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&&v());}u(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),u(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:m,type:"number",value:p,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,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(),u(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 zg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=react.useState(false),c=react.useRef(null),i=uo(c,o,220);return react.useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[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:u=>{u.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 left-0 "+(i?"bottom-full mb-1 ":"top-full 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(u=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),r(u),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===u&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:u}),e===u&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function Vg({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:u}=Ag(t,{delay:s}),p=m=>{m.stopPropagation(),!a&&t&&(n?l?u():i(!e):t(!e));},d=l?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:p,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]",d?"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&&d&&"ring-green-500/50",l&&!d&&"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:d?"#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"}):d?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:m=>{m.stopPropagation(),u();},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 jg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=react.useState(false),u=react.useRef(null),p=uo(u,c,220);react.useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||r(x);},h=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:u,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.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:f}),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 left-0 "+(p?"bottom-full mb-1 ":"top-full 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(b=>{let y=e.includes(b),x=!y&&h;return jsxRuntime.jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:b}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function zk(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 qg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=zk(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 Jg({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 jk(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 _k(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 Ra({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:u}){let[p,d]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:h,triggerFlash:b}=hs(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:jk(e,a);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.useEffect(()=>{if(e){let C=Math.floor(e/60),N=e%60;C>0&&N>0?f(`${C}h ${N}m`):C>0?f(`${C}h`):f(`${N}m`);}else f("");},[e,p]);let k=()=>{let C=_k(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(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 I=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(I,{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})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.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:C=>{C.stopPropagation(),d(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(I,{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 t0({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 a0({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",u=l==="financial"&&c>0,p=U=>u?`$${Math.round(U*c).toLocaleString("en-US")}`:`${U}h`,[d,m]=react.useState(false),[f,v]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,I=Math.round(w/60*10)/10,C=w>0?x/w*100:0,N=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let U=De=>{y.current&&!y.current.contains(De.target)&&(v(false),b(null));};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[f,h]);let T=U=>{if(U.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){v(De=>!De),b(null);return}o&&o(e);},V=U=>{v(false),b(U);},O=async(U,De)=>{h==="log"&&a&&U?a(e,U,De):h==="estimate"&&n?n(e,U):h==="quoted"&&s&&s(e,U),b(null);},X=a||n||s||o,F=[{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(U=>U.show),Fe=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:U=>U.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&X&&jsxRuntime.jsx("button",{onClick:T,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:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.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:F.map(U=>jsxRuntime.jsxs("button",{onClick:De=>{De.stopPropagation(),V(U.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:De=>{De.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:De=>{De.target.style.background="transparent";},children:[jsxRuntime.jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.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(Tn,{mode:h,locale:r,isDark:t,currentValue:Fe||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:U=>U.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(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 U=x===0,B=(w>0?x/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:U?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(I)]}),N>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(N)," ",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(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),X&&jsxRuntime.jsx("button",{onClick:T,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.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:F.map(U=>jsxRuntime.jsxs("button",{onClick:De=>{De.stopPropagation(),V(U.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:De=>{De.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:De=>{De.target.style.background="transparent";},children:[jsxRuntime.jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.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(Tn,{mode:h,locale:r,isDark:t,currentValue:Fe||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Zk(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 e1(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 n0({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 o0({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=Zk(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsxRuntime.jsx(n0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}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?e1(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(n0,{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 t1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function i0({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",t1[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function b1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function h1(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 g0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?d0.es:d0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),T=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-T&&(O=Math.max(T,e.y-P.height)),e.x+P.width>window.innerWidth-T&&(V=Math.max(T,window.innerWidth-P.width-T)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),react.useEffect(()=>{let N=T=>{b.current&&!b.current.contains(T.target)&&t();},P=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:y.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),l&&(N.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();}}]}),N.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();}}]}),u.length>0&&N.push({id:"assign",label:y.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:u.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 T=e.task.assignees||[],O=T.some(X=>X.name===P.name)?T.filter(X=>X.name!==P.name):[...T,{name:P.name,initials:b1(P.name),color:P.color||h1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&N.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&N.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&&N.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return i&&(N.push({id:"sort-asc",label:y.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.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"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:y.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},I=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:I.map(N=>N.separator?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsxRuntime.jsx(y1,{item:N,isDark:r},N.id):jsxRuntime.jsxs("button",{onClick:N.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",N.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:g(N.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function y1({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 d0={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 k0={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"})},R1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function T0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=react.useState(""),[p,d]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),h=c==="es"?C0.es:C0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let X=P.getBoundingClientRect();f({top:X.bottom+4,right:window.innerWidth-X.right});}let T=v.current.getBoundingClientRect(),O=window.innerHeight-T.top-20;d(Math.max(300,O));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),react.useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},T=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let b=react.useMemo(()=>{let N=new Set([...R1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&N.add(P.type);}),Array.from(N)},[r]);if(!e)return null;let y=N=>{let P=h.columns[N];if(P)return P;let T=r.find(V=>V.type===N);return T?.label?T.label:N},x=N=>{if(N==="name")return;let P=r.map(T=>T.id===N?{...T,visible:!T.visible}:T);n(P);},w=(N,P)=>{let T=r.find(O=>O.type===N&&(!P||O.customFieldId===P));if(T){x(T.id);return}let V={id:P||N,type:N,label:P?a.find(O=>O.id===P)?.name||N:y(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&y(N).toLowerCase().includes(i.toLowerCase())),I=a.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxRuntime.jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.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:N=>{N.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.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:N=>u(N.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:N=>{N&&N.style.setProperty("--focus-border",C);},onFocus:N=>{N.currentTarget.style.borderColor=C,N.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.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:N=>N.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(N=>{let P=r.find(O=>O.type===N&&!O.customFieldId),T=P?.visible??false,V=N==="name";return jsxRuntime.jsxs("button",{onClick:()=>{V||(P?x(P.id):w(N));},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:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?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(N),children:y(N)})]},N)})})]}),I.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:I.map(N=>{let T=r.find(V=>V.customFieldId===N.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(N.type,N.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:N.name})]},N.id)})})]})]})]})}var C0={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 V1=[{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 S0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,u]=react.useState([""]),p=n==="es"?D0.es:D0.en;react.useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),react.useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(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:p.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:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.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:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:V1.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:p.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:p.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:`${p.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:()=>v(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:m,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"}),p.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:p.cancel}),jsxRuntime.jsx("button",{onClick:d,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:p.create})]})]})]}):null}var D0={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 P0={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 F0({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),u=s==="es"?P0.es:P0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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",d&&(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"}),u.filters,d&&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:u.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.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"}):m.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(m.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?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.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 m=!t;a(m),m&&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:u.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function L0(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 fo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function A0({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,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>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:fo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});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:fo(i)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});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:fo(u)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),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(v,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=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:[m>=0?"+":"",fo(m),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=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:[p>=0?`+${fo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${fo(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=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:L0(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:L0(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:`${u}%`,backgroundColor:m}})})]})]})})(),(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,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${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]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),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 u=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:u}})})]},`${c.name}-${i}`)})})]})]})}var oC=[{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 W0(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(...W0(n.subtasks,t+1,s));}return a}function sC(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 u=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;a+=p,n++;}return n>0?a/n:null}function Cs(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=Cs(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 ks(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 iC({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 U0(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 u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}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 qd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?qd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function z0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:I=true,showCreateTaskButton:C=false,onCreateTask:N,persistFilter:P=false,financialBlur:T,healthSidebar:V,lens:O="hours",hourlyRate:X=0,rateMap:F,aggregateParentHours:Fe=false,showProjectTotals:U=false,totalsDollarOverride:De}=t,B=bl(f,v),z=m==="dark",Me=S=>{if(!F||!S.assignees||S.assignees.length===0)return X;let Y=0,re=0;for(let Ce of S.assignees){let We=Ce.id?F[Ce.id]:void 0;if(We==null||We<=0)continue;let oe=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;oe>0&&(Y+=We*oe,re+=oe);}if(re>0)return Y/re;let xe=S.assignees.map(Ce=>Ce.id?F[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return xe.length===0?X:xe.reduce((Ce,We)=>Ce+We,0)/xe.length},Ue=S=>{let Y=0,re=0,xe=0,Ce=We=>{for(let oe of We)if(oe.subtasks&&oe.subtasks.length>0){let Te={s:Y,a:re,q:xe};if(Ce(oe.subtasks),Y-Te.s+(re-Te.a)+(xe-Te.q)===0){let at=Me(oe);Y+=(oe.timeLoggedMinutes??0)/60*at,re+=(oe.effortMinutes??0)/60*at,xe+=(oe.soldEffortMinutes??0)/60*at;}}else {let Te=Me(oe);Y+=(oe.timeLoggedMinutes??0)/60*Te,re+=(oe.effortMinutes??0)/60*Te,xe+=(oe.soldEffortMinutes??0)/60*Te;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:Y,dollarAllocated:re,dollarQuoted:xe}},ce=react.useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let Y=JSON.parse(S);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),Le=react.useMemo(()=>{function S(Y){let re=0,xe=0,Ce=0,We=0,oe=0,Te=0;for(let Ke of Y)if(Ke.subtasks&&Ke.subtasks.length>0){let at=S(Ke.subtasks);if(at.spent+at.allocated+at.quoted>0)re+=at.spent,xe+=at.allocated,Ce+=at.quoted,We+=at.dollarSpent,oe+=at.dollarAllocated,Te+=at.dollarQuoted;else {let mt=Ke.timeLoggedMinutes??0,gt=Ke.effortMinutes??0,mr=Ke.soldEffortMinutes??0;re+=mt,xe+=gt,Ce+=mr;let kr=Me(Ke);We+=mt/60*kr,oe+=gt/60*kr,Te+=mr/60*kr;}}else {let at=Ke.timeLoggedMinutes??0,nt=Ke.effortMinutes??0,mt=Ke.soldEffortMinutes??0;re+=at,xe+=nt,Ce+=mt;let gt=Me(Ke);We+=at/60*gt,oe+=nt/60*gt,Te+=mt/60*gt;}return {spent:re,allocated:xe,quoted:Ce,dollarSpent:We,dollarAllocated:oe,dollarQuoted:Te}}return S(e)},[e]),J=react.useMemo(()=>{let S=new Map;function Y(re){let xe=0;for(let Ce of re)if(Ce.subtasks&&Ce.subtasks.length>0){let We=Y(Ce.subtasks);S.set(Ce.id,We),xe+=We;}else xe+=Ce.weight||0;return xe}return Y(e),S},[e]),Pe=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Le.spent,totalHoursAllocatedMinutes:Le.allocated}},[V,Le]),[Ee,$e]=react.useState(true),[He,et]=react.useState(null),[se,_e]=react.useState("position"),[qe,Re]=react.useState("asc"),[ut,Et]=react.useState(""),[Ge,Ie]=react.useState(()=>ce().statusFilter),[dt,Mt]=react.useState(()=>ce().hideCompleted),[Be,vt]=react.useState(y||oC),[L,Q]=react.useState(false),[R,_]=react.useState(false),[ue,ve]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Oe,ye]=react.useState(null),[ft,ie]=react.useState(false),[ge,Ze]=react.useState(null),[Xe,kt]=react.useState(null),[Je,At]=react.useState(null),Yt=react.useRef(0),pr=react.useRef(false),It=!!(r.onTaskMove||r.onTaskReparent),[Ur,Ht]=react.useState(null),[vr,jt]=react.useState(null),or=S=>{let Y=S.type;return S.customFieldId?Y==="file"?null:{kind:"customField",fieldId:S.customFieldId}:Y==="assignees"||Y==="teamLoad"?"assignees":Y==="startDate"?"startDate":Y==="endDate"?"endDate":null},ha=(S,Y)=>typeof S=="string"||typeof Y=="string"?S===Y:S.fieldId===Y.fieldId,pa=react.useRef([]),tt=react.useCallback((S,Y)=>{It&&(Y.preventDefault(),Yt.current=Y.clientY,ye(S),pr.current=false,ie(false),At({x:Y.clientX,y:Y.clientY}));},[It]),Ye=react.useCallback(S=>{if(!Oe||(Math.abs(S.clientY-Yt.current)>5&&!pr.current&&(pr.current=true,ie(true)),At({x:S.clientX,y:S.clientY}),!pr.current))return;let re=document.querySelectorAll("[data-listview-row]"),xe=null,Ce=null;re.forEach(We=>{let oe=We.getBoundingClientRect(),Te=We.getAttribute("data-listview-row");if(Te&&Te!==Oe&&S.clientY>=oe.top&&S.clientY<=oe.bottom){xe=Te;let Ke=S.clientY-oe.top,at=oe.height;Ce=Ke<at*.25?"above":Ke>at*.75?"below":"child";}}),Ze(xe),kt(Ce);},[Oe]),ea=react.useCallback(()=>{if(pr.current&&Oe&&ge&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Oe,ge);else if(Xe==="above"||Xe==="below"){let S=(xe,Ce,We=null)=>{for(let oe of xe){if(oe.id===Ce)return We;if(oe.subtasks){let Te=S(oe.subtasks,Ce,oe.id);if(Te!==void 0)return Te}}},Y=S(e,Oe,null),re=S(e,ge,null);if(r.onTaskReparent){let xe=(at,nt)=>{if(nt===null)return at;for(let mt of at){if(mt.id===nt)return mt.subtasks||[];if(mt.subtasks){let gt=xe(mt.subtasks,nt);if(gt.length>0||mt.subtasks.some(mr=>mr.id===nt))return gt}}return []},Ce=xe(e,re??null),We=Ce.findIndex(at=>at.id===ge),oe=Y===re,Te=oe?Ce.findIndex(at=>at.id===Oe):-1,Ke=Xe==="below"?We+1:We;oe&&Te!==-1&&Te<We&&(Ke-=1),r.onTaskReparent(Oe,re??null,Math.max(0,Ke));}}}ye(null),Ze(null),kt(null),At(null),pr.current=false,ie(false);},[Oe,ge,Xe,e,r]),_r=(S,Y)=>typeof Y!="string"?S.customFields?.find(xe=>xe.fieldId===Y.fieldId)?.value:Y==="assignees"?S.assignees:Y==="startDate"?S.startDate:S.endDate,sa=(S,Y,re,xe)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ce.map(yt=>yt.getAttribute("data-listview-row")||""),oe=Math.max(0,We.indexOf(Y)),Te=yt=>We.slice(oe,yt+1);jt({sourceTaskId:Y,column:re,sourceIndex:xe,targetIndex:xe,rangeIds:new Set([Y])});let at=(yt=>{let Ft=yt?.parentElement??null;for(;Ft;){let Ta=window.getComputedStyle(Ft).overflowY;if((Ta==="auto"||Ta==="scroll")&&Ft.scrollHeight>Ft.clientHeight)return Ft;Ft=Ft.parentElement;}let Lr=document.scrollingElement;return Lr&&Lr.scrollHeight>Lr.clientHeight?Lr:null})(S.currentTarget),nt=yt=>{let Ft=oe,Lr=false;Ce.forEach((Ta,Cr)=>{let Yr=Ta.getBoundingClientRect();yt>=Yr.top&&yt<=Yr.bottom&&(Ft=Cr,Lr=true);});let xa=Ce[Ce.length-1];if(!Lr&&xa){let Ta=xa.getBoundingClientRect();yt>Ta.bottom&&(Ft=Ce.length-1);}return Ft<oe&&(Ft=oe),Ft},mt=S.clientY,gt=null,mr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},kr=()=>{let yt=nt(mt),Ft=new Set(Te(yt));jt(Lr=>Lr&&{...Lr,targetIndex:yt,rangeIds:Ft});},zr=()=>{if(mr(),!at)return;let yt=at,Lr=yt===document.scrollingElement?{top:0,bottom:window.innerHeight}:yt.getBoundingClientRect(),xa=60,Ta=12,Cr=mt-Lr.top,Yr=Lr.bottom-mt,vo=yt.scrollHeight-yt.clientHeight;if(Yr<xa&&yt.scrollTop<vo){let Ss=Math.max(1,Math.round(Ta*(1-Math.max(0,Yr)/xa))),wo=()=>{yt.scrollTop+=Ss,kr(),yt.scrollTop<yt.scrollHeight-yt.clientHeight&&(gt=requestAnimationFrame(wo));};gt=requestAnimationFrame(wo);}else if(Cr<xa&&yt.scrollTop>0){let Ss=Math.max(1,Math.round(Ta*(1-Math.max(0,Cr)/xa))),wo=()=>{yt.scrollTop-=Ss,kr(),yt.scrollTop>0&&(gt=requestAnimationFrame(wo));};gt=requestAnimationFrame(wo);}},Ut=yt=>{mt=yt.clientY,kr(),zr();},Gt=yt=>{window.removeEventListener("mousemove",Ut),window.removeEventListener("mouseup",Gt),mr(),document.body.style.cursor="",document.body.style.userSelect="",jt(null);let Ft=nt(yt.clientY),Lr=new Map(pa.current.map(Yr=>[Yr.id,Yr])),xa=Lr.get(Y);if(!xa)return;let Ta=_r(xa,re),Cr=[];for(let Yr of Te(Ft)){if(Yr===Y)continue;let vo=Lr.get(Yr);vo&&(vo.subtasks&&vo.subtasks.length>0||Cr.push(Yr));}Cr.length>0&&r.onBulkFill?.(Cr,re,Ta);};window.addEventListener("mousemove",Ut),window.addEventListener("mouseup",Gt);},wr=S=>vr?vr.rangeIds.has(S):false;react.useEffect(()=>{if(Oe)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",ea),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",ea),document.body.style.cursor="",document.body.style.userSelect="";}},[Oe,Ye,ea]);let[Wr,le]=react.useState("all"),[de,pt]=react.useState(false),j=react.useRef(null),be=react.useRef(null),te=react.useMemo(()=>{let S=0;function Y(re,xe){for(let Ce of re)xe>S&&(S=xe),Ce.subtasks?.length&&Y(Ce.subtasks,xe+1);}return Y(e,1),S},[e]);react.useEffect(()=>{if(!de)return;let S=Y=>{j.current?.contains(Y.target)||be.current?.contains(Y.target)||pt(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),react.useEffect(()=>{if(Wr==="all"){let re=function(xe){for(let Ce of xe)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),re(Ce.subtasks));};re(e);}else {let re=function(xe,Ce){for(let We of xe)if(We.subtasks?.length){let oe=Ce<Wr,Te=We.isExpanded!==false;oe!==Te&&r.onTaskToggleExpand?.(We.id),re(We.subtasks,Ce+1);}};re(e,1);}},[Wr]);let[$,ee]=react.useState(null),[ke,D]=react.useState(0),[W,pe]=react.useState(0),we=react.useRef(null),[rt,fe]=react.useState(null),[q,it]=react.useState(null);react.useEffect(()=>{y&&vt(S=>{if(S.length===y.length){let Y=true;for(let re=0;re<S.length;re++){let xe=S[re],Ce=y[re];if(!xe||!Ce||xe.id!==Ce.id||xe.visible!==Ce.visible||xe.width!==Ce.width||xe.label!==Ce.label){Y=false;break}}if(Y)return S}return y});},[y]),react.useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Ge,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,Ge,dt]);let bt=react.useMemo(()=>{let S=new Set;function Y(re){for(let xe of re)xe.subtasks?.length&&(xe.isExpanded!==false&&S.add(xe.id),Y(xe.subtasks));}return Y(e),S},[e]),Pt=react.useMemo(()=>Be.filter(S=>S.visible),[Be]),Zt=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ya=react.useCallback(S=>{se===S?Re(Y=>Y==="asc"?"desc":"asc"):(_e(S),Re("asc")),r.onSortChange?.({column:S,direction:qe==="asc"?"desc":"asc"});},[se,qe,r]),Kr=react.useCallback(S=>{vt(S),r.onColumnsChange?.(S);},[r]),Za=react.useCallback(S=>{let Y=Be.map(re=>re.id===S?{...re,visible:false}:re);Kr(Y);},[Be,Kr]),er=react.useCallback((S,Y)=>{_e(S),Re(Y);},[]),yo=react.useCallback((S,Y,re)=>{I&&(S.preventDefault(),ve({isOpen:true,x:S.clientX,y:S.clientY,type:Y?"task":"header",task:Y,columnId:re}));},[I]),Vn=react.useCallback(()=>{ve(S=>({...S,isOpen:false}));},[]),Wa=react.useCallback((S,Y)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let re=Be.find(xe=>xe.id===Y);re&&(ee(Y),D(S.clientX),pe(re.width));},[Be,M]);react.useEffect(()=>{if(!$)return;let S=Be,Y=xe=>{let Ce=xe.clientX-ke,We=Math.max(50,W+Ce);S=S.map(oe=>oe.id===$?{...oe,width:We}:oe),vt(S);},re=()=>{r.onColumnsChange?.(S),ee(null);};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",re);}},[$,ke,W,r]);let jn=react.useCallback((S,Y)=>{if(Y==="name"){S.preventDefault();return}fe(Y),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Y),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),_n=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),fe(null),it(null);},[]),bi=react.useCallback((S,Y)=>{S.preventDefault(),Y!=="name"&&(S.dataTransfer.dropEffect="move",it(Y));},[]),_o=react.useCallback(()=>{it(null);},[]),hi=react.useCallback((S,Y)=>{if(S.preventDefault(),!rt||rt===Y||Y==="name")return;let re=[...Be],xe=re.findIndex(oe=>oe.id===rt),Ce=re.findIndex(oe=>oe.id===Y);if(xe===-1||Ce===-1)return;let We=re.splice(xe,1);We[0]&&(re.splice(Ce,0,We[0]),Kr(re),fe(null),it(null));},[rt,Be,Kr]),qr=react.useCallback(async S=>{if(r.onCreateCustomField){let Y={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(Y);}_(false);},[r]),xo=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=W0(e);if(ut.trim()){let Y=ut.toLowerCase();S=S.filter(re=>re.name.toLowerCase().includes(Y));}if(Ge!=="all"){let Y=new Set(S.filter(re=>xo(re)===Ge).flatMap(re=>re.parentPath));S=S.filter(re=>Y.has(re.id));}if(dt){let Y=new Set(S.filter(re=>xo(re)!=="completed").flatMap(re=>re.parentPath));S=S.filter(re=>Y.has(re.id));}return S.sort((Y,re)=>{let xe,Ce;switch(se){case "name":xe=Y.name.toLowerCase(),Ce=re.name.toLowerCase();break;case "startDate":xe=Y.startDate?.getTime()||0,Ce=re.startDate?.getTime()||0;break;case "endDate":xe=Y.endDate?.getTime()||0,Ce=re.endDate?.getTime()||0;break;case "progress":xe=Y.progress||0,Ce=re.progress||0;break;case "status":xe=Y.status||"todo",Ce=re.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};xe=We[Y.priority]??4,Ce=We[re.priority]??4;break;case "position":return 0;default:return 0}return xe<Ce?qe==="asc"?-1:1:xe>Ce?qe==="asc"?1:-1:0}),S},[e,ut,Ge,dt,se,qe,xo]);pa.current=ma;let za=react.useCallback((S,Y)=>{let re=We=>{r.onTaskUpdate?.({...S,...We});},xe=We=>We?S.customFields?.find(Te=>Te.fieldId===We)?.value:void 0,Ce=(We,oe)=>{if(!We)return;let Ke=[...S.customFields||[]],at=Ke.findIndex(nt=>nt.fieldId===We);at>=0?Ke[at]={fieldId:We,value:oe}:Ke.push({fieldId:We,value:oe}),re({customFields:Ke});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(Tg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:oe=>{re({status:oe,progress:oe==="completed"?100:oe==="in-progress"?50:0});},isDark:z,locale:f,translations:B.status});case "priority":return jsxRuntime.jsx(Dg,{value:S.priority,onChange:oe=>re({priority:oe}),isDark:z,locale:f});case "assignees":{let oe=S.hasChildren,Te=S.assignees||[];if(oe&&S.subtasks?.length){let Ke=new Map,at=nt=>{(nt||[]).forEach(mt=>{(mt.assignees||[]).forEach(gt=>{Ke.has(gt.name)||Ke.set(gt.name,gt);}),mt.subtasks?.length&&at(mt.subtasks);});};at(S.subtasks),Te=Array.from(Ke.values());}else oe&&(Te=[]);return jsxRuntime.jsx(xl,{value:Te,availableUsers:l,onChange:Ke=>re({assignees:Ke}),isDark:z,locale:f,disabled:oe})}case "startDate":return jsxRuntime.jsx(wl,{value:S.startDate,onChange:oe=>re({startDate:oe}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(wl,{value:S.endDate,onChange:oe=>re({endDate:oe}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let oe=!!(S.subtasks&&S.subtasks.length>0),Te=oe?U0(qd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Rg,{value:Te,onChange:oe?void 0:Ke=>{let at=Ke===100?"completed":Ke>0?"in-progress":"todo";re({progress:Ke,status:at});},isDark:z,disabled:oe})}case "tags":return jsxRuntime.jsx(Jg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Og,{value:xe(Y.customFieldId)||"",onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "number":return jsxRuntime.jsx(Wg,{value:xe(Y.customFieldId)||0,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "date":let We=xe(Y.customFieldId);return jsxRuntime.jsx(wl,{value:We?new Date(We):void 0,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(zg,{value:xe(Y.customFieldId)||"",options:Y.options||[],onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "checkbox":return jsxRuntime.jsx(Vg,{value:xe(Y.customFieldId)||false,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "multiselect":return jsxRuntime.jsx(jg,{value:xe(Y.customFieldId)||[],options:Y.options||[],onChange:oe=>Ce(Y.customFieldId,oe),isDark:z,maxSelectable:Y.maxSelectable});case "person":{let oe=xe(Y.customFieldId)||[];return jsxRuntime.jsx(xl,{value:oe.map(Te=>({name:Te.name,avatar:Te.avatar,initials:Te.initials||(Te.name||"?").slice(0,2).toUpperCase(),color:Te.color||"#00E5CC"})),availableUsers:l,onChange:Te=>Ce(Y.customFieldId,Te),isDark:z,locale:f})}case "file":return jsxRuntime.jsx(qg,{value:xe(Y.customFieldId),isDark:z,onOpen:oe=>{oe.url&&window.open(oe.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let oe=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ra,{value:S.estimatedTime,onChange:Te=>re({estimatedTime:Te}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S)})}case "quotedTime":{let oe=S.status==="completed"||S.progress===100,Te=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(Ra,{value:S.quotedTime,onChange:Ke=>re({quotedTime:Ke}),isDark:z,locale:f,disabled:oe,isBlurred:Te,lens:O,hourlyRate:Me(S)})}case "elapsedTime":{let oe=S.status==="completed"||S.progress===100,Te=S.executedDollarsCanonical;return jsxRuntime.jsx(Ra,{value:S.elapsedTime,onChange:Ke=>re({elapsedTime:Ke}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S),financialOverride:Te})}case "effortMinutes":{if(Fe&&S.subtasks&&S.subtasks.length>0){let{allocated:nt}=Cs(S);if(O==="financial"){let mt=Ue(S),gt=Math.round(mt.dollarAllocated),mr=Math.round(mt.dollarQuoted),kr=mr-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,kr!==0&&gt>0&&mr>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",kr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[kr>0?"+":"",Math.abs(kr)>=1e3?`$${(kr/1e3).toFixed(1)}K`:`$${kr}`]})]})}return jsxRuntime.jsx(Ra,{value:nt>0?nt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:X})}let oe=S.status==="completed"||S.progress===100,Te=S.effortMinutes||0,Ke=S.soldEffortMinutes||0,at=Me(S);if(O==="financial"&&at&&Te>0&&Ke>0){let nt=Math.round(Te/60*at),gt=Math.round(Ke/60*at)-nt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ra,{value:Te,onChange:mr=>re({effortMinutes:mr}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(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(Ra,{value:Te,onChange:nt=>re({effortMinutes:nt}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S)})}case "timeLoggedMinutes":{let oe=S.executedDollarsCanonical;if(Fe&&S.subtasks&&S.subtasks.length>0){let{spent:Ke}=Cs(S);return jsxRuntime.jsx(Ra,{value:Ke>0?Ke:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S),financialOverride:oe})}let Te=S.status==="completed"||S.progress===100;return jsxRuntime.jsx(Ra,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Ke=>{r.onLogTime?.(S,Ke);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Te,lens:O,hourlyRate:Me(S),financialOverride:oe})}case "soldEffortMinutes":{if(Fe&&S.subtasks&&S.subtasks.length>0){let{quoted:Ke}=Cs(S),at=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ra,{value:Ke>0?Ke:void 0,isDark:z,locale:f,disabled:true,isBlurred:at,lens:O,hourlyRate:Me(S)})}let oe=S.status==="completed"||S.progress===100,Te=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Ra,{value:S.soldEffortMinutes,onChange:Ke=>re({soldEffortMinutes:Ke}),isDark:z,locale:f,disabled:oe,isBlurred:Te,lens:O,hourlyRate:Me(S)})}case "scheduleVariance":{let oe=S.effortMinutes||0,Te=S.soldEffortMinutes||0,Ke=S.timeLoggedMinutes||0,at=oe>0||Te>0||Ke>0;return jsxRuntime.jsx(t0,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(Fe&&S.hasChildren){let{spent:oe,allocated:Te,quoted:Ke}=Cs(S),at=oe>Te&&Te>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:ks(oe)}),Te>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ks(Te)})]}),Ke>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ks(Ke)})]})]})}return jsxRuntime.jsx(a0,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:O,hourlyRate:Me(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsxRuntime.jsx(o0,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Te=>{r.onTaskUpdate?.({...S,assignees:Te});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(i0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let oe=J.get(S.id);if(oe!==void 0)return jsxRuntime.jsx("span",{className:g("text-xs font-mono",oe>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?`${Number(oe.toFixed(2))}%`:"\u2014"});let Te=S.weight||0;return jsxRuntime.jsx(iC,{value:Te,onChange:Ke=>re({weight:Ke}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,B,Fe,J]),en=react.useCallback(S=>{let re={name:B.columns.name,status:B.columns.status,priority:B.columns.priority,assignees:B.columns.assignees,startDate:B.columns.startDate,endDate:B.columns.endDate,progress:B.columns.progress,tags:B.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:B.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:B.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:B.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:B.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:B.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:B.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:B.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:B.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:B.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:B.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:B.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof re=="string"?re:String(re||S.type)},[B,f]),Kn=react.useMemo(()=>{let re=Pt.reduce((Ce,We)=>Ce+We.width,0)+(k?48:0),xe={};for(let Ce of Pt)xe[Ce.id]=`${Ce.width/re*100}%`;return xe},[Pt,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:[B.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:B.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:B.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:we,className:g(z?"bg-[#0D0D0D]":"bg-white",$&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let S=!!t.toolbarContainer,Y=jsxRuntime.jsx("div",{className:S?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:S?"flex items-center gap-2":"flex items-center gap-4",children:[jsxRuntime.jsx("div",{className:g("text-sm whitespace-nowrap",z?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let re=ma.filter(We=>(We.subtasks?.length??0)>0).length,xe=ma.length-re,Ce=f==="es";return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[xe," ",B.pagination.tasks,re>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" \xB7 ",re," ",Ce?re===1?"tarea padre":"tareas padre":re===1?"parent task":"parent tasks"]})]})})()}),h&&!S&&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:ut,onChange:re=>Et(re.target.value),placeholder:B.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")})]}),!S&&jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&te>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:j,onClick:()=>pt(!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"}),Wr==="all"?f==="es"?"Todos":"All":`L${Wr}`]}),de&&jsxRuntime.jsx("div",{ref:be,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(te,5)},(re,xe)=>({value:xe+1,label:`L${xe+1}`}))].map(re=>jsxRuntime.jsxs("button",{onClick:()=>{le(re.value),pt(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?Wr===re.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Wr===re.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:re.label}),Wr===re.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(re.value)))})]}),jsxRuntime.jsx(F0,{value:Ge,hideCompleted:dt,onChange:Ie,onHideCompletedChange:Mt,isDark:z,locale:f}),Pe?.enabled&&Pe.data&&!Ee&&jsxRuntime.jsx("button",{onClick:()=>$e(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,C&&N&&!S&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:N,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:B.toolbar.newTask})]})]})});return S?reactDom.createPortal(Y,t.toolbarContainer):Y})(),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:[It&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(S=>{let Y=S.id!=="name",re=q===S.id&&rt!==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",Y&&"cursor-grab",S.type!=="name"&&"justify-center",rt===S.id&&"opacity-50",re&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Kn[S.id],minWidth:S.minWidth},draggable:Y,onDragStart:Y?xe=>jn(xe,S.id):void 0,onDragEnd:Y?_n:void 0,onDragOver:Y?xe=>bi(xe,S.id):void 0,onDragLeave:Y?_o:void 0,onDrop:Y?xe=>hi(xe,S.id):void 0,onContextMenu:xe=>yo(xe,void 0,S.id),children:[Y&&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")}),u?jsxRuntime.jsxs("button",{draggable:false,onClick:xe=>{let Ce=xe.currentTarget.getBoundingClientRect();u(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[en(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,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:()=>ya(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[en(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,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:[en(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:xe=>Wa(xe,S.id),children:jsxRuntime.jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",$===S.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},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(),Q(Y=>!Y);},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",L&&(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(T0,{isOpen:L,onClose:()=>Q(false),columns:Be,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Kr,onCreateCustomField:()=>{Q(false),_(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:ma.map((S,Y)=>{let re=bt.has(S.id),xe=Math.min(Y*.01,.2),Ce=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(Ce){let{spent:mt,allocated:gt,quoted:mr}=Cs(S),kr=sC(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:xe},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",He===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[It&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(zr=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",zr.type!=="name"&&"justify-center"),style:{width:Kn[zr.id],minWidth:zr.minWidth},children:zr.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:Ut=>{Ut.stopPropagation(),Zt(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:re?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:Ut=>{Ut.stopPropagation(),Zt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:re?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",")"]}),kr!==null&&x&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",kr>=1?"text-[#32D74B] bg-[#32D74B]/10":kr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",kr.toFixed(2)]})]})]}):zr.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Ut=S.executedDollarsCanonical,Gt=Ut!=null?Math.round(Ut):Math.round(Ue(S).dollarSpent);return Gt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Gt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ra,{value:mt>0?mt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):zr.type==="soldEffortMinutes"?O==="financial"?(()=>{let Ut=Ue(S),Gt=Math.round(Ut.dollarQuoted);return Gt>0?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Gt.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Ra,{value:mr>0?mr:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):zr.type==="effortMinutes"?O==="financial"?(()=>{let Ut=Ue(S),Gt=Math.round(Ut.dollarAllocated),yt=Math.round(Ut.dollarQuoted),Ft=yt-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,Ft!==0&&Gt>0&&yt>0&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})})():jsxRuntime.jsx(Ra,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):za(S,zr)},zr.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let oe=Oe===S.id,Te=ge===S.id,Ke=Te&&Xe==="above",at=Te&&Xe==="below",nt=Te&&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:xe},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",He===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:oe?.4:1,backgroundColor:nt?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:nt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:mt=>yo(mt,S),onMouseEnter:()=>Ht(S.id),onMouseLeave:()=>Ht(mt=>mt===S.id?null:mt),children:[Ke&&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}}),It&&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:mt=>tt(S.id,mt),style:{color:z?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Pt.map(mt=>{let gt=!!(S.subtasks&&S.subtasks.length>0),mr=or(mt),zr=!!mr&&!gt&&Ur===S.id&&!vr,Ut=!!vr&&!!mr&&ha(vr.column,mr)&&wr(S.id);return jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",mt.type!=="name"&&"justify-center"),style:{width:Kn[mt.id],minWidth:mt.minWidth,position:"relative",backgroundColor:Ut?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ut?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:mt.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:Gt=>{Gt.stopPropagation(),Zt(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:re?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})]})]}):zr&&mr?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[za(S,mt),jsxRuntime.jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Gt=>sa(Gt,S.id,mr,Y),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}})]}):za(S,mt)},mt.id)}),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),U&&ma.length>0&&(()=>{let{spent:S,allocated:Y,quoted:re}=Le,xe=Y-S,Ce=xe<0,We=Ce?`+${ks(Math.abs(xe))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ks(xe)} ${f==="es"?"AHORRADO":"SAVED"}`,oe=O==="financial"&&X>0,Te=De?.breakdown,Ke=!!Te&&((Te.equipment??0)>0||(Te.travel??0)>0),at=Te?.laborSpent!=null?Te.laborSpent:De?.spent!=null?De.spent:Le.dollarSpent,nt=Te?.laborAllocated!=null?Te.laborAllocated:De?.allocated!=null?De.allocated:Le.dollarAllocated,mt=De?.quoted!=null?De.quoted:Le.dollarQuoted,gt=(Ut,Gt)=>{if(oe){let yt=Gt??Ut/60*X;return `$${Math.round(yt).toLocaleString("es-CO")}`}return ks(Ut)},mr=oe?Math.abs(nt-at):0,kr=oe?`+$${mr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,zr=oe&&Ke?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:[It&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(Ut=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Ut.type!=="name"&&"justify-center"),style:{width:Kn[Ut.id],minWidth:Ut.minWidth},children:Ut.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"}),zr&&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"}),zr]})]}):Ut.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,oe?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(Y,oe?nt:void 0)})]}),Y>0&&jsxRuntime.jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe?kr:We})]}):Ut.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?gt(re,oe?mt:void 0):"\u2013"}):Ut.type==="effortMinutes"?(()=>{if(oe&&re>0&&Y>0){let Gt=Math.round(mt),yt=Math.round(nt),Ft=Gt-yt,Lr=Gt>0?Math.round(Ft/Gt*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(Y,nt)}),jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>=0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Lr,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?gt(Y,oe?nt:void 0):"\u2013"})})():Ut.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,oe?at:void 0):"\u2013"}):Ut.type==="progress"?(()=>{let Gt=U0(qd(e||[]));return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Gt,"%"]})})():Ut.type==="weight"?(()=>{let Gt=e||[],yt=[],Ft=Cr=>{for(let Yr of Cr)yt.push(Yr),Yr.subtasks?.length&&Ft(Yr.subtasks);};Ft(Gt);let xa=yt.filter(Cr=>!Cr.subtasks?.length||Cr.subtasks.length===0).reduce((Cr,Yr)=>Cr+(Yr.weight||0),0),Ta=Math.abs(xa-100)<.1;return jsxRuntime.jsxs("span",{className:g("text-[12px] font-bold font-mono",Ta?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(xa.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ut.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ma.length===0&&ut&&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:B.empty.noResults})]})})]})}),Pe?.enabled&&Pe.data&&Ee&&jsxRuntime.jsx(A0,{data:Pe.data,isDark:z,locale:f,onClose:()=>$e(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Y=document.querySelector(`[data-task-id="${S}"]`);Y&&(Y.scrollIntoView({behavior:"smooth",block:"center"}),et(S),setTimeout(()=>et(null),2e3));}})]}),jsxRuntime.jsx(g0,{state:ue,onClose:Vn,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Za,onColumnSort:er,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),ft&&Je&&Oe&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=Ne.flattenTasks(e).find(re=>re.id===Oe);return Y?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:Y.name})]}):null})()}),document.body),jsxRuntime.jsx(S0,{isOpen:R,onClose:()=>_(false),onSave:qr,isDark:z,locale:f})]})}var G0=[{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}],V0=[{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"}],j0=[{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 Yd={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"},Xd={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"},Fl={dark:Yd,light:Xd,neutral:Jd};function _0(e){return Fl[e]||Fl.dark}function Ll(e,t,r,a,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,r),v=Math.min(m.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<r,contR:m.endSerial>a});}let c={};for(let m=r;m<=a;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],u=[],p={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var lC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],cC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function K0(e){return e==="es"?lC:cC}function q0(e){return (e.getDay()+6)%7}function Y0(e,t){let r=new Date(e,t,1),a=q0(r),n=new Date(e,t,1-a),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(n);return d.setDate(n.getDate()+(p-1)),d},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(r),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function ii(e,t){return q0(e.serialToDate(t))>=5}function dC(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 X0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function J0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Al(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=dC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=X0(u.startDate),f=X0(u.endDate);if(!m||!f)continue;let v=r.dateToSerial(m),h=r.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?J0(x):J0(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?mC(k.name):void 0),I=u.displayId||u.wbsCode||"",C=pC(I||u.id)?"":I||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var uC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pC(e){return uC.test(e)||/^task-\d+/.test(e)}function mC(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 gC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],fC=["January","February","March","April","May","June","July","August","September","October","November","December"];function Q0(e,t,r){return `${(r==="es"?gC:fC)[t]} ${e}`}var Qd=26,bC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Il({locale:e}){let t=K0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Rl({bar:e,ws:t,money:r,projColor:a,slotH:n=Qd}){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`,u={"--proj":e.color??s.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:u,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 Bl({chip:e,ws:t,slotH:r=Qd}){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:bC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function $l({more:e,ws:t,slotH:r=Qd,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 Z0({projects:e,locale:t="es"}){let r=t==="en";return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(a=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:a.color}}),a.id?`${a.id} `:"",a.name]},a.id||a.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",r?"Critical path":"Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",r?"Milestone":"Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",r?"Due date":"Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",r?"External event":"Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",r?"Absence":"Ausencia"]})]})}var vC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function Zd({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=vC.filter(p=>!c.includes(p.id));return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"cal-seg",children:u.map(p=>jsxRuntime.jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${i?p.en:p.es} (${p.key})`,children:i?p.en:p.es},p.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:"$"})]})]}):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:u.map(p=>jsxRuntime.jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[i?p.en:p.es,jsxRuntime.jsx("span",{className:"key",children:p.key})]},p.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 ef({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),h=u==="es";react.useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);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:v,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"]}),m?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,p,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-d,"/6"]})]})})]})}var wC=[{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 tf({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:wC.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 NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},DC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function af({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s,locale:o="es"}){let l=o==="en",c=react.useRef(null);react.useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let i=r.length+t.length,p=a||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"Absence":"Ausencia";case "ext":default:return ""}});return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${i} ${l?"items":"elementos"}`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===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:DC[d.type]},children:NC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var rf={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 nf({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=rf[r]||rf.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 sf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function MC(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 of=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function PC(e){return of[e%of.length]}function FC(e){return e>1?"over":e>=.9?"warn":"ok"}var eu="\xA0";function Uo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function lf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(sf(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:PC(c),initials:MC(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(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:r}}),u=i.reduce((p,d)=>p+d.hours,0);a.set(l,{assigned:Math.round(u*100)/100,capacity:r*e.length,perPerson:i});}return a}function cf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=sf(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,p="cal-cap-cell "+(o?"off":FC(i))+(r===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:p,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:d,onClick:m=>{!c||!a||a(s,d,m.currentTarget);},onKeyDown:m=>{!c||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,d,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${eu}/${eu}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[Uo(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",eu,Uo(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 df({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=p=>{p.key==="Escape"&&r();},u=p=>{n.current&&!n.current.contains(p.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[r]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.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:[Uo(s),"h asignadas / ",Uo(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",Uo(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 u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:u?"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/p*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[Uo(i.hours),"h / ",Uo(i.capacity),"h"]})]},i.name)})})]})}var tu=28,AC=182;function pf({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=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,v)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(IC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),c&&c[v]?jsxRuntime.jsx(cf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function IC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=react.useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),p=react.useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=r;f++)d.push(f);let m={height:`${AC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:m,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=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"),p.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Rl,{bar:f,ws:t,money:s,projColor:o,slotH:tu})},`b${v}`)),u.chips.map((f,v)=>jsxRuntime.jsx(Bl,{chip:f,ws:t,slotH:tu},`c${v}`)),u.more.map((f,v)=>jsxRuntime.jsx($l,{more:f,ws:t,slotH:tu,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var RC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function BC(e){return RC.test(e)||/^task-\d+/.test(e)}function $C(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 mf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function OC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function gf(e,t){let r=OC(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?mf(l):mf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?$C(i.name):void 0),p=n.displayId||n.wbsCode||"",d=BC(p||n.id)?"":p||n.id;a.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return a}function ff({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n,locale:s="es"}){let o=s==="en";return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:o?"Drag onto the calendar":"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(l=>{let c=a==="$"?l.cost:`${l.hrs}h`;return jsxRuntime.jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxRuntime.jsxs("div",{className:"row1",children:[l.id?jsxRuntime.jsx("span",{className:"tk",children:l.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:l.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:c}),l.who?jsxRuntime.jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function bf({onExpand:e,locale:t="es"}){let r=t==="en";return jsxRuntime.jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e());},title:r?"Expand backlog":"Expandir backlog",children:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",r?"Status":"Estado"]})]})}function Ns(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function hf({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=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=r.wasCritical,p=r.projectEndDeltaDays,d=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Ns(r.oldProjectEnd,n)} \u2192 ${Ns(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===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:[Ns(r.oldStart,n)," \u2013 ",Ns(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Ns(r.newStart,n)," \u2013 ",Ns(r.newEnd,n)]})]})]}),u?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:p>0?"v bad":"v good",children:d})]}),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:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var zC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function yf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.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 u=p=>p.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(p=>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:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>l?.(d.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:d.color??n,flex:"none"}}),d.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,d.id?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?d.cost:`${d.hrs}h`})]},d.uid)),p.items.map((d,m)=>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:zC[d.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function GC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Ol(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function ru(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 xf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let u of Ol(i))a.has(u)||a.set(u,[]),a.get(u).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 u=r.get(i);if(!u)return o.delete(i),0;let p=Ol(u).filter(f=>r.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=ru(u)*864e5;return n.set(i,d),s.set(i,d+m),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 vf(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 Ol(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 u=1/0;for(let p of i){let d=s.get(p),m=a.get(p);d!=null&&m&&(u=Math.min(u,d-ru(m)*864e5));}s.set(c.id,u===1/0?r:u);}}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&&Ol(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Hl(e,t,r,a){let n=GC(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=xf(n,new Map),i=vf(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),p=xf(u,new Map([[t,r.getTime()]])),d=vf(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=ru(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.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:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function wf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var KC=132,Ul=26,qC="#5B7FD4";function kf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=react.useState("mes"),[I,C]=react.useState(()=>{let ie=new Date,ge={y:ie.getFullYear(),m:ie.getMonth()},Ze=(e??[]).map(Je=>Je.startDate?new Date(Je.startDate):null).filter(Je=>!!Je&&!isNaN(Je.getTime()));if(Ze.length===0||(e??[]).some(Je=>{let At=Je.startDate?new Date(Je.startDate):null,Yt=Je.endDate?new Date(Je.endDate):At;if(!At||isNaN(At.getTime()))return false;let pr=new Date(ge.y,ge.m,1),It=new Date(ge.y,ge.m+1,0,23,59,59);return At<=It&&(Yt??At)>=pr}))return ge;let kt=Ze.reduce((Je,At)=>Je<At?Je:At);return {y:kt.getFullYear(),m:kt.getMonth()}}),[N,P]=react.useState(false),[T,V]=react.useState([]),[O,X]=react.useState("all"),[F,Fe]=react.useState(null),[U,De]=react.useState(null),[B,z]=react.useState(false),[Me,Ue]=react.useState(null),[ce,Le]=react.useState(false),J=react.useMemo(()=>Y0(I.y,I.m),[I.y,I.m]),Pe=a||qC,Ee=react.useMemo(()=>{let ie=new Set;for(let ge of y){let Ze=new Date(`${ge}T12:00:00`),Xe=J.dateToSerial(Ze);Xe>=1&&Xe<=42&&ie.add(Xe);}return ie},[y,J]);react.useEffect(()=>{w?.({start:wf(J.serialToDate(1)),end:wf(J.serialToDate(42))});},[I.y,I.m]);let $e=b.length,He=react.useMemo(()=>{let ie=x?.hoursPerDay;if(!ie)return 8;let ge=[ie.monday,ie.tuesday,ie.wednesday,ie.thursday,ie.friday].map(Ze=>Ze||0).filter(Ze=>Ze>0);return ge.length?Math.round(ge.reduce((Ze,Xe)=>Ze+Xe,0)/ge.length*10)/10:8},[x]),et=react.useMemo(()=>Al({tasks:e,grid:J,projectColor:()=>Pe,hourlyRate:o,projectId:r}),[e,J,Pe,o,r]),se=react.useMemo(()=>{if(d===false)return [];let ie=new Map;for(let ge of et.calTasks)ge.phaseId&&ge.phaseName&&ie.set(ge.phaseId,ge.phaseName);return [...ie.entries()].map(([ge,Ze])=>({id:ge,name:Ze})).sort((ge,Ze)=>ge.name.localeCompare(Ze.name))},[et.calTasks,d]),_e=!T.includes("tareas"),qe=!T.includes("cpm"),Re=react.useMemo(()=>{let ie=_e?et.calTasks:[];return O!=="all"&&(ie=ie.filter(ge=>ge.phaseId===O)),qe||(ie=ie.map(ge=>ge.critical?{...ge,critical:false}:ge)),ie},[et.calTasks,_e,qe,O]),ut=react.useMemo(()=>{let ie=new Set;return T.includes("hitos")&&(ie.add("hito"),ie.add("desembolso")),T.includes("ext")&&ie.add("ext"),T.includes("aus")&&ie.add("aus"),et.dayItems.filter(ge=>!ie.has(ge.type))},[et.dayItems,T]),Et=!T.includes("festivos"),Ge=new Date,Ie=J.dateToSerial(new Date(Ge.getFullYear(),Ge.getMonth(),Ge.getDate())),dt=ie=>V(ge=>ge.includes(ie)?ge.filter(Ze=>Ze!==ie):[...ge,ie]),Mt=()=>C(ie=>{let ge=new Date(ie.y,ie.m-1,1);return {y:ge.getFullYear(),m:ge.getMonth()}}),Be=()=>C(ie=>{let ge=new Date(ie.y,ie.m+1,1);return {y:ge.getFullYear(),m:ge.getMonth()}}),vt=()=>{let ie=new Date;C({y:ie.getFullYear(),m:ie.getMonth()});},L=(ie,ge,Ze)=>{if(!v||ge===0)return;let Xe=et.calTasks.find(pr=>pr.uid===ie);if(!Xe)return;let kt=ge*864e5,Je=new Date(Xe.realStart.getTime()+kt),At=new Date(Xe.realEnd.getTime()+kt),Yt=Hl(e,ie,Je,At);Yt&&Ue({uid:ie,taskId:Xe.id,taskName:Xe.name,sim:Yt,anchor:Ze});},Q=async()=>{if(!Me||!h)return;Le(true);let ie=[{id:Me.uid,startDate:Me.sim.newStart,endDate:Me.sim.newEnd},...Me.sim.movedSuccessors.map(Ze=>({id:Ze.id,startDate:Ze.newStart,endDate:Ze.newEnd}))],ge=await h(ie);Le(false),ge&&Ue(null);},R=Q0(I.y,I.m,n),_=[{id:"",name:t,color:Pe}],ue=react.useMemo(()=>gf(e,o),[e,o]),ve=react.useMemo(()=>{if(k==="lookahead"){let ie=J.weeks.find(Ze=>Ie>=Ze.ws&&Ie<=Ze.we)??J.weeks[0],ge=J.weeks.indexOf(ie);return J.weeks.slice(ge,ge+2)}return k==="semana"?[J.weeks.find(ge=>Ie>=ge.ws&&Ie<=ge.we)??J.weeks[0]]:[]},[k,J.weeks,Ie]),Oe=react.useMemo(()=>{let ie={};return ve.forEach((ge,Ze)=>{let Xe=[];for(let Je=ge.ws;Je<=ge.we;Je++)Xe.push({serial:Je,date:J.serialToDate(Je),isWeekend:ii(J,Je),isHoliday:Ee.has(Je)});let kt=lf(b,Xe,He);ie[Ze]={days:Xe,capByDay:kt};}),ie},[ve,J,Ee,b,He]),ye=k==="semana"||k==="lookahead",ft=k==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?reactDom.createPortal(jsxRuntime.jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsxRuntime.jsx(Zd,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsxRuntime.jsx(Zd,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsxRuntime.jsx(ef,{monthLabel:R,onPrev:Mt,onNext:Be,onToday:vt,layersOpen:N,onToggleLayers:()=>P(ie=>!ie),layersOff:T,phases:se,phaseFilter:O,onPhaseChange:X,locale:n,children:N?jsxRuntime.jsx(tf,{off:T,onToggle:dt}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:ft?"hidden":void 0},children:[ft?jsxRuntime.jsx(yf,{grid:J,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,locale:n,onTaskOpen:i}):ye?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx(pf,{grid:J,weeks:ve,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,locale:n,capRows:Oe,teamSize:$e,onTaskOpen:i,onMore:(ie,ge,Ze)=>Fe({day:ie,items:ge,tasks:Ze}),onCapDay:(ie,ge,Ze)=>{for(let Xe of Object.keys(Oe)){let kt=Oe[+Xe].capByDay.get(ie);if(kt){De({dayLabel:ge,perPerson:kt.perPerson,anchor:Ze.getBoundingClientRect()});break}}}})]}):et.isEmpty?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(ie=>jsxRuntime.jsx(Cf,{grid:J,ws:ie.ws,we:ie.we,todaySerial:Ie,showFestivos:Et,holidaySerials:Ee,locale:n,deadlineDays:new Set},ie.ws))}),jsxRuntime.jsx(nf,{monthLabel:R,locale:n,onCreateTask:f})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Il,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:J.weeks.map(ie=>jsxRuntime.jsx(YC,{grid:J,ws:ie.ws,we:ie.we,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,showFestivos:Et,holidaySerials:Ee,locale:n,onTaskOpen:i,onMore:(ge,Ze,Xe)=>Fe({day:ge,items:Ze,tasks:Xe}),canReschedule:v,onDragReschedule:L,pendingGhost:Me?{uid:Me.uid,days:Math.round((Me.sim.newStart.getTime()-Me.sim.oldStart.getTime())/864e5)}:null},ie.ws))})]}),F?jsxRuntime.jsx(af,{dayLabel:`${J.serialToDate(F.day).getDate()}`,items:F.items,tasks:F.tasks.map(ie=>({swatch:Pe,taskId:ie.id,label:ie.name,critical:ie.critical,value:l==="$"?ie.cost:`${ie.hrs}h`})),onClose:()=>Fe(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,U?jsxRuntime.jsx(df,{dayLabel:U.dayLabel,perPerson:U.perPerson,onClose:()=>De(null),style:{position:"fixed",top:`${U.anchor.top-8}px`,left:`${U.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Me?jsxRuntime.jsx(hf,{taskName:Me.taskName,taskId:Me.sim.taskId,sim:Me.sim,busy:ce,locale:n,onConfirm:Q,onCancel:()=>Ue(null),style:{position:"fixed",top:`${Me.anchor.top+12}px`,left:`${Math.min(Me.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),B?jsxRuntime.jsx(ff,{items:ue,money:l,projColor:Pe,onItemClick:ie=>i?.(ie),onCollapse:()=>z(false),locale:n==="en"?"en":"es"}):jsxRuntime.jsx(bf,{onExpand:()=>z(true),locale:n==="en"?"en":"es"})]}),jsxRuntime.jsx(Z0,{projects:_,locale:n==="en"?"en":"es"})]})}function Cf({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),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return ii(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===a&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxRuntime.jsxs("div",{className:d,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function YC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=react.useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(I=>I.type==="deadline").map(I=>I.serial)),[n]),y=Math.max(KC,h.laneCount*Ul+36),x=react.useRef(null),[w,k]=react.useState(null),M=(I,C)=>{if(!m||!f){p?.(C);return}I.preventDefault();let N=x.current;if(!N)return;let P=N.getBoundingClientRect().width/7,T=I.clientX,V=0,O=F=>{let Fe=Math.round((F.clientX-T)/P);V=Fe,k({id:C,days:Fe});},X=F=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",X),k(null),V===0){p?.(C);return}let Fe=new DOMRect(F.clientX,F.clientY,0,0);f(C,V,Fe);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",X);};return jsxRuntime.jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(Cf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((I,C)=>{let N=w?.id===I.t.uid?w.days:null,P=v?.uid===I.t.uid?v.days:null,T=N??P??0,V=N==null&&P!=null,O=T!==0?{...I,s:I.s+T,e:I.e+T}:I;return jsxRuntime.jsx("div",{onPointerDown:X=>M(X,I.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Rl,{bar:O,ws:t,money:s,projColor:o,slotH:Ul})},`b${C}`)}),h.chips.map((I,C)=>jsxRuntime.jsx(Bl,{chip:I,ws:t,slotH:Ul},`c${C}`)),h.more.map((I,C)=>jsxRuntime.jsx($l,{more:I,ws:t,slotH:Ul,onClick:()=>d(I.day,I.items,a.filter(N=>N.startSerial<=I.day&&N.endSerial>=I.day))},`m${C}`))]})]})}function JC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),u=react.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=react.useMemo(()=>{let m=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{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:d,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className: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:p.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:m=>{m.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:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var Nf={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 Df(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 Sf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...Nf,...o}),[o]),[i,u]=react.useState(new Set),p=react.useRef(null),d=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{u(x=>{let w=new Set(x);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),I=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:I<7?`${I}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&&p.current){let y=p.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 x=y.target.value;r({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[di(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.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:p,children:d.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((x,w)=>{let k=i.has(x.id),M=s===x.id,I=Df(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:di(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:ci(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},C)),x.metadata&&Object.keys(x.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(x.metadata).map(([C,N])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Mf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],p=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className: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:p&&di(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&ci(p)}),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:p&&p.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:m=>l(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,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(m)},m.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:u.map(m=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),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:p&&p.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(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):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 nu(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 ou(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 Pf(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 Ff(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function a2(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(u=>{let p=r/2,d=a/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function Lf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[u,p]=react.useState([]),[d,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=a2(e,t,r.width,r.height,r,150);p(O);},[e,t,r]);let M=react.useCallback((O,X)=>{r.enableDragging&&(X.stopPropagation(),m(O));},[r.enableDragging]),I=react.useCallback(O=>{if(!d||!i.current)return;let F=i.current.getBoundingClientRect(),Fe=(O.clientX-F.left-w.x)/y,U=(O.clientY-F.top-w.y)/y;p(De=>De.map(B=>B.id===d?{...B,x:Fe,y:U,fx:Fe,fy:U}:B));},[d,y,w]),C=react.useCallback(()=>{m(null);},[]),N=react.useCallback((O,X)=>{X.stopPropagation(),l?.({type:"node-click",node:O,position:{x:X.clientX,y:X.clientY}});},[l]),P=react.useCallback((O,X)=>{X.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:X.clientX,y:X.clientY}});},[l]),T=react.useCallback(O=>{let X=u.find(F=>F.id===O);return X?{x:X.x,y:X.y}:{x:0,y:0}},[u]),V=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let X=O.card.priority;return X==="URGENT"?"#ef4444":X==="HIGH"?"#f59e0b":X==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.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:()=>x(O=>Math.min(O+.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:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:nu(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Pf(O)," ",ou(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:I,onMouseUp:C,onMouseLeave:C,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let X=T(typeof O.source=="string"?O.source:O.source.id),F=T(typeof O.target=="string"?O.target:O.target.id),Fe=Ff(O.type),U=h===O.id,De=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",U&&"hovered",De&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:B=>P(O,B),children:[jsxRuntime.jsx("line",{x1:X.x,y1:X.y,x2:F.x,y2:F.y,stroke:nu(O.type),strokeWidth:De?r.edgeWidth*2:r.edgeWidth,strokeOpacity:U?1:.6,markerEnd:Fe?"url(#arrowhead)":void 0}),r.showEdgeLabels&&U&&jsxRuntime.jsx("text",{x:(X.x+F.x)/2,y:(X.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ou(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let X=f===O.id,F=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",X&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Fe=>M(O.id,Fe),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Fe=>N(O,Fe),children:[jsxRuntime.jsx("circle",{r:F?r.nodeSize*1.2:r.nodeSize,fill:V(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:X?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.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 Rf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,u]=react.useState(null),[p,d]=react.useState(null),m=react.useRef(null),f=l||n;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await a(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(r(p),v());};return e?jsxRuntime.jsxs(ir,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-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:v,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:p?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!"})]}),p.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:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>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},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>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})]})},x)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,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,x)=>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},x))})]})]})}),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:v,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"}),p?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 su={"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 o2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},s2={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 i2(e,t,r){let a=su[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 iu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=i2(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let a=r.length,n=r.reduce((p,d)=>p+d.cost,0),s=r.reduce((p,d)=>p+d.inputTokens,0),o=r.reduce((p,d)=>p+d.outputTokens,0),l=r.filter(p=>p.success),c=r.reduce((p,d)=>p+d.duration,0),i={},u={};return r.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.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)}},zo=new iu;function Of({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(zo.getStats()),[s,o]=react.useState(zo.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(zo.getStats()),o(zo.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=zo.getRecentOperations(5);return jsxRuntime.jsxs(ir,{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 u=a.costsByFeature[c]||0,p=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(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},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 Wf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[u,p]=react.useState(""),[d,m]=react.useState(false),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),k=d||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.useEffect(()=>{let P=T=>{T.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},I=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({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){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(r(h),M());};if(!e)return null;let N=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(ir,{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 (",N,"% 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,T)=>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:["#",T+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:u,onChange:P=>p(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,T)=>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},T))})]})]})}),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:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:I,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 Gl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}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(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},I=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===b){let T=I.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:T.map(V=>V.id)}}return P}),N={...x,cards:I,columns:C};return n(N),N});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};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 x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],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 x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(I=>I!==h)}:M),k={...b,cards:x,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 x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=react.useCallback(async(h,b)=>{a(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=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:u,onColumnDelete:p},setBoard:a,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Gf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Gl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+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:""},jf={by:"none",order:"asc"};function _f({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...pi,...e}),[s,o]=react.useState({...jf,...t}),l=react.useCallback(v=>{n(h=>({...h,...v}));},[]),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),i=react.useCallback(()=>{n(pi),o(jf);},[]),u=react.useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),p=react.useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),m=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(v=>{let h=[...v];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(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let I=M.endDate||M.dueDate;if(!I)return false;let C;if(typeof I=="string")C=I.split("T")[0]||I;else {let N=I.getUTCFullYear(),P=String(I.getUTCMonth()+1).padStart(2,"0"),T=String(I.getUTCDate()).padStart(2,"0");C=`${N}-${P}-${T}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let N=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),T=new Date(N);return T.setDate(T.getDate()+7),P>=N&&P<=T;case "custom":if(a.dateRange){let V=typeof I=="string"?new Date(I):I;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(x=>a.assignees.includes(x)))),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 x=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;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=I-C;break;case "dueDate":let N=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!N)return 1;if(!P)return -1;let T=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,X=y.estimatedTime||0;x=O-X;break;default:x=0;}return s.order==="asc"?x:-x}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var qf,Yf;if(typeof window<"u")try{let e=vi("ai");qf=e.generateObject,Yf=e.generateText;}catch{}function Xf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(qf&&Yf&&e.apiKey),o=react.useCallback(async p=>{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:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),l=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),c=react.useCallback(async p=>{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(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),u=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:a}}function cu(){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]=cu(),n=react.useCallback(p=>r.selectedCardIds.includes(p),[r.selectedCardIds]),s=react.useCallback((p,d)=>{if(!d){a({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)r.selectedCardIds.includes(p)?a({selectedCardIds:r.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});else if(f&&r.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===r.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,N)=>C.position-N.position),y=b.findIndex(C=>C.id===r.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),I=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:I,lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});},[t,r,a]),o=react.useCallback(p=>{a({selectedCardIds:r.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(p=>{r.selectedCardIds.includes(p)?o(p):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});},[r,o,a]),u=react.useCallback(()=>t.filter(p=>r.selectedCardIds.includes(p.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Qf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Zf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Qf,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((v,h,b,y,x)=>{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:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=react.useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=react.useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=react.useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=react.useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=react.useCallback(async v=>{let h=t.filter(k=>k.columnId===v);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(I=>I.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(I=>I.id),columnId:v,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 I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${I} ${M} Priority`,cardIds:k.map(C=>C.id),columnId:v,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 I=(await a.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(I.length>=n.minCardsPerStack-1){let C=[k.id,...I.map(P=>P.card.id)],N=I.reduce((P,T)=>P+T.similarity,0)/I.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:N});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=react.useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var eb=react.createContext(null);function tb({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}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@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(eb.Provider,{value:{store:n},children:e})}function Vl(){let e=react.useContext(eb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=Vl(),[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,x)=>{e.updateColumn(y,x);},[e]),u=react.useCallback(y=>{e.deleteColumn(y);},[e]),p=react.useCallback(y=>e.getColumn(y),[e]),d=react.useCallback(y=>{e.addCard(y);},[e]),m=react.useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),v=react.useCallback((y,x,w)=>{e.moveCard(y,x,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:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function ab(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 nb(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 jl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vu.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);}},T2=new jl;function sb({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),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:d,className:n,children:jsxRuntime.jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,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(v,f.index)},h)})})})}function ib(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 cb({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 u=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:o,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:m,className:s,children:jsxRuntime.jsx("div",{style:f,children:d.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function db(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 ub(e,t=10){return e>t}var mu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},bu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},hu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},xu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},vu={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)"},wu={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)"},ku={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cu={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}},Tu={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}},_l={spacing:mu,borderRadius:gu,fontSize:fu,fontWeight:bu,lineHeight:hu,zIndex:yu,duration:xu,easing:vu,shadows:wu,opacity:ku,kanban:Cu,gantt:Tu};function pb(e,t,r){return e[t]??r}function Nu(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)?Nu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function S2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Du(e="asakaa"){let t=Nu(_l),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=S2(n);r.push(` ${s}: ${o};`);}return `:root {
415
415
  ${r.join(`
416
416
  `)}
417
- }`}function fi(e,t="asakaa"){let r=[],a=Tu(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=Nu(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 Kl={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"}},Du={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"}},Su={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 Eu(e=Kl,t="asakaa"){let r=Nu(t),a=fi(e,t);return `${r}
420
+ }`}var Kl={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"}},Su={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"}},Eu={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 Mu(e=Kl,t="asakaa"){let r=Du(t),a=fi(e,t);return `${r}
421
421
 
422
- ${a}`}function ub(){return `/**
422
+ ${a}`}function mb(){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
- ${Eu(Kl)}
428
+ ${Mu(Kl)}
429
429
 
430
430
  /* Light theme */
431
431
  [data-theme="light"] {
432
- ${fi(Du,"asakaa").split(`
432
+ ${fi(Su,"asakaa").split(`
433
433
  `).slice(1,-1).join(`
434
434
  `)}
435
435
  }
436
436
 
437
437
  /* Neutral theme */
438
438
  [data-theme="neutral"] {
439
- ${fi(Su,"asakaa").split(`
439
+ ${fi(Eu,"asakaa").split(`
440
440
  `).slice(1,-1).join(`
441
441
  `)}
442
442
  }
443
- `}var N5=({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 pb({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=os();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(N5,{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=Bf;exports.AI_FEATURES=a5;exports.AI_MODELS=ou;exports.AddCardButton=Mc;exports.AddColumnButton=Tc;exports.AttachmentUploader=rs;exports.BoardProvider=Zf;exports.BulkOperationsToolbar=Ki;exports.BurnDownChart=$c;exports.CUSTOM_FIELD_TYPES=G0;exports.CalendarBoard=vf;exports.Card=Bn;exports.CardHistoryReplay=Sf;exports.CardHistoryTimeline=Nf;exports.CardRelationshipsGraph=Pf;exports.CardStack=qC;exports.CardTemplateSelector=Vc;exports.CircuitBreaker=ac;exports.Column=Jo;exports.ColumnManager=Zi;exports.CommandPalette=Lc;exports.ConfigMenu=qc;exports.ContextMenu=ls;exports.DEFAULT_SHORTCUTS=Vs;exports.DEFAULT_TABLE_COLUMNS=W0;exports.DEFAULT_TEMPLATES=Gc;exports.DateRangePicker=Ps;exports.DependenciesSelector=Ls;exports.DependencyLine=Js;exports.DistributionCharts=Oc;exports.EditableColumnTitle=uc;exports.ErrorBoundary=ts;exports.ExportDropdown=Am;exports.ExportImportModal=_c;exports.FilterBar=Kc;exports.GANTT_AI_SYSTEM_PROMPT=mg;exports.GanttAIAssistant=ul;exports.GanttBoard=cg;exports.GanttI18nContext=is;exports.GanttMilestone=il;exports.GanttToolbar=Qi;exports.GenerateGanttTasksDialog=Hf;exports.GeneratePlanModal=Af;exports.GroupBySelector=Wc;exports.HealthBar=hc;exports.KanbanBoard=Zn;exports.KanbanToolbar=kc;exports.KanbanViewAdapter=zs;exports.KeyboardShortcutsHelp=zc;exports.ListView=U0;exports.MenuIcons=tr;exports.PluginManager=jl;exports.PrioritySelector=Co;exports.ProfitabilityReport=yc;exports.QuickTaskCreate=Us;exports.RATE_LIMITS=r5;exports.STANDARD_FIELDS=z0;exports.SwimlaneBoardView=Hc;exports.TagBadge=mc;exports.TagList=Dp;exports.TagPicker=Qo;exports.TaskBar=rl;exports.TaskDetailModal=Eo;exports.TaskFormModal=pg;exports.TaskGrid=tl;exports.ThemeModal=Qc;exports.ThemeProvider=km;exports.ThemeSwitcher=pb;exports.TimeInputPopover=Tn;exports.TimePill=gc;exports.TimePopover=fc;exports.Timeline=ll;exports.UserAssignmentSelector=No;exports.VelocityChart=Bc;exports.VirtualGrid=ib;exports.VirtualList=nb;exports.aiUsageTracker=Wo;exports.borderRadius=mu;exports.buildCalendar=Al;exports.calculatePosition=ki;exports.cardToGanttTask=gl;exports.cardsToGanttTasks=vg;exports.cn=g;exports.createKanbanView=rm;exports.createRetryWrapper=Rb;exports.darkTheme=Yc;exports.darkTokenTheme=Kl;exports.defaultTheme=Yi;exports.designTokens=_l;exports.duration=yu;exports.easing=xu;exports.exportTokensToCSS=ub;exports.findTaskByName=zn;exports.fontSize=gu;exports.fontWeight=fu;exports.formatCost=ui;exports.ganttEnTranslations=Ji;exports.ganttEsTranslations=Tm;exports.ganttTaskToCardUpdate=xg;exports.ganttThemes=ct;exports.ganttTokens=Cu;exports.ganttTranslations=Zc;exports.ganttUtils=De;exports.generateCSSVariables=Nu;exports.generateCompleteCSS=Eu;exports.generateInitialPositions=Fb;exports.generateTasksContext=gg;exports.generateThemeVariables=fi;exports.getListViewTheme=V0;exports.getListViewTranslations=Nd;exports.getToken=db;exports.getTranslations=Nm;exports.kanbanTokens=ku;exports.lightTheme=Xc;exports.lightTokenTheme=Du;exports.lineHeight=bu;exports.listViewDarkTheme=qd;exports.listViewEnTranslations=Cd;exports.listViewEsTranslations=Td;exports.listViewLightTheme=Yd;exports.listViewNeutralTheme=Xd;exports.listViewThemes=Fl;exports.listViewTranslations=fl;exports.mergeListViewTranslations=bl;exports.mergeTranslations=ed;exports.neutralTheme=Jc;exports.neutralTokenTheme=Su;exports.opacity=wu;exports.parseLocalCommand=hg;exports.parseNaturalDate=vd;exports.parseNaturalDuration=wd;exports.parseProgress=kd;exports.parseStatus=bg;exports.pluginManager=w5;exports.retrySyncOperation=Ib;exports.retryWithBackoff=Ci;exports.shadows=vu;exports.shouldVirtualizeGrid=cb;exports.simulateReschedule=Hl;exports.spacing=pu;exports.themes=Po;exports.useAI=qf;exports.useBoard=Wf;exports.useBoardCore=gi;exports.useBoardStore=Vl;exports.useCardStacking=Jf;exports.useDragState=vc;exports.useFilteredCards=tb;exports.useFilters=Vf;exports.useGanttI18n=qa;exports.useKanbanState=Gl;exports.useKeyboardShortcuts=xm;exports.useMultiSelect=Yf;exports.useSelectionState=lu;exports.useSortedCards=rb;exports.useTheme=os;exports.useVirtualGrid=lb;exports.useVirtualList=ob;exports.validateAIResponse=yg;exports.withErrorBoundary=Pc;exports.wouldCreateCircularDependency=Di;exports.zIndex=hu;//# sourceMappingURL=index.cjs.map
443
+ `}var E2=({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 gb({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=ss();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(E2,{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=Of;exports.AI_FEATURES=s2;exports.AI_MODELS=su;exports.AddCardButton=Pc;exports.AddColumnButton=Nc;exports.AttachmentUploader=as;exports.BoardProvider=tb;exports.BulkOperationsToolbar=Ki;exports.BurnDownChart=Oc;exports.CUSTOM_FIELD_TYPES=j0;exports.CalendarBoard=kf;exports.Card=An;exports.CardHistoryReplay=Mf;exports.CardHistoryTimeline=Sf;exports.CardRelationshipsGraph=Lf;exports.CardStack=JC;exports.CardTemplateSelector=jc;exports.CircuitBreaker=nc;exports.Column=Qo;exports.ColumnManager=Zi;exports.CommandPalette=Ac;exports.ConfigMenu=Yc;exports.ContextMenu=cs;exports.DEFAULT_SHORTCUTS=Vs;exports.DEFAULT_TABLE_COLUMNS=G0;exports.DEFAULT_TEMPLATES=Vc;exports.DateRangePicker=Ps;exports.DependenciesSelector=Ls;exports.DependencyLine=Js;exports.DistributionCharts=Hc;exports.EditableColumnTitle=pc;exports.ErrorBoundary=rs;exports.ExportDropdown=Im;exports.ExportImportModal=Kc;exports.FilterBar=qc;exports.GANTT_AI_SYSTEM_PROMPT=fg;exports.GanttAIAssistant=ul;exports.GanttBoard=ug;exports.GanttI18nContext=ls;exports.GanttMilestone=il;exports.GanttToolbar=Qi;exports.GenerateGanttTasksDialog=Wf;exports.GeneratePlanModal=Rf;exports.GroupBySelector=zc;exports.HealthBar=yc;exports.KanbanBoard=eo;exports.KanbanToolbar=Cc;exports.KanbanViewAdapter=zs;exports.KeyboardShortcutsHelp=Gc;exports.ListView=z0;exports.MenuIcons=ar;exports.PluginManager=jl;exports.PrioritySelector=To;exports.ProfitabilityReport=xc;exports.QuickTaskCreate=Us;exports.RATE_LIMITS=o2;exports.STANDARD_FIELDS=V0;exports.SwimlaneBoardView=Uc;exports.TagBadge=gc;exports.TagList=Sp;exports.TagPicker=Zo;exports.TaskBar=rl;exports.TaskDetailModal=Mo;exports.TaskFormModal=gg;exports.TaskGrid=tl;exports.ThemeModal=Zc;exports.ThemeProvider=Cm;exports.ThemeSwitcher=gb;exports.TimeInputPopover=Tn;exports.TimePill=fc;exports.TimePopover=bc;exports.Timeline=ll;exports.UserAssignmentSelector=Do;exports.VelocityChart=$c;exports.VirtualGrid=cb;exports.VirtualList=sb;exports.aiUsageTracker=zo;exports.borderRadius=gu;exports.buildCalendar=Al;exports.calculatePosition=ki;exports.cardToGanttTask=gl;exports.cardsToGanttTasks=kg;exports.cn=g;exports.createKanbanView=am;exports.createRetryWrapper=Hb;exports.darkTheme=Xc;exports.darkTokenTheme=Kl;exports.defaultTheme=Yi;exports.designTokens=_l;exports.duration=xu;exports.easing=vu;exports.exportTokensToCSS=mb;exports.findTaskByName=Hn;exports.fontSize=fu;exports.fontWeight=bu;exports.formatCost=ui;exports.ganttEnTranslations=Ji;exports.ganttEsTranslations=Nm;exports.ganttTaskToCardUpdate=wg;exports.ganttThemes=ct;exports.ganttTokens=Tu;exports.ganttTranslations=ed;exports.ganttUtils=Ne;exports.generateCSSVariables=Du;exports.generateCompleteCSS=Mu;exports.generateInitialPositions=Rb;exports.generateTasksContext=bg;exports.generateThemeVariables=fi;exports.getListViewTheme=_0;exports.getListViewTranslations=Dd;exports.getToken=pb;exports.getTranslations=Dm;exports.kanbanTokens=Cu;exports.lightTheme=Jc;exports.lightTokenTheme=Su;exports.lineHeight=hu;exports.listViewDarkTheme=Yd;exports.listViewEnTranslations=Td;exports.listViewEsTranslations=Nd;exports.listViewLightTheme=Xd;exports.listViewNeutralTheme=Jd;exports.listViewThemes=Fl;exports.listViewTranslations=fl;exports.mergeListViewTranslations=bl;exports.mergeTranslations=td;exports.neutralTheme=Qc;exports.neutralTokenTheme=Eu;exports.opacity=ku;exports.parseLocalCommand=xg;exports.parseNaturalDate=wd;exports.parseNaturalDuration=kd;exports.parseProgress=Cd;exports.parseStatus=yg;exports.pluginManager=T2;exports.retrySyncOperation=Ob;exports.retryWithBackoff=Ci;exports.shadows=wu;exports.shouldVirtualizeGrid=ub;exports.simulateReschedule=Hl;exports.spacing=mu;exports.themes=Fo;exports.useAI=Xf;exports.useBoard=Gf;exports.useBoardCore=gi;exports.useBoardStore=Vl;exports.useCardStacking=Zf;exports.useDragState=wc;exports.useFilteredCards=ab;exports.useFilters=_f;exports.useGanttI18n=_a;exports.useKanbanState=Gl;exports.useKeyboardShortcuts=vm;exports.useMultiSelect=Jf;exports.useSelectionState=cu;exports.useSortedCards=nb;exports.useTheme=ss;exports.useVirtualGrid=db;exports.useVirtualList=ib;exports.validateAIResponse=vg;exports.withErrorBoundary=Fc;exports.wouldCreateCircularDependency=Di;exports.zIndex=yu;//# sourceMappingURL=index.cjs.map
445
445
  //# sourceMappingURL=index.cjs.map